internal void CloseForm(UserControl userControl) { //Parent_Grid.Children.Remove(userControl); userControl.Visibility = Visibility.Hidden; TableOrder tableOrder = fTableOrder.GetTableOrder(); //Closing Form_TableOrder will also close Form_AddItem and Form_Payment (if they are inflated) if (userControl.Name == "FormTableOrder") { GreyBackdrop.Visibility = Visibility.Hidden; try { CloseForm(fAddItem); CloseForm(fPayment); } catch { //nothing } //Change TableOrder.Status and table color Button buttonTable = (selectedTable as Button); int status = tableOrder.GetTableStatus(); if (status == TableOrder.CLOSED_BILL) { tableOrder.SetTableStatus(TableOrder.TABLE_EMPTY); status = TableOrder.TABLE_EMPTY; } ChangeTableColor(buttonTable, status); } else if (userControl.Name == "FormAddItem") { if (tableOrder.GetTableStatus() == TableOrder.PRESETTLEMENT_BILL || tableOrder.GetTableStatus() == TableOrder.CLOSED_BILL) { // do nothing } else { fTableOrder.Button_ItemForm.IsEnabled = true; } } }
internal void EnableForm(TableOrder tableOrder) { thisTableOrder = tableOrder; TextBlock_TableNum.Text = "TABLE " + tableOrder.GetTableNumber(); TableTableOrder.ConvertTableOrderToTableRow(tableOrder); UpdateSumTaxTotal(thisTableOrder.GetSumTaxTotal()); if (thisTableOrder.GetTableStatus() == TableOrder.PRESETTLEMENT_BILL) { DisableTableTableOrder(); } else { EnableTableTableOrder(); } BrushConverter brush = new BrushConverter(); Rectangle1.Fill = (Brush)brush.ConvertFrom("#363636"); Rectangle2.Fill = (Brush)brush.ConvertFrom("#363636"); Rectangle3.Fill = (Brush)brush.ConvertFrom("#363636"); TextBlock_TableNum.Foreground = (Brush)brush.ConvertFrom("#363636"); TextBlock_ItemOrderedHeader.Foreground = (Brush)brush.ConvertFrom("#363636"); TextBlock_SumHeader.Foreground = (Brush)brush.ConvertFrom("#363636"); TextBlock_SumNum.Foreground = (Brush)brush.ConvertFrom("#363636"); TextBlock_TaxHeader.Foreground = (Brush)brush.ConvertFrom("#363636"); TextBlock_TaxNum.Foreground = (Brush)brush.ConvertFrom("#363636"); TextBlock_TotalHeader.Foreground = (Brush)brush.ConvertFrom("#363636"); TextBlock_TotalNum.Foreground = (Brush)brush.ConvertFrom("#363636"); TextBlock_PrintHeader.Foreground = (Brush)brush.ConvertFrom("#363636"); }