152 lines
7.4 KiB
C#
152 lines
7.4 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.ExchangeData.Model;
|
|
using SuperMap.RealEstate.ExchangeData.Interface;
|
|
|
|
namespace SuperMap.RealEstate.ExchangeData
|
|
{
|
|
/// <summary>
|
|
/// 服务类 T_SEARCHCOMM 部分
|
|
/// </summary>
|
|
partial class Service:IService
|
|
{
|
|
#region SEARCHCOMM_Insert 插入数据
|
|
/// <summary>
|
|
/// 插入数据
|
|
/// </summary>
|
|
/// <param name="sEARCHCOMM">SEARCHCOMM类</param>
|
|
/// <param name="loggingInfo">日志信息</param>
|
|
/// <returns>SEARCHCOMM类</returns>
|
|
public SEARCHCOMM SEARCHCOMM_Insert(SEARCHCOMM sEARCHCOMM, ServiceLoggingInfo loggingInfo)
|
|
{
|
|
using (SQLStringHelper<SEARCHCOMM> _SQLStringHelper = new SQLStringHelper<SEARCHCOMM>(typeof(TableSchema_SEARCHCOMM)))
|
|
{
|
|
System.Int32 _SEARCHCOMM_ID=0;
|
|
using (DbCommand _DbCommand = DataBaseHelper.CreateCommand(
|
|
_SQLStringHelper.GetInsertSQL(sEARCHCOMM, DataBaseHelper.IsOracleClientFactory)))
|
|
{
|
|
Dictionary<string, object> _Parameters = _SQLStringHelper.Parameters;
|
|
if (DataBaseHelper.IsOracleClientFactory)
|
|
{
|
|
if (sEARCHCOMM.SEARCHCOMM_ID == null)
|
|
_SEARCHCOMM_ID= DataBaseHelper.ExecuteScalar<System.Int32>("select "+ TableSchema_SEARCHCOMM.SequenceName +".nextval from dual");
|
|
else
|
|
_SEARCHCOMM_ID = sEARCHCOMM.SEARCHCOMM_ID.Value;
|
|
if (_Parameters.ContainsKey(TableSchema_SEARCHCOMM.SEARCHCOMM_ID.ToLower()))
|
|
_Parameters[TableSchema_SEARCHCOMM.SEARCHCOMM_ID.ToLower()]=_SEARCHCOMM_ID;
|
|
else
|
|
_Parameters.Add(TableSchema_SEARCHCOMM.SEARCHCOMM_ID.ToLower(),_SEARCHCOMM_ID);
|
|
}
|
|
DataBaseHelper.PrepareCommandParameters(_DbCommand, _Parameters);
|
|
_DbCommand.ExecuteNonQuery();
|
|
if (DataBaseHelper.IsAccessClientFactory)
|
|
{
|
|
if (sEARCHCOMM.SEARCHCOMM_ID == null)
|
|
_SEARCHCOMM_ID = DataBaseHelper.ExecuteScalar<System.Int32>("select @@IDENTITY");
|
|
else
|
|
_SEARCHCOMM_ID = sEARCHCOMM.SEARCHCOMM_ID.Value;
|
|
}
|
|
if (DataBaseHelper.IsSqlClientFactory)
|
|
{
|
|
if (sEARCHCOMM.SEARCHCOMM_ID == null)
|
|
_SEARCHCOMM_ID = DataBaseHelper.ExecuteScalar<System.Int32>("select IDENT_CURRENT('"+ TableSchema_SEARCHCOMM.TableName +"');");
|
|
else
|
|
_SEARCHCOMM_ID = sEARCHCOMM.SEARCHCOMM_ID.Value;
|
|
}
|
|
if (_DbCommand.Transaction == null)
|
|
_DbCommand.Connection.Close();
|
|
}
|
|
sEARCHCOMM.SEARCHCOMM_ID = _SEARCHCOMM_ID;
|
|
LoggingDataForInsert<SEARCHCOMM, TableSchema_SEARCHCOMM>(sEARCHCOMM, loggingInfo);
|
|
}
|
|
return sEARCHCOMM;
|
|
}
|
|
#endregion
|
|
|
|
#region SEARCHCOMM_Update 更新数据
|
|
/// <summary>
|
|
/// 更新数据
|
|
/// </summary>
|
|
/// <param name="sEARCHCOMM">SEARCHCOMM类</param>
|
|
/// <param name="loggingInfo">日志信息</param>
|
|
/// <returns>SEARCHCOMM类</returns>
|
|
public bool SEARCHCOMM_Update(SEARCHCOMM sEARCHCOMM, ServiceLoggingInfo loggingInfo)
|
|
{
|
|
using (SQLStringHelper<SEARCHCOMM> _SQLStringHelper = new SQLStringHelper<SEARCHCOMM>(typeof(TableSchema_SEARCHCOMM)))
|
|
{
|
|
string _SQLStr = _SQLStringHelper.GetUpDateSQL(sEARCHCOMM, DataBaseHelper.IsOracleClientFactory);
|
|
if (string.IsNullOrEmpty(_SQLStr)) return true;
|
|
if (!LoggingDataForUpdate<SEARCHCOMM, TableSchema_SEARCHCOMM>(sEARCHCOMM, loggingInfo))
|
|
return true;
|
|
if (ConfigurationSetting.HttpRuntimeCache_Enabled == true)
|
|
ServiceCacheHelper<SEARCHCOMM>.Remove(sEARCHCOMM.SEARCHCOMM_ID.ToString());
|
|
Dictionary<string, object> _Parameters = _SQLStringHelper.Parameters;
|
|
return (DataBaseHelper.ExecuteNonQuery(_SQLStr, _Parameters) == 1);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region SEARCHCOMM_Delete 删除数据
|
|
/// <summary>
|
|
/// 删除数据
|
|
/// </summary>
|
|
/// <param name="sEARCHCOMM_ID">主键字段</param>
|
|
/// <param name="loggingInfo">日志信息</param>
|
|
public void SEARCHCOMM_Delete(System.Int32 sEARCHCOMM_ID, ServiceLoggingInfo loggingInfo)
|
|
{
|
|
if (ConfigurationSetting.HttpRuntimeCache_Enabled == true)
|
|
ServiceCacheHelper<SEARCHCOMM>.Remove(sEARCHCOMM_ID.ToString());
|
|
using (SQLStringHelper<SEARCHCOMM> _SQLStringHelper =
|
|
new SQLStringHelper<SEARCHCOMM>(typeof(TableSchema_SEARCHCOMM)))
|
|
{
|
|
string _SQLStr = _SQLStringHelper.GetDeleteSQL(sEARCHCOMM_ID,DataBaseHelper.IsOracleClientFactory);
|
|
LoggingDataForDelete<SEARCHCOMM, TableSchema_SEARCHCOMM>(sEARCHCOMM_ID, loggingInfo);
|
|
DataBaseHelper.ExecuteNonQuery(_SQLStr, _SQLStringHelper.Parameters);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region SEARCHCOMM_Search 查询数据
|
|
/// <summary>
|
|
/// 查询数据
|
|
/// </summary>
|
|
/// <param name="parameters">参数集合</param>
|
|
/// <param name="loggingInfo">日志信息</param>
|
|
/// <returns>SEARCHCOMM类</returns>
|
|
public SEARCHCOMM SEARCHCOMM_Search(List<SearchParameter> parameters, ServiceLoggingInfo loggingInfo)
|
|
{
|
|
SEARCHCOMM _SEARCHCOMM = null;
|
|
if (parameters.Count == 0)
|
|
return _SEARCHCOMM;
|
|
if ((ConfigurationSetting.HttpRuntimeCache_Enabled == true) && (parameters.Count == 1) &&
|
|
(parameters[0].Name.Equals(TableSchema_SEARCHCOMM.SEARCHCOMM_ID,System.StringComparison.CurrentCultureIgnoreCase)) &&
|
|
ServiceCacheHelper<SEARCHCOMM>.Read(parameters[0].Value.ToString(),out _SEARCHCOMM))
|
|
{
|
|
return _SEARCHCOMM;
|
|
}
|
|
using (SQLStringHelper<SEARCHCOMM> _SQLStringHelper = new SQLStringHelper<SEARCHCOMM>(typeof(TableSchema_SEARCHCOMM)))
|
|
{
|
|
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))
|
|
{
|
|
_SEARCHCOMM = new SEARCHCOMM();
|
|
_SQLStringHelper.DataRowToObject(ref _SEARCHCOMM, _DataSet.Tables[0].Rows[0]);
|
|
}
|
|
}
|
|
if ((ConfigurationSetting.HttpRuntimeCache_Enabled == true) && (_SEARCHCOMM != null))
|
|
{
|
|
ServiceCacheHelper<SEARCHCOMM>.Insert( _SEARCHCOMM.SEARCHCOMM_ID.ToString(),_SEARCHCOMM);
|
|
}
|
|
return _SEARCHCOMM;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
|