Example #1
0
        protected override void readCSVFile(CachedCsvReader csv)
        {
            #if(UseHeaders)
            int systemID1Index = csv.GetFieldIndex(_VLID);
            int systemID2Index = csv.GetFieldIndex(_CountryID);
            int countryNameIndex = csv.GetFieldIndex(_CountryName);
            #else
            int systemID1Index = _VLIDIndex;
            int systemID2Index = _CountryIDIndex;
            int countryNameIndex = _CountryNameIndex;
            #endif
            Dictionary<string, Country> dbCountryHash = getDBCountryListSysKey();
            List<Country> importCountryList = new List<Country>();

            Country country;
            while (csv.ReadNextRecord())
            {
                csvDataNextRow();
                string key = csv[systemID1Index];
                if (dbCountryHash.ContainsKey(key))
                {
                    country = dbCountryHash[key];
                }
                else
                {
                    country = new Country();
                    country.SystemID2 = csv[systemID2Index];
                }
                country.Name = csv[countryNameIndex];
                country.Import = true;
                country.CountryLanguage = SharedConsts.NeutralLangId;
                country.LanguageID = SharedConsts.NeutralLangId;
                country.SystemID1 = byte.Parse(csv[systemID1Index]);
                if (country.IsNew && !dbCountryHash.ContainsKey(key))
                    dbCountryHash.Add(key, country);
                if (!importCountryList.Contains(country))
                    importCountryList.Add(country);
                else
                    message(string.Format(GetLocalized("CountryExists"), _CurrentRow, _VLID, key));
            }
            csvDataEndRead();

            SaveOrUpdateList<Country>(_IContryServise, importCountryList);
        }
Example #2
0
 void FillLists()
 {
     m_listCountries.Refresh ();
     m_listRegions.Refresh ();
     m_ListStores.Refresh ();
     Country[] arrCountry = new Country [m_listCountries.Count ];
     m_listCountries.Values.CopyTo (arrCountry, 0);
     lookUpCountries.Properties.DataSource = arrCountry;
 }
Example #3
0
 public CountryName(long languageID, string name, Country country)
 {
     this._languageID = languageID;
     this._name = name;
     this._country = country;
 }