示例#1
0
        public void GetGeneralComparisonViewModel(GeneralComparisonViewModel model)
        {
            var hotels = Repo <HotelRestaurantRepository>().GetAllModels()
                         .AddEqual(obj => obj.DistrictId == model.AreaGuid, model.AreaGuid)
                         .AddEqual(item => item.StreetId == model.StreetGuid, model.StreetGuid)
                         .AddEqual(hotel => hotel.AddressId == model.AddressGuid, model.AddressGuid);

            var areas = Invoke <UserDictionaryProcess>()
                        .GetDictionaries(UserDictionaryType.Area, 0);

            var repo = Repo <RunningTimeRepository>();

            foreach (var userDictionary in areas)
            {
                var record = new GeneralCompasion()
                {
                    AreaGuid = userDictionary.Id,
                    AreaName = userDictionary.ItemValue
                };
                var areaHotels        = hotels.Where(obj => obj.DistrictId == userDictionary.Id).Select(item => item.Identity).ToList();
                var hotelRunningTimes = repo.GetModels(obj => areaHotels.Contains(obj.ProjectIdentity));
                record.CurrentLinkage = GetLinkage(hotelRunningTimes, model.DueDateTime, model.ReportType);

                var lastdueDateTime = ReportStartDate(model.DueDateTime, model.ReportType);

                record.LinkedLinkage = GetLinkage(hotelRunningTimes, lastdueDateTime, model.ReportType);

                record.LastLinkage = GetLinkage(hotelRunningTimes, model.DueDateTime.AddYears(-1), model.ReportType);

                model.GeneralReports.Add(record);
            }
        }
        private void GetGeneralCompison(GeneralComparisonViewModel model)
        {
            var areaList = new List <SelectListItem>
            {
                new SelectListItem()
                {
                    Text = "全部", Value = ""
                }
            };

            var streetList = new List <SelectListItem>
            {
                new SelectListItem()
                {
                    Text = "全部", Value = ""
                }
            };

            var addressList = new List <SelectListItem>
            {
                new SelectListItem()
                {
                    Text = "全部", Value = ""
                }
            };

            areaList.AddRange(ProcessInvoke <UserDictionaryProcess>()
                              .GetDistrictSelectList()
                              .Select(obj => new SelectListItem()
            {
                Text = obj.Value, Value = obj.Key.ToString()
            })
                              .ToList());

            if (model.AreaGuid != Guid.Empty)
            {
                streetList.AddRange(ProcessInvoke <UserDictionaryProcess>()
                                    .GetChildDistrict(model.AreaGuid)
                                    .Select(obj => new SelectListItem()
                {
                    Text = obj.Value, Value = obj.Key.ToString()
                })
                                    .ToList());

                if (model.StreetGuid != Guid.Empty)
                {
                    addressList.AddRange(ProcessInvoke <UserDictionaryProcess>()
                                         .GetChildDistrict(model.StreetGuid)
                                         .Select(obj => new SelectListItem()
                    {
                        Text = obj.Value, Value = obj.Key.ToString()
                    })
                                         .ToList());
                }
            }

            model.AreaListItems    = areaList;
            model.StreetListItems  = streetList;
            model.AddressListItems = addressList;
        }
 public ActionResult GeneralComparison(GeneralComparisonViewModel model)
 {
     ProcessInvoke <ReportProcess>().GetGeneralComparisonViewModel(model);
     GetGeneralCompison(model);
     return(View(model));
 }