Example #1
0
        protected override void readCSVFile(CachedCsvReader csv)
        {
            #if(UseHeaders)
            int systemID1Index = csv.GetFieldIndex(_VLID);
            int regionNameIndex = csv.GetFieldIndex(_RegionName);
            #else
            int systemID1Index = _VLIDIndex;
            int regionNameIndex = _RegionNameIndex;
            #endif
            Dictionary<string, Region> dbRegionHash = getDBRegionList();
            Dictionary<string, long> countrySysKeyIDKey = getDBCountryListSysKeyIDKey();
            List<Region> importRegionList = new List<Region>();

            int i = 1;
            while (csv.ReadNextRecord())
            {
                csvDataNextRow();
                string regionName = csv[regionNameIndex];
                string keyCountry = csv[systemID1Index];
                string keyRegion = keyCountry + regionName;

                if (!dbRegionHash.ContainsKey(keyRegion))
                {
                    if (countrySysKeyIDKey.ContainsKey(keyCountry))
                    {
                        Region region = new Region();
                        region.CountryID = countrySysKeyIDKey[keyCountry];
                        region.LanguageID = SharedConsts.NeutralLangId;
                        region.Name = regionName;
                        region.Import = true;
                        region.RegionSysID = regionName;
                        importRegionList.Add(region);
                        dbRegionHash.Add(keyRegion, region);
                    }
                    else
                    {
                        message(string.Format(GetLocalized("CountryNotExistsDB"), _CurrentRow, _VLID, keyCountry));
                    }
                }
                else
                {
                    message(string.Format(GetLocalized("RegiontExistsDB"), i, keyRegion));
                }
                i++;
            }
            csvDataEndRead();

            SaveOrUpdateList<Region>(_RegionService, importRegionList);
        }
Example #2
0
 public RegionName( long languageID, string name, Region region )
 {
     this._languageID = languageID;
     this._name = name;
     this._region = region;
 }