Exemple #1
0
 private void tbx_password_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         btn_dangnhap.Focus();
         accessData    acc    = new accessData();
         string        user   = tbx_username.Text.Trim();
         string        pass   = tbx_password.Text.Trim();
         SqlDataReader reader = acc.ExecuteReader("select USERNAME,PASSWORD from DANGNHAP where USERNAME='******' and PASSWORD='******'");
         if (reader.Read() == true)
         {
             QH(tbx_username.Text);
             MainMenu.Quyenhan     = QuyenHan;
             NguoiDung.QuyenHan    = QuyenHan;
             NguoiDung.TenDangNhap = tbx_username.Text;
             BaoCao.TenDangNhap    = tbx_username.Text;
             Doimatkhau.USERNAME   = tbx_username.Text;
             DoiQuyen.USERNAME     = tbx_username.Text;
             Doimatkhau.QUYENHAN   = QuyenHan;
             ThemTaiKhoan.Username = tbx_username.Text;
             lb_STT.Text           = "Đăng Nhập Thành Công!";
             MessageBox.Show("Bạn Đang Là: " + QuyenHan + "");
             this.Hide();
             MainMenu menu = new MainMenu();
             menu.ShowDialog();
         }
         else
         {
             lb_STT.Text = "Sai Thông Tin Đăng Nhập! Vui Lòng Nhập Lại!";
             tbx_username.Clear();
             tbx_password.Clear();
             tbx_username.Focus();
         }
     }
 }
Exemple #2
0
        public DataTable ThongTinMaNV(string TEXT)
        {
            accessData    acc = new accessData();
            SqlDataReader a   = acc.ExecuteReader("Select MANV FROM NHANVIEN WHERE TENNV LIKE N'" + TEXT + "'");

            while (a.Read())
            {
                MANV = a["MANV"].ToString().Trim();
            }
            return(null);
        }
Exemple #3
0
        public DataTable ThongTinMaKho(string TEXT)
        {
            accessData    acc = new accessData();
            SqlDataReader a   = acc.ExecuteReader("Select MAKHO FROM KHOHANG WHERE TENKHO LIKE N'" + TEXT + "'");

            while (a.Read())
            {
                MAKHO = a["MAKHO"].ToString().Trim();
            }
            return(null);
        }
Exemple #4
0
        public DataTable QH(string USERNAME)
        {
            accessData    acc = new accessData();
            SqlDataReader a   = acc.ExecuteReader("SELECT QUYENHAN FROM DANGNHAP WHERE USERNAME='******'");

            while (a.Read())
            {
                QuyenHan = a["QUYENHAN"].ToString();
            }
            return(null);
        }
Exemple #5
0
        public DataTable NV(string UN)
        {
            accessData    acc = new accessData();
            SqlDataReader a   = acc.ExecuteReader("SELECT MANV FROM DANGNHAP WHERE USERNAME='******'");

            while (a.Read())
            {
                MaNV = a["MANV"].ToString().Trim();
            }
            return(null);
        }
Exemple #6
0
        public DataTable ThongTinMANV(string TENBP)
        {
            accessData    acc = new accessData();
            SqlDataReader a   = acc.ExecuteReader("Select MABP FROM BOPHAN WHERE TENBP like N'" + TENBP + "'");

            while (a.Read())
            {
                MaBP = a["MABP"].ToString().Trim();
            }
            return(null);
        }
Exemple #7
0
        public DataTable ThongTinTDN(string TDNHT)
        {
            accessData    acc = new accessData();
            SqlDataReader a   = acc.ExecuteReader("Select MANV FROM DANGNHAP WHERE USERNAME = '******'");

            while (a.Read())
            {
                MANV = a["MANV"].ToString().Trim();
            }
            return(null);
        }
