Ejemplo n.º 1
0
		public string ProductCanonical(IProduct product, ILocalization localization)
		{
			product = _productService.Localize(product, localization);

			var productUrl = _productUrlService.GetCanonicalUrl(product);
			return _urlFormatService.FormatUrl(_urlLocalizationService.LocalizeCatalogUrl(productUrl, localization));
		}
		public CultureInfo GetCurrencyCulture(ILocalization localization)
		{
			if (localization == null) throw new ArgumentNullException("localization");
			var request = _requestService.Current;
			CultureInfo result;
			if (request.CurrencyCultures.TryGetValue(localization, out result))
			{
				return result;
			}

			var requestCulture = ResolveCulture();
			if (requestCulture != null && new RegionInfo(requestCulture.LCID).ISOCurrencySymbol == localization.CurrencyCode)
			{
				request.CurrencyCultures.Add(localization, requestCulture);
				return requestCulture;
			}
			var storeCulture = localization.Store.DefaultCurrencyCultureInfo;
			if (new RegionInfo(storeCulture.LCID).ISOCurrencySymbol == localization.CurrencyCode)
			{
				request.CurrencyCultures.Add(localization, storeCulture);
				return storeCulture;
			}

			result = _defaultCurrencyCultureService.GetCultureForCurrency(localization.CurrencyCode) ?? CultureInfo.GetCultures(CultureTypes.SpecificCultures).FirstOrDefault(c => new RegionInfo(c.LCID).ISOCurrencySymbol == localization.CurrencyCode);
			if (result == null)
			{
				Log.Instance.LogError("Can't determine culture for currency with code " + localization.CurrencyCode + "");
				result = localization.Store.DefaultCurrencyCultureInfo;
			}
			request.CurrencyCultures.Add(localization, result);
			return result;
		}
		/// <summary>
		/// Gets all countries.
		/// </summary>
		/// <param name="localization">The localization.</param>
		/// <returns></returns>
		public List<Country> GetAllCountries(ILocalization localization = null)
		{
			// todo: multicurrency maybe?
			var storeAlias = "none";
			if (localization != null && localization.Store != null)
			{
				storeAlias = localization.StoreAlias;
			}
			if (string.IsNullOrEmpty(storeAlias)) storeAlias = "none";
			return _cache.GetOrAdd(storeAlias, s =>
				{
					// future todo: make file location configurable (web.config or through code)
					var path = HttpContext.Current.Server.MapPath(string.Format("/scripts/uWebshop/" + BaseXMLFileName + "_{0}.xml", storeAlias));
					if (!System.IO.File.Exists(path))
					{
						// eventueel zou je in dit geval eigenlijk niet de storeAlias willen aanpassen naar none?
						path = HttpContext.Current.Server.MapPath("/scripts/uWebshop/" + BaseXMLFileName + ".xml");
					}
					if (!System.IO.File.Exists(path))
						return DotNETFrameworkFallback(storeAlias);

					XDocument doc;
					using (var streamReader = new StreamReader(path, new UTF8Encoding()))
					{
						doc = XDocument.Load(streamReader);
					}
					return doc.Descendants("country").Select(country => new Country {Name = country.Value, Code = country.Attribute("code").Value}).ToList();
				});
		}
 public void Init()
 {
     _helper = this.GetFixture().Create<IValidationHelper>();
     _localization = TestHelper.CreateStubLocalization();
     _sut = new TierFormFieldSheetShouldHaveCorrectFieldFormMapping(_helper, _localization);
     _loader = this.GetFixture().Create<IExcelLoader>();
 }
 public void Init()
 {
     _helper = this.GetFixture().Create<IValidationHelper>();
     _localization = TestHelper.CreateStubLocalization();
     _sut = new TierFormFolderSheetShouldHaveAllFoldersExisting(_helper, _localization);
     _loader = this.GetFixture().Create<IExcelLoader>();
 }
Ejemplo n.º 6
0
        public DirectShowPlayer(
            ILogger Logger_,
            IFolderService folderService,
            ILocalization loc_) : base(Logger_,folderService,loc_)
        {

        }
Ejemplo n.º 7
0
        public Player(
            ILogger Logger_,
            IFolderService FolderService_,
            ILocalization loc_,
            bool starttimer = true
            //,ISystemMessagePlatformSpecific isystemMessage_
            )
        {

            Logger = Logger_;
            FolderService = FolderService_;
            Loc = loc_;
            //SystemMessage = isystemMessage_;

            Logger.Write(this, LogMsgType.DeepTrace, "Player has been constructed");

            PreviousPosition = 0;
            ClearTargetPosition();

            if (starttimer)
            {
                timer = new TimerExt(20);
                //timer.Enabled = true;
                timer.Elapsed += timer_Elapsed;
                timer.AutoReset = false;
                //timer.Start();
            }
        }
