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