コード例 #1
0
        public List <RestItemsListDto> GetSelectedRestItems(GetRestReqForEditInput input)
        {
            List <RestItemsListDto> RestSchItems = new List <RestItemsListDto>();

            try
            {
                var restreq = _RestReqRepository.GetAll().Where(a => a.Id == input.Id).SingleOrDefault();

                var restreqitems = _RestRequestItemRepository.GetAll().Where(a => a.RestRequestsId == input.Id).ToList();

                foreach (var reqitem in restreqitems)
                {
                    if (reqitem.RestNonSchItemId != 0 && reqitem.RestNonSchItemId != null)
                    {
                        var RestNonSchesItem = _RestNonSchItemRepository.GetAll().Where(a => a.Id == reqitem.RestNonSchItemId && a.RestInfoID == restreq.RestInfosID && a.IsDeleted == false).SingleOrDefault();
                        var RestItem         = _RestItemRepository.GetAll().Where(a => a.Id == RestNonSchesItem.RestItemId && a.IsDeleted == false).SingleOrDefault();

                        var RestItemdto = ObjectMapper.Map <RestItemsListDto>(RestItem);
                        RestItemdto.Count             = reqitem.Count;
                        RestItemdto.ItemsCategoryDesc = _ItemsCategoryRepository.GetAll().Where(a => a.Id == RestItem.ItemsCategoryId && a.IsDeleted == false).Select(a => a.CategoryDesc).SingleOrDefault();

                        RestSchItems.Add(RestItemdto);
                    }
                    else if (reqitem.RestScheduleItemsId != 0 && reqitem.RestScheduleItemsId != null)
                    {
                        var RestScheduleItems = _RestScheduleItemRepository.GetAll().Include(a => a.RestSchedules).Where(a => a.Id == reqitem.RestScheduleItemsId && a.RestSchedules.RestInfoID == restreq.RestInfosID && a.IsDeleted == false).SingleOrDefault();
                        var RestItem          = _RestItemRepository.GetAll().Where(a => a.Id == RestScheduleItems.RestItemsId && a.IsDeleted == false).SingleOrDefault();

                        var RestItemdto = ObjectMapper.Map <RestItemsListDto>(RestItem);
                        RestItemdto.Count             = reqitem.Count;
                        RestItemdto.ItemsCategoryDesc = _ItemsCategoryRepository.GetAll().Where(a => a.Id == RestItem.ItemsCategoryId && a.IsDeleted == false).Select(a => a.CategoryDesc).SingleOrDefault();

                        RestSchItems.Add(RestItemdto);
                    }
                }

                return(new List <RestItemsListDto>(RestSchItems));
            }
            catch (Exception e)
            {
            }

            return(new List <RestItemsListDto>(RestSchItems));
        }
コード例 #2
0
        //[AbpAuthorize(AppPermissions.Pages_Tenant_RestaurantReq_EditRestReq)]
        public GetRestReqForEditOutput GetRestReqForEdit(GetRestReqForEditInput input)
        {
            RestSchedule   RestSches    = new RestSchedule();
            RestNonSchItem RestNonSches = new RestNonSchItem();

            var RestReq = _RestReqRepository.Get(input.Id);

            GetRestReqForEditOutput req = ObjectMapper.Map <GetRestReqForEditOutput>(RestReq);

            RestSches = _RestSchRepository.GetAll().Where(a => a.Id == req.RestSchedulesId).SingleOrDefault();

            RestNonSches = _RestNonSchItemRepository.GetAll().Where(a => a.Id == req.RestNonSchItemID).SingleOrDefault();

            var RestInfos = _RestInfoRepository.GetAll().Where(a => a.Id == req.RestInfosID).SingleOrDefault();

            var RestCategoryDesc = _RestCategoryRepository.GetAll().Where(a => a.Id == RestInfos.RestCategoryId).Select(a => a.RestCategoryDesc).SingleOrDefault();

            req.RestaurantInfo = RestInfos.Area + " - " + RestInfos.Building + " - " + " / " + RestCategoryDesc;

            req.Username = _EmployeesViewRepository.GetAll().Where(a => a.emp_id == RestReq.UserId).Select(a => a.emp_username).FirstOrDefault();

            if (RestSches != null)
            {
                req.RestInfosID = RestSches.RestInfoID;

                req.Day = RestSches.Day;

                req.Date = RestSches.CurrentDate.ToString("dd-MM-yyyy");
            }

            req.GetDates = GetDates(req.RestInfosID);

            req.SelectedRestItems = GetRestSchItems(req.RestSchedulesId, "", input.Id);

            return(req);
        }