Ejemplo n.º 1
0
 public DistributionBotScheduler(
     DistributionBotSheetsService distributionBotSheetsService,
     CultureService cultureService)
 {
     _distributionBotSheetsService = distributionBotSheetsService;
     _cultureService = cultureService;
 }
Ejemplo n.º 2
0
        private async void OnSelected(ChangeEventArgs e)
        {
            var culture = (string)e.Value;
            await CultureService.ChangeCulture(culture);

            await ChangeEventCallBack.InvokeAsync(true);
        }
Ejemplo n.º 3
0
 public AuthController(IAntiforgery antiForgeryService, ILocalAuthenticationService authService, CultureService cultureService, IOptions <Toucan.Server.Config> serverConfig, ISignupService signupService, ITokenProviderService <Token> tokenService, IDomainContextResolver resolver, ILocalizationService localization) : base(resolver, localization)
 {
     this.antiForgeryService = antiForgeryService;
     this.authService        = authService;
     this.cultureService     = cultureService;
     this.serverConfig       = serverConfig.Value;
     this.signupService      = signupService;
     this.tokenService       = tokenService;
 }
        public FirstDayOfWeek_and_WeekRule()
        {
            this.InitializeComponent();

            CultureInfo culture = new CultureInfo("en-US");

            culture.DateTimeFormat.FirstDayOfWeek   = DayOfWeek.Wednesday;
            culture.DateTimeFormat.CalendarWeekRule = CalendarWeekRule.FirstFullWeek;
            CultureService.SetCulture(this.calendar, culture);
        }
Ejemplo n.º 5
0
        public MainPage()
        {
            this.InitializeComponent();
            this.calendar.DisplayDate = new DateTime(2002, 9, 1);
            CultureInfo culture = new CultureInfo("en-US");

            culture.DateTimeFormat.FirstDayOfWeek   = DayOfWeek.Wednesday;
            culture.DateTimeFormat.CalendarWeekRule = CalendarWeekRule.FirstFullWeek;
            CultureService.SetCulture(this.calendar, culture);
        }
Ejemplo n.º 6
0
 public AuthController(IAntiforgery antiForgeryService, ILocalAuthenticationService authService, CultureService cultureService, IOptions <Toucan.Server.Config> serverConfig, ISignupService signupService, IVerificationProvider verificationProvider, ITokenProviderService <Token> tokenService)
 {
     this.antiForgeryService   = antiForgeryService;
     this.authService          = authService;
     this.cultureService       = cultureService;
     this.serverConfig         = serverConfig.Value;
     this.signupService        = signupService;
     this.tokenService         = tokenService;
     this.verificationProvider = verificationProvider;
 }
Ejemplo n.º 7
0
 public EmailTests()
 {
     Settings.Initialize();
     TemplateConfiguration.Initialize();
     _cultureService = new CultureService();
     _mailService    = new MailService(_cultureService);
     _workorder      = CreateWorkorderMock();
     _equipment      = CreateEquipmentMock();
     _sublocation    = CreateSublocationMock();
     _eventMonitor   = CreateEventMonitorMock();
 }
Ejemplo n.º 8
0
 public WorkerService(IOptions <DataOptions> dataOptions,
                      Context context,
                      CultureService cultureService,
                      ILoggerFactory loggerFactory,
                      ChartClient chartClient,
                      ITelegramBotClient client)
 {
     _context        = context;
     _cultureService = cultureService;
     _chartClient    = chartClient;
     _client         = client;
     _logger         = loggerFactory.CreateLogger("ChartsWorkerService");
     _data           = dataOptions.Value.Data;
 }
Ejemplo n.º 9
0
 public ManualController(
     RegionService regionService,
     NewsCategoryService newsCategoryService,
     ArticleCategoryService articleCategoryService,
     CityService cityService,
     CultureService cultureService
     )
 {
     _cityService            = cityService;
     _regionService          = regionService;
     _articleCategoryService = articleCategoryService;
     _newsCategoryService    = newsCategoryService;
     _cultureService         = cultureService;
 }
 public DistributionBotSheetsService(ITelegramBotClient client,
                                     ILogger <GoogleSheetsService> logger,
                                     GoogleSheetsService googleSheetsService,
                                     CultureService cultureService,
                                     Context context,
                                     IHostEnvironment env)
 {
     _client = client;
     _logger = logger;
     _googleSheetsService = googleSheetsService;
     _cultureService      = cultureService;
     _context             = context;
     _env = env;
 }
 public WorkerService(GoogleSheetsService sheetsService,
                      CultureService cultureService,
                      Context context,
                      IOptions <DataOptions> options,
                      ITelegramBotClient client,
                      IMailClient mailClient)
 {
     _sheetsService  = sheetsService;
     _cultureService = cultureService;
     _context        = context;
     _client         = client;
     _mailClient     = mailClient;
     _data           = options.Value.Data;
 }
