public static NewServiceProviderVm GetNewServiceProviderVm()
        {
            NewServiceProviderVm newServiceProviderVm = new NewServiceProviderVm()
            {
                Package           = new PackageType?(PackageType.Basic),
                Books             = AccountBc.Instance.GetBooks().ToSelectListItemList(),
                ServiceCategories = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetSHCCategoriesForServiceProvider()),
                AllCounties       = AdminViewModelsProvider.GetCounties(),
                CountiesServed    = new List <County>(),
                Address           = AdminViewModelsProvider.GetAddressVm(),
                PhoneList         = AdminViewModelsProvider.GetPhoneList(ServiceType.ProductsAndServices)
            };

            newServiceProviderVm.PhoneList.AdditionalPhones.ForEach((PhoneVm ph) => ph.PhoneTypes.RemoveAll((SelectListItem pt) => pt.get_Text().Contains("Provision")));
            newServiceProviderVm.EmailList = AdminViewModelsProvider.GetEmailListVm(ServiceType.ProductsAndServices);
            newServiceProviderVm.Contacts  = new List <ContactVm>()
            {
                AdminViewModelsProvider.GetContactVm(ServiceType.ProductsAndServices)
            };
            newServiceProviderVm.OfficeHours = new List <OfficeHoursVm>()
            {
                AdminViewModelsProvider.GetOfficeHoursVm()
            };
            newServiceProviderVm.PaymentTypes       = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetPaymentTypes());
            newServiceProviderVm.Coupon             = new CouponVm();
            newServiceProviderVm.Images             = new ImageListVm(DisplayNames.ServiceProviderImages);
            newServiceProviderVm.CallTrackingPhones = new List <CallTrackingPhoneVm>()
            {
                new CallTrackingPhoneVm()
            };
            return(newServiceProviderVm);
        }
        public static NewCommunityVm GetNewCommunityVm()
        {
            NewCommunityVm newCommunityVm = new NewCommunityVm()
            {
                Books        = AccountBc.Instance.GetBooks().ToSelectListItemList(),
                ListingTypes = ConverterHelpers.EnumToCheckBoxList <ListingType>(),
                SeniorHousingAndCareCategories = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetSHCCategoriesForCommunity()),
                AgeRestrictions = ConverterHelpers.EnumToCheckBoxList <AgeRestriction>(),
                Address         = AdminViewModelsProvider.GetAddressVm(),
                PhoneList       = AdminViewModelsProvider.GetPhoneList(CommunityType.Community)
            };

            newCommunityVm.PhoneList.AdditionalPhones.ForEach((PhoneVm ph) => ph.PhoneTypes.RemoveAll((SelectListItem pt) => pt.get_Text().Contains("Provision")));
            newCommunityVm.EmailList = AdminViewModelsProvider.GetEmailListVm(CommunityType.Community);
            newCommunityVm.Contacts  = new List <ContactVm>()
            {
                AdminViewModelsProvider.GetContactVm(CommunityType.Community)
            };
            newCommunityVm.OfficeHours = new List <OfficeHoursVm>()
            {
                AdminViewModelsProvider.GetOfficeHoursVm()
            };
            newCommunityVm.CommunityDetails = AdminViewModelsProvider.GetCommunityDetailsVm();
            newCommunityVm.ListingDetails   = AdminViewModelsProvider.GetListingDetailsVm();
            return(newCommunityVm);
        }
        public static HouseVm GetHouseUnit()
        {
            HouseVm houseVm = new HouseVm()
            {
                PriceRange     = new MeasureBoundaryVm <decimal, MoneyType>(),
                LivingSpace    = new MeasureBoundaryVm <int, LivingSpaceMeasure>(),
                Deposit        = new MeasureBoundaryVm <decimal, MoneyType>(),
                ApplicationFee = new MeasureBoundaryVm <decimal, MoneyType>(),
                PetDeposit     = new MeasureBoundaryVm <decimal, MoneyType>(),
                AvailableBedroomsFromQuantity  = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBedrooms().ToSelectListItemList(),
                AvailableBedroomsToQuantity    = houseVm.AvailableBedroomsFromQuantity,
                AvailableBathroomsFromQuantity = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBathrooms().ToSelectListItemList(),
                AvailableBathroomsToQuantity   = houseVm.AvailableBathroomsFromQuantity,
                CustomAmenities = new List <AmenityVm>()
                {
                    new AmenityVm()
                },
                DefaultAmenities = AmenityBc.Instance.GetDefaultAmenities(CommunityUnitType.House).ConvertAll <CheckBoxVm>((Amenity m) => new CheckBoxVm()
                {
                    Value = m.ClassId.ToString(),
                    Text  = m.Name
                }),
                Images  = new ImageListVm(DisplayHelpers.GetDisplayNameForCommunityUnitImages(CommunityUnitType.House)),
                Address = AdminViewModelsProvider.GetAddressVm()
            };

            return(houseVm);
        }
