コード例 #1
0
        /// <summary>
        /// This method is for the buttons btnTable. This button opens the Order form with the right tablenumber. If the table.Status is 'free' it will set the table.status to 'occupied' and creates a new Order Object.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnTable1_Click(object sender, EventArgs e)
        {
            Button btn        = (Button)sender;
            int    tableIndex = int.Parse(btn.Text) - 1;

            TableList = Service.GetTableList();

            ChapooModels.Order order;
            if (TableList[tableIndex].Status == "free")
            {
                string            message = "Do you want to set this table occupied.";
                string            title   = "Assign table";
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                DialogResult      result  = MessageBox.Show(message, title, buttons);
                if (result == DialogResult.Yes)
                {
                    order = new ChapooModels.Order();
                    Service.CreateOrder(Employee.EmployeeId, "new", TableList[tableIndex].TableNumber);
                    TableList[tableIndex].OrderId = Service.GetOrderId(tableIndex + 1);
                    btn.BackgroundImage           = ButtonImages[Images.btnTableGreen];
                    Service.UpdateTableStatus((tableIndex + 1), "occupied");
                }
            }
            else
            {
                TableList[tableIndex].OrderId = Service.GetOrderId(tableIndex + 1);
                Order orderForm = new Order(Employee, TableList[tableIndex]);
                this.Hide();
                orderForm.ShowDialog();
                this.Close();
            }
        }
コード例 #2
0
ファイル: Order.cs プロジェクト: dantim1997/project-Chapoo
        /// <summary>
        /// closes order, returns to tableoverview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Pay_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you want to finish the order?", "Confirm finishing order", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                orderService.UpdateStatus("closed", Table.OrderId);
                tableService.UpdateTableStatus(Table.TableNumber, "free");
                orderProductService.UpdateOrderProductStatusByOrderId(Table.OrderId, Statustype.Afgehandeld);
                TableOverview tableOverview = new TableOverview(Employee);
                this.Hide();
                tableOverview.ShowDialog();
                this.Close();
            }
        }