public List <FoodCategory> GetListFoodCategories() { string query = "Select *from LOAITHUCAN"; DataTable data = DataProvider.Instance.ExecuteQuery(query); List <FoodCategory> categories = new List <FoodCategory>(); foreach (DataRow i in data.Rows) { FoodCategory category = new FoodCategory(i); categories.Add(category); } return(categories); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cb = sender as ComboBox; if (cb.SelectedItem == null) { return; } FoodCategory category = cb.SelectedItem as FoodCategory; string tenloai = category.Tenloai; int maloai = FoodCategoryDAO.Instance.GetIdByNameFoodCategory(tenloai); txtTypeID.Text = maloai.ToString(); }
private void cbTenDanhMuc_SelectedIndexChanged(object sender, EventArgs e) { int maloai = 0; ComboBox cb = sender as ComboBox; if (cb.SelectedItem == null) { return; } FoodCategory selected = cb.SelectedItem as FoodCategory; maloai = selected.Maloai; LoadFoodListByCategoryID(maloai); }