public static LeadFormVm GetLeadFormVm(CommunitiesSearchVm vm)
        {
            LeadFormVm leadFormVm = GetLeadFormVm();

            leadFormVm.Message = vm.GetLeadFormMessage();
            leadFormVm.Brand   = vm.PageType.ToSearchType().MapToBrandType();
            leadFormVm.Inquiry = InquiryType.Community;
            return(leadFormVm);
        }
        public static LeadFormVm GetLeadFormVm(ServiceProvidersSearchVm vm)
        {
            LeadFormVm leadFormVm = GetLeadFormVm();

            leadFormVm.Message = vm.GetLeadFormMessage();
            leadFormVm.Brand   = vm.PageType.ToSearchType().MapToBrandType();
            leadFormVm.Inquiry = InquiryType.ServiceProvider;
            leadFormVm.DisplayProperties.MoveInDate = false;
            return(leadFormVm);
        }
        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);
        }
 private static void SaveCustomerInfo(LeadFormVm leadForm)
 {
     try
     {
         CookieManager.SetCookie(ConfigurationManager.Instance.UserInfoCookieName, leadForm.Customer, DateTime.Now.AddDays(ConfigurationManager.Instance.UserInfoCookiesLifeSpanDays));
     }
     catch (Exception exception)
     {
         Logger.Error(LogMessages.MvcUipcClient.ViewModelsProviders.UnableSaveCustomerCookieError, exception);
     }
 }
        public static LeadFormVm GetLeadFormVm(CommunityQuickViewVm vm, SearchType searchType)
        {
            LeadFormVm leadFormVm = GetLeadFormVm();

            leadFormVm.ListingId   = vm.Id;
            leadFormVm.ListingName = vm.Name;
            leadFormVm.Message     = vm.GetLeadFormMessage();
            leadFormVm.Brand       = searchType.MapToBrandType();
            leadFormVm.Inquiry     = InquiryType.Community;
            return(leadFormVm);
        }
        public static LeadFormVm GetLeadFormVm(ServiceProviderDetailsVm vm)
        {
            LeadFormVm leadFormVm = GetLeadFormVm();

            leadFormVm.ListingId   = vm.ServiceProvider.Id;
            leadFormVm.ListingName = vm.ServiceProvider.Name;
            leadFormVm.Message     = vm.ServiceProvider.GetLeadFormMessage();
            leadFormVm.Brand       = SearchType.ProductsAndServices.MapToBrandType();
            leadFormVm.Inquiry     = InquiryType.ServiceProvider;
            leadFormVm.DisplayProperties.MoveInDate = false;
            return(leadFormVm);
        }
        public static LeadFormVm GetLeadFormVm(SpecHomeQuickViewVm vm, long communityId, SearchType searchType)
        {
            LeadFormVm leadFormVm = GetLeadFormVm();

            leadFormVm.ListingId       = communityId;
            leadFormVm.CommunityUnitId = vm.Id;
            leadFormVm.ListingName     = vm.Name;
            leadFormVm.Message         = vm.GetLeadFormMessage();
            leadFormVm.Brand           = searchType.MapToBrandType();
            leadFormVm.Inquiry         = InquiryType.SpecialHome;
            return(leadFormVm);
        }
        public static LeadConfirmationVm ProcessLead(LeadFormVm leadForm)
        {
            LeadConfirmationVm leadConfirmationVm = new LeadConfirmationVm();

            try
            {
                LeadBc.Instance.ProcessLead(leadForm.ToEntity());
                SaveCustomerInfo(leadForm);
            }
            catch (Exception exception)
            {
                Logger.Error(LogMessages.MvcUipcClient.ViewModelsProviders.LeadProcessingError, exception);
                leadConfirmationVm.Success = false;
                leadConfirmationVm.Message = ErrorMessages.AjaxServerError;
                return(leadConfirmationVm);
            }
            leadConfirmationVm.Success = true;
            leadConfirmationVm.Message = StaticContent.Txt_LeadConfirmationMessage;
            return(leadConfirmationVm);
        }