private void btnMuon_Click(object sender, EventArgs e) { btnMuon.Enabled = false; btnTra.Enabled = true; btnGiaHan.Enabled = true; panel3.Enabled = true; PhieuMuonDAO pm = new PhieuMuonDAO(); string maphieumuon = txtCTMaPhieuMuon.Text; string madg = (cbMaDGMuon.SelectedItem as DocGia).MaDG; DateTime ngaymuon = dateTimeCTMuonMuon.Value; DateTime ngaytra = dateTimeCTTraMuon.Value; string manhanvien = LoginAccount.MaNhanVien; int trangthai = 0; string masach = (cbMaSachMuon.SelectedItem as Book).MaSach; int soluong = (int)numSLMuon.Value; BookDAO book = new BookDAO(); if (book.CheckBookNumberByMaSach(masach) < soluong) { MessageBox.Show("Sách không đủ"); } else { if (pm.InsertPhieuMuon(maphieumuon, madg, ngaymuon, ngaytra, manhanvien, trangthai, masach, soluong)) { MessageBox.Show("Thêm Thành công"); ShowMuon(); } else { MessageBox.Show("Có lỗi khi thêm"); } } }