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