Ejemplo n.º 12
0
 public WorkerService(IOptions <DataOptions> options,
                      ILoggerFactory loggerFactory,
                      Context context,
                      ITelegramBotClient client,
                      CultureService cultureService,
                      IHostEnvironment env)
 {
     _data           = options.Value.Data;
     _logger         = loggerFactory.CreateLogger("ReviewBotWorkerService");
     _context        = context;
     _client         = client;
     _cultureService = cultureService;
     _env            = env;
 }
 public GuestsBotScheduler(ITelegramBotClient client,
                           Context context,
                           ILogger <GoogleSheetsService> logger,
                           GoogleSheetsService googleSheetsService,
                           CultureService cultureService,
                           IHostEnvironment env)
 {
     _env                 = env;
     _client              = client;
     _context             = context;
     _logger              = logger;
     _googleSheetsService = googleSheetsService;
     _cultureService      = cultureService;
 }
        public SchedulingService(IHostApplicationLifetime lifetime,
                                 CultureService cultureService,
                                 IEnumerable <IScheduler> schedulers,
                                 ILogger <SchedulingService> logger,
                                 IOptions <DataOptions> dataOptions)
        {
            _cultureService = cultureService;
            _logger         = logger;
            _stoppingToken  = lifetime.ApplicationStopping;

            _runningTasks = dataOptions.Value.Data.Restaurants.SelectMany(r =>
                                                                          schedulers.Where(s => s.SchedulingTime(r) != Timeout.InfiniteTimeSpan)
                                                                          .Select(s => RunSchedulerAsync(s, r))).ToArray();
        }
Ejemplo n.º 15
0
        protected virtual List <PreferredLanguageViewModel> GetPreferredLanguageViewModel(CultureInfo currentCulture, string customerLanguage)
        {
            var         allcultures         = CultureService.GetAllSupportedCultures();
            CultureInfo customerCultureInfo = null;

            var languages = (from culture in allcultures
                             let displayName = LocalizationProvider.GetLocalizedString(new GetLocalizedParam
            {
                CultureInfo = currentCulture,
                Category = "General",
                Key = culture.DisplayName
            })
                                               select new PreferredLanguageViewModel
            {
                DisplayName = displayName,
                IsoCode = culture.Name,
                IsSelected = customerLanguage == culture.Name
            }).ToList();

            if (!languages.Any(item => item.IsSelected))
            {
                try
                {
                    customerCultureInfo = CultureInfo.GetCultureInfo(customerLanguage);
                }
                catch (Exception ex)
                {
                    var errorMessage = string.Format("Culture not found: {0}", customerLanguage);
                    Log.ErrorException(errorMessage, ex);
                }

                if (customerCultureInfo != null)
                {
                    var affinityCultureName = CultureService.GetAffinityCulture(customerCultureInfo)?.Name;
                    if (string.IsNullOrEmpty(affinityCultureName))
                    {
                        return(languages);
                    }

                    var affinityLanguage = languages.FirstOrDefault(item => affinityCultureName == item.IsoCode);

                    if (affinityLanguage != null)
                    {
                        affinityLanguage.IsSelected = true;
                    }
                }
            }
            return(languages);
        }
        public void properties_refreshed_after_culture_changes()
        {
            // ARRANGE
            var viewModel = new TestViewModel();

            var propertyNames = new List <string>();

            viewModel.ObservePropertyChanged()
            .Subscribe(x => propertyNames.Add(x.PropertyName));

            // ACT
            CultureService.SetCulture(CultureService.AvailableCultures.Skip(1).First());

            // ASSERT
            Assert.That(propertyNames.Count, Is.EqualTo(1));
            Assert.That(propertyNames.Contains(""), Is.True);
        }
        public void culture_changes()
        {
            // ARRANGE
            var called = false;

            CultureService.CultureChanged
            .Subscribe(x => called = true);

            var newCulture = CultureService.AvailableCultures.Last();

            // ACT
            CultureService.SetCulture(newCulture);

            // ASSERT
            Assert.That(called, Is.True);
            Assert.That(CultureService.CurrentCulture, Is.EqualTo(newCulture));
        }
        protected virtual List <PreferredLanguageViewModel> GetPreferredLanguageViewModel(CultureInfo currentCulture, string customerLanguage)
        {
            var allcultures = CultureService.GetAllSupportedCultures();

            return((from culture in allcultures
                    let displayName = LocalizationProvider.GetLocalizedString(new GetLocalizedParam
            {
                CultureInfo = currentCulture,
                Category = "General",
                Key = culture.DisplayName
            })
                                      select new PreferredLanguageViewModel
            {
                DisplayName = displayName,
                IsoCode = culture.Name,
                IsSelected = customerLanguage == culture.Name
            }).ToList());
        }
