コード例 #1
0
 public MaintenanceViewModel(
     ISiteMaintenanceContext siteMaintenanceContext,
     ITextTranslator textTranslator)
 {
     SiteMaintenanceContext = siteMaintenanceContext;
     TextTranslator         = textTranslator;
 }
コード例 #2
0
 public TopicContainerViewModel(
     IRenderingContext renderingContext,
     ITextTranslator textTranslator)
 {
     RenderingContext = renderingContext;
     TextTranslator   = textTranslator;
 }
コード例 #3
0
ファイル: AdViewModel.cs プロジェクト: jayasimhas/Suseela
 public AdViewModel(
     ISiteRootContext siteRootContext,
     ITextTranslator textTranslator)
 {
     SiteRootContext = siteRootContext;
     TextTranslator  = textTranslator;
 }
コード例 #4
0
 public RobotsTextController(
     ICacheProvider cacheProvider,
     ITextTranslator translator)
 {
     CacheProvider  = cacheProvider;
     TextTranslator = translator;
 }
コード例 #5
0
 public EmailSearchPopOutViewModel(
     ITextTranslator textTranslator,
     IAuthenticatedUserContext userContext)
 {
     TextTranslator = textTranslator;
     UserContext    = userContext;
 }
コード例 #6
0
        public TopicAlertButtonModel(
            IGlassBase model,
            IRenderingContextService renderingService,
            IAuthenticatedUserContext userContext,
            IUserContentService <ISavedSearchSaveable, ISavedSearchDisplayable> savedSearchService,
            ITextTranslator textTranslator)
        {
            var parameters = renderingService.GetCurrentRenderingParameters <ITopic_Alert_Options>();

            if (IsAuthorPage(model))
            {
                parameters = SetupAuthorParameters(parameters);
            }

            IsAuthenticated = userContext.IsAuthenticated;
            SetAlertText    = textTranslator.Translate(DictionaryKeys.TopicSetAlertText);
            RemoveAlertText = textTranslator.Translate(DictionaryKeys.TopicRemoveAlertText);
            DisplayButton   = model != null && (!string.IsNullOrEmpty(parameters?.Related_Search) || Sitecore.Context.PageMode.IsExperienceEditor);
            if (DisplayButton)
            {
                AlertIsSet = savedSearchService.Exists(new SavedSearchDisplayModel
                {
                    Url          = parameters?.Related_Search ?? string.Empty,
                    AlertEnabled = true
                });
                TopicName  = GetTopicTitle(model);
                AlertTitle = !string.IsNullOrEmpty(parameters?.Search_Name) ? parameters.Search_Name : TopicName;
                AlertUrl   = parameters?.Related_Search;
            }
        }
コード例 #7
0
 public EmailFriendController(
     ITextTranslator textTranslator,
     ISiteRootContext siteRootContext,
     IEmailFactory emailFactory,
     IEmailSender emailSender,
     IHtmlEmailTemplateFactory htmlEmailTemplateFactory,
     ISiteSettings siteSettings,
     ILog logger,
     IGlobalSitecoreService globalService,
     IArticleSearch articleSearch,
     IArticleService articleService,
     IRecaptchaService recaptchaService)
 {
     EmailSender = emailSender;
     HtmlEmailTemplateFactory = htmlEmailTemplateFactory;
     TextTranslator           = textTranslator;
     SiteRootContext          = siteRootContext;
     EmailFactory             = emailFactory;
     SiteSettings             = siteSettings;
     _logger          = logger;
     GlobalService    = globalService;
     ArticleSearch    = articleSearch;
     ArticleService   = articleService;
     RecaptchaService = recaptchaService;
 }
