/// <summary> /// Modify the given ApplicationSetting in the database /// </summary> public virtual void Modify(Model.ApplicationSetting modifiedApplicationSetting) { try { Trace.WriteVerbose("({0})", "Modify", CLASSNAME, modifiedApplicationSetting.ToString()); var helper = Database.GetDbHelper(); int recordsAffected = helper.ExecuteSPNonQuery(_storedProcedure_Modify, helper.CreateInputParam("@ApplicationSettingId", modifiedApplicationSetting.ApplicationSettingId), helper.CreateInputParam("@ApplicationSettingsCategoryId", modifiedApplicationSetting.ApplicationSettingsCategoryId), helper.CreateInputParam("@Name", modifiedApplicationSetting.Name), helper.CreateInputParam("@Description", modifiedApplicationSetting.Description), helper.CreateInputParam("@DataTypeId", modifiedApplicationSetting.DataTypeId), helper.CreateInputParam("@Value", modifiedApplicationSetting.Value), helper.CreateInputParam("@ListId", modifiedApplicationSetting.ListId.HasValue ? (object)modifiedApplicationSetting.ListId : DBNull.Value)); if (recordsAffected == 0) { throw new DalNothingUpdatedException("No records were updated (Table: ApplicationSettings). ApplicationSetting=" + modifiedApplicationSetting.ToString()); } } catch (Exception ex) { Trace.WriteError("({0})", "Modify", CLASSNAME, ex, modifiedApplicationSetting.ToString()); throw DbHelper.TranslateException(ex); } }
/// <summary> /// Add a new ApplicationSetting to the database /// </summary> public virtual void Add(Model.ApplicationSetting newApplicationSetting) { try { Trace.WriteVerbose("({0})", "Add", CLASSNAME, newApplicationSetting.ToString()); var helper = Database.GetDbHelper(); int recordsAffected = helper.ExecuteSPNonQuery(_storedProcedure_Add, helper.CreateInputParam("@ApplicationSettingId", newApplicationSetting.ApplicationSettingId), helper.CreateInputParam("@ApplicationSettingsCategoryId", newApplicationSetting.ApplicationSettingsCategoryId), helper.CreateInputParam("@Name", newApplicationSetting.Name), helper.CreateInputParam("@Description", newApplicationSetting.Description), helper.CreateInputParam("@DataTypeId", newApplicationSetting.DataTypeId), helper.CreateInputParam("@Value", newApplicationSetting.Value), helper.CreateInputParam("@ListId", newApplicationSetting.ListId.HasValue ? (object)newApplicationSetting.ListId : DBNull.Value)); if (recordsAffected == 0) { throw new DalNothingUpdatedException("Unable to add ApplicationSetting with ApplicationSettingId={0}", newApplicationSetting); } return; } catch (Exception ex) { Trace.WriteError("({0})", "Add", CLASSNAME, ex, newApplicationSetting.ToString()); throw DbHelper.TranslateException(ex); } }
/// <summary> /// Delete the given ApplicationSetting from the database /// </summary> public virtual void Delete(Model.ApplicationSetting applicationSetting) { try { Trace.WriteVerbose("({0})", "Delete", CLASSNAME, applicationSetting.ToString()); var helper = Database.GetDbHelper(); helper.ExecuteSPNonQuery(_storedProcedure_Delete, helper.CreateInputParam("@ApplicationSettingId", applicationSetting.ApplicationSettingId)); } catch (Exception ex) { Trace.WriteError("({0})", "Delete", CLASSNAME, ex, applicationSetting.ToString()); throw DbHelper.TranslateException(ex); } }