コード例 #1
0
        private static List <LinkVm> GetBreadcrumbs(CommunityDetailsVm communityDetails)
        {
            List <LinkVm> breadcrumbs = GetBreadcrumbs((SearchVm)communityDetails);

            breadcrumbs.Add(new LinkVm(communityDetails.Community.Name, MslcUrlBuilder.DetailsUrl(communityDetails.Community, communityDetails.Criteria.SearchType())));
            return(breadcrumbs);
        }
コード例 #2
0
        public static CommunityDetailsVm GetCommunityDetailsVm(long communityId, PageType pageType)
        {
            CommunityDetailsVm result    = null;
            Community          community = SearchBc.Instance.GetCommunity(communityId);

            if (community != null)
            {
                result             = community.MapToCommunityDetailsVm(pageType);
                result.Breadcrumbs = GetBreadcrumbs(result);
                result.Seo         = SeoHelper.GetSeo(result);
                PopulateFeaturedServices(result, communityId);
                foreach (FloorPlanVm floorPlan in result.FloorPlans)
                {
                    floorPlan.LeadForm = GetLeadFormVm(floorPlan, communityId, pageType.ToSearchType());
                }
                foreach (SpecHomeVm specHome in result.SpecHomes)
                {
                    specHome.LeadForm = GetLeadFormVm(specHome, communityId, pageType.ToSearchType());
                }
                {
                    foreach (HomeVm home in result.Homes)
                    {
                        home.LeadForm = GetLeadFormVm(home, communityId, pageType.ToSearchType());
                    }
                    return(result);
                }
            }
            return(result);
        }
コード例 #3
0
        public static CommunityDetailsVm GetCommunityDetailsVm()
        {
            CommunityDetailsVm communityDetailsVm = new CommunityDetailsVm()
            {
                PaymentTypes   = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetPaymentTypes()),
                PriceRange     = new MeasureBoundaryVm <decimal, MoneyType>(),
                Deposit        = new MeasureBoundaryVm <decimal, MoneyType>(),
                ApplicationFee = new MeasureBoundaryVm <decimal, MoneyType>(),
                PetDeposit     = new MeasureBoundaryVm <decimal, MoneyType>(),
                LivingSpace    = new MeasureBoundaryVm <int, LivingSpaceMeasure>(),
                AvailableBedroomsFromQuantity  = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBedrooms().ToSelectListItemList(),
                AvailableBedroomsToQuantity    = communityDetailsVm.AvailableBedroomsFromQuantity,
                AvailableBathroomsFromQuantity = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBathrooms().ToSelectListItemList(),
                AvailableBathroomsToQuantity   = communityDetailsVm.AvailableBathroomsFromQuantity,
                DefaultAmenities = AmenityBc.Instance.GetDefaultAmenities(CommunityType.Community).ConvertAll <CheckBoxVm>((Amenity m) => new CheckBoxVm()
                {
                    Value = m.ClassId.ToString(),
                    Text  = m.Name
                }),
                CustomAmenities = new List <AmenityVm>()
                {
                    new AmenityVm()
                },
                DefaultCommunityServices = CommunityServiceBc.Instance.GetDefaultCommunityServices().ConvertAll <CheckBoxVm>((CommunityService m) => new CheckBoxVm()
                {
                    Value = m.AdditionInfoTypeId.ToString(),
                    Text  = m.Name
                }),
                CustomCommunityServices = new List <CommunityServiceVm>()
                {
                    new CommunityServiceVm(),
                    new CommunityServiceVm()
                }
            };

            communityDetailsVm.CustomCommunityServices = new List <CommunityServiceVm>()
            {
                new CommunityServiceVm()
            };
            communityDetailsVm.Coupon     = new CouponVm();
            communityDetailsVm.FloorPlans = new List <FloorPlanVm>()
            {
                AdminViewModelsProvider.GetCommunityUnit(CommunityUnitType.FloorPlan)
            };
            communityDetailsVm.SpecHomes = new List <SpecHomeVm>()
            {
                AdminViewModelsProvider.GetCommunityUnit(CommunityUnitType.SpecHome)
            };
            communityDetailsVm.Houses = new List <HouseVm>()
            {
                AdminViewModelsProvider.GetHouseUnit()
            };
            communityDetailsVm.Images     = new ImageListVm(DisplayNames.CommunityImages);
            communityDetailsVm.LogoImages = new ImageListVm(DisplayNames.CommunityLogo);
            return(communityDetailsVm);
        }
