Пример #1
0
 private void CreateOrderButton_Click(object sender, EventArgs e) //creates new order and then gets its ID
 {
     {
         RosaLogic.Order_Service orderserv = new RosaLogic.Order_Service();
         Table_Service           ts        = new Table_Service();
         orderserv.AddOrder(table.tableId);
         ts.UpdateTable(table, false, table.isReserved);
         SetLatestOrder();
     }
 }
Пример #2
0
 private bool IncreaseAmountOfExistingItem(ListView list)  //Increases the amount of an item that is already created in the current order
 {
     RosaLogic.Order_Service orderserv = new RosaLogic.Order_Service();
     if (list.SelectedItems.Count > 0)
     {
         if (CheckListForItem(int.Parse(list.SelectedItems[0].SubItems[2].Text)))
         {
             orderserv.IncreaseAmount2(int.Parse(list.SelectedItems[0].SubItems[2].Text));
             orderserv.AdjustStock(int.Parse(list.SelectedItems[0].SubItems[2].Text), 1, "-");
             return(true);
         }
     }
     return(false);
 }
Пример #3
0
        private void GetItems(int menuID, ListView listView)  // gets items for each part of the menu
        {
            RosaLogic.Order_Service   orderserv     = new RosaLogic.Order_Service();
            List <RosaModel.MenuItem> menuItemsList = orderserv.GetMenuItems(menuID);

            listView.Items.Clear();
            foreach (RosaModel.MenuItem item in menuItemsList)
            {
                ListViewItem li = new ListViewItem(item.Name);
                li.SubItems.Add(item.Price.ToString());
                li.SubItems.Add(item.ID.ToString());
                listView.Items.Add(li);
            }
        }
Пример #4
0
 private bool CreateByID(ListView list)  //Creates a new order item in the current order by ID taken from the menu
 {
     RosaLogic.Order_Service orderserv = new RosaLogic.Order_Service();
     if (list.SelectedItems.Count != 0)
     {
         orderserv.CreateOrderItem(orderId, int.Parse(list.SelectedItems[0].SubItems[2].Text));
         Messagelabel.Text = "Added " + list.SelectedItems[0].SubItems[0].Text + " to Order " + orderId;
         orderserv.AdjustStock(int.Parse(list.SelectedItems[0].SubItems[2].Text), 1, "-");
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #5
0
        private void IncreaseButton_Click(object sender, EventArgs e)
        {
            RosaLogic.Order_Service orderserv = new RosaLogic.Order_Service();  // increases selected order item amount
            if (EditView.SelectedItems.Count > 0)
            {
                if (!CheckStockAmount(EditView, 2))
                {
                    orderserv.IncreaseAmount(int.Parse(EditView.SelectedItems[0].SubItems[1].Text));
                    orderserv.AdjustStock(int.Parse(EditView.SelectedItems[0].SubItems[2].Text), 1, "-");

                    FillOrderViewByOrderID(orderId);
                }
            }
            else
            {
                Messagelabel.Text = "No item selected!";
            }
        }
Пример #6
0
 private void DecreaseButton_Click(object sender, EventArgs e)
 {
     RosaLogic.Order_Service orderserv = new RosaLogic.Order_Service();
     if (EditView.SelectedItems.Count > 0)
     {
         // decreases selected order item amount
         if (int.Parse(EditView.SelectedItems[0].SubItems[3].Text) > 1)
         {
             orderserv.DecreaseAmount(int.Parse(EditView.SelectedItems[0].SubItems[1].Text));
             orderserv.AdjustStock(int.Parse(EditView.SelectedItems[0].SubItems[2].Text), 1, "+");
             FillOrderViewByOrderID(orderId);
         }
         else
         {
             orderserv.DeleteOrderItem(int.Parse(EditView.SelectedItems[0].SubItems[1].Text));
             Messagelabel.Text = "You can't decrease the amount any further so the item has been deleted!";
             FillOrderViewByOrderID(orderId);
         }
     }
     else
     {
         Messagelabel.Text = "No item selected!";
     }
 }