コード例 #1
0
ファイル: Item.cs プロジェクト: jromero82/Bismark
        /// <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);
        }
コード例 #2
0
ファイル: Item.cs プロジェクト: jromero82/Bismark
        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]);
        }
コード例 #3
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));
 }
コード例 #4
0
 /// <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));
 }
コード例 #5
0
 /// <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));
 }
コード例 #6
0
 /// <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));
 }
コード例 #7
0
 /// <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));
 }
コード例 #8
0
 /// <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));
 }
コード例 #9
0
        /// <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));
        }
コード例 #10
0
        /// <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));
        }
コード例 #11
0
ファイル: ItemCUD.cs プロジェクト: jromero82/Bismark
 public static bool Update(int employeeId, Item item)
 {
     return(ItemSQL.Update(employeeId, item));
 }
コード例 #12
0
ファイル: ItemLists.cs プロジェクト: jromero82/Bismark
 public static ItemList GetItemsByOrderId(int orderId)
 {
     return(Item.RePackage(ItemSQL.GetItemsByOrderId(orderId)));
 }