private void txtMaHang_TextChanged(object sender, EventArgs e) { BULHang bul = new BULHang(); List <Hang> arr = bul.layHang(); for (int i = 0; i < arr.Count; i++) { if (arr[i].MaHang + "" == txtMaHang.Text) { txtDonGia.Text = arr[i].DonGia + ""; txtDonViTinh.Text = arr[i].DonViTinh; txtSoLuongCon.Text = arr[i].SoLuongCon + ""; txtTenHang.Text = arr[i].TenHang; cbLoaiHang.SelectedValue = arr[i].MaLoaiHang; cbNCC.SelectedValue = arr[i].MaNhaCungCap; break; } else { txtDonGia.Text = ""; txtDonViTinh.Text = ""; txtSoLuongCon.Text = ""; txtTenHang.Text = ""; } } }
public void hienDanhSachHang() { BULHang bul = new BULHang(); dgvHang.DataSource = bul.layHang(); 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 = "Số lượng còn"; dgvHang.Columns[5].HeaderText = "Mã loại hàng"; dgvHang.Columns[6].HeaderText = "Mã NCC"; }
private void btnTimHangTheoten_Click(object sender, EventArgs e) { BULHang bul = new BULHang(); if (txtTenHang.Text != "") { dgvHang.DataSource = bul.layHangTheoTen(txtTenHang.Text); } else { dgvHang.DataSource = bul.layHang(); } }
private void txtMaHang_TextChanged(object sender, EventArgs e) { BULHang bul = new BULHang(); List <Hang> arr = bul.layHang(); for (int i = 0; i < arr.Count; i++) { if (arr[i].MaHang + "" == txtMaHang.Text) { txtDonGia.Text = arr[i].DonGia + ""; txtTenHang.Text = arr[i].TenHang; break; } else { txtDonGia.Text = ""; txtTenHang.Text = ""; } } }