private void hienthiSanPham(List <SANPHAM> lstSP) { pnHienThiSanPham.Controls.Clear(); foreach (SANPHAM item in lstSP) { string path = string.Empty; usSanPham itemsp = new usSanPham(); //itemsp.btnchon.Visible = false; itemsp.pnLine.Visible = false; if (string.IsNullOrEmpty(item.HINHANH)) { path = "../../img/img_sanpham/" + "no-image.jpg"; } else { path = item.HINHANH; } itemsp.setValueSP((int)item.GIABAN, path, item.TENSP); itemsp.setEventForALL(); itemsp.pictureBox1.Tag = item.MASP + "," + (int)item.GIABAN; itemsp.pictureBox1.Click += itemsp_picturebox; pnHienThiSanPham.Controls.Add(itemsp); } }
private void hienthiSanPham(List <QL_SanPham> lstSP) { pnHienThiSanPham.Controls.Clear(); foreach (QL_SanPham item in lstSP) { string path; usSanPham itemsp = new usSanPham(); //itemsp.btnchon.Visible = false; itemsp.pnLine.Visible = false; if (item.Hinh == null || item.Hinh == string.Empty) { path = "../../img/img_sanpham/" + "no-image.jpg"; } else { path = "../../img/img_sanpham/" + item.Hinh; } itemsp.setValueSP((int)item.Gia, path, item.TenSanPham); itemsp.setEventForALL(); itemsp.pictureBox1.Tag = item.MaSP + "," + (int)item.Gia; itemsp.pictureBox1.Click += itemsp_picturebox; pnHienThiSanPham.Controls.Add(itemsp); } }