Пример #1
0
 private void txtTimKiemSP_TextChanged(object sender, TextChangedEventArgs e)
 {
     lsDanhSachSanPham.Items.Clear();
     lsSanPham = sp_BUS.DanhSachSanPhamTheoTen(txtTimKiemSP.Text);
     foreach (var item in lsSanPham)
     {
         lsDanhSachSanPham.Items.Add(item);
     }
 }
Пример #2
0
        private void LoadDSTheoTen()// load theo tên chỉ cho phầm tìm kiếm sản phẩm
        {
            _sp_BUS                = new clsSanPham_BUS();
            _lsSanPham             = _sp_BUS.DanhSachSanPhamTheoTen(txtTimTenSP.Text);
            colTenSP.DisplayMember = "TenSP";
            colTenSP.ValueMember   = "MaSP";

            for (int i = 0; i < _lsSanPham.Count; i++)
            {
                ListViewItem lvi = new ListViewItem(_lsSanPham[i].TenSP);
                lvi.SubItems.Add(_lsSanPham[i].MaSP);
                if (File.Exists(_lsSanPham[i].HinhAnh))
                {
                    byte[]       byteHA = File.ReadAllBytes(_lsSanPham[i].HinhAnh);
                    MemoryStream ms     = new MemoryStream(byteHA);
                    Image        img    = Image.FromStream(ms);
                    imlSanPham.Images.Add(img);
                    //Thêm hình ảnh vào item
                    lvi.ImageIndex = imlSanPham.Images.Count - 1;
                }
                lvwSanPham.Items.Add(lvi);
            }
        }
Пример #3
0
 private void txtTimKiem_TextChanged(object sender, EventArgs e)
 {
     lsSanPham = sp_BUS.DanhSachSanPhamTheoTen(txtTimKiem.Text);
     dgvSanPhamTonKho.DataSource = lsSanPham;
 }