2025-03-27 15:05:14 +08:00

152 lines
7.8 KiB
C#

using System.Data;
using System.Data.Common;
using System.Collections.Generic;
using SuperMap.RealEstate.Configuration;
using SuperMap.RealEstate.ServiceModel;
using SuperMap.RealEstate.ServiceModel.Logging;
using SuperMap.RealEstate.HighWay.Storage.Model;
using SuperMap.RealEstate.HighWay.Storage.Interface;
namespace SuperMap.RealEstate.HighWay.Storage
{
/// <summary>
/// 服务类 T_ACTINSTOPINION 部分
/// </summary>
partial class Service:IService
{
#region ACTINSTOPINION_Insert
/// <summary>
/// 插入数据
/// </summary>
/// <param name="aCTINSTOPINION">ACTINSTOPINION类</param>
/// <param name="loggingInfo">日志信息</param>
/// <returns>ACTINSTOPINION类</returns>
public ACTINSTOPINION ACTINSTOPINION_Insert(ACTINSTOPINION aCTINSTOPINION, ServiceLoggingInfo loggingInfo)
{
using (SQLStringHelper<ACTINSTOPINION> _SQLStringHelper = new SQLStringHelper<ACTINSTOPINION>(typeof(TableSchema_ACTINSTOPINION)))
{
System.Int32 _ACTINSTOPINION_ID=0;
using (DbCommand _DbCommand = DataBaseHelper.CreateCommand(
_SQLStringHelper.GetInsertSQL(aCTINSTOPINION, DataBaseHelper.IsOracleClientFactory)))
{
Dictionary<string, object> _Parameters = _SQLStringHelper.Parameters;
if (DataBaseHelper.IsOracleClientFactory)
{
if (aCTINSTOPINION.ACTINSTOPINION_ID == null)
_ACTINSTOPINION_ID= DataBaseHelper.ExecuteScalar<System.Int32>("select "+ TableSchema_ACTINSTOPINION.SequenceName +".nextval from dual");
else
_ACTINSTOPINION_ID = aCTINSTOPINION.ACTINSTOPINION_ID.Value;
if (_Parameters.ContainsKey(TableSchema_ACTINSTOPINION.ACTINSTOPINION_ID.ToLower()))
_Parameters[TableSchema_ACTINSTOPINION.ACTINSTOPINION_ID.ToLower()]=_ACTINSTOPINION_ID;
else
_Parameters.Add(TableSchema_ACTINSTOPINION.ACTINSTOPINION_ID.ToLower(),_ACTINSTOPINION_ID);
}
DataBaseHelper.PrepareCommandParameters(_DbCommand, _Parameters);
_DbCommand.ExecuteNonQuery();
if (DataBaseHelper.IsAccessClientFactory)
{
if (aCTINSTOPINION.ACTINSTOPINION_ID == null)
_ACTINSTOPINION_ID = DataBaseHelper.ExecuteScalar<System.Int32>("select @@IDENTITY");
else
_ACTINSTOPINION_ID = aCTINSTOPINION.ACTINSTOPINION_ID.Value;
}
if (DataBaseHelper.IsSqlClientFactory)
{
if (aCTINSTOPINION.ACTINSTOPINION_ID == null)
_ACTINSTOPINION_ID = DataBaseHelper.ExecuteScalar<System.Int32>("select IDENT_CURRENT('"+ TableSchema_ACTINSTOPINION.TableName +"');");
else
_ACTINSTOPINION_ID = aCTINSTOPINION.ACTINSTOPINION_ID.Value;
}
if (_DbCommand.Transaction == null)
_DbCommand.Connection.Close();
}
aCTINSTOPINION.ACTINSTOPINION_ID = _ACTINSTOPINION_ID;
LoggingDataForInsert<ACTINSTOPINION, TableSchema_ACTINSTOPINION>(aCTINSTOPINION, loggingInfo);
}
return aCTINSTOPINION;
}
#endregion
#region ACTINSTOPINION_Update
/// <summary>
/// 更新数据
/// </summary>
/// <param name="aCTINSTOPINION">ACTINSTOPINION类</param>
/// <param name="loggingInfo">日志信息</param>
/// <returns>ACTINSTOPINION类</returns>
public bool ACTINSTOPINION_Update(ACTINSTOPINION aCTINSTOPINION, ServiceLoggingInfo loggingInfo)
{
using (SQLStringHelper<ACTINSTOPINION> _SQLStringHelper = new SQLStringHelper<ACTINSTOPINION>(typeof(TableSchema_ACTINSTOPINION)))
{
string _SQLStr = _SQLStringHelper.GetUpDateSQL(aCTINSTOPINION, DataBaseHelper.IsOracleClientFactory);
if (string.IsNullOrEmpty(_SQLStr)) return true;
if (!LoggingDataForUpdate<ACTINSTOPINION, TableSchema_ACTINSTOPINION>(aCTINSTOPINION, loggingInfo))
return true;
if (ConfigurationSetting.HttpRuntimeCache_Enabled == true)
ServiceCacheHelper<ACTINSTOPINION>.Remove(aCTINSTOPINION.ACTINSTOPINION_ID.ToString());
Dictionary<string, object> _Parameters = _SQLStringHelper.Parameters;
return (DataBaseHelper.ExecuteNonQuery(_SQLStr, _Parameters) == 1);
}
}
#endregion
#region ACTINSTOPINION_Delete
/// <summary>
/// 删除数据
/// </summary>
/// <param name="aCTINSTOPINION_ID">主键字段</param>
/// <param name="loggingInfo">日志信息</param>
public void ACTINSTOPINION_Delete(System.Int32 aCTINSTOPINION_ID, ServiceLoggingInfo loggingInfo)
{
if (ConfigurationSetting.HttpRuntimeCache_Enabled == true)
ServiceCacheHelper<ACTINSTOPINION>.Remove(aCTINSTOPINION_ID.ToString());
using (SQLStringHelper<ACTINSTOPINION> _SQLStringHelper =
new SQLStringHelper<ACTINSTOPINION>(typeof(TableSchema_ACTINSTOPINION)))
{
string _SQLStr = _SQLStringHelper.GetDeleteSQL(aCTINSTOPINION_ID,DataBaseHelper.IsOracleClientFactory);
LoggingDataForDelete<ACTINSTOPINION, TableSchema_ACTINSTOPINION>(aCTINSTOPINION_ID, loggingInfo);
DataBaseHelper.ExecuteNonQuery(_SQLStr, _SQLStringHelper.Parameters);
}
}
#endregion
#region ACTINSTOPINION_Search
/// <summary>
/// 查询数据
/// </summary>
/// <param name="parameters">参数集合</param>
/// <param name="loggingInfo">日志信息</param>
/// <returns>ACTINSTOPINION类</returns>
public ACTINSTOPINION ACTINSTOPINION_Search(List<SearchParameter> parameters, ServiceLoggingInfo loggingInfo)
{
ACTINSTOPINION _ACTINSTOPINION = null;
if (parameters.Count == 0)
return _ACTINSTOPINION;
if ((ConfigurationSetting.HttpRuntimeCache_Enabled == true) && (parameters.Count == 1) &&
(parameters[0].Name.Equals(TableSchema_ACTINSTOPINION.ACTINSTOPINION_ID,System.StringComparison.CurrentCultureIgnoreCase)) &&
ServiceCacheHelper<ACTINSTOPINION>.Read(parameters[0].Value.ToString(),out _ACTINSTOPINION))
{
return _ACTINSTOPINION;
}
using (SQLStringHelper<ACTINSTOPINION> _SQLStringHelper = new SQLStringHelper<ACTINSTOPINION>(typeof(TableSchema_ACTINSTOPINION)))
{
string _SQLStr = _SQLStringHelper.GetSelectSQL(parameters,
DataBaseHelper.IsOracleClientFactory);
DataSet _DataSet = DataBaseHelper.ExecuteDataSet(_SQLStr, _SQLStringHelper.Parameters);
if ((_DataSet.Tables.Count>0) && (_DataSet.Tables[0].Rows.Count > 0))
{
_ACTINSTOPINION = new ACTINSTOPINION();
_SQLStringHelper.DataRowToObject(ref _ACTINSTOPINION, _DataSet.Tables[0].Rows[0]);
}
}
if ((ConfigurationSetting.HttpRuntimeCache_Enabled == true) && (_ACTINSTOPINION != null))
{
ServiceCacheHelper<ACTINSTOPINION>.Insert( _ACTINSTOPINION.ACTINSTOPINION_ID.ToString(),_ACTINSTOPINION);
}
return _ACTINSTOPINION;
}
#endregion
}
}