Esempio n. 1
0
 public CityService
 (
     IPostalCodeService postalCodeService
     , ICityRepository cityRepository
     , IWeatherService weatherService
     , ICityTemperatureRepository cityTemperatureRepository
 )
 {
     PostalCodeService         = postalCodeService ?? throw new ArgumentNullException(nameof(IPostalCodeService));
     CityRepository            = cityRepository ?? throw new ArgumentNullException(nameof(ICityRepository));
     WeatherService            = weatherService ?? throw new ArgumentNullException(nameof(IWeatherService));
     CityTemperatureRepository = cityTemperatureRepository ?? throw new ArgumentNullException(nameof(ICityTemperatureRepository));
 }
Esempio n. 2
0
        static async Task Main(string[] args)
        {
            IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
                                                         .SetBasePath(Directory.GetCurrentDirectory())
                                                         .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = configurationBuilder.Build();

            ServiceProvider serviceProvider = new ServiceCollection()
                                              .AddLogging()
                                              .AddTransient <IPostalCodeService, PostalCodeService>()
                                              .AddTransient <IUnitOFWork, EfUnitOfWork>()
                                              .AddDbContext <ContextDb>(
                options => options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")),
                ServiceLifetime.Transient)
                                              .BuildServiceProvider();

            Console.WriteLine("enter path to file");

            string pathToFile = Console.ReadLine();

            using (ExcelPackage excelPackage = new ExcelPackage(new FileInfo($@"{pathToFile}")))
            {
                foreach (ExcelWorksheet worksheet in excelPackage.Workbook.Worksheets)
                {
                    for (int i = 2; i <= worksheet.Dimension.End.Row; i++)
                    {
                        for (int j = worksheet.Dimension.Start.Column; j <= worksheet.Dimension.End.Column; j++)
                        {
                            if (worksheet.Cells[i, j].Value != null)
                            {
                                ExcelData.Add(worksheet.Cells[i, j].Value.ToString());
                            }
                        }
                    }
                }
            }

            Console.WriteLine("enter service id");

            Guid id = Guid.Parse(Console.ReadLine());

            IPostalCodeService postalCode = serviceProvider.GetService <IPostalCodeService>();

            await postalCode.AddPostalCodeToServiceAsync(id, ExcelData);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="V7CodeListController"/> class.
        /// </summary>
        /// <param name="commonService">The common service.</param>
        /// <param name="municipalityService">The municipality service.</param>
        /// <param name="countryService">The country service.</param>
        /// <param name="postalCodeService">The postal code service.</param>
        /// <param name="languageService">The language service.</param>
        /// <param name="userOrganizationService">The user organization service.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="logger">The logger.</param>
        public V7CodeListController(
            ICommonService commonService,
            IMunicipalityService municipalityService,
            ICountryService countryService,
            IPostalCodeService postalCodeService,
            ILanguageService languageService,
            IUserOrganizationService userOrganizationService,
            IOptions <AppSettings> settings,
            ILogger <V7CodeListController> logger) : base(userOrganizationService, settings, logger)
        {
            this.commonService       = commonService;
            this.municipalityService = municipalityService;
            this.countryService      = countryService;
            this.postalCodeService   = postalCodeService;
            this.languageService     = languageService;

            pageSize = Settings.PageSize > 0 ? Settings.PageSize : 1000;
        }
        public AddressPickerViewModel(IOrderWorkflowService orderWorkflowService,
                                      IPlaces placesService,
                                      IGeolocService geolocService,
                                      IAccountService accountService,
                                      ILocationService locationService,
                                      IPostalCodeService postalCodeService,
                                      IGeocoding geocodingService)
        {
            _orderWorkflowService = orderWorkflowService;
            _geolocService        = geolocService;
            _placesService        = placesService;
            _accountService       = accountService;
            _locationService      = locationService;
            _postalCodeService    = postalCodeService;
            _geocodingService     = geocodingService;

            Observe(_orderWorkflowService.GetAndObserveAddressSelectionMode(), addressSelectionMode => AddressSelectionMode   = addressSelectionMode);
            Observe(_orderWorkflowService.GetAndObserveDropOffSelectionMode(), dropOffSelectionMode => IsDropOffSelectionMode = dropOffSelectionMode);

            FilteredPlaces = new AddressViewModel[0];
        }
Esempio n. 5
0
 /// <summary>
 /// Constructor of Common controller
 /// </summary>
 /// <param name="logger">logger commponent to support logging - injected by framework</param>
 /// <param name="addressService">address service responsible for operation related to addresses - injected by framework</param>
 /// <param name="serviceManager">manager responsible for wrapping of individual service call to UI output format - injected by framework</param>
 /// <param name="languageService">language service responsible for operation related to languages - injected by framework</param>
 /// <param name="commonService">common service responsible for operation related to common stuff - injected by framework</param>
 /// <param name="dialCodeService">dial code service responsible for operation related to dial codes - injected by framework</param>
 /// <param name="fintoService">finto service responsible for operation related to finto stuff - injected by framework</param>
 /// <param name="countryService">country service responsible for operation related to countries - injected by framework</param>
 /// <param name="userOrganizationService">user organization service - injected by framework</param>
 /// <param name="postalCodeService">postal code service responsible for operation related to postal codes - injected by framework</param>
 public RESTCommonController(
     ILogger <RESTCommonController> logger,
     IAddressService addressService,
     IServiceManager serviceManager,
     ILanguageService languageService,
     ICommonService commonService,
     IDialCodeService dialCodeService,
     IFintoService fintoService,
     ICountryService countryService,
     IUserOrganizationService userOrganizationService,
     IPostalCodeService postalCodeService) : base(logger)
 {
     this.addressService          = addressService;
     this.serviceManager          = serviceManager;
     this.languageService         = languageService;
     this.commonService           = commonService;
     this.fintoService            = fintoService;
     this.dialCodeService         = dialCodeService;
     this.countryService          = countryService;
     this.userOrganizationService = userOrganizationService;
     this.postalCodeService       = postalCodeService;
 }
Esempio n. 6
0
 public CityController(IMapper mapper, ICityService cityService, IPostalCodeService postalCodeService)
 {
     _mapper            = mapper;
     _cityService       = cityService;
     _postalCodeService = postalCodeService;
 }
 public PostalCodeService(IPostalCodeService postalCodeService, ILogger log)
 {
     _postalCodeService = postalCodeService;
     _log = log;
 }
Esempio n. 8
0
 public PostalCodeController(IPostalCodeService postalCodeService, IMapper mapper)
 {
     _postalCodeService = postalCodeService;
     _mapper            = mapper;
 }