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