public SetShippingInstructionsParameters(IShippingInstructions shippingInstructions) { if (shippingInstructions != null) { RequiredDeliveryDateTime = shippingInstructions.RequiredDeliveryDateTime; ShipmentDate = shippingInstructions.ShipmentDate; InternalNotes = shippingInstructions.InternalNotes; ExternalNotes = shippingInstructions.ExternalNotes; SpecialInstructions = shippingInstructions.SpecialInstructions; ShipFromOrSoldTo = shippingInstructions.ShipFromOrSoldToShippingLabel; ShipTo = shippingInstructions.ShipToShippingLabel; FreightBillTo = shippingInstructions.FreightBillToShippingLabel; } }
internal static void AssertEqual(this ShipmentInformation expected, IShippingInstructions shippingInstructions, ShippingLabel soldTo = null) { if (expected == null) { throw new ArgumentNullException("expected"); } if (shippingInstructions == null) { Assert.IsNull(expected.RequiredDeliveryDate); Assert.IsNull(expected.ShipmentDate); Assert.IsNull(expected.InternalNotes); Assert.IsNull(expected.ExternalNotes); Assert.IsNull(expected.SpecialInstructions); expected.ShipFrom.AssertEqual(null); expected.ShipTo.AssertEqual(null); expected.FreightBill.AssertEqual(null); } else { Assert.AreEqual(shippingInstructions.RequiredDeliveryDateTime, expected.RequiredDeliveryDate); Assert.AreEqual(shippingInstructions.ShipmentDate, expected.ShipmentDate); Assert.AreEqual(shippingInstructions.InternalNotes, expected.InternalNotes); Assert.AreEqual(shippingInstructions.ExternalNotes, expected.ExternalNotes); Assert.AreEqual(shippingInstructions.SpecialInstructions, expected.SpecialInstructions); if (soldTo != null) { soldTo.AssertEqual(shippingInstructions.ShipFromOrSoldToShippingLabel); } else { expected.ShipFrom.AssertEqual(shippingInstructions.ShipFromOrSoldToShippingLabel); } expected.ShipTo.AssertEqual(shippingInstructions.ShipToShippingLabel); expected.FreightBill.AssertEqual(shippingInstructions.FreightBillToShippingLabel); } }
private static void SetShippingInstructions(this ShipmentInformation shipmentInformation, IShippingInstructions shippingInstructions) { if (shipmentInformation == null) { throw new ArgumentNullException("shipmentInformation"); } ShippingLabel shipFrom = null; ShippingLabel shipTo = null; ShippingLabel freightBill = null; if (shippingInstructions == null) { shipmentInformation.RequiredDeliveryDate = null; shipmentInformation.InternalNotes = null; shipmentInformation.ExternalNotes = null; shipmentInformation.SpecialInstructions = null; } else { shipFrom = shippingInstructions.ShipFromOrSoldToShippingLabel; shipTo = shippingInstructions.ShipToShippingLabel; freightBill = shippingInstructions.FreightBillToShippingLabel; shipmentInformation.RequiredDeliveryDate = shippingInstructions.RequiredDeliveryDateTime.HasValue ? shippingInstructions.RequiredDeliveryDateTime.Value.Date : (DateTime?)null; shipmentInformation.InternalNotes = shippingInstructions.InternalNotes; shipmentInformation.ExternalNotes = shippingInstructions.ExternalNotes; shipmentInformation.SpecialInstructions = shippingInstructions.SpecialInstructions; } shipmentInformation.ShipFrom.SetShippingLabel(shipFrom); shipmentInformation.ShipTo.SetShippingLabel(shipTo); shipmentInformation.FreightBill.SetShippingLabel(freightBill); }