private void btnOK_Click(object sender, EventArgs e) { //go back to overview //opens th form corresponding with user this.Hide(); if (order.Employee.type == OrderSystemModel.employeeType.Barman) { BarUI barUI = new BarUI(order.Employee); barUI.ShowDialog(); } else if (order.Employee.type == OrderSystemModel.employeeType.Serveerder) { TableOverviewUI waiterUI = new TableOverviewUI(order.Employee); waiterUI.ShowDialog(); } else if (order.Employee.type == OrderSystemModel.employeeType.Kok) { KitchenUI kitchenUI = new KitchenUI(order.Employee); kitchenUI.ShowDialog(); } else if (order.Employee.type == OrderSystemModel.employeeType.Manager) { ManagerUI managerUI = new ManagerUI(order.Employee); managerUI.ShowDialog(); } }
private void btnLogin_Click(object sender, EventArgs e) { int employeeID; //tries to turn the received input into an it; if it's successful it sets the employee ID; if it is not successful it sets the username. if (int.TryParse(usernameInput.Text, out employeeID)) { employee.ID = employeeID; } else { employee.username = usernameInput.Text; } employee.password = passwordInput.Text; try { if (employeeLogic.CheckForUser(employee)) { this.Hide(); //opens th form corresponding with user if (employee.type == OrderSystemModel.employeeType.Barman) { BarUI barUI = new BarUI(employee); barUI.ShowDialog(); } else if (employee.type == OrderSystemModel.employeeType.Serveerder) { TableOverviewUI waiterUI = new TableOverviewUI(employee); waiterUI.ShowDialog(); } else if (employee.type == OrderSystemModel.employeeType.Kok) { KitchenUI kitchenUI = new KitchenUI(employee); kitchenUI.ShowDialog(); } else if (employee.type == OrderSystemModel.employeeType.Manager) { ManagerUI managerUI = new ManagerUI(employee); managerUI.ShowDialog(); } this.Close(); } else { MessageBox.Show("Invalid username or password."); usernameInput.Clear(); passwordInput.Clear(); } } catch { MessageBox.Show("Problem loading database. Please try again."); } }
public OrderHomeUI(Employee employee, Table table, TableOverviewUI tableUI) { InitializeComponent(); this.buttons = new List <Button>(); buttons.Add(btnBack); buttons.Add(btnFree); buttons.Add(btnReserved); buttons.Add(btnTaken); buttons.Add(Btn_BeverageMenu); buttons.Add(btn_Checkout); buttons.Add(btn_DinnerMenu); buttons.Add(btn_LunchMenu); buttons.Add(btn_OrderOverview); buttons.Add(btn_RemoveOrder); this.order.Employee = employee; this.order.Table = table; this.tableUI = tableUI; this.table = table; this.Text = "Tafel " + table.ID + "- Order Menu"; tableNumber.Text = "Tafel " + table.ID + ":"; try { try { this.order = orderLogic.GetTableOrder(table); } catch { orderLogic.AddNewOrder(order); this.order = orderLogic.GetLatestOrder(); } } catch { MessageBox.Show("Probleem met het laden van de database. Probeer opnieuw."); } try { InitTableStatusColors(); tableLogic.AssignEmployeeToTable(employee, table); tableUI.Hide(); } catch { MessageBox.Show("Probleem met het laden van de database. Probeer opnieuw."); } }