Ejemplo n.º 1
0
 public LocaleRepositoryUnitTest()
 {
     _locales = new LocaleRepository
                (
         new EnvironmentLocaleFactory()
                );
 }
        public static void MoveLocaleInRepository(this ILocaleRepository repository, string oldLocaleKey, string newLocaleKey)
        {
            if (!repository.Exists(oldLocaleKey))
            {
                return;
            }
            var localeData = repository.Get(oldLocaleKey);

            repository.Delete(oldLocaleKey);
            repository.Create(newLocaleKey, localeData);
        }
Ejemplo n.º 3
0
        public CurrencyRepositoryUnitTest()
        {
            _currencies = new CurrencyRepository
                          (
                new EnvironmentCurrencyFactory()
                          );

            _locales = new LocaleRepository
                       (
                new EnvironmentLocaleFactory()
                       );
        }
Ejemplo n.º 4
0
 public FilesService(
     IFilesRepository filesRepository,
     IGlossaryRepository glossaryRepository,
     ILocaleRepository localeRepository,
     IFilesPackagesRepository filesPackagesRepository,
     SettingsModel settings
     )
 {
     this._filesRepository         = filesRepository;
     this._glossaryRepository      = glossaryRepository;
     this._localeRepository        = localeRepository;
     this._filesPackagesRepository = filesPackagesRepository;
     this._settings = settings;
 }
Ejemplo n.º 5
0
        public CurrencyFormatterUnitTest()
        {
            _currencyRepository = new CurrencyRepository(new EnvironmentCurrencyFactory());
            _localeRepository   = new LocaleRepository(new EnvironmentLocaleFactory());

            _locale              = _localeRepository.GetLocale("pt-PT");
            _currency            = _currencyRepository.GetDefaultCurrency(_locale);
            _alternativeCurrency = _currencyRepository.GetCurrency("USD");

            _currencyFormatter = new CurrencyFormatter();

            _alternativeCurrencyNumberFormatInfo = (NumberFormatInfo)_locale.Culture.NumberFormat.Clone();
            _alternativeCurrencyNumberFormatInfo.CurrencyDecimalDigits = _alternativeCurrency.Scale;
            _alternativeCurrencyNumberFormatInfo.CurrencySymbol        = _alternativeCurrency.Symbol;
        }
Ejemplo n.º 6
0
        public MessageRepositoryUnitTest()
        {
            _locales = new LocaleRepository
                       (
                new EnvironmentLocaleFactory()
                       );

            _messages = new MessageRepository
                        (
                new MachineObjectMessageFactory()
                        );

            _english = _locales.GetLocale("en-US");

            _portuguese = _locales.GetLocale("pt-PT");
        }
Ejemplo n.º 7
0
        public GlobalizationContextUnitTest()
        {
            var guow = new GlobalizationUnitOfWork
                       (
                new CurrencyRepository(new EnvironmentCurrencyFactory()),
                new LocaleRepository(new EnvironmentLocaleFactory()),
                new MessageRepository(new MachineObjectMessageFactory())
                       );

            _currencyRepository = guow.Currencies;

            _localeRepository = guow.Locales;

            _locale = guow.Locales.GetLocale("pt-PT");

            _globalizationContext = guow.CreateContext("pt-PT", "default");

            _alternativeCurrency = guow.Currencies.GetCurrency("USD");

            _alternativeCurrencyNumberFormatInfo = (NumberFormatInfo)_locale.Culture.NumberFormat.Clone();
            _alternativeCurrencyNumberFormatInfo.CurrencyDecimalDigits = _alternativeCurrency.Scale;
            _alternativeCurrencyNumberFormatInfo.CurrencySymbol        = _alternativeCurrency.Symbol;
        }
Ejemplo n.º 8
0
 public static bool Delete(this ILocaleRepository repository, string id)
 {
     return(repository.Query(new DeleteLocaleQuery(id)));
 }
Ejemplo n.º 9
0
 public static IEnumerable <string> GetAll(this ILocaleRepository repository, params string[] ids)
 {
     return(repository.Query(new GetAllLocalesQuery(ids)));
 }
Ejemplo n.º 10
0
 public static string Get(this ILocaleRepository repository, string id)
 {
     return(repository.Query(new GetLocaleQuery(id)));
 }
Ejemplo n.º 11
0
 public void AddRepository(ILocaleRepository repository)
 {
     LocaleDatasets.Add(repository.LocaleCode, repository);
 }
Ejemplo n.º 12
0
 public static string Create(this ILocaleRepository repository, string text, string id)
 {
     return(repository.Query(new CreateLocaleQuery(text, id)));
 }
        public static void UpdateLocale <T>(this T localeEntity, string newAssetCode, ILocaleRepository repository)
            where T : IHasLocaleDescription
        {
            var oldNameLocaleId        = localeEntity.NameLocaleId;
            var oldDescriptionLocaleId = localeEntity.DescriptionLocaleId;

            localeEntity.GenerateLocaleCodes(newAssetCode);

            MoveLocaleInRepository(repository, oldNameLocaleId, localeEntity.NameLocaleId);
            MoveLocaleInRepository(repository, oldDescriptionLocaleId, localeEntity.DescriptionLocaleId);
        }
 /// <summary>
 ///		Creates a new globalization unit of work.
 /// </summary>
 /// <param name="currencies">
 ///		The currency repository.
 /// </param>
 /// <param name="locales">
 ///		The locale repository.
 /// </param>
 /// <param name="messages">
 ///		The message repository.
 /// </param>
 public GlobalizationUnitOfWork(ICurrencyRepository currencies, ILocaleRepository locales, IMessageRepository messages)
 {
     Currencies = currencies ?? throw new ArgumentNullException(nameof(currencies));
     Locales    = locales ?? throw new ArgumentNullException(nameof(locales));
     Messages   = messages ?? throw new ArgumentNullException(nameof(messages));
 }
Ejemplo n.º 15
0
 public static bool Exists(this ILocaleRepository repository, string id)
 {
     return(repository.Query(new LocaleExistsQuery(id)));
 }
Ejemplo n.º 16
0
 public static LocaleDataset GetDataset(this ILocaleRepository repository, string locale)
 {
     return(repository.Query(new GetLocaleDatasetQuery(locale)));
 }
Ejemplo n.º 17
0
 public DataImportController(ILocaleRepository localeRepository, FromExcel fromExcel, IHubContext <DataImportHub> hubContext)
 {
     this._localeRepository = localeRepository;
     this._fromExcel        = fromExcel;
     this._hubContext       = hubContext;
 }
 public static string GetKeyFor(this ILocaleRepository repository, string typeKey, int typeValue)
 {
     return(DefaultLocaleRepository.GetKeyFor(typeKey, typeValue));
 }
Ejemplo n.º 19
0
 public LocaleCacheRepository(ILocaleRepository repository, IMemoryCache cache, ICachedUnitOfWork unitOfWork)
 {
     _repository = repository ?? throw new ArgumentNullException(nameof(repository));
     _cache      = cache ?? throw new ArgumentNullException(nameof(cache));
     _unitOfWork = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
 }