コード例 #8
0
 public SalesforceSavedDocuments(
     ISalesforceServiceContext service,
     ITextTranslator textTranslator)
 {
     Service        = service;
     TextTranslator = textTranslator;
 }
		public void PopulatePayment(IElectronicPayment payment, IBasket order, ITextTranslator translator) {

			BasketDecorator basket = new BasketDecorator(order);

			payment.LocalRequestReference = basket.OrderHeader.OrderHeaderID.ToString();
			payment.Description = string.Format(translator.GetText("web_store_purchase{0}"), payment.LocalRequestReference);
			payment.PaymentAmount = basket.GrandTotal;
			payment.PaymentDate = DateTime.Now;

            IUserDetails userDetails = (order.UserDetails != null) ? new UserDecorator(order.UserDetails) : order.AltUserDetails;

            //payment.UserInfo.UserDetails. = userDetails.FirstName + " " + userDetails.LastName; -- Is this needed?
            if(payment.UserInfo.UserDetails == null){
                payment.UserInfo.UserDetails = userDetails;
            }

			IAddress invoiceAddress = basket.OrderHeader.InvoiceAddress; 

			payment.UserInfo.UserAddress = invoiceAddress;

			if (invoiceAddress.AddressLine3 != null && invoiceAddress.AddressLine3.Length > 0) {
				payment.UserInfo.UserAddress.AddressLine2 = invoiceAddress.AddressLine2 + ", " + invoiceAddress.AddressLine3;
			} else {
				payment.UserInfo.UserAddress.AddressLine2 = invoiceAddress.AddressLine2;
			}

			payment.UserInfo.UserAddress.City = invoiceAddress.City;
			payment.UserInfo.UserAddress.Region = invoiceAddress.Region;
			payment.UserInfo.UserAddress.Postcode = invoiceAddress.Postcode;
			
			ITextTranslator ccTrans = TranslatorUtils.GetTextTranslator(typeof(CountryCode), translator.CultureCode);
			payment.UserInfo.UserAddress.CountryCode = invoiceAddress.CountryCode;
		}
コード例 #10
0
 public SitemapController(
     ICacheProvider cacheProvider,
     ITextTranslator translator)
 {
     CacheProvider  = cacheProvider;
     TextTranslator = translator;
 }
		public IElectronicPayment CreatePayment(IBasket order, ITextTranslator translator) {
			
			IElectronicPayment payment = new ElectronicPayment();
			PopulatePayment(payment, order, translator);

			return payment;
		}
コード例 #12
0
        public CompaniesandDealsShareViewModel(
            ITextTranslator textTranslator,
            IDCDReader dcdReader,
            IHttpContextProvider context,
            I___BasePage glassModel,
            IAuthenticatedUserContext userContext)
        {
            TextTranslator      = textTranslator;
            DCDReader           = dcdReader;
            HttpContextProvider = context;
            UserContext         = userContext;

            var wildcardValue = UrlUtils.GetLastUrlSement(HttpContextProvider.Current);

            if (glassModel._TemplateId.Equals(ICompany_PageConstants.TemplateId.Guid))
            {
                var Company = DCDReader.GetCompanyByRecordNumber(wildcardValue);
                PageTitle = Company.Title;
                CompanyId = Company.RecordNumber.ToString();
            }
            else if (glassModel._TemplateId.Equals(IDeal_PageConstants.TemplateId.Guid))
            {
                var Deal = DCDReader.GetDealByRecordNumber(wildcardValue);
                PageTitle = Deal.Title;
                DealId    = Deal.RecordNumber.ToString();
            }
        }
コード例 #13
0
 public SalesforceManageAccountInfo(
     ISalesforceServiceContext service,
     ITextTranslator textTranslator)
 {
     Service        = service;
     TextTranslator = textTranslator;
 }
コード例 #14
0
 public SideNavigationMenuViewModel(
     ISiteMainNavigationContext siteMainNavigationContext,
     ITextTranslator textTranslator)
 {
     SiteMainNavigationContext = siteMainNavigationContext;
     TextTranslator            = textTranslator;
 }
        public HtmlTextTranslator(ITextTranslator translator) {
            
            _translator = translator;

            if (HttpContext.Current != null) {
                _util = HttpContext.Current.Server;
            }
        }
コード例 #16
0
        public ArticlePrologueShareViewModel(
            ITextTranslator textTranslator,
            IRenderingItemContext articleRenderingContext)
        {
            TextTranslator = textTranslator;

            _article = new Lazy <IArticle>(articleRenderingContext.Get <IArticle>);
        }
		public static string FormatMoney(Money money, string cultureCode, IBasketRules rules, ITextTranslator translator) {

			if (rules.ShowPrices(WebStoreContext.Current.CurrentUser)) {
				return FormatMoney(money, cultureCode);
			}

			return translator.GetText("no_price_shown");
		}
