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