/// <summary> /// Add a new HistoryKey to the database /// </summary> public virtual void Add(Model.HistoryKey newHistoryKey) { try { Trace.WriteVerbose("({0})", "Add", CLASSNAME, newHistoryKey.ToString()); var helper = Database.GetDbHelper(); int recordsAffected = helper.ExecuteSPNonQuery(_storedProcedure_Add, helper.CreateInputParam("@HistoryKey", newHistoryKey.HistoryKey), helper.CreateInputParam("@ShowInClient", newHistoryKey.ShowInClient), helper.CreateInputParam("@SaveInDatabase", newHistoryKey.SaveInDatabase), helper.CreateInputParam("@TraceLevel", newHistoryKey.TraceLevel)); if (recordsAffected == 0) { throw new DalNothingUpdatedException("Unable to add HistoryKey with HistoryKey={0}", newHistoryKey); } return; } catch (Exception ex) { Trace.WriteError("({0})", "Add", CLASSNAME, ex, newHistoryKey.ToString()); throw DbHelper.TranslateException(ex); } }
/// <summary> /// Delete the given HistoryKey from the database /// </summary> public virtual void Delete(Model.HistoryKey historyKey) { try { Trace.WriteVerbose("({0})", "Delete", CLASSNAME, historyKey.ToString()); var helper = Database.GetDbHelper(); helper.ExecuteSPNonQuery(_storedProcedure_Delete, helper.CreateInputParam("@HistoryKey", historyKey.HistoryKey)); } catch (Exception ex) { Trace.WriteError("({0})", "Delete", CLASSNAME, ex, historyKey.ToString()); throw DbHelper.TranslateException(ex); } }
/// <summary> /// Modify the given HistoryKey in the database /// </summary> public virtual void Modify(Model.HistoryKey modifiedHistoryKey) { try { Trace.WriteVerbose("({0})", "Modify", CLASSNAME, modifiedHistoryKey.ToString()); var helper = Database.GetDbHelper(); int recordsAffected = helper.ExecuteSPNonQuery(_storedProcedure_Modify, helper.CreateInputParam("@HistoryKey", modifiedHistoryKey.HistoryKey), helper.CreateInputParam("@ShowInClient", modifiedHistoryKey.ShowInClient), helper.CreateInputParam("@SaveInDatabase", modifiedHistoryKey.SaveInDatabase), helper.CreateInputParam("@TraceLevel", modifiedHistoryKey.TraceLevel)); if (recordsAffected == 0) { throw new DalNothingUpdatedException("No records were updated (Table: HistoryKeys). HistoryKey=" + modifiedHistoryKey.ToString()); } } catch (Exception ex) { Trace.WriteError("({0})", "Modify", CLASSNAME, ex, modifiedHistoryKey.ToString()); throw DbHelper.TranslateException(ex); } }