//XÓA TÀI KHOẢN
 private void XoaTaiKhoan()
 {
     if (XacNhanXoa == 1)
     {
         DangNhap_ThongTin DangNhap = new DangNhap_ThongTin();
         DangNhap.TaiKhoan = tbDanhSachTaiKhoan.Rows[DongChon].Cells[0].Value.ToString();
         if (MessageBox.Show("Bạn có thật sự muốn xóa thông tin tài khoản " + DangNhap.TaiKhoan + "", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             try
             {
                 cls_DangNhap.XoaTaiKhoan(DangNhap);
                 tbDanhSachTaiKhoan.DataSource = cls_DangNhap.DanhSachTaiKhoan();
             }
             catch
             {
                 MessageBox.Show("Không thể xóa dữ liệu này, hãy kiểm tra lại.!", "Thông báo lỗi.", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         XacNhanXoa = 0;
         txtTimKiem.Focus();
     }
     else
     {
         MessageBox.Show("Bạn hãy chọn khóa học muốn xóa.", "Thông báo.", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtTimKiem.Focus();
     }
 }
Beispiel #2
0
        //THÊM TÀI KHOẢN MỚI.
        private void ThemTaiKhoan()
        {
            DangNhap_ThongTin DN = new DangNhap_ThongTin();

            DN.TaiKhoan = txtTaiKhoan.Text;
            DN.Quyen    = cbQuyen.SelectedValue.ToString();
            try
            {
                if (!DN.TaiKhoan.Equals(""))
                {
                    cls_DangNhap.ThemTaiKhoan(DN);
                    MessageBox.Show("Bạn đã thêm tài khoản " + DN.TaiKhoan + "", "Thông báo.", MessageBoxButtons.OK, MessageBoxIcon.None);
                }
                else
                {
                    MessageBox.Show("Hãy nhập tên tài khoản");
                    txtTaiKhoan.Focus();
                }
            }
            catch
            {
                MessageBox.Show("Không thể thêm mới, có thể khóa chính bị trùng.", "Thông báo lối!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            txtTaiKhoan.ResetText();
            txtTaiKhoan.Focus();
            btHoanTat.Enabled = true;
            if (DuLieu != null)
            {
                DuLieu(DN);
            }
        }
 private void KhiAnTimKiem(object sender, KeyEventArgs e)
 {
     if (!e.KeyValue.ToString().Equals("120") && !e.KeyValue.ToString().Equals("121") && !e.KeyValue.ToString().Equals("122") && !e.KeyValue.ToString().Equals("123"))
     {
         txtTimKiem.BackColor = Color.White;
         DangNhap_ThongTin DN = new DangNhap_ThongTin();
         DN.TaiKhoan = txtTimKiem.Text;
         tbDanhSachTaiKhoan.DataSource = cls_DangNhap.TimKiemTaiKhoan(DN);
     }
     if (e.KeyValue.ToString().Equals("120"))
     {
         ThemTaiKhoan();
         txtTimKiem.Focus();
     }
     if (e.KeyValue.ToString().Equals("121"))
     {
         SuaTaiKhoan();
         txtTimKiem.Focus();
     }
     if (e.KeyValue.ToString().Equals("122"))
     {
         XoaTaiKhoan();
         txtTimKiem.Focus();
     }
     if (e.KeyValue.ToString().Equals("123"))
     {
         txtTimKiem.BackColor = Color.YellowGreen;
         txtTimKiem.Focus();
     }
     txtTimKiem.Focus();
 }
        //KHI ĐĂNG XUẤT
        public void KhiDangXuat()
        {
            DangNhap_ThongTin DN = new DangNhap_ThongTin();

            DN.TaiKhoan  = txtTen.Text;
            DN.TrangThai = false;
            cls_DangNhap.UpDateTrangThai(DN);
            this.Close();
        }
Beispiel #5
0
        //TÌM KIẾM TÀI KHOẢN.
        public DataTable TimKiemTaiKhoan(DangNhap_ThongTin DN)
        {
            int Nparameter = 1;

            string[] name  = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@TimKiem";   value[0] = DN.TaiKhoan;
            return(cls.TimKiem("TimKiemTaiKhoan", name, value, Nparameter));
        }
Beispiel #6
0
 public DoiMatKhau(DangNhap_ThongTin DN)
 {
     InitializeComponent();
     this.TaiKhoan  = DN.TaiKhoan;
     this.MatKhau   = DN.MatKhau;
     this.Quyen     = DN.Quyen;
     this.TrangThai = DN.TrangThai;
     txtMatKhauCu.Focus();
 }
Beispiel #7
0
        //XÓA 1 TÀI KHOẢN.
        public int XoaTaiKhoan(DangNhap_ThongTin DN)
        {
            int Nparameter = 1;

            string[] name  = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@TaiKhoan";  value[0] = DN.TaiKhoan;
            return(cls.CapNhat("XoaTaiKhoan", name, value, Nparameter));
        }
Beispiel #8
0
 //KHI KÍCH THỰC HIỆN.
 private void XuLyThayDoiMatKhau()
 {
     if (txtMatKhauCu.Text.Equals(""))
     {
         MessageBox.Show("Bạn hãy nhập vào mật khẩu cũ!", "Thông báo lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtMatKhauCu.Focus();
     }
     else
     {
         if (txtMatKhauMoi.Text.Equals(""))
         {
             MessageBox.Show("Bạn hãy nhập vào mật khẩu mới!", "Thông báo lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtMatKhauMoi.Focus();
         }
         else
         {
             if (txtNhapLaiMatKhauMoi.Text.Equals(""))
             {
                 MessageBox.Show("Bạn hãy xác nhận lại mật khẩu mới!", "Thông báo lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 txtNhapLaiMatKhauMoi.Focus();
             }
             else
             {
                 if (!txtMatKhauMoi.Text.Equals(txtNhapLaiMatKhauMoi.Text))
                 {
                     MessageBox.Show("Xác nhận mật khẩu không chính xác, hãy nhập lại để xác nhận lại!", "Thông báo lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     txtNhapLaiMatKhauMoi.Text = "";
                     txtNhapLaiMatKhauMoi.Focus();
                 }
                 else
                 {
                     DangNhap_ThongTin DN = new DangNhap_ThongTin();
                     DN.TaiKhoan = this.TaiKhoan;
                     DN.MatKhau  = txtMatKhauCu.Text;
                     DataTable Bang = new DataTable();
                     DataRow   Hang;
                     Bang = cls_DangNhap.KiemTraDangNhap(DN);
                     try
                     {
                         Hang       = Bang.Rows[0];
                         DN.MatKhau = txtNhapLaiMatKhauMoi.Text;
                         cls_DangNhap.UpDateMatKhau(DN);
                         MessageBox.Show("Thay đổi mật khẩu thành công.", "Thông báo.", MessageBoxButtons.OK, MessageBoxIcon.None);
                         this.Hide();
                     }
                     catch
                     {
                         MessageBox.Show("Mật khẩu của bạn bị sai, hãy kiểm tra lại!", "Thông báo lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         txtMatKhauCu.Text = "";
                         txtMatKhauCu.Focus();
                     }
                 }
             }
         }
     }
 }
Beispiel #9
0
        public int UpDateMatKhau(DangNhap_ThongTin DN)
        {
            int Nparameter = 2;

            string[] name  = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@TaiKhoan";  value[0] = DN.TaiKhoan;
            name[1] = "@MatKhau";   value[1] = DN.MatKhau;
            return(cls.CapNhat("UpDateMatKhau", name, value, Nparameter));
        }
        private void btInBaoCao_Click(object sender, EventArgs e)
        {
            DangNhap_ThongTin DN = new DangNhap_ThongTin();

            DN.TaiKhoan          = txtTimKiem.Text;
            BaoCao.BaoCao.DuLieu = cls_DangNhap.TimKiemTaiKhoan(DN);
            BaoCao.BaoCao.Kieu   = "TimKiemTaiKhoan";
            BaoCao.BaoCao BC = new BaoCao.BaoCao();
            BC.ShowDialog();
        }
Beispiel #11
0
        //SỬA 1 TÀI KHOẢN - CẤP QUYỀN.
        public int ChinhSuaQuyen(DangNhap_ThongTin DN)
        {
            int Nparameter = 2;

            string[] name  = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@TaiKhoan";  value[0] = DN.TaiKhoan;
            name[1] = "@Quyen";     value[1] = DN.Quyen;
            return(cls.CapNhat("ChinhSuaQuyen", name, value, Nparameter));
        }
Beispiel #12
0
        public DataTable KiemTraDangNhap(DangNhap_ThongTin DN)
        {
            int Nparameter = 2;

            string[] name  = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@TaiKhoan";  value[0] = DN.TaiKhoan;
            name[1] = "@MatKhau";   value[1] = DN.MatKhau;
            return(cls.TimKiem("KiemTraDangNhap", name, value, Nparameter));
        }
        //KHI KÍCH BUTTON THÊM
        private void ThemTaiKhoan()
        {
            ChucNang = "F9";
            DangNhap_ThongTin DangNhap = new DangNhap_ThongTin();

            A.GiaoDien.QuanLyTaiKhoan QLTK = new A.GiaoDien.QuanLyTaiKhoan(ChucNang, DangNhap);
            QLTK.DuLieu = new QuanLyTaiKhoan.DuLieuTruyenVe(LayDuLieu);
            QLTK.ShowDialog(this);
            XacNhanXoa = 0;
            txtTimKiem.Focus();
        }
        private void đổiMậtKhẩuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DangNhap_ThongTin DN = new DangNhap_ThongTin();

            DN.TaiKhoan  = this.TaiKhoan;
            DN.MatKhau   = this.MatKhau;
            DN.Quyen     = this.Quyen;
            DN.TrangThai = this.TrangThai;
            A.GiaoDien.DoiMatKhau DMK = new A.GiaoDien.DoiMatKhau(DN);
            DMK.ShowDialog(this);
        }
        //KHI KÍCH BUTTON SỬA THÔNG TIN
        private void SuaTaiKhoan()
        {
            ChucNang = "F10";
            DangNhap_ThongTin DangNhap = new DangNhap_ThongTin();

            DangNhap.TaiKhoan = tbDanhSachTaiKhoan.Rows[DongChon].Cells[0].Value.ToString();
            DangNhap.Quyen    = tbDanhSachTaiKhoan.Rows[DongChon].Cells[1].Value.ToString();
            A.GiaoDien.QuanLyTaiKhoan QLTK = new A.GiaoDien.QuanLyTaiKhoan(ChucNang, DangNhap);
            QLTK.DuLieu = new QuanLyTaiKhoan.DuLieuTruyenVe(LayDuLieu);
            QLTK.ShowDialog(this);
            XacNhanXoa = 0;
            txtTimKiem.Focus();
        }
 //LẤY DỮ LIỆU GỬI VỀ.
 public void LayDuLieu(DangNhap_ThongTin DN)
 {
     this.TaiKhoan = DN.TaiKhoan;
     if (!this.TaiKhoan.Equals(""))
     {
         try
         {
             tbDanhSachTaiKhoan.DataSource = cls_DangNhap.DanhSachTaiKhoan();
         }
         catch { }
     }
     txtTimKiem.Focus();
 }
        public GiaoDienChinh(DangNhap_ThongTin DN)
        {
            InitializeComponent();
            txtQuyen.Text = DN.Quyen;
            txtTen.Text   = DN.TaiKhoan;

            this.TaiKhoan  = DN.TaiKhoan;
            this.MatKhau   = DN.MatKhau;
            this.Quyen     = DN.Quyen;
            this.TrangThai = DN.TrangThai;

            TrangChu TC = new TrangChu();

            TC.TopLevel = false;
            HienThi.Controls.Clear();
            HienThi.Controls.Add(TC);
            TC.Show();
        }
Beispiel #18
0
 //ĐĂNG NHẬP
 private void DangNhapTaiKhoan()
 {
     if (txtTaiKhoan.Text.Equals(""))
     {
         MessageBox.Show("Bạn hãy nhập tài khoản của mình", "Thông báo.", MessageBoxButtons.OK, MessageBoxIcon.None);
         txtTaiKhoan.Focus();
     }
     else
     {
         if (txtMatKhau.Text.Equals(""))
         {
             MessageBox.Show("Bạn hãy nhập mật khẩu của mình", "Thông báo.", MessageBoxButtons.OK, MessageBoxIcon.None);
             txtMatKhau.Focus();
         }
         else
         {
             DangNhap_ThongTin DN = new DangNhap_ThongTin();
             DN.TaiKhoan = txtTaiKhoan.Text;
             DN.MatKhau  = txtMatKhau.Text;
             DataTable Bang = new DataTable();
             DataRow   Hang;
             Bang = cls_DangNhap.KiemTraDangNhap(DN);
             try
             {
                 Hang         = Bang.Rows[0];
                 Quyen        = Hang["Quyen"].ToString();
                 DN.Quyen     = Quyen;
                 DN.TrangThai = true;
                 cls_DangNhap.UpDateTrangThai(DN);
                 A.GiaoDien.GiaoDienChinh GDC = new A.GiaoDien.GiaoDienChinh(DN);
                 GDC.ShowDialog(this);
                 this.Close();
             }
             catch
             {
                 MessageBox.Show("Tài khoản hoặc mật khẩu của bạn bị sai, hãy kiểm tra lại!", "Thông báo lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 txtMatKhau.Text = "";
                 txtTaiKhoan.Focus();
             }
         }
     }
     txtMatKhau.Focus();
 }
Beispiel #19
0
 public QuanLyTaiKhoan(string ChucNang, DangNhap_ThongTin DN)
 {
     InitializeComponent();
     cbQuyen.DataSource    = cls_DangNhap.DanhSachQuyen();
     cbQuyen.DisplayMember = "Quyen";
     cbQuyen.ValueMember   = "Quyen";
     this.ChucNang         = ChucNang;
     if (this.ChucNang.Equals("F9"))
     {
         txtTaiKhoan.Focus();
         btHoanTat.Enabled = false;
     }
     if (this.ChucNang.Equals("F10"))
     {
         txtTaiKhoan.Text      = DN.TaiKhoan;
         cbQuyen.SelectedValue = DN.Quyen;
         btHoanTat.Enabled     = false;
         txtTaiKhoan.Enabled   = false;
     }
 }
Beispiel #20
0
        //CHỈNH SỬA TÀI KHOẢN.
        private void SuaTaiKhoan()
        {
            DangNhap_ThongTin DN = new DangNhap_ThongTin();

            DN.TaiKhoan = txtTaiKhoan.Text;
            DN.Quyen    = cbQuyen.SelectedValue.ToString();
            try
            {
                cls_DangNhap.ChinhSuaQuyen(DN);
                MessageBox.Show("Bạn đã chỉnh sửa thông tin tài khoản " + DN.TaiKhoan + ".", "Thông báo.", MessageBoxButtons.OK, MessageBoxIcon.None);
            }
            catch
            {
                MessageBox.Show("Không thể chỉnh sửa, hãy kiểm tra lại,", "Thông báo lối!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (DuLieu != null)
            {
                DuLieu(DN);
            }
            this.Hide();
        }
Beispiel #21
0
 public int UpDateMatKhau(DangNhap_ThongTin DN)
 {
     return(cls.UpDateMatKhau(DN));
 }
Beispiel #22
0
 public DataTable KiemTraDangNhap(DangNhap_ThongTin DN)
 {
     return(cls.KiemTraDangNhap(DN));
 }
Beispiel #23
0
 public int UpDateTrangThai(DangNhap_ThongTin DN)
 {
     return(cls.UpDateTrangThai(DN));
 }
Beispiel #24
0
 public int XoaTaiKhoan(DangNhap_ThongTin DN)
 {
     return(cls.XoaTaiKhoan(DN));
 }
Beispiel #25
0
 public DataTable TimKiemTaiKhoan(DangNhap_ThongTin DN)
 {
     return(cls.TimKiemTaiKhoan(DN));
 }
Beispiel #26
0
 public int ChinhSuaQuyen(DangNhap_ThongTin DN)
 {
     return(cls.ChinhSuaQuyen(DN));
 }
Beispiel #27
0
 public int ThemTaiKhoan(DangNhap_ThongTin DN)
 {
     return(cls.ThemTaiKhoan(DN));
 }