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