Esempio n. 1
0
        private void tsmiChangePassword_Click(object sender, EventArgs e)
        {
            FrmChangePassword frmChangePassword = new FrmChangePassword(staff);

            frmChangePassword.Show();
            this.Enabled = false;
            frmChangePassword.FormClosed += frmChangePassword_FormClosed;
        }
Esempio n. 2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtbAccName.Text == "")
         {
             throw new Exception("Bạn chưa nhập tên tài khoản!");
         }
         else
         {
             if (txtbPassword.Text == "")
             {
                 throw new Exception("Bạn chưa nhập mật khẩu!");
             }
             else
             {
                 Staff staff = staffBUS.GetStaffByAccount(txtbAccName.Text);
                 if (staff.Password.Equals(txtbPassword.Text))
                 {
                     if (staff.Password.Equals(staff.Account))
                     {
                         FrmChangePassword frmChangePassword = new FrmChangePassword(staff);
                         frmChangePassword.Show();
                         this.Enabled = false;
                         frmChangePassword.FormClosed += frmChangePassword_FormClosed;
                     }
                     else
                     {
                         FrmMain frmMain = new FrmMain(staff);
                         frmMain.Show();
                         this.Visible        = false;
                         frmMain.FormClosed += frmMain_FormClosed;
                     }
                 }
                 else
                 {
                     throw new Exception("Mật khẩu không đúng!");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 3
0
 private void txtbPassword_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (firstPress2)
         {
             txtbPassword.ForeColor             = Color.Black;
             txtbPassword.UseSystemPasswordChar = true;
             txtbPassword.Text = "";
             firstPress2       = false;
         }
         if (e.KeyCode == Keys.Enter)
         {
             Staff staff = staffBUS.GetStaffByAccount(txtbAccName.Text);
             if (staff.Password.Equals(txtbPassword.Text))
             {
                 if (staff.Password.Equals(staff.Account))
                 {
                     FrmChangePassword frmChangePassword = new FrmChangePassword(staff);
                     frmChangePassword.Show();
                     this.Enabled = false;
                     frmChangePassword.FormClosed += frmChangePassword_FormClosed;
                 }
                 else
                 {
                     FrmMain frmMain = new FrmMain(staff);
                     frmMain.Show();
                     this.Visible        = false;
                     frmMain.FormClosed += frmMain_FormClosed;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 4
0
 private void tsmiChangePassword_Click(object sender, EventArgs e)
 {
     FrmChangePassword frmChangePassword = new FrmChangePassword(staff);
     frmChangePassword.Show();
     this.Enabled = false;
     frmChangePassword.FormClosed += frmChangePassword_FormClosed;
 }