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