Ejemplo n.º 8
0
        public override double GetMessageWeigth(Base.Model.IMessage message, ILocalization localization)
        {
            double score = BluemixSentiment.GetInstance().GetMessageSentimentScore(message.Content.ToString());

            BluemixSentiment.GetInstance().PersistMessage(message.Metadata);

            return score;
        }
Ejemplo n.º 9
0
		internal SummedPrice(IEnumerable<IVatPrice> prices, bool includingVat, decimal vat, ILocalization localization, IVatCalculationStrategy vatCalculationStrategy)
		{
			_prices = prices.ToArray();
			_originalPricesIncludingVat = includingVat;
			_vat = vat;
			_localization = localization;
			_vatCalculationStrategy = vatCalculationStrategy;
		}
Ejemplo n.º 10
0
		public SimplePrice(IAmountUnit source, ILocalization localization)
		{
			if (localization == null) throw new ArgumentNullException("lo");
			//_ranged = true;
			_source = source;
			_localization = localization;
			_discount = YesNoDifference.Yes;
		}
Ejemplo n.º 11
0
		public SimplePrice(SimplePrice previous)
		{
			_localization = previous._localization;
			_source = previous._source;
			_vat = previous._vat;
			_discount = previous._discount;
			_ranged = previous._ranged;
		}
		public void Setup()
		{
			IOC.UnitTest();
			IOC.ProductRepository.Mock(out _productRepositoryMock);
			_productService = IOC.ProductService.Actual().Resolve();
			_localization = StubLocalization.Default;
			_productRepositoryMock.Setup(m => m.GetAll(_localization)).Returns(new List<Product>());
		}
		public void Setup()
		{
			IOC.UnitTest();
			_repository = (UmbracoProductRepository) IOC.ProductRepository.Actual().Resolve();
			_product = new Product {ParentId = 0};
			_propertyProvider = new TestPropertyProvider();
			_localization = new StubLocalization {CurrencyCode = "EUR", StoreAlias = "EN", Currency = new StubCurrency {Ratio = (decimal) 1.1}};
		}
Ejemplo n.º 14
0
        public Music(ILocalization loc, CommandService cmds, ShardedDiscordClient client, IGoogleApiService google) : base(loc, cmds, client)
        {
            //it can fail if its currenctly opened or doesn't exist. Either way i don't care
            try { Directory.Delete(MusicDataPath, true); } catch { }

            Directory.CreateDirectory(MusicDataPath);

            _google = google;
        }
		public BillingMethodFulfillmentAdaptor(PaymentProviderMethod paymentProviderMethod, bool pricesIncludingVat, ILocalization localization)
		{
			_paymentProviderMethod = paymentProviderMethod;
			_pricesIncludingVat = pricesIncludingVat;
			_localization = localization;
			Id = paymentProviderMethod.Id;
			Title = paymentProviderMethod.Title;
			Description = paymentProviderMethod.Description;
			Disabled = paymentProviderMethod.Disabled;
		}
 public ReferencesToWord_ViewModel_WPF(
     ILogger Logger_, 
     INavigationService NavigationService_,
     EFDbContext EFDbContext_,
     IDialogService DialogService_,
     ILocalization Tx_
     )
     : base(Logger_,NavigationService_,EFDbContext_,DialogService_,Tx_)
 {
 }
 public Download_ViewModel_WPF(
     INavigationService NavigationService_,
     IDialogServiceExtended IDialogServiceExtended_,
     AppSetting AppSetting_,
     IStore Store_,
     ILocalization loc_,
     ILogger logger_,
     IWebAPI_Authorization MainWebAPI_
     ) : base (NavigationService_,IDialogServiceExtended_,AppSetting_,Store_,loc_,logger_)
 {
  }
		public void Setup()
		{
			IOC.UnitTest();
			_repository = (UmbracoProductRepository) IOC.ProductRepository.Actual().Resolve();
			_product = new Product {ParentId = 0};
			_propertyProvider = new TestPropertyProvider();
			//_localization = new StubLocalization {StoreAlias = StoreAlias};
			var store = StoreHelper.GetCurrentStore();
			StoreAlias = store.Alias;
			_localization = Localization.CreateLocalization(store); // todo: not neccessary?
		}
