Exemple #1
0
 /// <summary>
 /// Thêm món ăn vào Order
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Food_Click(object sender, EventArgs e)
 {
     try
     {
         if (OrderStatus == EnumOrderStatus.Cancel)
         {
             MessageBoxCommon.ShowExclamation("Order đã hủy không thể thêm món ăn");
             return;
         }
         UctFood control = (UctFood)sender;
         if (control != null)
         {
             var uct = CreateUctChooseFood(control.DataInventoryItemRow);
             if (uct != null)
             {
                 fpnlChooseFood.Controls.Add(uct);
                 TotalAmount += uct.UnitPrice * uct.Quantity;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxCommon.ShowException(ex);
     }
 }
Exemple #2
0
 /// <summary>
 /// Lọc mặt hàng theo điều kiện
 /// 0 - ALL, 1- Đồ ăn, 2- Đồ uống
 /// </summary>
 /// <param name="condition"></param>
 private void FilterInventory(int condition)
 {
     if (condition == 0)
     {
         foreach (var item in fpnlInventoryItem.Controls)
         {
             if (item.GetType() == typeof(UctFood))
             {
                 UctFood control = (UctFood)item;
                 control.Visible = true;
             }
         }
     }
     else if (condition == 1)
     {
         foreach (var item in fpnlInventoryItem.Controls)
         {
             if (item.GetType() == typeof(UctFood))
             {
                 UctFood control = (UctFood)item;
                 if (control.InventoryItemType == EnumInventoryItemType.Other || control.InventoryItemType == EnumInventoryItemType.Food)
                 {
                     control.Visible = true;
                 }
                 else
                 {
                     control.Visible = false;
                 }
             }
         }
     }
     else if (condition == 2)
     {
         foreach (var item in fpnlInventoryItem.Controls)
         {
             if (item.GetType() == typeof(UctFood))
             {
                 UctFood control = (UctFood)item;
                 if (control.InventoryItemType == EnumInventoryItemType.Other || control.InventoryItemType == EnumInventoryItemType.Drink)
                 {
                     control.Visible = true;
                 }
                 else
                 {
                     control.Visible = false;
                 }
             }
         }
     }
 }