コード例 #1
0
        /// <summary>
        /// Thêm mới món ăn
        /// </summary>
        /// <param name="inventoryItem"></param>
        /// <returns></returns>
        private UctChooseFood CreateUctChooseFood(DictionaryDataSet.InventoryItemRow inventoryItem)
        {
            DictionaryDataSet.OrderRow master = (DictionaryDataSet.OrderRow)dsDictionary.Order.FindByOrderID(OrderID);
            var row = dsDictionary.OrderDetail.FirstOrDefault((t) => t.RowState != DataRowState.Deleted && t.InventoryItemID == inventoryItem.InventoryItemID && t.OrderDetailStatus == (int)EnumOrderDetailStatus.Ordering);

            if (row != null)
            {
                row.Quantity += 1;
                return(null);
            }
            else
            {
                DictionaryDataSet.OrderDetailRow orderDetail = (DictionaryDataSet.OrderDetailRow)_oBL.InitNewRowDetail(dsDictionary.OrderDetail, master, inventoryItem.InventoryItemID);
                var uct = new UctChooseFood(orderDetail);
                uct.Click           += ChooseFood_Click;
                uct.CalculateAmount += new EventHandler(CalculateAmount);
                return(uct);
            }
        }