Ejemplo n.º 19
0
        public Gambling(ILocalization loc, CommandService cmds, ShardedDiscordClient client) : base(loc, cmds, client)
        {
            using (var uow = DbHandler.UnitOfWork())
            {
                var conf = uow.BotConfig.GetOrCreate();

                CurrencyName = conf.CurrencyName;
                CurrencySign = conf.CurrencySign;
                CurrencyPluralName = conf.CurrencyPluralName;
            }
        }
		public BillingFulfillmentAdaptor(PaymentProvider paymentProvider, bool pricesIncludingVat, ILocalization localization)
		{
			_paymentProvider = paymentProvider;
			Id = paymentProvider.Id;
			Title = paymentProvider.Title;
			Description = paymentProvider.Description;
			Methods = new List<IBillingProviderMethod>(paymentProvider.PaymentProviderMethods.Select(m => new BillingMethodFulfillmentAdaptor(m, pricesIncludingVat, localization)));
			Type = paymentProvider.Type;
			Zones = paymentProvider.Zones;
			Disabled = paymentProvider.Disabled;
		}
		public ShippingMethodFulfillmentAdaptor(ShippingProviderMethod shippingProviderMethod, bool pricesIncludingVat, ILocalization localization, OrderInfo order)
		{
			_shippingProviderMethod = shippingProviderMethod;
			_pricesIncludingVat = pricesIncludingVat;
			_localization = localization;
			_order = order;
			Id = shippingProviderMethod.Id;
			Title = shippingProviderMethod.Title;
			Description = shippingProviderMethod.Description;
			Name = shippingProviderMethod.Name;
			Disabled = shippingProviderMethod.Disabled;
		}
        public UnderstandingTest_ViewModel_WPF(
            ILogger Logger_,
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IAudioAPI AudioAPI_,
            IMvxMessenger Messenger_,
            ISpeechAPI SpeechAPI_,
            ILocalization loc_) : 
            base (Logger_,NavigationService_,DialogService_,AppSetting_,AudioAPI_,Messenger_,SpeechAPI_,loc_)
        {

        }
Ejemplo n.º 23
0
        public DiscordModule(ILocalization loc, CommandService cmds, ShardedDiscordClient client)
        {
            string prefix;
            if (NadekoBot.ModulePrefixes.TryGetValue(this.GetType().Name, out prefix))
                _prefix = prefix;
            else
                _prefix = "?missing_prefix?";

            _l = loc;
            _commands = cmds;
            _client = client;
            _log = LogManager.GetCurrentClassLogger();
        }
Ejemplo n.º 24
0
		private IEnumerable<ICategory> GetLocalizedCurrentPath(ILocalization localization)
		{
			var path = _requestService.Current.CategoryPath ?? Enumerable.Empty<ICategory>();
			if (!localization.Equals(_requestService.Current.Localization))
			{
				path = path.Select(c => _categoryService.Localize(c, localization));
				if (path.Any(c => c == null))
				{
					return null;
				}
			}
			return path;
		}
		internal Zone FallBackZone(ILocalization localization)
		{
			return new Zone { CountryCodes = _countryRepository.GetAllCountries(localization).Select(c => c.Code).ToList(),
							  Id = -666,
							  CreateDate = DateTime.Now,
							  Name = "AllCountriesZone",
							  NodeTypeAlias = Zone.ShippingZoneNodeAlias,
							  ParentId = 0,
							  Path = "0,-666",
							  UpdateDate = DateTime.Now,
							  SortOrder = 0,
							  UrlName = "zone",
			};
		}
 public PlayerWindow_ViewModel_WPF(
     ILogger logger,
     INavigationService navigationService,
     IDialogService dialogService,
     AppSetting appSetting,
     ISpeechAPI speechApi,
     IAudioAPI audioApi,
     IMvxMessenger messenger,
     ILocalization loc)
     : base(logger,navigationService,dialogService,appSetting,speechApi,audioApi,messenger,loc)
 {
     if (!IsInDesignModeNet())
     {
         player = Mvx.Resolve<IPlayer>(); 
     }
 }
        public MainWindow_ViewModel(
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IStore Store_,
            ILocalization Loc_,
            ILogger logger_) : base()
        {

            if (!IsInDesignMode)
            {
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSettings = AppSetting_;
                Store = Store_;
                Tx = Loc_;
                logger = logger_;

               
                //OpenCommand = new MvxCommand<LearningItem>(Open);
                DeleteCommand = new MvxCommand<LearningItem>(Delete);
                //EditCommand = new MvxCommand<LearningItem>(Edit);
                OpenDictionary_Command = new MvxCommand(OpenDictionary_Cmd);
                OpenAppSetting_Command = new MvxCommand(OpenAppSetting_Cmd);
                Training_Command = new MvxCommand(Training_Cmd);

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }
            
            if (IsInDesignMode)
            {
                AppSettings = new AppSetting();

                AppSettings.LearningItems.Add(
                    new LearningItem {Name = "Mazzy in Gondoland" }
                    ); 
                AppSettings.LearningItems.Add(
                    new LearningItem {Name = "Lego movies" }
                    ); 
                AppSettings.LearningItems.Add(
                    new LearningItem {Name = "Futurama" }
                    );

            }
            

        }
