Example #1
0
        public string ProcessCountries(NopCommerceDataReader dataReader, 
            NopImportContext nopImportContext)
        {
            var countryDatas = dataReader.GetCountryData();
            _session.Transact(session =>
            {
                foreach (CountryData countryData in countryDatas)
                {
                    var country = new Country
                    {
                        Name = countryData.Name,
                        ISOTwoLetterCode = countryData.IsoCode
                    };
                    session.Save(country);
                    nopImportContext.AddEntry(countryData.Id, country);
                }
            });

            return string.Format("{0} countries processed", countryDatas.Count);
        }
Example #2
0
        public string ProcessCountries(NopCommerceDataReader dataReader,
                                       NopImportContext nopImportContext)
        {
            var countryDatas = dataReader.GetCountryData();

            _session.Transact(session =>
            {
                foreach (CountryData countryData in countryDatas)
                {
                    var country = new Country
                    {
                        Name             = countryData.Name,
                        ISOTwoLetterCode = countryData.IsoCode
                    };
                    session.Save(country);
                    nopImportContext.AddEntry(countryData.Id, country);
                }
            });

            return(string.Format("{0} countries processed", countryDatas.Count));
        }
Example #3
0
        public string ProcessCountries(NopCommerceDataReader dataReader,
                                       NopImportContext nopImportContext)
        {
            var countryDatas = dataReader.GetCountryData();
            var site         = _session.Get <Site>(_site.Id);

            _session.Transact(session =>
            {
                foreach (CountryData countryData in countryDatas)
                {
                    var country = new Country
                    {
                        Name             = countryData.Name,
                        ISOTwoLetterCode = countryData.IsoCode
                    };
                    country.AssignBaseProperties(site);
                    session.Insert(country);
                    nopImportContext.AddEntry(countryData.Id, country);
                }
            });

            return(string.Format("{0} countries processed", countryDatas.Count));
        }