Exemple #8
0
        private void btn_dq_Click(object sender, EventArgs e)
        {
            accessData access = new accessData();

            if (tbx_tdn.Text == null)
            {
                SqlDataReader reader = access.ExecuteReader("select QUYENHAN from DANGNHAP where USERNAME= '******'");
                while (reader.Read() == true)
                {
                    string sql = "update DANGNHAP set QUYENHAN ='" + tbx_quyenmoi.Text + "' where USERNAME ='******'";
                    if (tbx_quyencu.Text == "" || tbx_quyenmoi.Text == "")
                    {
                        MessageBox.Show("Yêu cầu điền đủ vào các mục");
                    }
                    else
                    {
                        if (tbx_quyenmoi.Text == tbx_quyencu.Text)
                        {
                            MessageBox.Show("Quyền Hạn mới phải khác Quyền Hạn cũ!");
                            tbx_quyenmoi.Clear();
                        }
                        else
                        {
                            if (access.executenonquery(sql) == true)
                            {
                                MessageBox.Show("Cập nhật quyền hạn thành công");
                                this.Hide();
                            }
                        }
                    }
                }
            }
            else
            {
                SqlDataReader reader = access.ExecuteReader("select QUYENHAN from DANGNHAP where USERNAME= '******'");
                while (reader.Read() == true)
                {
                    string sql = "update DANGNHAP set QUYENHAN ='" + tbx_quyenmoi.Text + "' where USERNAME ='******'";
                    if (tbx_quyencu.Text == "" || tbx_quyenmoi.Text == "")
                    {
                        MessageBox.Show("Yêu cầu điền đủ vào các mục");
                    }
                    else
                    {
                        if (tbx_quyenmoi.Text == tbx_quyencu.Text)
                        {
                            MessageBox.Show("Quyền Hạn mới phải khác Quyền Hạn cũ!");
                            tbx_quyenmoi.Clear();
                        }
                        else
                        {
                            if (access.executenonquery(sql) == true)
                            {
                                MessageBox.Show("Cập nhật quyền hạn thành công");
                                this.Hide();
                            }
                        }
                    }
                }
            }
        }
Exemple #9
0
        private void btn_DMK_Click(object sender, EventArgs e)
        {
            accessData access = new accessData();

            if (tbx_tdn.Text == "")
            {
                SqlDataReader reader = access.ExecuteReader("select Password from DANGNHAP where USERNAME= '******'");
                while (reader.Read() == true)
                {
                    string sql = "update DANGNHAP set PASSWORD ='******' where USERNAME ='******'";
                    if (tbx_matkhaucu.Text == "" || tbx_matkhaumoi.Text == "" || tbx_nlmatkhaumoi.Text == "")
                    {
                        MessageBox.Show("Yêu cầu điền đủ vào các mục");
                    }
                    else
                    {
                        if (tbx_matkhaumoi.Text != tbx_nlmatkhaumoi.Text)
                        {
                            MessageBox.Show("Mật khẩu thay thế phải trùng nhau");
                        }
                        else
                        {
                            if (access.executenonquery(sql) == true)
                            {
                                MessageBox.Show("Cập nhật mật khẩu  thành công");
                                this.Hide();
                            }
                        }
                    }
                }
                tbx_matkhaucu.Clear();
            }
            else
            {
                SqlDataReader reader = access.ExecuteReader("select Password from DANGNHAP where USERNAME= '******'");
                while (reader.Read() == true)
                {
                    string sql = "update DANGNHAP set PASSWORD ='******' where USERNAME ='******'";
                    if (tbx_matkhaucu.Text == "" || tbx_matkhaumoi.Text == "" || tbx_nlmatkhaumoi.Text == "")
                    {
                        MessageBox.Show("Yêu cầu điền đủ vào các mục");
                    }
                    else
                    {
                        if (tbx_matkhaumoi.Text != tbx_nlmatkhaumoi.Text)
                        {
                            MessageBox.Show("Mật khẩu thay thế phải trùng nhau");
                        }
                        else
                        {
                            if (access.executenonquery(sql) == true)
                            {
                                MessageBox.Show("Cập nhật mật khẩu  thành công");
                                this.Hide();
                            }
                        }
                    }
                }
                tbx_matkhaucu.Clear();
            }
        }