/// <summary> /// 获取餐厅菜品类别 /// </summary> /// <param name="restaurantId"></param> /// <returns></returns> public JsonResult GetCategorys(int restaurantId) { var res = new Response() { Data = null, Successed = false }; if (ModelState.IsValid) { try { var categorys = _categoryRepository.GetAllCategoryList(); categorys = _restaurantCategoryRepository.FilterRestaurantCategorys(categorys, restaurantId); res.Data = categorys; res.Successed = true; } catch (Exception e) { res.Message = e.Message; } } else { res.Message = string.Join(",", ModelState.SelectMany(ms => ms.Value.Errors).Select(e => e.ErrorMessage)); } return(Json(res, JsonRequestBehavior.AllowGet)); }
public ActionResult InitFormInfo(List <int> orderTableId) { var itemAndDetails = _projectRepository.GetProjectAndDetailList(0, true); //菜品明细 var categories = _categoryRepository.GetAllCategoryList(); //菜品分类 var orderAndTables = _orderRepository.GetOrderAndTablesByOrderTableId(orderTableId[0]); //var projectExtendSplitList = _projectRepository.GetProjectExtendSplitList(); var projectExtendSplitList = _projectRepository.GetProjectExtendSplitListNew(); var projects = _projectRepository.GetDetailList(0, false); List <OrderDetailDTO> orderTableProjects = new List <OrderDetailDTO>(); if (orderTableId.Count == 1) // { orderTableProjects = _orderRepository.GetOrderTableProjects(orderTableId[0]); //已点菜品 } else if (orderTableId.Count > 1) { var Tables = _orderRepository.GetTablesByOrderTableIds(orderTableId); orderAndTables.TableName = Tables.Count > 1 ? string.Join(",", Tables.Select(p => p.Name)) : orderAndTables.TableName; orderTableProjects = _orderRepository.GetOrderTableProjects(orderTableId[0]);//已点菜品 } itemAndDetails = _restaurantCategoryRepository.FilterRestaurantCategorys(itemAndDetails, orderAndTables.R_Restaurant_Id); categories = _restaurantCategoryRepository.FilterRestaurantCategorys(categories, orderAndTables.R_Restaurant_Id); var currentUser = OperatorProvider.Provider.GetCurrent(); var permissions = new Dictionary <string, bool>(); permissions.Add("IsGive", (currentUser.Permission & (int)Permission.赠菜) == 0?false:true); permissions.Add("IsReturn", (currentUser.Permission & (int)Permission.退菜) == 0 ? false : true); var orderDetailCauses = _orderDetailCauseRepository.GetAllList(); var customConfigs = _customConfigRepository.GetList(new CustomConfigDTO() { PageModule = (int)PageModule.点餐界面PC端 }); var customConfigsFlat = _customConfigRepository.GetList(new CustomConfigDTO() { PageModule = (int)PageModule.点餐界面平板端 }); var info = new { OrderAndTables = orderAndTables, ProjectAndDetails = itemAndDetails, CategoryList = categories, OrderTableProjects = orderTableProjects, ProjectExtendSplitList = projectExtendSplitList, Projects = projects, PrintModel = _printerRepository.GetPrintModel(), UserPermission = permissions, GiveCauses = orderDetailCauses.Where(p => p.CauseType == CauseType.赠菜).ToList(), ReturnCauses = orderDetailCauses.Where(p => p.CauseType == CauseType.退菜).ToList(), OrderDetailTest = _projectRepository.GetOrderDetailIsTeset(), CustomConfigs = customConfigs, CustomConfigsFlat = customConfigsFlat, AutoListPrint = _orderRepository.GetAutoListPrint(), DefaultPromptly = _orderRepository.GetDefaultPromptly() }; return(Json(info)); }
/// <summary> /// 获取所有餐饮项目分类和餐饮项目类别 /// </summary> /// <param name="restaurantId"></param> /// <returns></returns> public ActionResult GetAllCategoryProject(int restaurantId) { var res = new Response() { Data = null, Successed = false }; if (ModelState.IsValid) { try { var categorys = _categoryRepository.GetAllCategoryList(); var projects = _projectRepository.GetProjectAndDetailList(0, true); var projectExtendSplitList = _projectRepository.GetProjectExtendSplitListNew(); projects = _restaurantCategoryRepository.FilterRestaurantCategorys(projects, restaurantId); categorys = _restaurantCategoryRepository.FilterRestaurantCategorys(categorys, restaurantId); var info = new { CategoryList = categorys, ProjectAndDetails = projects, ProjectExtendSplitList = projectExtendSplitList }; res.Data = info; res.Successed = true; } catch (Exception e) { res.Message = e.Message; } } else { res.Message = string.Join(",", ModelState.SelectMany(ms => ms.Value.Errors).Select(e => e.ErrorMessage)); } return(new ContentResult { Content = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue }.Serialize(res), ContentType = "application/json" }); //return Json(res, JsonRequestBehavior.AllowGet); }