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