Esempio n. 1
0
        public BuySellDoc GetOpenSaleWithSameCustomerAndSeller(string customerId, string ownerProductChildId, ProductChild productChild)
        {
            customerId.IsNullThrowExceptionArgument("customerId");
            ownerProductChildId.IsNullThrowExceptionArgument("ownerProductChildId");
            productChild.IsNullThrowExceptionArgument("productChild");

            BuySellDoc buysSellDoc = FindAll().FirstOrDefault(x =>
                                                              x.CustomerId == customerId &&
                                                              x.OwnerId == ownerProductChildId &&
                                                              x.BuySellDocStateEnum == BuySellDocStateENUM.RequestUnconfirmed);

            //make sure the product addresses are also the same.
            if (buysSellDoc.IsNull())
            {
                return(buysSellDoc);
            }

            if (productChild.ShipFromAddress.IsNull())
            {
                productChild.ShipFromAddressId.IsNullOrWhiteSpaceThrowException();

                productChild.ShipFromAddress = AddressBiz.Find(productChild.ShipFromAddressId);
                productChild.ShipFromAddress.IsNullThrowException();
            }
            productChild.ShipFromAddressComplex = productChild.ShipFromAddress.ToAddressComplex();

            if (buysSellDoc.AddressShipFromComplex.Equals(productChild.ShipFromAddressComplex))
            {
                return(buysSellDoc);
            }

            return(null);
        }
Esempio n. 2
0
        public void AddPickupAddress(BuySellDoc buySellDoc)
        {
            //add the PickUp From Address to the Complex
            buySellDoc.AddressShipFromId.IsNullOrWhiteSpaceThrowException("AddressShipFromId");
            AddressMain addressShipFrom = AddressBiz.Find(buySellDoc.AddressShipFromId);

            addressShipFrom.IsNullThrowException("addressShipFrom");

            buySellDoc.AddressShipFromString  = addressShipFrom.AddressWithoutContacts();
            buySellDoc.AddressShipFromComplex = addressShipFrom.ToAddressComplex();
        }
Esempio n. 3
0
 private void fixBillTo(BuySellDoc buySellDoc)
 {
     if (buySellDoc.AddressBillToId.IsNullOrWhiteSpace())
     {
         buySellDoc.AddressBillToId = null;
     }
     else
     {
         buySellDoc.AddressBillTo = AddressBiz.Find(buySellDoc.AddressBillToId);
         buySellDoc.AddressBillTo.IsNullThrowException("Bill To Address not found");
     }
 }
Esempio n. 4
0
 public void FillAddressShipToComplex(BuySellDoc buySellDoc)
 {
     if (buySellDoc.AddressShipTo.IsNull())
     {
         if (buySellDoc.AddressShipToId.IsNullOrWhiteSpace())
         {
             buySellDoc.AddressShipToComplex = new AddressComplex();
             return;
         }
         buySellDoc.AddressShipTo = AddressBiz.Find(buySellDoc.AddressShipToId);
         buySellDoc.AddressShipTo.IsNullThrowException();
     }
     buySellDoc.AddressShipToComplex = buySellDoc.AddressShipTo.ToAddressComplex();
 }
Esempio n. 5
0
 private void loadAddressShipTo(BuySellDoc buysellDoc)
 {
     if (buysellDoc.AddressShipTo.IsNull())
     {
         if (buysellDoc.AddressShipToId.IsNullOrWhiteSpace())
         {
             //do nothing
         }
         else
         {
             buysellDoc.AddressShipTo        = AddressBiz.Find(buysellDoc.AddressShipToId);
             buysellDoc.AddressShipToComplex = buysellDoc.AddressShipTo.ToAddressComplex();
         }
     }
     else
     {
         buysellDoc.AddressShipToComplex = buysellDoc.AddressShipTo.ToAddressComplex();
     }
 }