Пример #1
0
        private void btnRegister_Click(object sender, RoutedEventArgs e)
        {
            uname        = txtUname.Text;
            name         = txtName.Text;
            pword        = txtPword.Password;
            confirmPword = txtConfirmPword.Password;

            if (pword != confirmPword)
            {
                notification.MessageDialog(this, "Error", "Passwords do not match");
            }
            else
            {
                Administrator tempAdmin = new Administrator(uname, name, pword);

                name = controller.addAdmin(tempAdmin);

                if (name != null)
                {
                    notification.successNotifier(uname + " has Successfully Registered");

                    AdminDashboard adminBoard = new AdminDashboard();
                    adminBoard.status += uname;

                    adminBoard.Show();
                }
                else
                {
                    notification.MessageDialog(this, "Error", "Username already exists");
                }
                //this.Close();
            }
        }
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            uname = txtuname.Text;
            pword = txtpword.Password;

            returnValue = controller.adminAuthenticator(uname, pword);

            if (returnValue != uname)
            {
                notification.errorNotifier(returnValue);
            }
            else
            {
                AdminDashboard dashboard1 = new AdminDashboard();

                notification.successNotifier(uname + " has Logged In Successfully");

                dashboard1.status += uname;

                dashboard1.ShowDialog();

                //this.Close();
            }
        }