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