Ejemplo n.º 28
0
        public Download_ViewModel(
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IStore Store_,
            ILocalization Loc_,
            ILogger logger_) : base()
        {

            if (!IsInDesignMode)
            {
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSettings = AppSetting_;
                Store = Store_;
                Tx = Loc_;
                logger = logger_;

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
                Command_DownloadStoreItem = new MvxCommand<StoreItemExt>((x)=>CmdDispatcher_StoreItem(x,"Download"));
            }
            
            StoreItems = new SynchronizedObservableCollection<StoreItemExt>();
            
            if (IsInDesignMode)
            {

                StoreItemExt item;

                item = new StoreItemExt { Name = "South Park" };
                item.DownloadButton.State1 = true;
                StoreItems.Add(item);

                item = new StoreItemExt { Name = "Chuggington" };
                item.DownloadButton.State2 = true;
                StoreItems.Add(item);

                item = new StoreItemExt { Name = "Futurama" };
                item.DownloadButton.State3 = true;
                StoreItems.Add(item);

            }
            

        }
        public ReferencesToWord_ViewModel(
            ILogger Logger_, 
            INavigationService NavigationService_,
            EFDbContext EFDbContext_,
            IDialogService DialogService_,
            ILocalization Tx_
            )
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                EFDbContext =EFDbContext_;
                DialogService = DialogService_;
                Tx = Tx_;

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

                References = new ObservableCollection<ReferenceToWordOfDictionary>();
            }

            ClearButton = new ButtonModel();
                      

            if (IsInDesignMode)
            {
                Word = new WordOfDictionary { word_of_dictionary = "I'm" };

                LearningItem li1 = new LearningItem { Name = "Mazzy collection" };
                LearningItem li2 = new LearningItem { Name = "Futurama season 1" };

                Subtitles st1 = new Subtitles { Name = "English - Russian" };
                Subtitles st2 = new Subtitles { Name = "English - Ukraine" };

                References = new ObservableCollection<ReferenceToWordOfDictionary>()
                {
                    new ReferenceToWordOfDictionary {LearningItem = li1, Subtitles = st1,SubtitleItem =  new SubtitleItem { Text = "I'm Mazzy"},WordOfSubtitleItem = new WordOfSubtitleItem { word = "I'm"} },
                    new ReferenceToWordOfDictionary {LearningItem = li1, Subtitles = st1, SubtitleItem = new SubtitleItem { Text = "I am princess Sylvia" } ,WordOfSubtitleItem = new WordOfSubtitleItem { word = "I am"}},
                    new ReferenceToWordOfDictionary {LearningItem = li2, Subtitles = st2, SubtitleItem = new SubtitleItem { Text = "I'm Nibbler" } ,WordOfSubtitleItem = new WordOfSubtitleItem { word = "I'm"}}
                };

            }

        }
 public MainWindow_ViewModel_WPF(
     INavigationService NavigationService_,
     IDialogServiceExtended IDialogServiceExtended_,
     AppSetting AppSetting_,
     IStore Store_,
     ILocalization loc_,
     ILogger logger_,
     IWebAPI_Authorization MainWebAPI_
     ) : base (NavigationService_,IDialogServiceExtended_,AppSetting_,Store_,loc_,logger_)
 {
     
     IDialogServiceExtended = IDialogServiceExtended_;
     MainWebAPI = MainWebAPI_;
     
     if(!IsInDesignModeNet())
     {
         AddCommand = new MvxCommand(Add);
         CommandDispatecherWPF = new MvxCommand<string>(CmdDispatcherWPF);
     }
  }