Beispiel #1
0
        /// <summary>
        /// this only fires once user has accepted to move on
        /// </summary>
        /// <param name="buySellDoc"></param>
        private void update_Customer_Person_Bill_To_Default_Address_If_empty(BuySellDoc buySellDoc)
        {
            buySellDoc.IsNullThrowException();
            buySellDoc.CustomerId.IsNullOrWhiteSpaceThrowException();
            buySellDoc.AddressBillToId.IsNullOrWhiteSpaceThrowException();
            Person customerPerson = CustomerBiz.GetPersonForPlayer(buySellDoc.CustomerId);

            customerPerson.IsNullThrowException();

            if (customerPerson.DefaultBillAddressId.IsNullOrEmpty())
            {
                customerPerson.DefaultBillAddressId = buySellDoc.AddressBillToId;
                PersonBiz.Update(customerPerson);
            }

            //Now update the Customer Default Address if required.
            //get the customer.
            Customer customer = buySellDoc.Customer;

            if (customer.IsNull())
            {
                buySellDoc.CustomerId.IsNullOrWhiteSpaceThrowException();
                customer = CustomerBiz.Find(buySellDoc.CustomerId);
                customer.IsNullThrowException();

                if (customer.DefaultBillAddressId.IsNullOrWhiteSpace())
                {
                    customer.DefaultBillAddressId = customerPerson.DefaultBillAddressId;
                    CustomerBiz.Update(customer);
                }
            }
        }
Beispiel #2
0
 private void fixCustomer(BuySellDoc buySellDoc)
 {
     //do we want to allow empty orders??
     if (buySellDoc.CustomerId.IsNullOrWhiteSpace())
     {
         buySellDoc.CustomerId = null;
     }
     else
     {
         buySellDoc.Customer = CustomerBiz.Find(buySellDoc.CustomerId);
         buySellDoc.Customer.IsNullThrowException("Customer not found!");
     }
 }
Beispiel #3
0
        private void prepareTheData(BuySellDoc buySellDoc)
        {
            buySellDoc.CustomerId.IsNullOrWhiteSpaceThrowException();
            if (buySellDoc.Customer.Person.IsNull())
            {
                Customer customer = CustomerBiz.Find(buySellDoc.CustomerId);
                customer.IsNullThrowException();
                buySellDoc.Customer = customer;
            }

            buySellDoc.Customer.PersonId.IsNullOrWhiteSpaceThrowException();
            if (buySellDoc.Customer.Person.IsNull())
            {
                Person p = PersonBiz.Find(buySellDoc.Customer.PersonId);
                p.IsNullThrowException();
                buySellDoc.Customer.Person = p;
            }

            if (buySellDoc.Customer.Person.Addresses.IsNull())
            {
                buySellDoc.Customer.Person.Addresses = new List <AddressMain>();
            }
        }