Beispiel #1
0
        private async Task CompleteEUDataByCountry(GeoZone pGeoZone)
        {
            try
            {
                string url = string.Join(string.Empty, UtilsConstants.UrlConstants.URL_TO_COMPLETE_DATA, pGeoZone.geoID);
                JArray oJArrayCountry;
                UtilsJSON.GetInstance().JsonParseJArrayFromUrl(out oJArrayCountry, url);

                if (oJArrayCountry is null)
                {
                    return;
                }

                Country oCountry = new Country();
                oCountry.oCountryList = new List <CountryData>();
                this.AddCountryDataToCountryList(oCountry.oCountryList, oJArrayCountry);

                Dictionary <string, CountryData> oDateCountryDataDictionary = new Dictionary <string, CountryData>();
                this.FillDateCountryDataDictionary(oCountry.oCountryList, oDateCountryDataDictionary);

                this.CalculateDiaryDeaths(pGeoZone.dataList, oDateCountryDataDictionary);
            }
            catch (Exception)
            {
                return;
            }
        }
Beispiel #2
0
        private void POSTToDAOGetAllDates(ref List <CovidDate> oCovidDateList)
        {
            DAOModelPOST oDAOModelPOST = new DAOModelPOST(UtilsConstants.POSTMethodsConstants.GET_ALL_DATES, null);

            oCovidDateList = UtilsJSON.GetInstance().DeserializeFromPOSTUrl(
                oCovidDateList, UtilsConstants.UrlConstants.URL_DATA_REST, oDAOModelPOST).Result;
        }
Beispiel #3
0
        private void POSTToDAOGetAllGeoZoneForAllDates(ref List <GeoZone> pAllGeoZoneList)
        {
            DAOModelPOST oDAOModelPOST = new DAOModelPOST(
                UtilsConstants.POSTMethodsConstants.GET_ALL_GEO_ZONE_FOR_ALL_DATES,
                null);

            pAllGeoZoneList = UtilsJSON.GetInstance().DeserializeFromPOSTUrl(
                pAllGeoZoneList, UtilsConstants.UrlConstants.URL_DATA_REST, oDAOModelPOST).Result;
        }
Beispiel #4
0
        public async Task <string> POSTJsonAsyncToURL <Input>(string pUrl, Input pJsonObject)
        {
            HttpClientHandler clientHandler = new HttpClientHandler();

            clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return(true); };

            using (var client = new HttpClient(clientHandler))
            {
                var response = await client.PostAsync(
                    pUrl,
                    new StringContent(UtilsJSON.GetInstance().Serialize(pJsonObject), Encoding.UTF8, "application/json"));

                return(await response.Content.ReadAsStringAsync());
            }
        }
Beispiel #5
0
        private void SetPaths()
        {
            string createTablePaths = string.Empty;
            string so = UtilsSO.GetInstance().GetSO();

            if (so.Contains("unix"))
            {
                createTablePaths = @"./DAOs/PathsFiles/insertQueries_Unix_Paths.json";
            }
            else
            {
                createTablePaths = @".\DAOs\PathsFiles\insertQueries_Unix_Paths.json";
            }

            var paths = UtilsStreamReaders.GetInstance().ReadStreamFile(createTablePaths);

            UtilsJSON.GetInstance().DeserializeFromString(out _oPathsArray, paths);
        }
Beispiel #6
0
        private void SetProperties()
        {
            _connectionProperties = String.Empty;
            string so = UtilsSO.GetInstance().GetSO();

            if (so.Contains("unix"))
            {
                _connectionProperties = @"./DAOs/Connection/connectionProperties.json";
            }
            else
            {
                _connectionProperties = @".\DAOs\Connection\connectionProperties.json";
            }

            var connectionProp = UtilsStreamReaders.GetInstance().ReadStreamFile(_connectionProperties);

            UtilsJSON.GetInstance().DeserializeFromString(out _oProperties, connectionProp);
        }
