Exemplo n.º 1
0
        private void submitButton_Click(object sender, RoutedEventArgs e)
        {
            bool loginCorrect = bridge.Login(ID.Text.Trim(), passwordBox.Password.Trim());

            if (loginCorrect == true)
            {
                MessageBox.Show(string.Format("Welcome back {0}!", bridge.CurrentUser.Name));
                if (bridge.CurrentUser.isManager)
                {
                    AdminMenu adminMenu = new AdminMenu();
                    Close();
                }
                else
                {
                    EmployeeMenu EmployeeMenu = new EmployeeMenu();
                    Close();
                }
            }
            else
            {
                //label2.Content = "Wrong Id or Password, please try again";
                MessageBox.Show("Wrong Id or Password, please try again");
                RefreshThisForm();
            }
        }
Exemplo n.º 2
0
        //private void Password_TextChanged(object sender, TextChangedEventArgs e)
        //{

        //}

        private void Save_Click(object sender, RoutedEventArgs e)
        {
            Personnel admin = bridge.Factory.CreateNewAdmin(UserName.Text.Trim(), passwordBox.Password.Trim());

            if (admin.Email != "invalid")
            {
                List <string> empInfo = bridge.GetObjectInfo(admin);
                empInfo.RemoveAt(empInfo.Count - 1);
                string message = "You have created the master admin account:\n" + string.Join(Environment.NewLine, empInfo);
                MessageBox.Show(message);

                bridge.Login(admin.Email, passwordBox.Password);
                AdminMenu adminMenu = new AdminMenu();
                Close();
            }
            else
            {
                MessageBox.Show("Email is invalid format, please enter a new email.");
            }
        }