コード例 #1
0
ファイル: EditForm.cs プロジェクト: logoffro1/ROSA
 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
ファイル: tableViewForm.cs プロジェクト: logoffro1/ROSA
        private void btnSaveTableInfo_Click(object sender, EventArgs e)
        {
            Table_Service tableService = new Table_Service();

            Table tempSelectedTable = new Table() //store the table information into a temp table
            {
                isAvailable = selectedTable.isAvailable,
                isReserved  = selectedTable.isReserved
            };

            //set the temp table to the correct information
            if (btnOccupiedYes.Checked)
            {
                tempSelectedTable.isAvailable = false;
            }
            else
            {
                tempSelectedTable.isAvailable = true;
            }

            if (btnReservedYes.Checked)
            {
                tempSelectedTable.isReserved = true;
            }
            else
            {
                tempSelectedTable.isReserved = false;
            }


            // this check if changes were actually made (it compares the temp table with the selected table)
            if (tempSelectedTable.isAvailable != selectedTable.isAvailable || tempSelectedTable.isReserved != selectedTable.isReserved)
            {
                if (tempSelectedTable.isAvailable != selectedTable.isAvailable) //if the isAvailable changed
                {
                    if (selectedTable.status != TableStatus.Ordered)            //if the order doesn't have an order, change the availability
                    {
                        selectedTable.isAvailable = tempSelectedTable.isAvailable;
                    }
                    else //if there is an order, give warning message
                    {
                        MessageBox.Show("Can't change info if there is a running order!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                selectedTable.isReserved = tempSelectedTable.isReserved;



                ShowTableInfo(selectedTable.tableId);                                                         //refresh ShowTableInfo panel
                tableService.UpdateTable(selectedTable, selectedTable.isAvailable, selectedTable.isReserved); // update the table
                ChangeTableColor();                                                                           //change the colors and the icons
            } // if there were no changes, do nothing
        }