コード例 #4
0
        public static LeadFormVm GetLeadFormVm(CommunityDetailsVm vm)
        {
            LeadFormVm leadFormVm = GetLeadFormVm();

            leadFormVm.ListingId   = vm.Community.Id;
            leadFormVm.ListingName = vm.Community.Name;
            leadFormVm.Message     = vm.Community.GetLeadFormMessage();
            leadFormVm.Brand       = vm.PageType.ToSearchType().MapToBrandType();
            leadFormVm.Inquiry     = InquiryType.Community;
            return(leadFormVm);
        }
コード例 #5
0
 public static SeoVm GetSeo(CommunityDetailsVm communityDetails)
 {
     return(new SeoVm()
     {
         PageType = communityDetails.PageType,
         Description = Description.CommunityDetails.Replace(communityDetails),
         Title = Title.CommunityDetails.Replace(communityDetails),
         Header = Header.CommunityDetails.Replace(communityDetails),
         CanonicalUrl = MslcUrlBuilder.DetailsUrl(communityDetails.Community, communityDetails.Community.ListingTypes.ToSearchType())
     });
 }
コード例 #6
0
        public static CommunityDetailsVm GetCommunityDetailsVmForPrint(long communityId, PageType pageType)
        {
            CommunityDetailsVm communityDetailsVm = null;
            Community          community          = SearchBc.Instance.GetCommunity(communityId);

            if (community != null)
            {
                communityDetailsVm     = community.MapToCommunityDetailsVm(pageType);
                communityDetailsVm.Seo = SeoHelper.GetSeo(communityDetailsVm);
            }
            return(communityDetailsVm);
        }
コード例 #7
0
        private static CommunityDetailsVm MapToCommunityDetailsVm(this Community community, PageType pageType, CommunityDetailsVm viewModel)
        {
            ImageVm            imageVm;
            CommunityDetailsVm communityQuickViewVm = viewModel ?? new CommunityDetailsVm();

            communityQuickViewVm.PageType       = pageType;
            communityQuickViewVm.Community      = community.MapToCommunityQuickViewVm(pageType.ToSearchType());
            communityQuickViewVm.Criteria       = communityQuickViewVm.Community.Address.MapToSearchCriteriaVm(pageType.ToSearchType());
            communityQuickViewVm.Deposit        = community.Deposit.PriceCaption();
            communityQuickViewVm.ApplicationFee = community.ApplicationFee.PriceCaption();
            communityQuickViewVm.PetDeposit     = community.PetDeposit.PriceCaption();
            communityQuickViewVm.VirtualTourUrl = community.VirtualTour.ExternalUrl();
            communityQuickViewVm.WebsiteUrl     = community.WebsiteUrl.ExternalUrl();
            CommunityDetailsVm communityDetailsVm = communityQuickViewVm;

            if (community.Images.Any <Image>((Image i) => i.Type == ImageType.Logo))
            {
                imageVm = community.Images.First <Image>((Image i) => i.Type == ImageType.Logo).MapToImageVm(ImageOwner.Community, string.Format("{0} Logo", communityQuickViewVm.Community.Name));
            }
            else
            {
                imageVm = null;
            }
            communityDetailsVm.Logo = imageVm;
            communityQuickViewVm.AgeRestrictions  = community.AgeRestrictions.Select <AgeRestriction, string>(new Func <AgeRestriction, string>(LocalizationExtensions.GetEnumLocalizedValue <AgeRestriction>)).ToList <string>();
            communityQuickViewVm.ShcCategories    = community.ShcCategories;
            communityQuickViewVm.PaymentsAccepted = community.AcceptedPayments;
            communityQuickViewVm.FloorPlans       = community.FloorPlans.MapToFloorPlanVmList();
            communityQuickViewVm.SpecHomes        = community.SpecHomes.MapToSpecHomeVmList();
            communityQuickViewVm.Homes            = community.Homes.MapToHomeVmList();
            communityQuickViewVm.Coupon           = community.Coupon.MapToCouponVm(MslcUrlBuilder.PrintCouponUrl(community, communityQuickViewVm.Criteria.SearchType()));
            communityQuickViewVm.Pmc         = community.Pmc.MapToOwnerVm(communityQuickViewVm.Community.Package);
            communityQuickViewVm.OfficeHours = (
                from oh in community.OfficeHours
                select oh.ToString()).ToList <string>();
            communityQuickViewVm.DisplayProperties = new DetailsDisplayProperties();
            return(communityQuickViewVm);
        }
