Esempio n. 1
0
        private void FormChonSanPham_Load(object sender, EventArgs e)
        {
            List <SanPhamDTO> sanPhamDTO = new List <SanPhamDTO>();

            sanPhamDTO = SanPhamBUS.SelectSanPhamAll();

            for (int i = 0; i < sanPhamDTO.Count; i++)
            {
                dataGridView_ChoSanPham.Rows.Add(i + 1, sanPhamDTO[i].MaSanPham, sanPhamDTO[i].TenSanPham, LoaiSanPhamBUS.SelectLoaiSanPhamById(sanPhamDTO[i].MaLoaiSanPham).TenLoaiSanPham, false);
            }


            List <LoaiSanPhamDTO> lstcbspDTO = LoaiSanPhamBUS.SelectLoaiSanPhamAll();

            LoaiSanPhamDTO all = new LoaiSanPhamDTO();

            all.MaLoaiSanPham  = "Tất cả";
            all.TenLoaiSanPham = "Tất cả";

            lstcbspDTO.Insert(0, all);

            comboBoxLoaiSanPham.DisplayMember = "TenLoaiSanPham";
            comboBoxLoaiSanPham.ValueMember   = "TenLoaiSanPham";
            comboBoxLoaiSanPham.DataSource    = lstcbspDTO;
            comboBoxLoaiSanPham.SelectedIndex = 0;
        }