/// <summary> /// This method will update the item's status as well as determine if /// any item's left in the order that are pending. /// </summary> /// <param name="itemStatus"></param> /// <returns></returns> public bool Process(int employeeId, ItemStatus itemStatus) { if (itemId == 0) { throw new InvalidOperationException("Unable to change the status an item not yet associated with an existing order."); } if (BusinessRules.IsOrderClosed(this.orderId)) { throw new InvalidOperationException("Unable to change in item's status on a closed order status."); } if (itemStatus == ItemStatus.Approved) { if (this.modified && string.IsNullOrEmpty(this.reason)) // Business Rule { throw new InvalidOperationException("Changes to the item have been detected. Please provide a reason before processing."); } } else if (itemStatus == ItemStatus.Denied) { if (string.IsNullOrEmpty(this.reason)) // Business Rule { throw new InvalidOperationException("A reason must be provided for denial."); } } this.status = itemStatus; this.NotifyPropertyChanged("Status"); var areItemsPending = ItemSQL.Process(employeeId, this); return(areItemsPending); }
public static Item Create(int itemId) { if (itemId == 0) { throw new ArgumentException("Invalid item Id."); } var itemList = RePackage(ItemSQL.GetItemById(itemId)); return((Item)itemList[0]); }
/// <summary> /// Function that sets a PurchaseOrder Item status to Pending /// </summary> /// <param name="tmpItem"></param> /// <returns></returns> public static bool PendingItem(Item tmpItem, int employeeId) { return(ItemSQL.PendingItem(tmpItem, employeeId)); }
/// <summary> /// Deny function that sets a PurchaseOrder Item status to Denied /// </summary> /// <param name="tmpItem"></param> /// <returns></returns> public static bool DenyItem(Item tmpItem, int employeeId, string reason) { return(ItemSQL.DenyItem(tmpItem, employeeId, reason)); }
/// <summary> /// Approve function that sets a PurchaseOrder Item status to Approved /// </summary> /// <param name="tmpItem"></param> /// <returns></returns> public static bool ApproveItem(Item tmpItem, int employeeId) { return(ItemSQL.ApproveItem(tmpItem, employeeId)); }
/// <summary> /// Remove function that removes an Item from a PurchaseOrder /// </summary> /// <param name="tmpItem"></param> /// <param name="tmpOrder"></param> /// <returns></returns> public static bool EmployeeRemoveItem(Item tmpItem, PurchaseOrder tmpOrder) { return(ItemSQL.EmployeeRemoveItem(tmpItem, tmpOrder)); }
/// <summary> /// Add function that adds a new Item to a PurchaseOrder /// </summary> /// <param name="tmpItem"></param> /// <param name="tmpOrder"></param> /// <returns></returns> public static int EmployeeAddItem(Item tmpItem, PurchaseOrder tmpOrder) { return(ItemSQL.EmployeeAddItem(tmpItem, tmpOrder)); }
/// <summary> /// Modify function that updates an Item's information /// </summary> /// <param name="tmpItem"></param> /// <returns></returns> public static bool EmployeeModifyItem(Item tmpItem) { return(ItemSQL.EmployeeModifyItem(tmpItem)); }
/// <summary> /// Retrieves an Item based on it's ItemId /// </summary> /// <param name="itemNumber"></param> /// <returns></returns> public static Item RetrieveByItemNumber(int itemId) { DataTable tmpTable = ItemSQL.RetrieveItemById(itemId); return(Repackager(tmpTable)); }
/// <summary> /// Retrieves an Item based on its PurchaseOrder number /// </summary> /// <param name="orderNumber"></param> /// <returns></returns> public static List <Item> RetrieveByOrderNumber(int orderNumber) { DataTable tmpTable = ItemSQL.RetrieveOrderItems(orderNumber); return(RepackagerList(tmpTable)); }
public static bool Update(int employeeId, Item item) { return(ItemSQL.Update(employeeId, item)); }
public static ItemList GetItemsByOrderId(int orderId) { return(Item.RePackage(ItemSQL.GetItemsByOrderId(orderId))); }