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 { /// /// 服务类 T_PROJECTSETTL_AH 部分 /// partial class Service:IService { #region PROJECTSETTL_AH_Insert 插入数据 /// /// 插入数据 /// /// PROJECTSETTL_AH类 /// 日志信息 /// PROJECTSETTL_AH类 public PROJECTSETTL_AH PROJECTSETTL_AH_Insert(PROJECTSETTL_AH pROJECTSETTL_AH, ServiceLoggingInfo loggingInfo) { using (SQLStringHelper _SQLStringHelper = new SQLStringHelper(typeof(TableSchema_PROJECTSETTL_AH))) { System.Int32 _PROJECTSETTL_AH_ID=0; using (DbCommand _DbCommand = DataBaseHelper.CreateCommand( _SQLStringHelper.GetInsertSQL(pROJECTSETTL_AH, DataBaseHelper.IsOracleClientFactory))) { Dictionary _Parameters = _SQLStringHelper.Parameters; if (DataBaseHelper.IsOracleClientFactory) { if (pROJECTSETTL_AH.PROJECTSETTL_AH_ID == null) _PROJECTSETTL_AH_ID= DataBaseHelper.ExecuteScalar("select "+ TableSchema_PROJECTSETTL_AH.SequenceName +".nextval from dual"); else _PROJECTSETTL_AH_ID = pROJECTSETTL_AH.PROJECTSETTL_AH_ID.Value; if (_Parameters.ContainsKey(TableSchema_PROJECTSETTL_AH.PROJECTSETTL_AH_ID.ToLower())) _Parameters[TableSchema_PROJECTSETTL_AH.PROJECTSETTL_AH_ID.ToLower()]=_PROJECTSETTL_AH_ID; else _Parameters.Add(TableSchema_PROJECTSETTL_AH.PROJECTSETTL_AH_ID.ToLower(),_PROJECTSETTL_AH_ID); } DataBaseHelper.PrepareCommandParameters(_DbCommand, _Parameters); _DbCommand.ExecuteNonQuery(); if (DataBaseHelper.IsAccessClientFactory) { if (pROJECTSETTL_AH.PROJECTSETTL_AH_ID == null) _PROJECTSETTL_AH_ID = DataBaseHelper.ExecuteScalar("select @@IDENTITY"); else _PROJECTSETTL_AH_ID = pROJECTSETTL_AH.PROJECTSETTL_AH_ID.Value; } if (DataBaseHelper.IsSqlClientFactory) { if (pROJECTSETTL_AH.PROJECTSETTL_AH_ID == null) _PROJECTSETTL_AH_ID = DataBaseHelper.ExecuteScalar("select IDENT_CURRENT('"+ TableSchema_PROJECTSETTL_AH.TableName +"');"); else _PROJECTSETTL_AH_ID = pROJECTSETTL_AH.PROJECTSETTL_AH_ID.Value; } if (_DbCommand.Transaction == null) _DbCommand.Connection.Close(); } pROJECTSETTL_AH.PROJECTSETTL_AH_ID = _PROJECTSETTL_AH_ID; LoggingDataForInsert(pROJECTSETTL_AH, loggingInfo); } return pROJECTSETTL_AH; } #endregion #region PROJECTSETTL_AH_Update 更新数据 /// /// 更新数据 /// /// PROJECTSETTL_AH类 /// 日志信息 /// PROJECTSETTL_AH类 public bool PROJECTSETTL_AH_Update(PROJECTSETTL_AH pROJECTSETTL_AH, ServiceLoggingInfo loggingInfo) { using (SQLStringHelper _SQLStringHelper = new SQLStringHelper(typeof(TableSchema_PROJECTSETTL_AH))) { string _SQLStr = _SQLStringHelper.GetUpDateSQL(pROJECTSETTL_AH, DataBaseHelper.IsOracleClientFactory); if (string.IsNullOrEmpty(_SQLStr)) return true; if (!LoggingDataForUpdate(pROJECTSETTL_AH, loggingInfo)) return true; if (ConfigurationSetting.HttpRuntimeCache_Enabled == true) ServiceCacheHelper.Remove(pROJECTSETTL_AH.PROJECTSETTL_AH_ID.ToString()); Dictionary _Parameters = _SQLStringHelper.Parameters; return (DataBaseHelper.ExecuteNonQuery(_SQLStr, _Parameters) == 1); } } #endregion #region PROJECTSETTL_AH_Delete 删除数据 /// /// 删除数据 /// /// 主键字段 /// 日志信息 public void PROJECTSETTL_AH_Delete(System.Int32 pROJECTSETTL_AH_ID, ServiceLoggingInfo loggingInfo) { if (ConfigurationSetting.HttpRuntimeCache_Enabled == true) ServiceCacheHelper.Remove(pROJECTSETTL_AH_ID.ToString()); using (SQLStringHelper _SQLStringHelper = new SQLStringHelper(typeof(TableSchema_PROJECTSETTL_AH))) { string _SQLStr = _SQLStringHelper.GetDeleteSQL(pROJECTSETTL_AH_ID,DataBaseHelper.IsOracleClientFactory); LoggingDataForDelete(pROJECTSETTL_AH_ID, loggingInfo); DataBaseHelper.ExecuteNonQuery(_SQLStr, _SQLStringHelper.Parameters); } } #endregion #region PROJECTSETTL_AH_Search 查询数据 /// /// 查询数据 /// /// 参数集合 /// 日志信息 /// PROJECTSETTL_AH类 public PROJECTSETTL_AH PROJECTSETTL_AH_Search(List parameters, ServiceLoggingInfo loggingInfo) { PROJECTSETTL_AH _PROJECTSETTL_AH = null; if (parameters.Count == 0) return _PROJECTSETTL_AH; if ((ConfigurationSetting.HttpRuntimeCache_Enabled == true) && (parameters.Count == 1) && (parameters[0].Name.Equals(TableSchema_PROJECTSETTL_AH.PROJECTSETTL_AH_ID,System.StringComparison.CurrentCultureIgnoreCase)) && ServiceCacheHelper.Read(parameters[0].Value.ToString(),out _PROJECTSETTL_AH)) { return _PROJECTSETTL_AH; } using (SQLStringHelper _SQLStringHelper = new SQLStringHelper(typeof(TableSchema_PROJECTSETTL_AH))) { 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)) { _PROJECTSETTL_AH = new PROJECTSETTL_AH(); _SQLStringHelper.DataRowToObject(ref _PROJECTSETTL_AH, _DataSet.Tables[0].Rows[0]); } } if ((ConfigurationSetting.HttpRuntimeCache_Enabled == true) && (_PROJECTSETTL_AH != null)) { ServiceCacheHelper.Insert( _PROJECTSETTL_AH.PROJECTSETTL_AH_ID.ToString(),_PROJECTSETTL_AH); } return _PROJECTSETTL_AH; } #endregion } }