예제 #1
0
        public string ProcessAddresses(NopCommerceDataReader dataReader, NopImportContext nopImportContext)
        {
            var addressData = dataReader.GetAddressData();
            _session.Transact(session =>
            {
                foreach (var data in addressData)
                {
                    var country = nopImportContext.FindNew<Country>(data.Country.GetValueOrDefault());
                    var address = new Address
                    {
                        Address1 = data.Address1,
                        Address2 = data.Address2,
                        City = data.City,
                        Company = data.Company,
                        CountryCode = country == null ? string.Empty : country.ISOTwoLetterCode,
                        FirstName = data.FirstName,
                        LastName = data.LastName,
                        PhoneNumber = data.PhoneNumber,
                        PostalCode = data.PostalCode,
                        StateProvince = data.StateProvince,
                    };

                    session.Save(address);
                    nopImportContext.AddEntry(data.Id, address);
                }
            });
            return string.Format("{0} addresses added", addressData.Count);
        }
예제 #2
0
 public string GetAddress(Address address, string email)
 {
     var stringBuilder = new StringBuilder();
     stringBuilder.AppendFormat("name={0},", address.Name);
     stringBuilder.AppendFormat("company={0},", address.Company);
     stringBuilder.AppendFormat("addr_1={0},", address.Address1);
     stringBuilder.AppendFormat("addr_2={0},", address.Address2);
     stringBuilder.AppendFormat("city={0},", address.City);
     stringBuilder.AppendFormat("state={0},", address.StateProvince);
     stringBuilder.AppendFormat("post_code={0},", address.PostalCode);
     stringBuilder.AppendFormat("country={0},", address.GetCountryName());
     stringBuilder.AppendFormat("email={0},", email);
     return stringBuilder.ToString();
 }
예제 #3
0
 public void Delete(Address address)
 {
     _session.Transact(session => session.Delete(address));
 }
예제 #4
0
 public void Update(Address address)
 {
     _session.Transact(session => session.Update(address));
 }
예제 #5
0
 public void SetBillingAddress(Address address)
 {
     _cartSessionManager.SetSessionValue(CurrentBillingAddressKey, _getUserGuid.UserGuid, address);
 }
예제 #6
0
 public void SetShippingAddress(Address address, Guid? userGuid = null)
 {
     _cartSessionManager.SetSessionValue(CurrentShippingAddressKey, userGuid ?? _getUserGuid.UserGuid, address);
 }
예제 #7
0
 public void SetShippingAddress(Address address)
 {
     _cartManager.SetShippingAddress(address);
 }
예제 #8
0
 public void Save(Address item)
 {
     _session.Transact(session => session.SaveOrUpdate(item));
 }