public void hienDanhSachLoaiHang() { BULLoaiHang bul = new BULLoaiHang(); dgvLoaiHang.DataSource = bul.layLoaiHang(); dgvLoaiHang.Columns[0].HeaderText = "Mã loại hàng"; dgvLoaiHang.Columns[1].HeaderText = "Tên loại hàng"; }
private void btnTimKiemLoaiHangTheoten_Click(object sender, EventArgs e) { BULLoaiHang bul = new BULLoaiHang(); if (txtTenLoaiHang.Text != "") { dgvLoaiHang.DataSource = bul.layLoaiHangTheoTen(txtTenLoaiHang.Text); } else { dgvLoaiHang.DataSource = bul.layLoaiHang(); } }
void hienComboBox() { BULLoaiHang bulLH = new BULLoaiHang(); cbLoaiHang.DataSource = bulLH.layLoaiHang(); cbLoaiHang.DisplayMember = "tenLoaiHang"; cbLoaiHang.ValueMember = "maLoaiHang"; BULNhaCungCap bulNCC = new BULNhaCungCap(); cbNCC.DataSource = bulNCC.layNhaCungCap(); cbNCC.DisplayMember = "tenNhaCungCap"; cbNCC.ValueMember = "maNhaCungCap"; }
private void txtMaLoaiHang_TextChanged(object sender, EventArgs e) { BULLoaiHang bul = new BULLoaiHang(); List <LoaiHang> arr = bul.layLoaiHang(); for (int i = 0; i < arr.Count; i++) { if (arr[i].MaLoaiHang + "" == txtMaLoaiHang.Text) { txtTenLoaiHang.Text = arr[i].TenLoaiHang; break; } else { txtTenLoaiHang.Text = ""; } } }