private void btnLuu_Click(object sender, EventArgs e)
 {
     // Mở kết nối
     // Thêm dữ liệu
     if (them)
     {
         try
         {
             // Thực hiện lệnh
             BLInfomation bl = new BLInfomation();
             bl.ThemDocGia(this.txtMaThe.Text.Trim(), this.txtHoTen.Text.Trim(), this.dtpNgaySinh.Value, this.dtpNgayCap.Value, this.dtpHanDung.Value,
                           this.txtDiaChi.Text.Trim());
             // Load lại dữ liệu trên DataGridView
             LoadData();
             // Thông báo
             MessageBox.Show("Đã thêm xong!");
         }
         catch
         {
             MessageBox.Show("Không thêm được. Lỗi rồi!");
         }
     }
     else
     {
         // Thực hiện lệnh
         BLInfomation bl = new BLInfomation();
         bl.CapNhatDocGia(this.txtMaThe.Text.Trim(), this.txtHoTen.Text.Trim(), this.dtpNgaySinh.Value, this.dtpNgayCap.Value, this.dtpHanDung.Value,
                          this.txtDiaChi.Text.Trim());
         // Load lại dữ liệu trên DataGridView
         LoadData();
         // Thông báo
         MessageBox.Show("Đã sửa xong!");
     }
     // Đóng kết nối
 }
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (txtTen.Text != "" && txtMK.Text != "")
     {
         try
         {
             // Thực hiện lệnh
             BLInfomation bl = new BLInfomation();
             bl.ThemTaiKhoan(this.txtTen.Text.Trim(), this.txtMK.Text.Trim());
             // Load lại dữ liệu trên DataGridView
             LoadData();
             // Thông báo
             MessageBox.Show("Đã tạo tài khoản!");
             txtTen.ResetText();
             txtMK.ResetText();
             LoadData();
         }
         catch
         {
             MessageBox.Show("Tài khoản đã tồn tại!");
         }
     }
     else
     {
         MessageBox.Show("Vui lòng nhập đầy đủ thông tin!");
     }
 }
Exemple #3
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     // Mở kết nối
     // Thêm dữ liệu
     if (them)
     {
         try
         {
             // Thực hiện lệnh
             BLInfomation bl = new BLInfomation();
             bl.ThemNhanVien(this.txtMaNV.Text.Trim(), this.txtHoTen.Text.Trim(), this.rbNu.Checked, this.txtDiaChi.Text.Trim(),
                             this.txtSoDT.Text.Trim(), this.dtpNgayNhanViec.Value, int.Parse(this.txtLuong.Text));
             // Load lại dữ liệu trên DataGridView
             LoadData();
             // Thông báo
             MessageBox.Show("Đã thêm xong!");
         }
         catch
         {
             MessageBox.Show("Không thêm được. Lỗi rồi!");
         }
     }
     else
     {
         // Thực hiện lệnh
         BLInfomation bl = new BLInfomation();
         bl.CapNhatNhanVien(this.txtMaNV.Text.Trim(), this.txtHoTen.Text.Trim(), this.rbNu.Checked, this.txtDiaChi.Text.Trim(),
                            this.txtSoDT.Text.Trim(), this.dtpNgayNhanViec.Value, int.Parse(this.txtLuong.Text));
         // Load lại dữ liệu trên DataGridView
         LoadData();
         // Thông báo
         MessageBox.Show("Đã sửa xong!");
     }
     // Đóng kết nối
 }
 private void btnLuu_Click(object sender, EventArgs e)
 {
     // Mở kết nối
     // Thêm dữ liệu
     if (them)
     {
         try
         {
             // Thực hiện lệnh
             BLInfomation bl = new BLInfomation();
             bl.ThemDauSach(this.txtMaSach.Text.Trim(), this.txtTua.Text.Trim(), this.cmbMaNXB.Text.Trim());
             // Load lại dữ liệu trên DataGridView
             LoadData();
             // Thông báo
             MessageBox.Show("Đã thêm xong!");
         }
         catch
         {
             MessageBox.Show("Không thêm được. Lỗi rồi!");
         }
     }
     else
     {
         // Thực hiện lệnh
         BLInfomation bl = new BLInfomation();
         bl.CapNhatDauSach(this.txtMaSach.Text.Trim(), this.txtTua.Text.Trim(), this.cmbMaNXB.Text.Trim());
         // Load lại dữ liệu trên DataGridView
         LoadData();
         // Thông báo
         MessageBox.Show("Đã sửa xong!");
     }
     // Đóng kết nối
 }
