Ejemplo n.º 1
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
 }