コード例 #18
0
ファイル: HomeController.cs プロジェクト: lessismoore/LIM
 public HomeController(IMemoryCache memoryCache        = null, IHostingEnvironment env = null, IHttpContextAccessor context = null,
                       ITextTranslator _TextTranslator = null, IOptions <AppSettings> settings = null) : base(context, _TextTranslator, settings)
 {
     _env         = env;
     _tl          = _TextTranslator;
     _memoryCache = memoryCache;
     _AppSettings = settings != null ? settings.Value : null;
 }
コード例 #19
0
 public ExecutiveSummaryViewModel(
     ITextTranslator textTranslator,
     IAccountManagementService accountService,
     IItemReferences itemReferences)
 {
     TextTranslator = textTranslator;
     AccountService = accountService;
     ItemReferences = itemReferences;
 }
コード例 #20
0
 public ArticlePurchasesViewModel(
     IAuthenticatedUserContext userContext,
     IUserArticlePurchaseItemsContext userArticlePurchaseItemsContext,
     ITextTranslator textTranslator)
 {
     UserContext = userContext;
     UserArticlePurchaseItemsContext = userArticlePurchaseItemsContext;
     TextTranslator = textTranslator;
 }
コード例 #21
0
 public EmailArticlePopOutViewModel(
     ITextTranslator textTranslator,
     IRenderingItemContext articleRenderingContext,
     IAuthenticatedUserContext userContext)
 {
     TextTranslator          = textTranslator;
     ArticleRenderingContext = articleRenderingContext;
     UserContext             = userContext;
     Article = ArticleRenderingContext.Get <IArticle>();
 }
コード例 #22
0
 public ArticleKeyDocumentsModel(
     ITextTranslator textTranslator,
     IIsEntitledProducItemContext entitledProductContext,
     IArticleService articleService,
     IAuthenticatedUserContext authenticatedUserContext,
     ISitecoreUserContext sitecoreUserContext) : base(entitledProductContext, authenticatedUserContext, sitecoreUserContext)
 {
     TextTranslator = textTranslator;
     ArticleService = articleService;
 }
コード例 #23
0
 public RegisterUserViewModel(
     IGlobalSitecoreService globalService,
     ITextTranslator textTranslator,
     IReturnUrlContext returnUrlContext,
     IRegisterReturnUrlContext registerReturnUrlContext)
 {
     GlobalService           = globalService;
     TextTranslator          = textTranslator;
     ReturnUrlContext        = returnUrlContext;
     RegisterReturnUrlContex = registerReturnUrlContext;
 }
コード例 #24
0
 public RegisterPopOutViewModel(
     ITextTranslator textTranslator,
     ISiteRootContext siteRootContext,
     IReturnUrlContext returnUrlContext,
     IHttpContextProvider httpContextProvider)
 {
     TextTranslator      = textTranslator;
     SiteRootContext     = siteRootContext;
     ReturnUrlContext    = returnUrlContext;
     HttpContextProvider = httpContextProvider;
 }
コード例 #25
0
 public SavedArticlesViewModel(
     ITextTranslator translator,
     IAuthenticatedUserContext userContext,
     ISignInViewModel signInViewModel,
     ISavedDocumentItemsContext savedDocumentItemsContext)
 {
     TextTranslator            = translator;
     UserContext               = userContext;
     SignInViewModel           = signInViewModel;
     SavedDocumentItemsContext = savedDocumentItemsContext;
 }
コード例 #26
0
 public ContactInfoApiController(
     IAuthenticatedUserContext userContext,
     IManageAccountInfo accountInfo,
     ITextTranslator textTranslator,
     IUserProfileContext profileContext)
 {
     UserContext    = userContext;
     AccountInfo    = accountInfo;
     TextTranslator = textTranslator;
     ProfileContext = profileContext;
 }
