public async Task <InitialDataResponse> GetInitialData()
        {
            var communicationHelper = new CommunicationHelper <InitialDataResponse, ErrorResponse> {
                Timeout = GetTimeout()
            };

            var authenticationHeader = await _accountService.GetAuthenticationHeader();

            var response = await communicationHelper.GetRequest(_urlHelper.BuildUrl("api/Cases"), authenticationHeader);


            if (response == null)
            {
                throw new CommunicationException(communicationHelper.ErrorResponse?.ToStringList());
            }

            return(response);
        }
Beispiel #2
0
        public async Task <CurrentVersionResponse> UpdateRequired()
        {
            var timeoutSeconds = _settingsService.Setting <int?>("Communication.TimeoutSeconds");
            var timeout        = (timeoutSeconds.HasValue)
                                                                        ? (TimeSpan?)TimeSpan.FromSeconds(timeoutSeconds.Value)
                                                                        : null;

            var communicationHelper = new CommunicationHelper <CurrentVersionResponse, ErrorResponse> {
                Timeout = timeout
            };

            Dictionary <string, string> queryString = new Dictionary <string, string>();

            queryString["appVersion"] = _versionService.VersionNumber();
            queryString["noCache"]    = DateTime.UtcNow.Ticks.ToString();

            var response = await communicationHelper.GetRequest(_urlHelper.BuildUrl("api/Cases/CurrentVersion", queryString));

            return(response);
        }
        public async Task <LocationsAndServicesResponse> GetLocationsAndServices(int caseId, DateTime date)
        {
            var communicationHelper = new CommunicationHelper <LocationsAndServicesResponse, ErrorResponse> {
                Timeout = GetTimeout()
            };

            var authenticationHeader = await _accountService.GetAuthenticationHeader();

            Dictionary <string, string> queryValues = new Dictionary <string, string>();

            queryValues["caseId"] = caseId.ToString(CultureInfo.InvariantCulture);
            queryValues["date"]   = date.ToString("yyyyMMdd", CultureInfo.InvariantCulture);

            var response = await communicationHelper.GetRequest(_urlHelper.BuildUrl("api/Cases/LocationsAndServices", queryValues), authenticationHeader);

            if (response == null)
            {
                throw new CommunicationException(communicationHelper.ErrorResponse?.ToStringList());
            }

            return(response);
        }