Exemplo n.º 1
0
        public void btnDangnhap_Click(object sender, EventArgs e)
        {
            frmIndex fI = new frmIndex();

            tblNhanVien = new NhanVien();
            var r = tblNhanVien.Select("Username='******' and Password ='******'");

            if (r.Count() > 0)
            {
                if (txtMatkhau.Text == "123")
                {
                    MessageBox.Show("Hẫy đổi lại mật khẩu tại trang chủ chọn [Account]->[Change Pass]!");
                    fI.Text = "Rabbit's House - Welcome " + r[0]["TenNV"].ToString();
                    fI.maNV = r[0]["MaNV"].ToString();
                    fI.enableControl((int)r[0]["MaLTK"]);
                    fI.Show();
                    this.Hide();
                }
                else
                {
                    fI.Text = "Rabbit's House - Welcome " + r[0]["TenNV"].ToString();
                    fI.maNV = r[0]["MaNV"].ToString();
                    fI.enableControl((int)r[0]["MaLTK"]);
                    fI.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu!");
            }
        }
Exemplo n.º 2
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     errorProvider1.SetError(txtMKCu, "");
     errorProvider1.SetError(txtNhapLaiMK, "");
     if (txtMKCu.Text.Length < 8 || !txtMKCu.Text.Any(char.IsUpper) || !txtMKCu.Text.Any(char.IsDigit) || !txtMKCu.Text.Any(char.IsLower))
     {
         errorProvider1.SetError(txtMKCu, "Mat khau toi thieu 8 ki tu" + "in hoa, in thuong.");
         return;
     }
     if (txtMKCu.Text != txtNhapLaiMK.Text)
     {
         errorProvider1.SetError(txtNhapLaiMK, "Mat khau khong trung!");
         return;
     }
     if (maNV != null)
     {
         int count = table.Thuc_hien_lenh("update NHANVIEN set Password ='******'where MaNV = '" + maNV + "'");
         if (count > 0)
         {
             MessageBox.Show("Cap nhat thanh cong!.");
             Application.Restart();
         }
         else
         {
             MessageBox.Show("Mat khau khong hop le");
             return;
         }
     }
     else
     {
         frmIndex fI    = (frmIndex)this.MdiParent;
         int      count = table.Thuc_hien_lenh("update NHANVIEN set Password ='******'where MaNV = '" + fI.maNV + "'");
         if (count > 0)
         {
             MessageBox.Show("Cap nhat thanh cong!.");
             Application.Restart();
         }
         else
         {
             MessageBox.Show("Mat khau khong hop le");
             return;
         }
     }
 }
Exemplo n.º 3
0
        private void btnChapNhan_Click(object sender, EventArgs e)
        {
            errorProvider1.SetError(txtTenDN, "");
            errorProvider1.SetError(txtKey, "");
            tblNhanVien = new NhanVien();
            frmIndex fI = (frmIndex)this.MdiParent;
            var      r  = tblNhanVien.Select("Username='******' and MaNV ='" + txtKey.Text + "'");

            if (r.Count() > 0)
            {
                frmChangepass fC = new frmChangepass(txtKey.Text);
                fC.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Sai tên đăng nhập hoặc Key!");
                return;
            }
        }