コード例 #27
0
        public SiteMaintenanceContext(
            ISiteRootContext siteRootContext,
            ITextTranslator textTranslator,
            ICacheProvider cacheProvider)
        {
            SiteRootContext = siteRootContext;
            TextTranslator  = textTranslator;
            CacheProvider   = cacheProvider;

            Info = GetSiteMaintenanceInfo();
        }
コード例 #28
0
 public ChangeViewModel(
     ITextTranslator textTranslator,
     IFindUserProfileByUsername findUserProfile,
     IFindUserResetPassword findUserResetPassword,
     IWebUserResetPasswordTokenContext tokenContext)
 {
     TextTranslator        = textTranslator;
     FindUserProfile       = findUserProfile;
     FindUserResetPassword = findUserResetPassword;
     TokenContext          = tokenContext;
 }
コード例 #29
0
        public SaveSearchPopOutViewModel(IGlassBase model, IAuthenticatedUserContext userContext, ITextTranslator textTranslator, ISignInViewModel signInViewModel)
        {
            _textTranslator = textTranslator;

            IsAuthenticated = userContext.IsAuthenticated;
            IsSearch        = model is ISearch;
            SignInViewModel = signInViewModel;

            TitleLabelText      = textTranslator.Translate("Search.SavePopout.TitleLabelText");
            ButtonLoggedInText  = textTranslator.Translate("Search.SavePopout.ButtonLoggedInText");
            ButtonLoggedOutText = textTranslator.Translate("Search.SavePopout.ButtonLoggedOutText");
        }
コード例 #30
0
 public AsktheAnalystPopOutViewModel(
     ISiteRootContext siteRootContext,
     ITextTranslator textTranslator,
     IRenderingItemContext articleRenderingContext,
     IAuthenticatedUserContext userContext)
 {
     SiteRootContext         = siteRootContext;
     TextTranslator          = textTranslator;
     ArticleRenderingContext = articleRenderingContext;
     UserContext             = userContext;
     Article = ArticleRenderingContext.Get <IArticle>();
 }
コード例 #31
0
ファイル: SitemapService.cs プロジェクト: jayasimhas/Suseela
 public SitemapService(
     IProviderSearchContextFactory searchContextFactory,
     ISitecoreContext context,
     IArticleSearch searcher,
     ITextTranslator translator,
     IGlobalSitecoreService globalService)
 {
     SearchContextFactory = searchContextFactory;
     SitecoreContext      = context;
     ArticleSearcher      = searcher;
     TextTranslator       = translator;
     GlobalService        = globalService;
 }
コード例 #32
0
ファイル: ArticleService.cs プロジェクト: jayasimhas/Suseela
 public ArticleService(
     ICacheProvider cacheProvider,
     ITextTranslator textTranslator,
     ISiteRootsContext siteRootsContext,
     IGlobalSitecoreService globalService,
     IDCDTokenMatchers dcdTokenMatchers)
 {
     CacheProvider    = cacheProvider;
     TextTranslator   = textTranslator;
     SiteRootsContext = siteRootsContext;
     GlobalService    = globalService;
     DCDTokenMatchers = dcdTokenMatchers;
 }
コード例 #33
0
 public EmailPreferencesViewModel(
     ITextTranslator translator,
     IOfferUserOptedInContext offersOptedInContext,
     ISignInViewModel signInViewModel,
     IAuthenticatedUserContext userContext,
     IPublicationsNewsletterUserOptInContext publicationNewsletterUserOptInContext)
 {
     TextTranslator       = translator;
     OffersOptedInContext = offersOptedInContext;
     UserContext          = userContext;
     SignInViewModel      = signInViewModel;
     PublicationNewsletterUserOptInContext = publicationNewsletterUserOptInContext;
 }
