示例#1
0
        private void btnChangeMenu_Click(object sender, EventArgs e)
        {
            MenuCardSelection selection = new MenuCardSelection(DateTime.Now, user);

            // show different menus
            DialogResult sel = selection.ShowDialog();

            this.submenu = selection.ReturnValue;
            FillMenu();
        }
示例#2
0
        private void TablesClicked(Table table) //pop up menu (4 actions(occupied,served......etc ) ) // contextMenu
        {
            DialogBox dialog = new DialogBox(table);

            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                MenuCardSelection selection = new MenuCardSelection(DateTime.Now, user);
                DialogResult      sel       = selection.ShowDialog();
                TakeOrder         order     = new TakeOrder(this, selection.ReturnValue, user, table);
                this.Hide();
                order.ShowDialog();
            }
            else if (result == DialogResult.Yes) // reserve table
            {
                int rows = tbSrv.ChangeTableStatus(table, TableState.Reserved);

                if (rows > 0)
                {
                    MessageBox.Show("table is reserved");
                }
                else if (rows == -1)
                {
                    MessageBox.Show("database connection failed");
                }
                else
                {
                    MessageBox.Show("an error occured");
                }
            }
            else if (result == DialogResult.No) // free table
            {
                int rows = tbSrv.ChangeTableStatus(table, TableState.Free);

                if (rows > 0)
                {
                    MessageBox.Show("table is free");
                }
                else if (rows == -1)
                {
                    MessageBox.Show("database connection failed");
                }
                else
                {
                    MessageBox.Show("an error occured");
                }
            }
            tables = tbSrv.GetAllTables();
            InitiateTableStates(tables);
        }