//加载所有的 菜品 大类 小类 public void LoadDishObject() { //加载所有小类 DishTypeSmail = new ObservableCollection <DishType>(); List <DishType> listsmail = _DataService.FindDishTypeByType(-1); DishTypeSmail.Clear(); foreach (var element in listsmail) { DishTypeSmail.Add(element); } //加载所有的菜品 List <Dish> list = _DataService.FindDishs(0); CreateDishesMenusSelected(list); }
//选择小类显示菜品 public void SelectedItemSecondCategory(int dishTypeId) { //更新菜品 List <Dish> list = _DataService.FindDishs(dishTypeId); _Dishes.Clear(); foreach (var element in list) { DishBean dishBean = new DishBean().CreateDishBean(element); //注入大类,小类 ZhuRuDishTypeName(element, dishBean); CreateDishBeanUtil(dishBean); } }
//加载所有的 菜品 大类 小类 public void LoadDishObject() { //加载所有小类 _DishTypeSmail = new ObservableCollection <DishType>(); List <DishType> listsmail = _IChooseDishesDataService.FindDishTypeByType(-1); _DishTypeSmail.Clear(); foreach (var element in listsmail) { _DishTypeSmail.Add(element); } //加载所有的菜品 List <Dish> list = _IChooseDishesDataService.FindDishs(0); _DishesMenusSelected.Clear(); foreach (var element in list) { DishBean dishBean = new DishBean().CreateDishBean(element); //注入大类,小类 for (int i = 0; i < _DishTypeSmail.Count; i++) { if (element.DishTypeId == _DishTypeSmail[i].DishTypeId) { dishBean.DishTypeName = _DishTypeSmail[i].Name; bool flag = false; for (int j = 0; j < _DishTypeBig.Count; j++) { if (_DishTypeSmail[i].ParentId == _DishTypeBig[j].DishTypeId) { dishBean.DishTypeBigName = _DishTypeBig[j].Name; flag = true; break; } } if (flag) { break; } } } DishesMenusSelected.Add(dishBean); } }
public void LoadDishBase(object DishId) { int DishIdRault = DishId == null?0:(int)(DishId); List <Dish> list = _DataService.FindDishs(DishIdRault); DishesList.Clear(); for (int i = 0; i < list.Count; i++) { var dishB = (new DishBean()).CreateDishBean(list[i]); dishB.InjectBeanPrice(); TreeNode ttd = GetDishTypeBigName(list[i].DishType.ParentId, Root); if (ttd != null) { dishB.DishTypeName = list[i].DishType.Name; dishB.DishTypeBigName = ttd.Name; } dishB.DishUnitName = list[i].DishUnit.Name; DishesList.Add(dishB); } }