private void btnDatThe_Click(object sender, EventArgs e) { Class.XuLyThuVien KiemTra = new Class.XuLyThuVien(); if (KiemTra.DemSachTemp() < 1) { if (MetroFramework.MetroMessageBox.Show(this, "Chắc Chắn Hay Không", "Thoát", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.Close(); } } else { if (MetroFramework.MetroMessageBox.Show(this, "Chắc Chắn Hay Không", "Bạn Muốn Đặt Sách ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int SoLuongSach = KiemTra.DemSachTemp(); int STT; string MaSach; KiemTra.XoaPhieuMuonSach(MaVe_FormMain); KiemTra.PhieuMuonSach(lblNgayMuon.Text, MaVe_FormMain); for (int i = 0; i < SoLuongSach; i++) { STT = Convert.ToInt32(GridViewSachMuon.Rows[i].Cells[0].Value.ToString()); MaSach = KiemTra.LayMaSach_TempView(STT); KiemTra.ChiTietMuonSach(MaSach, STT, MaVe_FormMain); } //clear DGV_Temp KiemTra.DeleteAll_DgvTemp(); MetroFramework.MetroMessageBox.Show(this, string.Format("Đặt Thành Công Cho Độc Giả : {0}", lblTenDocGia.Text), "Thông Báo"); this.Close(); } } }
private void GridViewSachMuon_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) { Class.XuLyThuVien KiemTra = new Class.XuLyThuVien(); if (KiemTra.DemSachTemp() < 1) { btnDatThe.Visible = true; btnDatThe2.Visible = false; lblDat_Close.Visible = true; lblDatthe2.Visible = false; } else { btnDatThe.Visible = false; btnDatThe2.Visible = true; lblDat_Close.Visible = false; lblDatthe2.Visible = true; } }