Exemplo n.º 1
0
        private void btnpay_Click(object sender, EventArgs e)
        {
            string paymentmethod = "";

            if (radiobtnpin.Checked || radiobtncash.Checked || radiobtnmastercard.Checked)
            {
                if (radiobtnpin.Checked)
                {
                    paymentmethod = "pin";
                }
                else if (radiobtncash.Checked)
                {
                    paymentmethod = "Cash";
                }
                else if (radiobtnmastercard.Checked)
                {
                    paymentmethod = "CreditCard";
                }
                paymentService.UpdatePaidOrders(table);
                paymentService.UpdateTable(table);
                DateTime dateTime = DateTime.Now;
                string   date     = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                paymentService.SaveOrders(orderid, employee.EmployeeId, paymentmethod, date, vatvalue, tipvalue, totalamount);

                this.Hide();
                TablePage tablepage = new TablePage(employee);
                tablepage.ShowDialog();
                this.Close();
            }
            else
            {
                MessageBox.Show(text: "Choose an option");
            }
        }
Exemplo n.º 2
0
        private void LoginEmployee()
        {
            login    loginCode = new login(int.Parse(LoginBox.Text));
            Employee employee  = EmployeeServices.GetEmployee(loginCode);

            if (employee != null)
            {
                if (employee.role == "Waiter")
                {
                    this.Hide();
                    TablePage tablepage = new TablePage(employee);
                    tablepage.ShowDialog();
                    this.Close();
                }
                else if (employee.role == "Chef" || employee.role == "Bar")
                {
                    this.Hide();
                    OrdersList tablepage = new OrdersList(employee);
                    tablepage.ShowDialog();
                    this.Close();
                }
            }
            else
            {
                LoginBox.Text = "";
                MessageBox.Show("Incorrect Password");
            }
        }
Exemplo n.º 3
0
        private void btn_back_Click(object sender, EventArgs e)
        {
            this.Hide();
            TablePage orderSelect = new TablePage(employee);

            orderSelect.ShowDialog();
            this.Close();
        }
Exemplo n.º 4
0
        private void btn_Confirm_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < gridV_Drinks.Rows.Count; i++)
            {
                OrderMenuItem item = new OrderMenuItem()
                {
                    menuItemID = int.Parse(gridV_Drinks.Rows[i].Cells[0].Value.ToString()),
                    price      = double.Parse(gridV_Drinks.Rows[i].Cells[2].Value.ToString()),
                    quantity   = int.Parse(gridV_Drinks.Rows[i].Cells[3].Value.ToString()),
                    comments   = "No comment",
                };
                orderMenuItems.Add(item);
            }

            try
            {
                orderServices.NewOrder(table, employee);
                table.status = OrderStatus.occupied.ToString();
                orderServices.UpdateTable(table);

                Order order = orderServices.getId(table, employee);
                foreach (OrderMenuItem menuItems in orderMenuItems)
                {
                    orderServices.InsertMenu(menuItems, order.OrderID);
                    orderServices.UpdateStock(menuItems);
                }
                ;

                this.Hide();
                TablePage waiterPage = new TablePage(employee);
                waiterPage.ShowDialog();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }