private void AccessData()
        {
            try
            {
                // lấy chuỗi kết nối từ form setting
                frmSetting.dblogin = new DBLoginSystem(frmSetting.StrConnection);
            }

            catch (NullReferenceException nre) { Console.WriteLine(nre.Message); }
            catch (Exception ex) { Console.WriteLine(ex.Message); }
            if (rb_Student.Checked)
            {
                DAL.Rolename = rb_Student.Text.ToLower();
            }
            else if (rb_Teacher.Checked)
            {
                DAL.Rolename = rb_Teacher.Text.ToLower();
            }
            else if (rb_Admin.Checked)
            {
                DAL.Rolename = rb_Admin.Text.ToLower();
            }

            try
            {
                DAL.Username = txtUsername.Text;
                DAL.Password = txtPwd.Text;
                // mã hóa password
                status = frmSetting.dblogin.isConnect(txtUsername.Text.Trim(), Encrypter.Encrypt(txtPwd.Text), DAL.Rolename);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                status = (int)DBLoginSystem.connStatus.notconnect;
            }
        }
Example #2
0
 public bool changePwd(string username, string pwd)
 {
     pwd = Encrypter.Encrypt(pwd);
     return(DAL.Constance.ExecuteQueryNonDataSet("proc_changePwd", CommandType.StoredProcedure, ref error, new SqlParameter("@username", username), new SqlParameter("@pwd", pwd)));
 }