private bool kiemTraMaLoaiTonTai(string str) { foreach (LoaiHang item in bulLoaiHang.layTatCaLoaiHang()) { if (item.MaLoai == str) { return(true); } } return(false); }
private LoaiHang kiemTraTonTai(string str) { foreach (LoaiHang item in bulLoaiHang.layTatCaLoaiHang()) { if (item.MaLoai == str) { return(item); } } return(null); }
private void btnTimLoaiHang_Click(object sender, EventArgs e) { LoaiHang loaiHang = new LoaiHang(); loaiHang.MaLoai = txtLoaiHang.Text; BULLoaiHang bulLoaiHang = new BULLoaiHang(); if (txtLoaiHang.Text == "") { dgvLoaiHang.DataSource = bulLoaiHang.layTatCaLoaiHang(); } else { dgvLoaiHang.DataSource = bulLoaiHang.tim(loaiHang); } }
private void loadDuLieu() { BULLoaiHang bulLoaiHang = new BULLoaiHang(); dgvLoaiHang.DataSource = bulLoaiHang.layTatCaLoaiHang(); dgvLoaiHang.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvLoaiHang.Columns[0].HeaderText = "Mã loại"; dgvLoaiHang.Columns[1].HeaderText = "Tên loại"; dgvLoaiHang.Columns[2].HeaderText = "Ghi chú"; BULHang bulHang = new BULHang(); dgvHang.DataSource = bulHang.layTatCaHang(); dgvHang.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvHang.Columns[0].HeaderText = "Mã hàng"; dgvHang.Columns[1].HeaderText = "Tên hàng"; dgvHang.Columns[2].HeaderText = "Đơn vị tính"; dgvHang.Columns[3].HeaderText = "Đơn giá"; dgvHang.Columns[4].HeaderText = "Mã loại"; dgvHang.Columns[5].HeaderText = "Số lượng có"; dgvHang.Columns[6].HeaderText = "Mã nhà cung cấp"; }