Exemple #5
0
 private void btnAgree_Click(object sender, EventArgs e)
 {
     if (txtOld.Text != "" && txtNew.Text != "")
     {
         BLInfomation bl = new BLInfomation();
         if (bl.SearchTK(cLogin.ID.Trim(), this.txtOld.Text.Trim()))
         {
             try
             {
                 // Thực hiện lệnh
                 bl.CapNhatTaiKhoan(cLogin.ID.Trim(), this.txtNew.Text.Trim());
                 // Load lại dữ liệu trên DataGridView
                 LoadData();
                 // Thông báo
                 MessageBox.Show("Đã đổi mật khẩu!");
                 this.Close();
                 LoadData();
             }
             catch
             {
                 MessageBox.Show("Không đổi được mật khẩu");
             }
         }
         else
         {
             MessageBox.Show("Mật khẩu hiện tại sai!");
         }
     }
     else
     {
         MessageBox.Show("Vui lòng nhập đầy đủ thông tin!");
     }
 }
Exemple #6
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     // Mở kết nối
     // Thêm dữ liệu
     if (them)
     {
         try
         {
             // Thực hiện lệnh
             BLInfomation bl = new BLInfomation();
             bl.ThemMuonTra(this.cmbMaThe.Text.Trim(), this.cmbMaCuon.Text.Trim(), this.cmbMaNV.Text.Trim(), this.dtpNgayMuon.Value,
                            this.dtpNgayTra.Value);
             // Load lại dữ liệu trên DataGridView
             LoadData();
             // Thông báo
             MessageBox.Show("Đã thêm xong!");
         }
         catch
         {
             MessageBox.Show("Không thêm được. Lỗi rồi!");
         }
     }
     else
     {
         // Thực hiện lệnh
         BLInfomation bl = new BLInfomation();
         bl.CapNhatMuonTra(this.cmbMaThe.Text.Trim(), this.cmbMaCuon.Text.Trim(), this.cmbMaNV.Text.Trim(), this.dtpNgayMuon.Value,
                           this.dtpNgayTra.Value);
         // Load lại dữ liệu trên DataGridView
         LoadData();
         // Thông báo
         MessageBox.Show("Đã sửa xong!");
     }
     // Đóng kết nối
 }
Exemple #7
0
        private void msiDelete(object sender, EventArgs e)
        {
            // Khai báo biến traloi
            DialogResult traloi;

            // Hiện hộp thoại hỏi đáp
            traloi = MessageBox.Show("Bạn có muốn xóa tài khoản không?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            // Kiểm tra có nhắp chọn nút Ok không?
            if (traloi == DialogResult.OK)
            {
                BLInfomation bl = new BLInfomation();
                bl.XoaTaiKhoan(cLogin.ID);
                msiLogout(sender, e);
            }
        }
 private void btnAccess_Click(object sender, EventArgs e)
 {
     if (txtTen.Text != "" && txtMK.Text != "")
     {
         BLInfomation bl = new BLInfomation();
         bl.DangNhap(txtTen.Text.Trim(), txtMK.Text.Trim());
         if (cLogin.isLogin == true)
         {
             this.Close();
             cLogin.ID = txtTen.Text.Trim();
         }
         if (cLogin.isLogin == false)
         {
             MessageBox.Show("Tên tài khoản hoặc mật khẩu không đúng");
         }
     }
     else
     {
         MessageBox.Show("Vui lòng nhập đầy đủ tên tài khoản và mật khẩu!");
     }
 }