コード例 #8
0
        public static CommunityDetailsVm Repopulate(this CommunityDetailsVm viewModel)
        {
            List <SelectListItem> bedrooms  = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBedrooms().ToSelectListItemList();
            List <SelectListItem> bathrooms = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBathrooms().ToSelectListItemList();

            viewModel.AvailableBathroomsFromQuantity = bathrooms;
            viewModel.AvailableBathroomsToQuantity   = bathrooms;
            viewModel.AvailableBedroomsFromQuantity  = bedrooms;
            viewModel.AvailableBedroomsToQuantity    = bedrooms;
            foreach (FloorPlanVm floorPlan in viewModel.FloorPlans)
            {
                floorPlan.Images = floorPlan.Images ?? new ImageListVm(DisplayNames.FloorPlanImages);
                floorPlan.AvailableBathroomsFromQuantity = bathrooms;
                floorPlan.AvailableBathroomsToQuantity   = bathrooms;
                floorPlan.AvailableBedroomsFromQuantity  = bedrooms;
                floorPlan.AvailableBedroomsToQuantity    = bedrooms;
            }
            foreach (SpecHomeVm specHome in viewModel.SpecHomes)
            {
                specHome.Images = specHome.Images ?? new ImageListVm(DisplayNames.SpecHomeImages);
                specHome.AvailableBathroomsFromQuantity = bathrooms;
                specHome.AvailableBathroomsToQuantity   = bathrooms;
                specHome.AvailableBedroomsFromQuantity  = bedrooms;
                specHome.AvailableBedroomsToQuantity    = bedrooms;
            }
            foreach (HouseVm house in viewModel.Houses)
            {
                house.Images = house.Images ?? new ImageListVm(DisplayNames.HouseImages);
                house.AvailableBathroomsFromQuantity = bathrooms;
                house.AvailableBathroomsToQuantity   = bathrooms;
                house.AvailableBedroomsFromQuantity  = bedrooms;
                house.AvailableBedroomsToQuantity    = bedrooms;
                house.Address = house.Address.Repopulate();
            }
            return(viewModel);
        }
コード例 #9
0
 private static string Replace(this string input, CommunityDetailsVm data)
 {
     return(input.ReplaceWithDescription("{COMMUNITY_DESCRIPTION}", data.Community.Description).Replace("{COMMUNITY_NAME}", data.Community.Name).Replace("{CITY_STATE_CODE}", string.Format("{0}, {1}", data.Community.Address.City, data.Community.Address.StateCode)));
 }
