Пример #1
0
        public SearchViewModel(
            ITextTranslator textTranslator,
            IAuthenticatedUserContext userContext,
            IUserSubscriptionsContext subscriptionsContext)
        {
            TextTranslator  = textTranslator;
            IsAuthenticated = userContext.IsAuthenticated;

            _subcriptions = new Lazy <IEnumerable <string> >(() =>
            {
                return(userContext.IsAuthenticated
                                        ? subscriptionsContext.Subscriptions?.Select(s => s.Publication) ?? Enumerable.Empty <string>()
                                        : Enumerable.Empty <string>());
            });
        }
Пример #2
0
        public SubscriptionsViewModel(
            ITextTranslator translator,
            IAuthenticatedUserContext userContext,
            IUserSubscriptionsContext userSubscriptionsContext,
            ISignInViewModel signInViewModel,
            IFindSitePublicationByCode findSitePublication)
        {
            TextTranslator      = translator;
            UserContext         = userContext;
            SignInViewModel     = signInViewModel;
            FindSitePublication = findSitePublication;

            RenewBtnSettings        = new Dictionary <string, bool>();
            SubscriptionBtnSettings = new Dictionary <string, bool>();

            _subcriptions = userSubscriptionsContext.Subscriptions.Where(w => string.IsNullOrEmpty(w.Publication) == false && w.ExpirationDate >= DateTime.Now.AddMonths(-6)).OrderByDescending(o => o.ExpirationDate);

            foreach (var sub in _subcriptions)
            {
                //renew btns
                if (!RenewBtnSettings.ContainsKey(sub.ProductCode))
                {
                    RenewBtnSettings.Add(sub.ProductCode, WithinRenewRange(sub.ExpirationDate));
                }
                else
                {
                    RenewBtnSettings[sub.ProductCode] &= WithinRenewRange(sub.ExpirationDate);
                }

                //subscribe btns
                if (!SubscriptionBtnSettings.ContainsKey(sub.ProductCode))
                {
                    SubscriptionBtnSettings.Add(sub.ProductCode, IsValidSubscription(sub));
                }
                else
                {
                    SubscriptionBtnSettings[sub.ProductCode] |= IsValidSubscription(sub);
                }
            }
        }
Пример #3
0
 public AnalyticsViewModel(
     IItemReferences itemReferences,
     IIsEntitledProducItemContext isEntitledProductItemContext,
     IArticleSearch articleSearch,
     ISiteSettings siteSettings,
     IAuthenticatedUserContext authenticatedUserContext,
     IUserCompanyContext userCompanyContext,
     IUserProfileContext userProfileContext,
     IUserSubscriptionsContext userSubscriptionsContext,
     IWebAuthenticateUser webAuthenticateUser,
     IUserEntitlementsContext userEntitlementsContext,
     IUserIpAddressContext userIpAddressContext,
     ISiteRootContext siteRootContext,
     IHttpContextProvider httpContextProvider,
     IDCDReader dcdReader,
     ITaxonomyService taxonomyService, IGlobalSitecoreService globalService, IRecaptchaService recaptchaSettings)
 {
     ItemReferences = itemReferences;
     IsEntitledProductItemContext = isEntitledProductItemContext;
     ArticleSearch            = articleSearch;
     SiteSettings             = siteSettings;
     AuthenticatedUserContext = authenticatedUserContext;
     UserCompanyContext       = userCompanyContext;
     UserProfileContext       = userProfileContext;
     UserSubscriptionsContext = userSubscriptionsContext;
     WebAuthenticateUser      = webAuthenticateUser;
     UserEntitlementsContext  = userEntitlementsContext;
     UserIpAddressContext     = userIpAddressContext;
     SiteRootContext          = siteRootContext;
     HttpContextProvider      = httpContextProvider;
     DcdReader              = dcdReader;
     EntitlementType        = GetEntitlementType(UserCompanyContext);
     UserEntitlements       = GetUserEntitlements();
     SubscribedProducts     = GetSubscribedProducts();
     OpportunityLineItemIds = GetOpportunityLineItemIds();
     OpportunityIds         = GetOpportunityIds();
     TaxonomyService        = taxonomyService;
     GlobalService          = globalService;
     RecaptchaSettings      = recaptchaSettings;
 }
Пример #4
0
        public IndividualRenewalMessageViewModel(
            ITextTranslator textTranslator,
            IIndividualSubscriptionRenewalMessageContext context,
            IAuthenticatedUserContext userContext,
            ISiteRootContext siteRootContext,
            IUserSubscriptionsContext userSubscriptionsContext,
            IUserProfileContext profileContext)
        {
            Context                  = context;
            SiteRootContext          = siteRootContext;
            UserSubscriptionsContext = userSubscriptionsContext;
            ProfileContext           = profileContext;

            ISubscription record = userContext.IsAuthenticated ? GetLatestExpiringRecord() : null;

            DismissText  = textTranslator.Translate("Subscriptions.Renewals.Dismiss");
            Display      = DisplayMessage(record);
            Message      = Display ? GetMessage(record, profileContext?.Profile?.FirstName ?? string.Empty) : string.Empty;
            Id           = context.ID;
            RenewURL     = context.RenewalLinkURL;
            RenewURLText = context.RenewalLinkText;
        }
 public UserSubscriptionsViewModel(
     IUserSubscriptionsContext userSubscriptionsContext)
 {
     UserSubscriptionsContext = userSubscriptionsContext;
 }
Пример #6
0
 public UserSubscribedContext(
     IUserSubscriptionsContext userSubscriptionsContext)
 {
     UserSubscriptionsContext = userSubscriptionsContext;
 }