Example #1
0
 private void PopulateDeliveryAddressInfo(Customer customer, Address deliveryAddressDetails)
 {
     customer.DeliveryAddress1 = !String.IsNullOrEmpty(deliveryAddressDetails.Line1) ? deliveryAddressDetails.Line1 : String.Empty;
     customer.DeliveryAddress2 = !String.IsNullOrEmpty(deliveryAddressDetails.Line2) ? deliveryAddressDetails.Line2 : String.Empty;
     customer.DeliveryAddress3 = !String.IsNullOrEmpty(deliveryAddressDetails.Line3) ? deliveryAddressDetails.Line3 : String.Empty;
     customer.DeliveryAddress4 = !String.IsNullOrEmpty(deliveryAddressDetails.Line4) ? deliveryAddressDetails.Line4 : String.Empty;
     customer.DeliveryAddress5 = !String.IsNullOrEmpty(deliveryAddressDetails.Line5) ? deliveryAddressDetails.Line5 : String.Empty;
 }
Example #2
0
        public Customer Create(
			Guid id, string name, Address tradingAddressDetails, ContactInfo tradingContactInfo,
			string invoiceTitle, Address invoiceAddressDetails, ContactInfo invoiceContactInfo,
			string deliveryTitle, Address deliveryAddressDetails, ContactInfo deliveryContactInfo)
        {
            if (id == null || id == Guid.Empty)
                throw new ArgumentException("An ID must be supplied for the customer", "id");
            var customer = new Customer();
            customer.Name = name;
            customer.InvoiceTitle = !String.IsNullOrEmpty(invoiceTitle) ? invoiceTitle : String.Empty;
            customer.DeliveryTitle = !String.IsNullOrEmpty(deliveryTitle) ? deliveryTitle : String.Empty;
            PopulateTradingAddressInfo(customer, tradingAddressDetails);
            PopulateTradingContactInfo(customer, tradingContactInfo);
            PopulateInvoiceAddressInfo(customer, invoiceAddressDetails);
            PopulateSalesContactInfo(customer, invoiceContactInfo);
            PopulateDeliveryAddressInfo(customer, deliveryAddressDetails);
            PopulateDeliveryContactInfo(customer, deliveryContactInfo);
            _customerValidator.ValidateThrowOnFailure(customer);
            _customerRepository.Create(customer);
            return customer;
        }
Example #3
0
        private void EditCustomer(
			Guid id, string name, Address tradingAddressDetails, ContactInfo tradingContactInfo,
			string invoiceTitle, Address invoiceAddressDetails, ContactInfo invoiceContactInfo,
			string deliveryTitle, Address deliveryAddressDetails, ContactInfo deliveryContactInfo)
        {
            try
            {
                _customerService.Edit(
                    id, name, tradingAddressDetails, tradingContactInfo, invoiceTitle, invoiceAddressDetails, invoiceContactInfo, deliveryTitle, deliveryAddressDetails, deliveryContactInfo);
            }
            catch (DomainValidationException dex)
            {
                _domainValidationException = dex;
            }
        }
Example #4
0
 private void PopulateTradingAddressInfo(Customer customer, Address tradingAddressDetails)
 {
     customer.Address1 = !String.IsNullOrEmpty(tradingAddressDetails.Line1) ? tradingAddressDetails.Line1 : String.Empty;
     customer.Address2 = !String.IsNullOrEmpty(tradingAddressDetails.Line2) ? tradingAddressDetails.Line2 : String.Empty;
     customer.Address3 = !String.IsNullOrEmpty(tradingAddressDetails.Line3) ? tradingAddressDetails.Line3 : String.Empty;
     customer.Address4 = !String.IsNullOrEmpty(tradingAddressDetails.Line4) ? tradingAddressDetails.Line4 : String.Empty;
     customer.Address5 = !String.IsNullOrEmpty(tradingAddressDetails.Line5) ? tradingAddressDetails.Line5 : String.Empty;
 }
Example #5
0
 private void PopulateInvoiceAddressInfo(Customer customer, Address invoiceAddressDetails)
 {
     customer.InvoiceAddress1 = !String.IsNullOrEmpty(invoiceAddressDetails.Line1) ? invoiceAddressDetails.Line1 : String.Empty;
     customer.InvoiceAddress2 = !String.IsNullOrEmpty(invoiceAddressDetails.Line2) ? invoiceAddressDetails.Line2 : String.Empty;
     customer.InvoiceAddress3 = !String.IsNullOrEmpty(invoiceAddressDetails.Line3) ? invoiceAddressDetails.Line3 : String.Empty;
     customer.InvoiceAddress4 = !String.IsNullOrEmpty(invoiceAddressDetails.Line4) ? invoiceAddressDetails.Line4 : String.Empty;
     customer.InvoiceAddress5 = !String.IsNullOrEmpty(invoiceAddressDetails.Line5) ? invoiceAddressDetails.Line5 : String.Empty;
 }