コード例 #10
0
        internal static CommunityDetailsVm MapToCommunityDetailsVm(this Community community)
        {
            CommunityDetailsVm communityDetails = new CommunityDetailsVm()
            {
                PaymentTypes   = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetPaymentTypes(), community.PaymentTypeIds),
                PriceRange     = community.PriceRange.MapToMeasureBoundaryVm <decimal, MoneyType>(),
                Deposit        = community.Deposit.MapToMeasureBoundaryVm <decimal, MoneyType>(),
                ApplicationFee = community.ApplicationFee.MapToMeasureBoundaryVm <decimal, MoneyType>(),
                PetDeposit     = community.PetDeposit.MapToMeasureBoundaryVm <decimal, MoneyType>(),
                LivingSpace    = community.LivingSpace.MapToMeasureBoundaryVm <int, LivingSpaceMeasure>(),
                BathroomFromId = community.BathroomFromId,
                BathroomToId   = community.BathroomToId
            };
            List <KeyValuePair <int, string> > bedrooms = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBedrooms();

            communityDetails.AvailableBedroomsFromQuantity = bedrooms.ToSelectListItemList(community.BedroomFromId);
            communityDetails.AvailableBedroomsToQuantity   = bedrooms.ToSelectListItemList(community.BedroomToId);
            communityDetails.BedroomFromId = community.BedroomFromId;
            communityDetails.BedroomToId   = community.BedroomToId;
            List <KeyValuePair <int, string> > bathrooms = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBathrooms();

            communityDetails.AvailableBathroomsFromQuantity = bathrooms.ToSelectListItemList(community.BathroomFromId);
            communityDetails.AvailableBathroomsToQuantity   = bathrooms.ToSelectListItemList(community.BathroomToId);
            communityDetails.UnitCount = community.UnitCount;
            List <Amenity> defaultCommunityAmenities = AmenityBc.Instance.GetDefaultAmenities(CommunityType.Community);

            communityDetails.DefaultAmenities = community.Amenities.MapToCheckBoxVmList(defaultCommunityAmenities);
            communityDetails.CustomAmenities  = community.Amenities.MapToAmenityVmList(defaultCommunityAmenities);
            List <CommunityService> defaultCommunityServices = CommunityServiceBc.Instance.GetDefaultCommunityServices();

            communityDetails.DefaultCommunityServices = CommunityExtentions.GetDefaultCommunityServices(community.CommunityServices, defaultCommunityServices);
            communityDetails.CustomCommunityServices  = CommunityExtentions.GetCustomCommunityServices(community.CommunityServices, defaultCommunityServices);
            communityDetails.Images      = community.Images.MapToImageListVm(DisplayNames.CommunityImages);
            communityDetails.LogoImages  = community.LogoImages.MapToImageListVm(DisplayNames.CommunityLogo);
            communityDetails.VirtualTour = community.VirtualTour;
            communityDetails.Coupon      = (community.Coupon != null ? community.Coupon.MapToCouponVm() : new CouponVm());
            if (community.FloorPlans == null || !community.FloorPlans.Any <FloorPlan>())
            {
                communityDetails.HasFloorPlans = false;
                communityDetails.FloorPlans    = new List <FloorPlanVm>()
                {
                    AdminViewModelsProvider.GetCommunityUnit(CommunityUnitType.FloorPlan)
                };
            }
            else
            {
                communityDetails.HasFloorPlans = community.FloorPlans.Any <FloorPlan>();
                communityDetails.FloorPlans    = community.FloorPlans.MapToFloorPlanVmList();
            }
            if (community.SpecHomes == null || !community.SpecHomes.Any <SpecHome>())
            {
                communityDetails.HasSpecHomes = false;
                communityDetails.SpecHomes    = new List <SpecHomeVm>()
                {
                    AdminViewModelsProvider.GetCommunityUnit(CommunityUnitType.SpecHome)
                };
            }
            else
            {
                communityDetails.HasSpecHomes = community.SpecHomes.Any <SpecHome>();
                communityDetails.SpecHomes    = community.SpecHomes.MapToSpecHomeVmList();
            }
            if (community.Houses == null || !community.Houses.Any <House>())
            {
                communityDetails.HasHouses = false;
                communityDetails.Houses    = new List <HouseVm>()
                {
                    AdminViewModelsProvider.GetHouseUnit()
                };
            }
            else
            {
                communityDetails.HasHouses = community.Houses.Any <House>();
                communityDetails.Houses    = community.Houses.MapToHouseVmList();
            }
            return(communityDetails);
        }