示例#4
0
 public static OwnerVm GetOwnerVm(OwnerType ownerType)
 {
     return(new OwnerVm()
     {
         NewOwner = new NewOwnerVm()
         {
             Address = AdminViewModelsProvider.GetAddressVm(),
             PhoneList = AdminViewModelsProvider.GetPhoneList(ownerType),
             EmailList = AdminViewModelsProvider.GetEmailListVm(ownerType),
             Contacts = new List <ContactVm>()
             {
                 AdminViewModelsProvider.GetContactVm(ownerType)
             },
             LogoImages = new ImageListVm(ownerType.MapToDisplayName()),
             OwnerType = ownerType
         },
         Owners = (
             from m in OwnerBc.Instance.GetAllByOwnerType(ownerType)
             select new SelectListItem()
         {
             Value = m.Id.ToString(),
             Text = m.Name
         }).ToList <SelectListItem>()
     });
 }
        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);
        }
 public static ListingDetailsVm GetListingDetailsVm()
 {
     return(new ListingDetailsVm()
     {
         PropertyManager = AdminViewModelsProvider.GetOwnerVm(OwnerType.PropertyManager),
         Builder = AdminViewModelsProvider.GetOwnerVm(OwnerType.Builder),
         CallTrackingPhones = new List <CallTrackingPhoneVm>()
         {
             new CallTrackingPhoneVm()
         }
     });
 }
        public static EditServiceProviderVm GetEditServiceProviderVm(long id)
        {
            if (!ServiceProviderBc.Instance.IsUsersService(id))
            {
                return(null);
            }
            ServiceProvider       serviceProvider       = ServiceProviderBc.Instance.GetById(id);
            EditServiceProviderVm editServiceProviderVm = new EditServiceProviderVm()
            {
                Id = serviceProvider.Id,
                MarchexAccountId  = serviceProvider.MarchexAccountId,
                BookId            = serviceProvider.Book.Id,
                Books             = AccountBc.Instance.GetBooks().ToSelectListItemList(),
                ServiceCategories = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetSHCCategoriesForServiceProvider(), (
                                                                                  from sc in serviceProvider.ServiceCategories
                                                                                  select sc.Key).ToList <long>()),
                AllCounties    = AdminViewModelsProvider.GetCounties(),
                CountiesServed = ServiceProviderBc.Instance.GetCountiesServedById(id),
                PhoneList      = serviceProvider.Phones.MapToPhoneListVm(ServiceType.ProductsAndServices)
            };

            editServiceProviderVm.PhoneList.AdditionalPhones.ForEach((PhoneVm ph) => ph.PhoneTypes.RemoveAll((SelectListItem pt) => pt.get_Text().Contains("Provision")));
            editServiceProviderVm.EmailList = serviceProvider.Emails.MapToEmailListVm(ServiceType.ProductsAndServices);
            List <KeyValuePair <int, string> > contactTypes = MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetContactTypes(ServiceType.ProductsAndServices);

            editServiceProviderVm.Contacts = (serviceProvider.Contacts == null || !serviceProvider.Contacts.Any <Contact>() ? new List <ContactVm>()
            {
                AdminViewModelsProvider.GetContactVm(ServiceType.ProductsAndServices)
            } : serviceProvider.Contacts.ConvertAll <ContactVm>((Contact m) => AdminViewModelsProvider.GetContactVm(m, contactTypes)));
            editServiceProviderVm.OfficeHours = (serviceProvider.OfficeHours == null || !serviceProvider.OfficeHours.Any <OfficeHours>() ? new List <OfficeHoursVm>()
            {
                AdminViewModelsProvider.GetOfficeHoursVm()
            } : serviceProvider.OfficeHours.ConvertAll <OfficeHoursVm>((OfficeHours m) => new OfficeHoursVm(m)));
            editServiceProviderVm.FeatureStartDate  = serviceProvider.FeatureStartDate;
            editServiceProviderVm.FeatureEndDate    = serviceProvider.FeatureEndDate;
            editServiceProviderVm.Description       = serviceProvider.Description;
            editServiceProviderVm.WebsiteUrl        = serviceProvider.WebsiteUrl;
            editServiceProviderVm.DisplayWebsiteUrl = serviceProvider.DisplayWebsiteUrl;
            editServiceProviderVm.Name                         = serviceProvider.Name;
            editServiceProviderVm.PublishEndDate               = serviceProvider.PublishEndDate;
            editServiceProviderVm.PublishStartDate             = serviceProvider.PublishStartDate;
            editServiceProviderVm.Package                      = serviceProvider.Package;
            editServiceProviderVm.Address                      = (serviceProvider.Address == null ? AdminViewModelsProvider.GetAddressVm() : serviceProvider.Address.MapToAddressVm());
            editServiceProviderVm.DoNotDisplayAddress          = !serviceProvider.DisplayAddress;
            editServiceProviderVm.PaymentTypes                 = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetPaymentTypes(), serviceProvider.PaymentTypeIds);
            editServiceProviderVm.Images                       = serviceProvider.Images.MapToImageListVm(DisplayNames.ServiceProviderImages);
            editServiceProviderVm.Coupon                       = (serviceProvider.Coupon != null ? serviceProvider.Coupon.MapToCouponVm() : new CouponVm());
            editServiceProviderVm.ProvisionCallTrackingNumbers = serviceProvider.CallTrackingPhones.Any <CallTrackingPhone>();
            editServiceProviderVm.CallTrackingPhones           = AdminViewModelsProvider.GetCallTrackingPhoneVmList(serviceProvider.CallTrackingPhones);
            return(editServiceProviderVm);
        }
 public static NewOwnerVm GetNewOwnerVm(OwnerType ownerType)
 {
     return(new NewOwnerVm()
     {
         OwnerType = ownerType,
         Address = AdminViewModelsProvider.GetAddressVm(),
         PhoneList = AdminViewModelsProvider.GetPhoneList(ownerType),
         EmailList = AdminViewModelsProvider.GetEmailListVm(ownerType),
         Contacts = new List <ContactVm>()
         {
             AdminViewModelsProvider.GetContactVm(ownerType)
         },
         LogoImages = new ImageListVm(ownerType.MapToDisplayName())
     });
 }
        public static EditCommunityVm GetEditCommunityVm(long id)
        {
            if (!CommunityBc.Instance.IsUsersCommunity(id))
            {
                return(null);
            }
            Community       community       = CommunityBc.Instance.GetById(id);
            EditCommunityVm editCommunityVm = new EditCommunityVm()
            {
                Id = community.Id,
                MarchexAccountId = community.MarchexAccountId,
                BookId           = community.Book.Id,
                Books            = AccountBc.Instance.GetBooks().ToSelectListItemList(),
                Package          = community.Package,
                ListingTypes     = ConverterHelpers.EnumToCheckBoxList <ListingType>(community.ListingTypes),
                SeniorHousingAndCareCategories = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetSHCCategoriesForCommunity(), community.SeniorHousingAndCareCategoryIds),
                AgeRestrictions     = ConverterHelpers.EnumToCheckBoxList <AgeRestriction>(community.AgeRestrictions),
                Name                = community.Name,
                Address             = community.Address.MapToAddressVm(),
                DoNotDisplayAddress = !community.DisplayAddress,
                PhoneList           = community.Phones.MapToPhoneListVm(CommunityType.Community)
            };

            editCommunityVm.PhoneList.AdditionalPhones.ForEach((PhoneVm ph) => ph.PhoneTypes.RemoveAll((SelectListItem pt) => pt.get_Text().Contains("Provision")));
            editCommunityVm.EmailList = community.Emails.MapToEmailListVm(CommunityType.Community);
            List <KeyValuePair <int, string> > contactTypes = MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetContactTypes(CommunityType.Community);

            editCommunityVm.Contacts = (community.Contacts == null || !community.Contacts.Any <Contact>() ? new List <ContactVm>()
            {
                AdminViewModelsProvider.GetContactVm(CommunityType.Community)
            } : community.Contacts.ConvertAll <ContactVm>((Contact m) => AdminViewModelsProvider.GetContactVm(m, contactTypes)));
            editCommunityVm.OfficeHours = (community.OfficeHours == null || !community.OfficeHours.Any <OfficeHours>() ? new List <OfficeHoursVm>()
            {
                AdminViewModelsProvider.GetOfficeHoursVm()
            } : community.OfficeHours.ConvertAll <OfficeHoursVm>((OfficeHours m) => new OfficeHoursVm(m)));
            editCommunityVm.Description       = community.Description;
            editCommunityVm.WebsiteUrl        = community.WebsiteUrl;
            editCommunityVm.DisplayWebsiteUrl = community.DisplayWebsiteUrl;
            editCommunityVm.ListingDetails    = community.MapToListingDetailsVm();
            editCommunityVm.CommunityDetails  = community.MapToCommunityDetailsVm();
            editCommunityVm.PublishStart      = community.Publishing.StartDate;
            editCommunityVm.PublishEnd        = community.Publishing.EndDate;
            editCommunityVm.ShowcaseStart     = community.Showcase.StartDate;
            editCommunityVm.ShowcaseEnd       = community.Showcase.EndDate;
            return(editCommunityVm);
        }
        public static CommunityCallTrackingPhonesVm GetCommunityCallTrackingPhonesVm(long communityId)
        {
            if (!CommunityBc.Instance.IsUsersCommunity(communityId))
            {
                return(null);
            }
            CommunityCallTrackingPhonesVm communityCallTrackingPhonesVm = new CommunityCallTrackingPhonesVm();
            Community community = CommunityBc.Instance.GetById(communityId);

            communityCallTrackingPhonesVm.CommunityId                  = new long?(communityId);
            communityCallTrackingPhonesVm.CommunityName                = community.Name;
            communityCallTrackingPhonesVm.CallTrackingPhones           = AdminViewModelsProvider.GetCallTrackingPhoneVmList(community.CallTrackingPhones);
            communityCallTrackingPhonesVm.ProvisionCallTrackingNumbers = communityCallTrackingPhonesVm.CallTrackingPhones.Any <CallTrackingPhoneVm>();
            communityCallTrackingPhonesVm.PublishStart                 = community.Publishing.StartDate;
            communityCallTrackingPhonesVm.PublishEnd = community.Publishing.EndDate;
            return(communityCallTrackingPhonesVm);
        }
 public static OwnerVm GetOwnerVm(OwnerType ownerType)
 {
     return(new OwnerVm()
     {
         NewOwner = new NewOwnerVm()
         {
             Address = AdminViewModelsProvider.GetAddressVm(),
             PhoneList = AdminViewModelsProvider.GetPhoneList(ownerType),
             EmailList = AdminViewModelsProvider.GetEmailListVm(ownerType),
             Contacts = new List <ContactVm>()
             {
                 AdminViewModelsProvider.GetContactVm(ownerType)
             },
             LogoImages = new ImageListVm(ownerType.MapToDisplayName()),
             OwnerType = ownerType
         },
         Owners = OwnerBc.Instance.GetAllByOwnerType(ownerType).Select <Owner, SelectListItem>((Owner m) => {
             SelectListItem selectListItem = new SelectListItem();
             selectListItem.set_Value(m.Id.ToString());
             selectListItem.set_Text(m.Name);
             return selectListItem;
         }).ToList <SelectListItem>()
     });
 }