private static IDictionary <string, string> GetReplacementValuesFromFile(string fileName)
        {
            string message    = string.Empty;
            var    repository = new CSVFileRepository <ReplacementEntity>(fileName);

            if (!repository.TestDbAccess(ref message))
            {
                Logging.Logging.Instance.LogError(string.Format("Une erreur est survenue lors du chargement du dictionnaire '{0}': {1}", fileName, message), ErrorLevel.Error);
            }
            var dic = repository.GetData().ToDictionary(x => x.ValueToReplace.ToUpperInvariant(), x => x.ReplacementValue.ToUpperInvariant());

            return(dic);
        }
 private static IDictionary<string, string> BuildCountriesDictionnary()
 {
     string message = string.Empty;
     var repository = new CSVFileRepository<CountryEntity>(CountriesLabelsAndCodesFileName);
     if (!repository.TestDbAccess(ref message))
     {
         Logging.Logging.Instance.LogError(
             string.Format("Une erreur est survenue lors du chargement du dictionnaire des pays : {0}", message),
             ErrorLevel.Error);
     }
     return repository.GetData().ToDictionary(countryEntity => countryEntity.CountryName,
                                              countryEntity => countryEntity.CountryCode);
 }
Esempio n. 3
0
        private static IDictionary <string, string> BuildCountriesDictionnary()
        {
            string message    = string.Empty;
            var    repository = new CSVFileRepository <CountryEntity>(CountriesLabelsAndCodesFileName);

            if (!repository.TestDbAccess(ref message))
            {
                Logging.Logging.Instance.LogError(
                    string.Format("Une erreur est survenue lors du chargement du dictionnaire des pays : {0}", message),
                    ErrorLevel.Error);
            }
            return(repository.GetData().ToDictionary(countryEntity => countryEntity.CountryName,
                                                     countryEntity => countryEntity.CountryCode));
        }
 private static IDictionary<string, string> GetReplacementValuesFromFile(string fileName)
 {
     string message = string.Empty;
     var repository = new CSVFileRepository<ReplacementEntity>(fileName);
     if (!repository.TestDbAccess(ref message))
     {
         Logging.Logging.Instance.LogError(string.Format("Une erreur est survenue lors du chargement du dictionnaire '{0}': {1}", fileName, message), ErrorLevel.Error);
     }
     var dic = repository.GetData().ToDictionary(x => x.ValueToReplace.ToUpperInvariant(), x => x.ReplacementValue.ToUpperInvariant());
     return dic;
 }