Ejemplo n.º 19
0
        public async void ProductModelProductDescriptionCulturesByCultureID_Not_Exists()
        {
            var mock = new ServiceMockFacade <ICultureRepository>();

            mock.RepositoryMock.Setup(x => x.ProductModelProductDescriptionCulturesByCultureID(default(string), It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult <List <ProductModelProductDescriptionCulture> >(new List <ProductModelProductDescriptionCulture>()));
            var service = new CultureService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.CultureModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLCultureMapperMock,
                                             mock.DALMapperMockFactory.DALCultureMapperMock,
                                             mock.BOLMapperMockFactory.BOLProductModelProductDescriptionCultureMapperMock,
                                             mock.DALMapperMockFactory.DALProductModelProductDescriptionCultureMapperMock);

            List <ApiProductModelProductDescriptionCultureResponseModel> response = await service.ProductModelProductDescriptionCulturesByCultureID(default(string));

            response.Should().BeEmpty();
            mock.RepositoryMock.Verify(x => x.ProductModelProductDescriptionCulturesByCultureID(default(string), It.IsAny <int>(), It.IsAny <int>()));
        }
Ejemplo n.º 20
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <ICultureRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult <Culture>(null));
            var service = new CultureService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.CultureModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLCultureMapperMock,
                                             mock.DALMapperMockFactory.DALCultureMapperMock,
                                             mock.BOLMapperMockFactory.BOLProductModelProductDescriptionCultureMapperMock,
                                             mock.DALMapperMockFactory.DALProductModelProductDescriptionCultureMapperMock);

            ApiCultureResponseModel response = await service.Get(default(string));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>()));
        }
Ejemplo n.º 21
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <ICultureRepository>();
            var model = new ApiCultureRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <string>())).Returns(Task.CompletedTask);
            var service = new CultureService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.CultureModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLCultureMapperMock,
                                             mock.DALMapperMockFactory.DALCultureMapperMock,
                                             mock.BOLMapperMockFactory.BOLProductModelProductDescriptionCultureMapperMock,
                                             mock.DALMapperMockFactory.DALProductModelProductDescriptionCultureMapperMock);

            ActionResponse response = await service.Delete(default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <string>()));
            mock.ModelValidatorMockFactory.CultureModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <string>()));
        }
Ejemplo n.º 22
0
        public async void Create()
        {
            var mock  = new ServiceMockFacade <ICultureRepository>();
            var model = new ApiCultureRequestModel();

            mock.RepositoryMock.Setup(x => x.Create(It.IsAny <Culture>())).Returns(Task.FromResult(new Culture()));
            var service = new CultureService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.CultureModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLCultureMapperMock,
                                             mock.DALMapperMockFactory.DALCultureMapperMock,
                                             mock.BOLMapperMockFactory.BOLProductModelProductDescriptionCultureMapperMock,
                                             mock.DALMapperMockFactory.DALProductModelProductDescriptionCultureMapperMock);

            CreateResponse <ApiCultureResponseModel> response = await service.Create(model);

            response.Should().NotBeNull();
            mock.ModelValidatorMockFactory.CultureModelValidatorMock.Verify(x => x.ValidateCreateAsync(It.IsAny <ApiCultureRequestModel>()));
            mock.RepositoryMock.Verify(x => x.Create(It.IsAny <Culture>()));
        }
Ejemplo n.º 23
0
        public async void All()
        {
            var mock    = new ServiceMockFacade <ICultureRepository>();
            var records = new List <Culture>();

            records.Add(new Culture());
            mock.RepositoryMock.Setup(x => x.All(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult(records));
            var service = new CultureService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.CultureModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLCultureMapperMock,
                                             mock.DALMapperMockFactory.DALCultureMapperMock,
                                             mock.BOLMapperMockFactory.BOLProductModelProductDescriptionCultureMapperMock,
                                             mock.DALMapperMockFactory.DALProductModelProductDescriptionCultureMapperMock);

            List <ApiCultureResponseModel> response = await service.All();

            response.Should().HaveCount(1);
            mock.RepositoryMock.Verify(x => x.All(It.IsAny <int>(), It.IsAny <int>()));
        }
Ejemplo n.º 24
0
 public IndexModel(CultureService cultureService, TelemetryClient telemetryClient)
 {
     _cultureService  = cultureService ?? throw new ArgumentNullException(nameof(cultureService));
     _telemetryClient = telemetryClient ?? throw new ArgumentNullException(nameof(telemetryClient));
 }
Ejemplo n.º 25
0
 public CultureController()
 {
     _cultureService = new CultureService();
 }
Ejemplo n.º 26
0
 public ExcelService()
 {
     _translationService = new TranslationService.Services.TranslationService();
     _cultureService     = new CultureService();
     _templatePath       = HostingEnvironment.MapPath("~/Content/ExportFiles/");
 }
Ejemplo n.º 27
0
 public ProfileController(CultureService cultureService, IManageProfileService profileService, IDomainContextResolver resolver, ILocalizationService localization) : base(resolver, localization)
 {
     this.cultureService = cultureService;
     this.profileService = profileService;
 }
Ejemplo n.º 28
0
 public Functions(CultureService cultureService, ApiService apiService)
 {
     _cultureService = cultureService;;
     _apiService     = apiService;
 }
Ejemplo n.º 29
0
 public ProfileController(CultureService cultureService, ILocalizationService localization, IManageProfileService profileService)
 {
     this.cultureService = cultureService;
     this.localization   = localization;
     this.profileService = profileService;
 }
Ejemplo n.º 30
0
 public CultureHelper(CultureService service)
 {
     _service = service;
 }