private void DefaultLogin()
 {
     Enter_B.Text         = "Войти";
     CheckPass_CB.Enabled = true;
     Login_CB.Enabled     = true;
     Password_TB.Clear();
     Password_TB.Enabled = true;
 }
Exemplo n.º 2
0
        private void Login_btn_Click(object sender, EventArgs e)
        {
            if (Username_TB.Text == "" || Password_TB.Text == "")
            {
                MessageBox.Show("Please Enter Username and Passwords");
            }
            else
            {
                User user = new Admin();
                user = User.Login(Username_TB.Text, Password_TB.Text);

                if (user == null)
                {
                    MessageBox.Show("Not Found!");
                    Username_TB.Clear();
                    Password_TB.Clear();
                }
                else
                {
                    if (user.Rolename == RolesEnum.Admin)
                    {
                        this.Hide();
                        Admin admin = new Admin();
                        user.CopyInto(ref admin);
                        admin.loadAdminDetails();
                        AdminForm form = new AdminForm(admin);
                        form.ShowDialog();
                    }
                    else
                    {
                        this.Hide();
                        StudentForm form = new StudentForm(user);
                        form.ShowDialog();
                    }
                    this.Close();
                }
            }
        }