Beispiel #7
0
        private void SetPaths()
        {
            string createTablePaths;
            string so = UtilsSO.GetInstance().GetSO();

            if (so.Contains("unix"))
            {
                createTablePaths = @"./DAOs/CreateTableOperations/createTables_Unix_Paths.json";
            }
            else
            {
                createTablePaths = @".\DAOs\CreateTableOperations\createTables_Unix_Paths.json";
            }

            var   paths = UtilsStreamReaders.GetInstance().ReadStreamFile(createTablePaths);
            Paths oPathsArray;

            UtilsJSON.GetInstance().DeserializeFromString(out oPathsArray, paths);
            _oPathsArray = oPathsArray.oPaths;
        }
Beispiel #8
0
        public void SetQuery(string pPath, out Query pQuery)
        {
            string path;

            switch (pPath)
            {
            case "all":
                path = _oPaths.oPaths[0];
                break;

            case "column":
                path = _oPaths.oPaths[1];
                break;

            default:
                path = string.Empty;
                break;
            }

            UtilsJSON.GetInstance().DeserializeFromString(
                out pQuery,
                UtilsStreamReaders.GetInstance().ReadStreamFile(path));
        }
Beispiel #9
0
        private void SetPaths()
        {
            string createTablePaths = string.Empty;
            string so = UtilsSO.GetInstance().GetSO();

            if (so.Contains("unix"))
            {
                createTablePaths = @"./Processes/InitialDataInsertion/insertData_Unix_Paths.json";
            }
            else
            {
                createTablePaths = @".\Processes\InitialDataInsertion\insertData_Windows_Paths.json";
            }

            var   paths = UtilsStreamReaders.GetInstance().ReadStreamFile(createTablePaths);
            Paths oPathsArray;

            UtilsJSON.GetInstance().DeserializeFromString(out oPathsArray, paths);
            this._INSERT_DATES_QUERY_PATH             = oPathsArray.oPaths[UtilsConstants.IntConstants.ZERO];
            this._INSERT_GEOZONE_COUNTRIES_QUERY_PATH = oPathsArray.oPaths[UtilsConstants.IntConstants.THREE];
            this._INSERT_GEOZONE_NAME_QUERY_PATH      = oPathsArray.oPaths[UtilsConstants.IntConstants.ONE];
            this._INSERT_GEOZONE_QUERY_PATH           = oPathsArray.oPaths[UtilsConstants.IntConstants.TWO];
        }
Beispiel #10
0
        private void SetPaths()
        {
            string createTablePaths = string.Empty;
            string so = UtilsSO.GetInstance().GetSO();

            if (so.Contains("unix"))
            {
                createTablePaths = @"./DAOs/SelectTableOperations/selectTables_Unix_Paths.json";
            }
            else
            {
                createTablePaths = @".\\DAOs\\SelectTableOperations\\selectTables_Windows_Paths.json";
            }

            var   paths = UtilsStreamReaders.GetInstance().ReadStreamFile(createTablePaths);
            Paths oPathsArray;

            UtilsJSON.GetInstance().DeserializeFromString(out oPathsArray, paths);
            this._SELECT_FROM_COUNTRIES_QUERY_PATH     = oPathsArray.oPaths[UtilsConstants.IntConstants.ZERO];
            this._SELECT_FROM_COUNTRIES_ID_QUERY_PATH  = oPathsArray.oPaths[UtilsConstants.IntConstants.ONE];
            this._SELECT_FROM_GEONAMEDTABLE_QUERY_PATH = oPathsArray.oPaths[UtilsConstants.IntConstants.TWO];
            this._SELECT_ID_QUERY_PATH    = oPathsArray.oPaths[UtilsConstants.IntConstants.THREE];
            this._SELECT_DATES_QUERY_PATH = oPathsArray.oPaths[UtilsConstants.IntConstants.FOUR];
        }
Beispiel #11
0
        public void SetQuery(string pPath, out Query pQuery)
        {
            string query = UtilsStreamReaders.GetInstance().ReadStreamFile(pPath);

            UtilsJSON.GetInstance().DeserializeFromString(out pQuery, query);
        }
Beispiel #12
0
 public void GetData(string pPath)
 {
     UtilsJSON.GetInstance().DeserializeFromUrl(out _oRecords, pPath);
 }