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