public bool Login(string username, string password)
        {
            //MessageBox.Show("Login Action");
            AccountDao AcDAO        = new AccountDao();
            bool       LoginSuccess = AcDAO.CheckLogin(username, password);

            if (LoginSuccess)
            {
                MessageBox.Show("LoginSuccess");
                User = AcDAO.GetAccountByUsername(username);
                welcomeToolStripMenuItem.Text = "Xin chào " + username;
                // chuyển đến form Order
                this.mainPanel.Controls.Clear();

                ResetUserLogin();
                int userRole = User.UserRole;
                if (userRole == 1)
                {
                    PhanQuyenNhanVien();
                }
                else if (userRole == 2)
                {
                    PhanQuyenAdmin();
                }
                return(true);
            }
            else
            {
                MessageBox.Show("LoginFailed");
                return(false);
            }
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length > 0 && textBox2.Text.Length > 0 && textBox3.Text.Length > 0 && textBox4.Text.Length > 0)
     {
         AccountDao account = new AccountDao();
         if (account.CheckLogin(textBox1.Text, textBox2.Text))
         {
             bool Success = account.ChangePasswordAccount(textBox1.Text, textBox3.Text);
             if (Success)
             {
                 MessageBox.Show("Change Password Successful !");
                 textBox1.Text = "";
                 textBox2.Text = "";
                 textBox3.Text = "";
                 // Chuyển về form đăng nhập ???
             }
             else
             {
                 MessageBox.Show("Sai ở đâu đó. Cái này không nên hiện ra !");
                 textBox1.Text = "";
                 textBox2.Text = "";
                 textBox3.Text = "";
             }
         }
         else
         {
             MessageBox.Show("Change Password Failed !");
             textBox1.Text = "";
             textBox2.Text = "";
             textBox3.Text = "";
         }
     }
     else
     {
         textBox1.Text = "";
         textBox2.Text = "";
         textBox3.Text = "";
     }
 }
Beispiel #3
0
 public AccountObject CheckLogin(string username, string password)
 {
     return(ModelAccont.CheckLogin(username, password));
 }