コード例 #1
0
ファイル: CustomersService.cs プロジェクト: rtpHarry/OShop
        public IEnumerable<CustomerAddressPart> GetAddressesForCustomer(CustomerPart Customer)
        {
            if (Customer == null) {
                return new List<CustomerAddressPart>();
            }

            return GetAddressesForCustomer(Customer.ContentItem.Id);
        }
コード例 #2
0
        private AddressPart MapAddress(AddressViewModel source, string addressType, CustomerPart customerPart)
        {
            var addressPart = _customerService.GetAddress(customerPart.Id, addressType) ?? _customerService.CreateAddress(customerPart.Id, addressType);
            dynamic address = addressPart;

            address.Name.Value = source.Name.TrimSafe();
            address.AddressLine1.Value = source.AddressLine1.TrimSafe();
            address.AddressLine2.Value = source.AddressLine2.TrimSafe();
            address.Zipcode.Value = source.Zipcode.TrimSafe();
            address.City.Value = source.City.TrimSafe();
            address.Country.Value = source.Country.TrimSafe();

            return addressPart;
        }
コード例 #3
0
        private AddressPart MapAddress(AddressViewModel source, string addressType, CustomerPart customerPart)
        {
            var addressPart = _customerService.GetAddress(customerPart.Id, addressType) ?? _customerService.CreateAddress(customerPart.Id, addressType);

            addressPart.Name = source.Name.TrimSafe();
            addressPart.Address = source.Address.TrimSafe();
            addressPart.State = source.State.TrimSafe();
            addressPart.Postcode = source.Postcode.TrimSafe();
            addressPart.City = source.City.TrimSafe();
            addressPart.CountryCode = source.CountryCode.TrimSafe();

            return addressPart;
        }
コード例 #4
0
        private AddressViewModel MapAddress(AddressPart addressPart, CustomerPart customer)
        {
            var addressViewModel = new AddressViewModel();

            if (addressPart != null)
            {
                addressViewModel.Name = addressPart.Name;
                addressViewModel.Address = addressPart.Address;
                addressViewModel.State = addressPart.State;
                addressViewModel.Postcode = addressPart.Postcode;
                addressViewModel.City = addressPart.City;
                addressViewModel.CountryCode = addressPart.CountryCode;
            }

            addressViewModel.CountryCodes = CountryCode.SelectList;

            return addressViewModel;
        }
コード例 #5
0
        private AddressPart MapAddress(AddressViewModel source, string addressType, CustomerPart customerPart)
        {
            // Allow for many different Shipping Addresses: one for each order
            AddressPart addressPart;
            if (addressType == "InvoiceAddress")
            {
                addressPart = _customerService.GetInvoiceAddress(customerPart.Id);
                if (addressPart == null)
                    addressPart = _customerService.CreateAddress(customerPart.Id, addressType, 0);
            }
            else
            {
                addressPart = _customerService.CreateAddress(customerPart.Id, addressType, 0);
            }

            addressPart.Name = source.Name.TrimSafe();
            addressPart.Address = source.Address.TrimSafe();
            addressPart.State = source.State.TrimSafe();
            addressPart.Postcode = source.Postcode.TrimSafe();
            addressPart.City = source.City.TrimSafe();
            addressPart.CountryCode = source.CountryCode.TrimSafe();

            return addressPart;
        }
コード例 #6
0
 private object MergeBody(CustomerPart customer)
 {
     string unsubscribe = _webshopSettings.Settings.UnsubscribeEmail;
     string body = string.Format(_webshopSettings.Settings.WelcomeBodyTemplate,
         customer.FirstName, customer.LastName);
     //if (subscribed && !string.IsNullOrWhiteSpace(unsubscribe))
     //    body += "<br/><br/>PS You are subscribed to our mailing list. To unsubscribe please send an email to " + unsubscribe;
     return body;
 }