public ActionList() { ActionsDAO lwDataAccess = new ActionsDAO(); DataTable actionsTable = lwDataAccess.EnumerateActions(); foreach (DataRow row in actionsTable.Rows) { Action action = new Action(row); this.Add(action); } }
/// <summary> /// Update this ACTION in the database /// </summary> /// <returns></returns> public int Update(Action oldaction) { ActionsDAO lwDataAccess = new ActionsDAO(); if (this._actionID == 0) { Add(); } else { lwDataAccess.ActionUpdate(this); AuditChanges(oldaction); } return(0); }
/// <summary> /// Delete the current license from the database /// </summary> public void Delete() { // Delete from the database ActionsDAO lwDataAccess = new ActionsDAO(); lwDataAccess.ActionDelete(this); // ...and audit the deletion AuditTrailEntry ate = BuildATE(); ate.Type = AuditTrailEntry.TYPE.deleted; AuditTrailDAO lAuditTrailDAO = new AuditTrailDAO(); lAuditTrailDAO.AuditTrailAdd(ate); }
/// <summary> /// Add this Action to the database /// </summary> /// <returns></returns> public int Add() { int status = -1; // If this supplier already exists then call the update instead if (_actionID != 0) { return(Update(null)); } // Add the ACTION to the database ActionsDAO lwDataAccess = new ActionsDAO(); int id = lwDataAccess.ActionAdd(this); if (id != 0) { AuditChanges(null); _actionID = id; status = 0; } return(status); }