コード例 #1
0
        //加载所有的 菜品 大类 小类
        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.FindDishPackages(0);

            _DishesMenusSelected.Clear();

            foreach (var element in list)
            {
                DishBean dishBean = new DishBean();
                dishBean = dishBean.CreateDishBean(element);
                dishBean.InjectBeanPrice();
                //注入大类,小类
                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);
            }
        }
コード例 #2
0
 // 装载 DishBeanUtil
 public void CreateDishBeanUtil(DishBean element)
 {
     if (element.DishPrice != null && element.DishPrice.Count > 0)
     {
         foreach (var elem in element.DishPrice)
         {
             DishBeanUtil Dbu = new DishBeanUtil();
             Dbu.CreateDishBeanUtilByDishBean(elem);
             Dbu.DishName        = element.DishName;
             Dbu.Code            = element.Code;
             Dbu.DishUnitName    = element.DishUnit.Name;
             Dbu.PingYing        = element.PingYing;
             Dbu.AidNumber       = element.PingYing;
             Dbu.DishTypeBigName = element.DishTypeBigName;
             Dbu.DishTypeName    = element.DishTypeName;
             DishesMenusSelected.Add(Dbu);
         }
     }
 }