/// <summary>
 /// Initializes a new instance of the <see cref="ElectionsServices"/> class.
 /// </summary>
 /// <param name="webConfigReaderService">
 /// NOT CURRENTLY USED, but may use this 'slot' in the future. -SKF
 /// </param>
 /// <param name="electionsRepository">
 /// The elections repository.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// Thrown if <paramref name="electionsRepository"/> is null.
 /// </exception>
 public ElectionsServices(
     IWebConfigReaderService webConfigReaderService,
     IElectionsRepository electionsRepository)
 {
     _webConfigReaderService = webConfigReaderService;
     _electionsRepository    = electionsRepository ?? throw new ArgumentNullException(nameof(electionsRepository));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="WebConfigContainer"/> class.
        /// </summary>
        /// <param name="webConfigReaderSvc">The web configuration reader SVC.</param>
        /// <exception cref="ArgumentNullException">webConfigReaderSvc</exception>
        public WebConfigContainer(
            IWebConfigReaderService webConfigReaderSvc)
        {
            _webConfigReaderSvc = webConfigReaderSvc ?? throw new ArgumentNullException(nameof(webConfigReaderSvc));

            _electionId = -1;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpClientProvider"/> class.
        /// </summary>
        public HttpClientProvider(
            IWebConfigReaderService webConfigReader)
        {
            _webCfgRdr = webConfigReader ?? throw new ArgumentNullException(nameof(webConfigReader));

            InitializeApiHttpClient();
        }
示例#4
0
        public LoginScreenDataAccess(
            IWebConfigReaderService webConfigReaderService,
            IWebConfigContainer webConfigContainer,
            IHttpClientProvider httpClientProvider)
        {
            _webConfigContainer = webConfigContainer ?? throw new ArgumentNullException(nameof(webConfigContainer));

            // TODO: Hopefully I can kill this because IWebConfigContainer is here now.
            _webConfigReaderService =
                webConfigReaderService ?? throw new ArgumentNullException(nameof(webConfigReaderService));

            _httpClientProvider =
                httpClientProvider ?? throw new ArgumentNullException(nameof(httpClientProvider));
        }
示例#5
0
        public HomeController(
            IWebConfigReaderService webConfigReaderService,
            ILoginServices loginServices,
            IUiDependentLoginServices uiDepLoginServices,
            IUserCredentialsValidation userCredentialsValidation)
        {
            var readerService = webConfigReaderService ??
                                throw new ArgumentNullException(nameof(webConfigReaderService));

            _loginServices            = loginServices ?? throw new ArgumentNullException(nameof(loginServices));
            _uiDependentLoginServices =
                uiDepLoginServices ?? throw new ArgumentNullException(nameof(uiDepLoginServices));
            _userCredentialsValidation = userCredentialsValidation ??
                                         throw new ArgumentNullException(nameof(userCredentialsValidation));

            _currentElectionId = readerService.GetAppSetting <int>("CurrentElectionId");

            //if (_currentElectionId <= 0)
            //{
            // TODO: How should we handle this condition? -- log it! ..and... put up a notice about "come back in a hour" or something.
            //    // the read failed!
            //}
        }