Example #1
0
 public InvitationsWindow(MealSharers system, EaterMainWindow main)
 {
     this.system = system;
     this.main   = main;
     InitializeComponent();
     loadTable();
 }
        private void login(object sender, RoutedEventArgs e)
        {
            String username = textBoxUsername.Text;
            String password = textBoxPassword.Password.ToString();

            if (system.loginAdmin(username, password))
            {
                if (system.currentAdmin.username.Equals("manager"))
                {
                    goback = true;
                    this.Close();

                    label.Content = "";
                    ManagerMainWindow eaterWindow = new ManagerMainWindow(system, main);
                    eaterWindow.Show();
                }
                else
                {
                    goback = true;
                    this.Close();

                    label.Content = "";
                    AdminMainWindow eaterWindow = new AdminMainWindow(system, main);
                    eaterWindow.Show();
                }
            }
            else if (system.loginEater(username, password))
            {
                goback = true;
                this.Close();

                label.Content = "";
                EaterMainWindow eaterWindow = new EaterMainWindow(system, main);
                eaterWindow.Show();
            }
            else if (system.loginCook(username, password))
            {
                goback = true;
                this.Close();

                label.Content = "";
                CookMainWindow cookWindow = new CookMainWindow(system, main);
                cookWindow.Show();
            }
            else
            {
                label.Content = "User name or password is incorrect.";
            }
        }