コード例 #34
0
        public HierarchyLinksViewModel(
            I___BaseTaxonomy glassModel,
            ITextTranslator textTranslator,
            ITaxonomyService taxonomyService)
        {
            TextTranslator  = textTranslator;
            TaxonomyService = taxonomyService;

            model = new HierarchyLinks();

            model.Text     = "Related Topics";
            model.Url      = string.Empty;
            model.Children = TaxonomyService.GetHeirarchyChildLinks(glassModel);
        }
        public BasketDecorator ProcessReceivedPayment(IElectronicPayment ccPayment, ITextTranslator translator) {

			try {

				long orderID = Int64.Parse(ccPayment.LocalRequestReference);
				IBasket basket = _dao.FindOrder(orderID);
				BasketDecorator order;

				if (basket != null) {
					order = new BasketDecorator(basket);
				} else {
					throw new InvalidOperationException("Could not find order for local ccPayment ref [" + ccPayment.LocalRequestReference + "]");
				}

				//Make a record in the database about this ccPayment
				RecordPayment(basket, ccPayment);

				//Make sure this isn't already purchased
				if (order.IsPurchased) {
					throw new InvalidOperationException("Paid for order [" + order.OrderHeader.OrderHeaderID + "] more than once");
				}

				//Make sure the amount is correct (assume the same currency)
				if (order.GrandTotal.Amount != (decimal) ccPayment.PaymentAmount.Amount) {
					throw new InvalidOperationException("Invalid ccPayment amount - expected " + order.GrandTotal.Amount
						+ ", recieved " + ccPayment.PaymentAmount.Amount + " " 
						+ ccPayment.PaymentAmount.CurrencyCode);
				}

				//Either PO or successful credit card
				if (order.OrderHeader.PaymentMethod == PaymentMethodType.PurchaseOrderInvoice 
					|| ccPayment != null && (ccPayment.TransactionStatus == PaymentStatus.Approved || ccPayment.TransactionStatus == PaymentStatus.Referred)) {

					//This is a purchase order, or a direct credit card order
                    return order;
				}

			} catch (Exception f) {
				LogManager.GetLogger(GetType()).Error(f);
			}

            return null;
		}
        public static string FormatMoney(Money money, IBasketRules rules, ITextTranslator translator) {
			return FormatMoney(money, "en-GB", rules, translator);
		}
		public bool CloseCurrentOrder(IStoreContext context, ITextTranslator translator) {

			IBasket order = GetCurrentBasket(context);
            BasketDecorator decorator = order as BasketDecorator;

            if (decorator != null) {
                order = decorator.Basket;
            }
			
			if (order != null && CloseOrder(order, translator)) {

                SetLastOrder(context, order);
                SetCurrentBasket(context, null);
				
				return true;

			} else {
				return false;
			}
		}
		protected virtual void AddTranslatorData(ITextTranslator translator, IDictionary context, bool isHtml) {

			//Make a translator available
			if (translator != null && !context.Contains(TRANSLATOR_KEY)) {

				if (!isHtml) {
					context.Add(TRANSLATOR_KEY, translator);
				} else {
				
					HtmlTextTranslator htm = translator as HtmlTextTranslator;

					if (!isHtml || htm == null) {
						context.Add(TRANSLATOR_KEY, new HtmlTextTranslator(translator));
					} else {
						context.Add(TRANSLATOR_KEY, translator);
					}
				}
			}
		}
        public static string FormatUnitLinePrice(IBasketLine line, IBasketRules rules, ITextTranslator translator) {
			return FormatMoney(line.UnitLinePrice, rules, translator);
		}
        public bool SubmitCurrentOrder(IStoreContext context, ITextTranslator translator) {

            IBasket order = GetCurrentBasket(context);

            if (order != null && SubmitOrder(order, translator)) {

                SetLastOrder(context, order);
                SetCurrentBasket(context, null);

                return true;

            } else {
                return false;
            }
        }
 public new string GetText(string key) {
     if (_translator == null) {
         _translator = TranslatorUtils.GetTextTranslator(GetType(), CultureCode);
     }
     return _translator.GetText(key.ToLower());
 }
		protected virtual void SendEmail(Hashtable data, ITextTranslator translator) {
			SendEmail(data, translator, TemplateName, SenderEmail, ToEmail, SubjectTag, IsHtml);
		}
		protected virtual void AddTranslatorData(ITextTranslator translator, Hashtable data, bool isHtml) {

			//Make a translator available
			if (translator != null && !data.ContainsKey(TRANSLATOR_KEY)) {

				if (!isHtml) {
					data.Add(TRANSLATOR_KEY, translator);
				} else {
				
					HtmlTextTranslator htm = translator as HtmlTextTranslator;

					if (!isHtml || htm == null) {
						data.Add(TRANSLATOR_KEY, new HtmlTextTranslator(translator));
					} else {
						data.Add(TRANSLATOR_KEY, translator);
					}
				}
			}
		}
		protected virtual void SendEmail(Hashtable data, ITextTranslator translator, string templateName, string senderEmail, string toEmail, string subjectTag, bool isHtml) {

			//Apply configured defaults, possibly
			senderEmail = GetOptimalValue(senderEmail, SenderEmail);
			toEmail = GetOptimalValue(toEmail, ToEmail);

			string[] ccEmailArray = (!string.IsNullOrEmpty(CcEmail)) ? new string[] {CcEmail} : new string[] {};
            string[] bccEmailArray = (!string.IsNullOrEmpty(BccEmail)) ? new string[] { BccEmail } : new string[] { };

			templateName = GetOptimalValue(templateName, TemplateName);
			subjectTag = GetOptimalValue(subjectTag, SubjectTag);
			if (_isHtmlSet) isHtml = IsHtml;

			AddTranslatorData(translator, data, isHtml);
			
			string text = _templateEngine.GetTemplateText(templateName, data);

            _transport.Send(senderEmail, toEmail, translator.GetText(subjectTag), text, ccEmailArray, bccEmailArray);
		}
        public bool CloseOrder(IBasket order, ITextTranslator translator) {

            BasketDecorator b = new BasketDecorator(order);
            if (b.IsPurchased) {
                throw new InvalidOperationException("Cannot close an order that is already purchased");
            }

            order.OrderHeader.Status = Util.Enums.OrderStatus.OrderedPaid;
            order.OrderHeader.OrderedDate = DateTime.Now;

            IOrderProcessor processor = _processorFactory.GetCloseProcessor();

            if (processor != null) {
                processor.Process(order);
            }

            //And save the results
            _dao.Save(order);
            return true;
        }
        protected virtual bool SendEmail(IDictionary context, ITextTranslator translator, string templateName, string senderEmail, string toEmail, string subjectTag, bool isHtml) {

            //Apply configured defaults, possibly
            senderEmail = GetOptimalValue(senderEmail, SenderEmail);
            toEmail = GetOptimalValue(toEmail, ToEmail);

            templateName = GetOptimalValue(templateName, TemplateName);
            subjectTag = GetOptimalValue(subjectTag, SubjectTag);
            if (_isHtmlSet) isHtml = IsHtml;

            AddTranslatorData(translator, context, isHtml);

            StringWriter sw = new StringWriter();

            try {
                _templateEngine.Process(context, templateName, sw);

                MailMessage message = MailHelper.CreateMessage(senderEmail, toEmail, CcEmail, BccEmail, translator.GetText(subjectTag), sw.ToString(), isHtml);
                _transport.Send(message);
            } catch (Exception f) {
                LogManager.GetLogger(GetType()).Error(f);
                return false;
            }
            return true;
        }
		protected virtual bool SendEmail(IDictionary context, ITextTranslator translator) {
			return SendEmail(context, translator, TemplateName, SenderEmail, ToEmail, SubjectTag, IsHtml);
		}
        public bool SubmitOrder(IBasket order, ITextTranslator translator) {

            BasketDecorator b = new BasketDecorator(order);
            if (b.IsPurchased || b.OrderHeader.Status == OrderStatus.OrderedSubmittedForAccountPayment) {
                throw new InvalidOperationException("Cannot close an order that is already purchased or submitted");
            }

            order.OrderHeader.Status = Util.Enums.OrderStatus.OrderedSubmittedForAccountPayment;
            order.OrderHeader.OrderedDate = DateTime.Now;

            IOrderProcessor processor = _processorFactory.GetProcessor("order.submit");

            if (processor != null) {
                processor.Process(order);
            }

            //And save the results
            _dao.Save(order);
            return true;
        }