Exemple #1
0
        private void button_logIn_Click(object sender, EventArgs e)
        {
            try
            {
                int          Employeeid       = int.Parse(textBox_Id.Text);
                string       EmployeePassword = textBox_password.Text;
                Employee     employee         = new Employee(Employeeid, EmployeePassword);
                LoginService login            = new LoginService();

                Function function = login.funtion(employee);

                if (login.CheckLogin(employee))
                {
                    if (Enum.IsDefined(typeof(Function), function))
                    {
                        switch (function)
                        {
                        case Function.Owner:
                            OwnerMenu main = new OwnerMenu();
                            main.FormClosed += new FormClosedEventHandler(login_FormClosed);
                            main.Show();
                            this.Hide();
                            break;

                        case Function.Barkeeper:
                            Overview bar = new Overview(employee.function, employee);
                            bar.FormClosed += new FormClosedEventHandler(login_FormClosed);
                            bar.Show();
                            this.Hide();
                            break;

                        case Function.Cook:
                            Overview kitchen = new Overview(employee.function, employee);
                            kitchen.FormClosed += new FormClosedEventHandler(login_FormClosed);
                            kitchen.Show();
                            this.Hide();
                            break;

                        case Function.Waiter:
                            WaiterMenu menu = new WaiterMenu();
                            menu.FormClosed += new FormClosedEventHandler(login_FormClosed);
                            menu.Show();
                            this.Hide();
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Wrong ID");
                    }
                }
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
        }
Exemple #2
0
        private void Next_Button_Click(object sender, RoutedEventArgs e)
        {
            Overview overview = new Overview();

            overview.Show();
            this.Close();
        }
        private void BTN_LogIn_Click(object sender, RoutedEventArgs e)
        {
            PasswordEncoder pe = new PasswordEncoder();

            if (User.Password == pe.EncryptWithByteArray(TB_Password.Password))
            {
                ((App)Application.Current).LoggedUser = User;
                signInWindow.Close();
                Overview overview = new Overview();
                overview.Show();
            }
            else
            {
                MessageBox.Show("Podano nieprawidłowe hasło.", "Błędne hasło", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 private void ShowCorrectPage(Employee employee)
 {
     if (employee.Role == RestaurantRole.Waiter)
     {
         Overview overviewForm = new Overview(employee);
         overviewForm.Show();
     }
     else if (employee.Role == RestaurantRole.Barman || employee.Role == RestaurantRole.Chef)
     {
         OrderForwarding OrderForwardingForm = new OrderForwarding(employee);
         OrderForwardingForm.Show();
     }
     else if (employee.Role == RestaurantRole.Manager)
     {
         Employee_Edit employeeForm = new Employee_Edit();
         employeeForm.Show();
     }
 }