Ejemplo n.º 1
0
        private void comboBoxLoaiSanPham_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (this.initData == false)
                {
                    return;
                }

                cbbSize.DataSource     = null;
                cbbLoaiBia.DataSource  = null;
                cbbLoaiGiay.DataSource = null;

                setSetForm();

                if (cbbLoaiSanPham.SelectedIndex >= 0)
                {
                    int       idSanPhamCha = (int)cbbLoaiSanPham.SelectedValue;
                    DataTable dt           = SanPhamDao.getListChiTiet(idSanPhamCha);

                    List <String> listSize     = new List <string>();
                    List <String> listLoaiBia  = new List <string>();
                    List <String> listLoaiGiay = new List <string>();
                    foreach (DataRow row in dt.Rows)
                    {
                        String size = row["SIZE"].ToString().Trim();
                        if (!listSize.Contains(size))
                        {
                            listSize.Add(size);
                        }
                        String loaiBia = row["LOAI_BIA"].ToString().Trim();
                        if (!listLoaiBia.Contains(loaiBia))
                        {
                            listLoaiBia.Add(loaiBia);
                        }
                        String loaiGiay = row["LOAI_GIAY"].ToString().Trim();
                        if (!listLoaiGiay.Contains(loaiGiay))
                        {
                            listLoaiGiay.Add(loaiGiay);
                        }
                    }
                    //FILL combobox
                    cbbSize.DataSource     = listSize;
                    cbbLoaiBia.DataSource  = listLoaiBia;
                    cbbLoaiGiay.DataSource = listLoaiGiay;
                }
            }
            catch (Exception) {}
        }
Ejemplo n.º 2
0
        private void reloadData()
        {
            int idSanPhamCha = 0;

            if (cbbLoaiSanPham.SelectedIndex >= 0)
            {
                int.TryParse(cbbLoaiSanPham.SelectedValue.ToString(), out idSanPhamCha);
            }

            if (idSanPhamCha != 0)
            {
                this.dataGridViewSanPham.DataSource = SanPhamDao.getListChiTiet(idSanPhamCha);
            }
            else
            {
                this.dataGridViewSanPham.DataSource = SanPhamDao.getListChiTiet();
            }
        }
Ejemplo n.º 3
0
 private void loadDataGridview(int idSanPhamCha)
 {
     this.dataGridViewSanPham.DataSource = SanPhamDao.getListChiTiet(idSanPhamCha);
 }