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