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();
     }
 }
Beispiel #2
0
        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.");
            }
        }