/// <summary> /// Delete the current PickList from the database /// </summary> public void Delete() { // Delete from the database PicklistsDAO lwDataAccess = new PicklistsDAO(); lwDataAccess.PickListDelete(this.PickItemID); }
/// <summary> /// Update this PICKITEM in the database /// </summary> /// <returns></returns> public int Update() { PicklistsDAO lwDataAccess = new PicklistsDAO(); if (this.PickItemID == 0) { Add(); } else { lwDataAccess.PickItemUpdate(this); } return(0); }
/// <summary> /// Populate the list of PickLists and items from the database /// </summary> /// <returns></returns> public int Populate() { // Clear any existing items this.Clear(); // ...and re-read all Picklists and items from the database PicklistsDAO lwDataAccess = new PicklistsDAO(); DataTable actionsTable = lwDataAccess.EnumeratePickLists(); foreach (DataRow row in actionsTable.Rows) { AddItem(row); } return(Count); }
/// <summary> /// Add this PickList to the database /// </summary> /// <returns></returns> public int Add() { int status = -1; // If this supplier already exists then call the update instead if (_pickitemID != 0) { return(Update()); } // Add the PickList to the database PicklistsDAO lwDataAccess = new PicklistsDAO(); int id = lwDataAccess.PickItemAdd(this); if (id != 0) { PickItemID = id; status = 0; } return(status); }