private void frmPhieuNhapSach_Load(object sender, EventArgs e) { cboNXB.DataSource = NhaXuatBanBUS.DanhSachNXB(); cboNXB.DisplayMember = "TenNXB"; cboNXB.ValueMember = "MaNXB"; dgvDanhSach.AllowUserToAddRows = false; dtkNgayNhap.Value = DateTime.Now; dgvDanhSach.Rows.Clear(); }
private void frmThemSach_Load(object sender, EventArgs e) { cboTheLoai.DataSource = TheLoaiBUS.DanhSachTheLoai(); cboTheLoai.DisplayMember = "TenTL"; cboTheLoai.ValueMember = "MaTL"; cboTacGia.DataSource = TacGiaBUS.DanhSachTacGia(); cboTacGia.DisplayMember = "TenTG"; cboTacGia.ValueMember = "MaTG"; cboNXB.DataSource = NhaXuatBanBUS.DanhSachNXB(); cboNXB.DisplayMember = "TenNXB"; cboNXB.ValueMember = "MaNXB"; txtMaSach.Text = SachBUS.GetIDSach(); }
public frmSuaSach(SachDTO S) { InitializeComponent(); cboTheLoai.DataSource = TheLoaiBUS.DanhSachTheLoai(); cboTheLoai.DisplayMember = "TenTL"; cboTheLoai.ValueMember = "MaTL"; cboTacGia.DataSource = TacGiaBUS.DanhSachTacGia(); cboTacGia.DisplayMember = "TenTG"; cboTacGia.ValueMember = "MaTG"; cboNXB.DataSource = NhaXuatBanBUS.DanhSachNXB(); cboNXB.DisplayMember = "TenNXB"; cboNXB.ValueMember = "MaNXB"; txtMaSach.Text = S.MaSach; txtTenSach.Text = S.TenSach; cboTheLoai.SelectedValue = S.MaTL; cboTacGia.SelectedValue = S.MaTG; cboNXB.SelectedValue = S.MaNXB; }
void Custom() { dgvDanhSach.AutoGenerateColumns = false; dgvDanhSach.Columns.Clear(); dgvDanhSach.AllowUserToAddRows = false; DataGridViewTextBoxColumn dgvCol = new DataGridViewTextBoxColumn(); dgvCol.HeaderText = "Mã sách"; dgvCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dgvCol.DataPropertyName = "MaSach"; dgvCol.ReadOnly = true; dgvDanhSach.Columns.Add(dgvCol); dgvCol = new DataGridViewTextBoxColumn(); dgvCol.HeaderText = "Tên sách"; dgvCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; dgvCol.DataPropertyName = "TenSach"; dgvCol.ReadOnly = true; dgvCol.Width = 400; dgvDanhSach.Columns.Add(dgvCol); DataGridViewComboBoxColumn dgvCo = new DataGridViewComboBoxColumn(); dgvCo.HeaderText = "Thể loại"; dgvCo.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dgvCo.DataSource = TheLoaiBUS.DanhSachTheLoai(); dgvCo.DisplayMember = "TenTL"; dgvCo.ValueMember = "MaTL"; dgvCo.DataPropertyName = "MaTL"; dgvCo.ReadOnly = true; dgvCo.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing; dgvDanhSach.Columns.Add(dgvCo); dgvCo = new DataGridViewComboBoxColumn(); dgvCo.HeaderText = "Nhà xuất bản"; dgvCo.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dgvCo.DataSource = NhaXuatBanBUS.DanhSachNXB(); dgvCo.DisplayMember = "TenNXB"; dgvCo.ValueMember = "MaNXB"; dgvCo.DataPropertyName = "MaNXB"; dgvCo.ReadOnly = true; dgvCo.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing; dgvDanhSach.Columns.Add(dgvCo); dgvCo = new DataGridViewComboBoxColumn(); dgvCo.HeaderText = "Tác giả"; dgvCo.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dgvCo.DataSource = TacGiaBUS.DanhSachTacGia(); dgvCo.DisplayMember = "TenTG"; dgvCo.ValueMember = "MaTG"; dgvCo.DataPropertyName = "MaTG"; dgvCo.ReadOnly = true; dgvCo.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing; dgvDanhSach.Columns.Add(dgvCo); dgvCol = new DataGridViewTextBoxColumn(); dgvCol.HeaderText = "Số lượng tồn"; dgvCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; dgvCol.DataPropertyName = "SoLuongTon"; dgvCol.ReadOnly = true; dgvCol.Width = 110; dgvDanhSach.Columns.Add(dgvCol); dgvCol = new DataGridViewTextBoxColumn(); dgvCol.HeaderText = "Giá bán (VNĐ)"; dgvCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dgvCol.DataPropertyName = "GiaBan"; dgvCol.ReadOnly = true; dgvCol.DefaultCellStyle.Format = "0,00"; dgvDanhSach.Columns.Add(dgvCol); }
void LoadData() { dgvDanhSach.DataSource = NhaXuatBanBUS.DanhSachNXB(); Custom(); dgvDanhSach.ClearSelection(); }
private void frmTimKiemTheoNXB_Load(object sender, EventArgs e) { cboNXB.DataSource = NhaXuatBanBUS.DanhSachNXB(); cboNXB.DisplayMember = "TenNXB"; cboNXB.ValueMember = "MaNXB"; }