Пример #1
0
        public List <CategoryDuc> GetListFoodCategory()
        {
            List <CategoryDuc> listCategory = new List <CategoryDuc>();
            string             query        = "select * from FoodCategory";
            DataTable          dt           = dtPro.ExecuteQuery(query);

            foreach (DataRow item in dt.Rows)
            {
                CategoryDuc category = new CategoryDuc(item);
                listCategory.Add(category);
            }
            return(listCategory);
        }
Пример #2
0
        // Sự kiện Load FoodList theo CategoryID sau mỗi lần thay đổi CategoryID
        private void cmbDanhMuc_SelectedIndexChanged(object sender, EventArgs e)
        {
            int      id  = 0;
            ComboBox cmb = sender as ComboBox;

            if (cmb.SelectedItem == null)
            {
                return;
            }
            CategoryDuc selected = cmb.SelectedItem as CategoryDuc;

            id = selected.ID;

            LoadFoodListByCategoryID(id);
        }