private void dgvPhieuMuon_CellContentClick(object sender, DataGridViewCellEventArgs e) { for (int i = 0; i < dgvPhieuMuon.Rows.Count; i++) { for (int j = 0; j < dgvPhieuMuon.Columns.Count; j++) { if (dgvPhieuMuon.Rows[i].Cells[j].Selected == true) { string strSoPhieu = dgvPhieuMuon.Rows[i].Cells[0].Value.ToString(); string strMaThe = dgvPhieuMuon.Rows[i].Cells[1].Value.ToString(); string strMaDocGia = BUS_OBJ.layMaTheTheoMaDocGia(strMaThe); string strTenDocGia = BUS_OBJ.layTenDocGia(strMaDocGia); string strMaSach = dgvPhieuMuon.Rows[i].Cells[2].Value.ToString(); string strTenSach = BUS_OBJ.layTenSach(strMaSach); string strNgayMuon = dgvPhieuMuon.Rows[i].Cells[3].Value.ToString(); string strNgayTra = dgvPhieuMuon.Rows[i].Cells[4].Value.ToString(); string strTinhTrang = dgvPhieuMuon.Rows[i].Cells[5].Value.ToString(); string strGhiChu = dgvPhieuMuon.Rows[i].Cells[6].Value.ToString(); string strCaption = "Số phiếu: " + strSoPhieu + "\n" + "Mã thẻ: " + strMaThe + "\n" + "Tên độc giả: " + strTenDocGia + "\n" + "Mã sách: " + strMaSach + "\n" + "Tên sách: " + strTenSach + "\n" + "Ngày mượn: " + strNgayMuon + "\n" + "Ngày trả: " + strNgayTra + "\n" + "Tình trạng: " + strTinhTrang + "\n" + "Ghi chú: " + strGhiChu + "\n"; dgvPhieuMuon.Rows[i].Cells[j].ToolTipText = strCaption; dgvPhieuMuon.ShowCellToolTips = true; } } } }
private void cboLuaChonTra_SelectedValueChanged(object sender, EventArgs e) { if (cboLuaChonTra.SelectedValue == null) { return; } if (this.user.LoaiTaiKhoan == 1) { dt = BUS_OBJ.loadTTPhieuMuonTheoMaTheVaMaSach(txtMaThe.Text, cboLuaChonTra.SelectedValue.ToString()); } else { dt = BUS_OBJ.loadTTPhieuMuonTheoMaTheVaMaSach(user.TenDangNhap, cboLuaChonTra.SelectedValue.ToString()); } if (dt.Rows.Count != 0) { lbSoPhieu.Text = dt.Rows[0].Field <Int32>(0).ToString(); lbMaThe.Text = dt.Rows[0].Field <string>(1).ToString(); lbMaSach.Text = dt.Rows[0].Field <string>(2).ToString(); try { string chuoiNgayMuon = dt.Rows[0].Field <DateTime>(3).ToString(); DateTime ngayMuon = new DateTime(); DateTime.TryParse(chuoiNgayMuon, out ngayMuon); dtpNgayMuon.Value = ngayMuon; } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, ex.Message); } try { string chuoiNgayTra = dt.Rows[0].Field <DateTime>(4).ToString(); DateTime ngayTra = new DateTime(); DateTime.TryParse(chuoiNgayTra, out ngayTra); dtpNgayTra.Value = ngayTra; } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, ex.Message); } cboTinhTrang.SelectedItem = dt.Rows[0].Field <string>(5).ToString(); rtbGhiChu.Text = dt.Rows[0].Field <string>(6).ToString(); try { tltTenSach.SetToolTip(lbMaSach, BUS_OBJ.layTenSach(lbMaSach.Text)); tltTenChuThe.SetToolTip(lbMaThe, BUS_OBJ.layTenDocGia(lbMaThe.Text)); } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, ex.Message); } } }
private void dgvPhieuMuon_CellContentClick(object sender, DataGridViewCellEventArgs e) { for (int i = 0; i < dgvPhieuMuon.Rows.Count; i++) { for (int j = 0; j < dgvPhieuMuon.Columns.Count; j++) { if (dgvPhieuMuon.Rows[i].Cells[j].Selected == true) { lbSoPhieu.Text = dgvPhieuMuon.Rows[i].Cells[0].Value.ToString(); lbMaThe.Text = dgvPhieuMuon.Rows[i].Cells[1].Value.ToString(); lbMaSach.Text = dgvPhieuMuon.Rows[i].Cells[2].Value.ToString(); try { string chuoiNgayMuon = dgvPhieuMuon.Rows[i].Cells[3].Value.ToString(); DateTime ngayMuon = new DateTime(); DateTime.TryParse(chuoiNgayMuon, out ngayMuon); dtpNgayMuon.Value = ngayMuon; } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, ex.Message); } try { string chuoiNgayTra = dgvPhieuMuon.Rows[i].Cells[4].Value.ToString(); DateTime ngayTra = new DateTime(); DateTime.TryParse(chuoiNgayTra, out ngayTra); dtpNgayTra.Value = ngayTra; } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, ex.Message); } cboTinhTrang.SelectedItem = dgvPhieuMuon.Rows[i].Cells[5].Value.ToString(); rtbGhiChu.Text = dgvPhieuMuon.Rows[i].Cells[6].Value.ToString(); } } } try { tltTenSach.SetToolTip(lbMaSach, BUS_OBJ.layTenSach(lbMaSach.Text)); tltTenChuThe.SetToolTip(lbMaThe, BUS_OBJ.layTenDocGia(lbMaThe.Text)); } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, ex.Message); } }