Exemple #1
0
        internal static void AssertEqual(this ShipmentInformation expected, ITransitInformation result)
        {
            if (expected == null)
            {
                throw new ArgumentNullException("expected");
            }

            if (result == null)
            {
                Assert.IsNull(expected.FreightBillType);
                Assert.IsNull(expected.ShipmentMethod);
                Assert.IsNull(expected.DriverName);
                Assert.IsNull(expected.CarrierName);
                Assert.IsNull(expected.TrailerLicenseNumber);
                Assert.IsNull(expected.ContainerSeal);
            }
            else
            {
                Assert.AreEqual(result.FreightType, expected.FreightBillType);
                Assert.AreEqual(result.ShipmentMethod, expected.ShipmentMethod);
                Assert.AreEqual(result.DriverName, expected.DriverName);
                Assert.AreEqual(result.CarrierName, expected.CarrierName);
                Assert.AreEqual(result.TrailerLicenseNumber, expected.TrailerLicenseNumber);
                Assert.AreEqual(result.ContainerSeal, expected.ContainerSeal);
            }
        }
        private static void SetTransitInformation(this ShipmentInformation shipInfo, ISetTransitInformation transitInformation)
        {
            if (shipInfo == null)
            {
                throw new ArgumentNullException("shipInfo");
            }

            if (transitInformation == null)
            {
                shipInfo.FreightBillType      = null;
                shipInfo.ShipmentMethod       = null;
                shipInfo.DriverName           = null;
                shipInfo.CarrierName          = null;
                shipInfo.TrailerLicenseNumber = null;
                shipInfo.ContainerSeal        = null;
            }
            else
            {
                shipInfo.FreightBillType      = transitInformation.FreightBillType;
                shipInfo.ShipmentMethod       = transitInformation.ShipmentMethod;
                shipInfo.DriverName           = transitInformation.DriverName;
                shipInfo.CarrierName          = transitInformation.CarrierName;
                shipInfo.TrailerLicenseNumber = transitInformation.TrailerLicenseNumber;
                shipInfo.ContainerSeal        = transitInformation.ContainerSeal;
            }
        }
        internal static void SetShipmentInformation(this ShipmentInformation shipmentInformation, ISetShipmentInformation shipment, bool setShipFrom = true)
        {
            if (shipmentInformation == null)
            {
                throw new ArgumentNullException("shipmentInformation");
            }

            if (shipment == null)
            {
                shipmentInformation.Status              = ShipmentStatus.Unscheduled;
                shipmentInformation.PalletWeight        = null;
                shipmentInformation.PalletQuantity      = 0;
                shipmentInformation.ExternalNotes       = null;
                shipmentInformation.InternalNotes       = null;
                shipmentInformation.SpecialInstructions = null;

                shipmentInformation.SetShippingInstructions(null, setShipFrom);
                shipmentInformation.SetTransitInformation((ISetTransitInformation)null);
            }
            else
            {
                shipmentInformation.PalletWeight   = shipment.PalletWeight;
                shipmentInformation.PalletQuantity = shipment.PalletQuantity;

                shipmentInformation.SetShippingInstructions(shipment.ShippingInstructions, setShipFrom);
                shipmentInformation.SetTransitInformation(shipment.TransitInformation);
            }
        }
        private static void SetShippingInstructions(this ShipmentInformation shipInfo, ISetShippingInstructions shippingInstructions, bool setShipFrom)
        {
            if (shipInfo == null)
            {
                throw new ArgumentNullException("shipInfo");
            }

            if (shippingInstructions == null)
            {
                shipInfo.RequiredDeliveryDate = null;
                shipInfo.ShipmentDate         = null;

                shipInfo.InternalNotes       = null;
                shipInfo.ExternalNotes       = null;
                shipInfo.SpecialInstructions = null;

                shipInfo.ShipFrom    = new ShippingLabel();
                shipInfo.ShipTo      = new ShippingLabel();
                shipInfo.FreightBill = new ShippingLabel();
            }
            else
            {
                shipInfo.RequiredDeliveryDate = shippingInstructions.RequiredDeliveryDateTime;
                shipInfo.ShipmentDate         = shippingInstructions.ShipmentDate;

                shipInfo.InternalNotes       = shippingInstructions.InternalNotes;
                shipInfo.ExternalNotes       = shippingInstructions.ExternalNotes;
                shipInfo.SpecialInstructions = shippingInstructions.SpecialInstructions;

                shipInfo.ShipFrom    = (setShipFrom ? shippingInstructions.ShipFromOrSoldTo : null) ?? new ShippingLabel();
                shipInfo.ShipTo      = shippingInstructions.ShipTo ?? new ShippingLabel();
                shipInfo.FreightBill = shippingInstructions.FreightBillTo ?? new ShippingLabel();
            }
        }
        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);
        }
Exemple #6
0
        internal static void AssertEqual(this ShipmentInformation expected, IShipmentInformationReturn result, ShippingLabel soldTo = null)
        {
            if (expected == null)
            {
                throw new ArgumentNullException("expected");
            }

            if (result == null)
            {
                Assert.AreEqual(ShipmentStatus.Unscheduled, expected.Status);
                Assert.AreEqual(0.0, expected.PalletWeight);
                Assert.AreEqual(0, expected.PalletQuantity);
                Assert.IsNull(expected.InternalNotes);
                Assert.IsNull(expected.ExternalNotes);
                Assert.IsNull(expected.SpecialInstructions);

                expected.AssertEqual((ISetTransitInformation)null);
                expected.AssertEqual((ISetShippingInstructions)null, soldTo);
            }
            else
            {
                Assert.AreEqual(result.PalletWeight, expected.PalletWeight);
                Assert.AreEqual(result.PalletQuantity, expected.PalletQuantity);

                expected.AssertEqual(result.TransitInformation);
                expected.AssertEqual(result.ShippingInstructions, soldTo);
            }
        }
Exemple #7
0
 internal static void AssertEqual(this ISetShipmentInformation expected, ShipmentInformation result, ShippingLabel soldTo = null)
 {
     expected = expected ?? new SetShipmentInformationWithStatus();
     Assert.AreEqual(expected.PalletWeight, result.PalletWeight);
     Assert.AreEqual(expected.PalletQuantity, result.PalletQuantity);
     expected.ShippingInstructions.AssertEqual(result, soldTo);
     expected.TransitInformation.AssertEqual(result);
 }
        internal static void SetShipmentInformation(this ShipmentInformation shipmentInformation, ISetShipmentInformationWithStatus shipment)
        {
            if (shipmentInformation == null)
            {
                throw new ArgumentNullException("shipmentInformation");
            }

            shipmentInformation.SetShipmentInformation(shipment as ISetShipmentInformation);
            shipmentInformation.Status = shipment == null ? ShipmentStatus.Unscheduled : shipment.ShipmentStatus;
        }
Exemple #9
0
        internal static void AssertEqual(this ISetTransitInformation expected, ShipmentInformation result)
        {
            expected = expected ?? new SetTransitInformation();

            Assert.AreEqual(expected.FreightBillType, result.FreightBillType);
            Assert.AreEqual(expected.ShipmentMethod, result.ShipmentMethod);
            Assert.AreEqual(expected.DriverName, result.DriverName);
            Assert.AreEqual(expected.CarrierName, result.CarrierName);
            Assert.AreEqual(expected.TrailerLicenseNumber, result.TrailerLicenseNumber);
            Assert.AreEqual(expected.ContainerSeal, result.ContainerSeal);
        }
 private ShipmentTableEntity MapToTableEntry(ShipmentInformation shipmentInformation)
 {
     return(new ShipmentTableEntity
     {
         PartitionKey = shipmentInformation.TrackingNumber,
         RowKey = DateTimeOffset.UtcNow.ToString("s"),
         TrackingNumber = shipmentInformation.TrackingNumber,
         DeliveryAddress = JsonConvert.SerializeObject(shipmentInformation.DeliveryAddress),
         Status = shipmentInformation.Status.ToString(),
     });
 }
Exemple #11
0
        internal static void AssertEqual(this ISetShippingInstructions expected, ShipmentInformation result, ShippingLabel soldTo = null)
        {
            expected = expected ?? new SetShippingInstructions();

            Assert.AreEqual(expected.RequiredDeliveryDateTime, result.RequiredDeliveryDate);
            Assert.AreEqual(expected.ShipmentDate, result.ShipmentDate);
            Assert.AreEqual(expected.InternalNotes, result.InternalNotes);
            Assert.AreEqual(expected.ExternalNotes, result.ExternalNotes);
            Assert.AreEqual(expected.SpecialInstructions, result.SpecialInstructions);
            expected.ShipFromOrSoldTo.AssertEquivalent(soldTo ?? result.ShipFrom);
            expected.ShipTo.AssertEquivalent(result.ShipTo);
            expected.FreightBillTo.AssertEquivalent(result.FreightBill);
        }
        // end



        public string SaveAcceptance(string HAWBNo, Int32 HAWBSNo, ShipmentInformation ShipmentInformation, List <HAWBSPHC> AwbSPHC, List <HAWBSPHCTrans> AWBSPHCTrans, Int32 UpdatedBy)
        {
            try
            {
                List <ShipmentInformation> lstShipmentInformation = new List <ShipmentInformation>();
                lstShipmentInformation.Add(ShipmentInformation);

                // List<HAWBSPHC> lstAWBSPHC = new List<HAWBSPHC>();
                // lstAWBSPHC.Add(AwbSPHC);

                DataTable dtShipmentInformation = CollectionHelper.ConvertTo(lstShipmentInformation, "");
                DataTable dtAWBSPHC             = CollectionHelper.ConvertTo(AwbSPHC, "");
                DataTable dtAWBSPHCTrans        = CollectionHelper.ConvertTo(AWBSPHCTrans, "SNo");

                BaseBusiness baseBusiness = new BaseBusiness();

                SqlParameter paramShipmentInformation = new SqlParameter();
                paramShipmentInformation.ParameterName = "@ShipmentInformation";
                paramShipmentInformation.SqlDbType     = System.Data.SqlDbType.Structured;
                paramShipmentInformation.Value         = dtShipmentInformation;

                SqlParameter paramAWBSPHC = new SqlParameter();
                paramAWBSPHC.ParameterName = "@HAWBSPHC";
                paramAWBSPHC.SqlDbType     = System.Data.SqlDbType.Structured;
                paramAWBSPHC.Value         = dtAWBSPHC;

                SqlParameter paramAWBSPHCTrans = new SqlParameter();
                paramAWBSPHCTrans.ParameterName = "@HAWBSPHCTrans";
                paramAWBSPHCTrans.SqlDbType     = System.Data.SqlDbType.Structured;
                paramAWBSPHCTrans.Value         = dtAWBSPHCTrans;


                DataSet        ds         = new DataSet();
                SqlParameter[] Parameters = { new SqlParameter("@HAWBNo", HAWBNo), new SqlParameter("@HAWBSNo", HAWBSNo), paramShipmentInformation, paramAWBSPHC, paramAWBSPHCTrans, new SqlParameter("@UpdatedBy", UpdatedBy) };
                DataSet        ds1        = new DataSet();
                //try
                //{
                ds = SqlHelper.ExecuteDataset(DMLConnectionString.WebConfigConnectionString, "HousesaveAcceptance", Parameters);
                return(ds.Tables[ds.Tables.Count - 1].Rows[0][0].ToString());
            }
            catch (Exception ex)//
            {
                throw ex;
            }
            //}
            //catch(Exception ex)// (Exception ex)
            //{
            //    return ex.Message;
            //}
        }
Exemple #13
0
        public Task <ShipmentInformation> CreateAsync(Order createdOrder)
        {
            var trackingNumber = Guid.NewGuid().ToString();

            var shipmentInformation = new ShipmentInformation
            {
                TrackingNumber  = trackingNumber,
                DeliveryAddress = createdOrder.Customer.Address,
                Status          = ShipmentStatus.AwaitingPickup
            };

            _shipments.Add(trackingNumber, shipmentInformation);

            return(Task.FromResult(shipmentInformation));
        }
        public async Task <ShipmentInformation> CreateAsync(Address address)
        {
            var trackingNumber = Guid.NewGuid().ToString();

            var shipmentInformation = new ShipmentInformation
            {
                TrackingNumber  = trackingNumber,
                DeliveryAddress = address,
                Status          = ShipmentStatus.AwaitingPickup
            };

            var shipmentInformationTableEntry = MapToTableEntry(shipmentInformation);
            await _tableStorageAccessor.PersistAsync(TableName, shipmentInformationTableEntry);

            return(shipmentInformation);
        }
Exemple #15
0
        internal static void AssertEqual(this ShipmentInformation expected, ISetShipmentInformationWithStatus setShipmentInformation)
        {
            if (expected == null)
            {
                throw new ArgumentNullException("expected");
            }

            expected.AssertEqual((ISetShipmentInformation)setShipmentInformation);
            if (setShipmentInformation == null)
            {
                Assert.AreEqual(ShipmentStatus.Unscheduled, expected.Status);
            }
            else
            {
                Assert.AreEqual(setShipmentInformation.ShipmentStatus, expected.Status);
            }
        }
 private static void SetTransitInformation(this ShipmentInformation shipmentInformation, ITransitInformation transitInformation)
 {
     if (transitInformation == null)
     {
         shipmentInformation.FreightBillType      = null;
         shipmentInformation.DriverName           = null;
         shipmentInformation.CarrierName          = null;
         shipmentInformation.TrailerLicenseNumber = null;
         shipmentInformation.ContainerSeal        = null;
     }
     else
     {
         shipmentInformation.FreightBillType      = transitInformation.FreightType;
         shipmentInformation.DriverName           = transitInformation.DriverName;
         shipmentInformation.CarrierName          = transitInformation.CarrierName;
         shipmentInformation.TrailerLicenseNumber = transitInformation.TrailerLicenseNumber;
         shipmentInformation.ContainerSeal        = transitInformation.ContainerSeal;
     }
 }
        internal static void SetShipmentInformation(this ShipmentInformation shipmentInformation, IShipmentDetailReturn shipment)
        {
            if (shipmentInformation == null)
            {
                throw new ArgumentNullException("shipmentInformation");
            }

            if (shipmentInformation.ShipFrom == null)
            {
                shipmentInformation.ShipFrom = new ShippingLabel();
            }
            if (shipmentInformation.ShipTo == null)
            {
                shipmentInformation.ShipTo = new ShippingLabel();
            }
            if (shipmentInformation.FreightBill == null)
            {
                shipmentInformation.FreightBill = new ShippingLabel();
            }

            if (shipment == null)
            {
                shipmentInformation.Status         = ShipmentStatus.Unscheduled;
                shipmentInformation.PalletWeight   = 0.0;
                shipmentInformation.PalletQuantity = 0;

                shipmentInformation.SetShippingInstructions(null);
                shipmentInformation.SetTransitInformation((ITransitInformation)null);
            }
            else
            {
                shipmentInformation.Status         = shipment.Status;
                shipmentInformation.PalletWeight   = shipment.PalletWeight;
                shipmentInformation.PalletQuantity = shipment.PalletQuantity;

                shipmentInformation.SetShippingInstructions(shipment.ShippingInstructions);
                shipmentInformation.SetTransitInformation(shipment.TransitInformation);
            }
        }
Exemple #18
0
        internal static void AssertEqual(this ShipmentInformation expected, ISetShippingInstructions 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.ShipFromOrSoldTo);
                }
                else
                {
                    expected.ShipFrom.AssertEqual(shippingInstructions.ShipFromOrSoldTo);
                }
                expected.ShipTo.AssertEqual(shippingInstructions.ShipTo);
                expected.FreightBill.AssertEqual(shippingInstructions.FreightBillTo);
            }
        }
Exemple #19
0
        protected override IEnumerable <SalesQuote> BirthRecords()
        {
            var dateSequences = new Dictionary <DateTime, int>();

            foreach (var oldQuote in SelectRecordsToLoad())
            {
                LoadCount.AddRead(EntityType.SalesQuote);

                var sourceFacility = _newContextHelper.GetFacility(oldQuote.WHID);
                if (oldQuote.WHID != null && sourceFacility == null)
                {
                    Log(new CallbackParameters(CallbackReason.FacilityNotFound)
                    {
                        tblQuote = oldQuote
                    });
                    continue;
                }

                var customer = _newContextHelper.GetCompany(oldQuote.Company_IA, CompanyType.Customer);
                if (oldQuote.Company_IA != null && customer == null)
                {
                    Log(new CallbackParameters(CallbackReason.CompanyNotFound)
                    {
                        tblQuote = oldQuote
                    });
                    continue;
                }

                var broker = _newContextHelper.GetCompany(oldQuote.Broker, CompanyType.Broker);
                if (oldQuote.Broker != null && broker == null)
                {
                    Log(new CallbackParameters(CallbackReason.BrokerNotFound)
                    {
                        tblQuote = oldQuote
                    });
                    continue;
                }

                var dateCreated = oldQuote.EntryDate.Value.Date;

                var shipmentInformation = new ShipmentInformation
                {
                    DateCreated = dateCreated,
                    Sequence    = _newContextHelper.ShipmentInformationKeys.GetNextSequence(dateCreated),

                    Status               = ShipmentStatus.Scheduled,
                    PalletWeight         = (double?)oldQuote.PalletOR,
                    PalletQuantity       = (int)(oldQuote.PalletQty ?? 0),
                    FreightBillType      = oldQuote.FreightBillType,
                    ShipmentMethod       = oldQuote.ShipVia,
                    DriverName           = oldQuote.Driver,
                    CarrierName          = oldQuote.Carrier,
                    TrailerLicenseNumber = oldQuote.TrlNbr,
                    ContainerSeal        = oldQuote.ContSeal,

                    RequiredDeliveryDate = oldQuote.DelDueDate,
                    ShipmentDate         = oldQuote.Date ?? oldQuote.SchShipDate,
                    InternalNotes        = oldQuote.InternalNotes,
                    ExternalNotes        = oldQuote.ExternalNotes,
                    SpecialInstructions  = oldQuote.SpclInstr,

                    ShipTo      = oldQuote.ShipTo,
                    FreightBill = oldQuote.BillTo
                };

                int sequence;
                if (!dateSequences.TryGetValue(dateCreated, out sequence))
                {
                    sequence = 0;
                }

                var employeeId = _newContextHelper.DefaultEmployee.EmployeeId;
                if (oldQuote.EmployeeID == null)
                {
                    Log(new CallbackParameters(CallbackReason.DefaultEmployee)
                    {
                        tblQuote = oldQuote
                    });
                }
                else
                {
                    employeeId = oldQuote.EmployeeID.Value;
                }

                var salesQuote = new SalesQuote
                {
                    TimeStamp  = oldQuote.EntryDate.Value.ConvertLocalToUTC(),
                    EmployeeId = employeeId,

                    DateCreated = dateCreated,
                    Sequence    = sequence,

                    QuoteNum     = oldQuote.QuoteNum,
                    QuoteDate    = oldQuote.Date.Value,
                    DateReceived = oldQuote.DateRecd,
                    CalledBy     = oldQuote.From,
                    TakenBy      = oldQuote.TakenBy,
                    PaymentTerms = oldQuote.PayTerms,

                    SourceFacilityId = sourceFacility == null ? (int?)null : sourceFacility.Id,
                    CustomerId       = customer == null ? (int?)null : customer.Id,
                    BrokerId         = broker == null ? (int?)null : broker.Id,

                    ShipmentInfoDateCreated = shipmentInformation.DateCreated,
                    ShipmentInfoSequence    = shipmentInformation.Sequence,
                    ShipmentInformation     = shipmentInformation,

                    SoldTo = oldQuote.SoldTo,

                    Items = new List <SalesQuoteItem>()
                };

                var itemSequence = 0;
                foreach (var detail in oldQuote.Details)
                {
                    LoadCount.AddRead(EntityType.SalesQuoteItem);

                    var product = _newContextHelper.GetProduct(detail.ProdID);
                    if (product == null)
                    {
                        Log(new CallbackParameters(CallbackReason.ProductNotFound)
                        {
                            tblQuoteDetail = detail
                        });
                        continue;
                    }

                    var packaging = _newContextHelper.GetPackagingProduct(detail.PkgID);
                    if (packaging == null)
                    {
                        Log(new CallbackParameters(CallbackReason.PackagingNotFound)
                        {
                            tblQuoteDetail = detail
                        });
                        continue;
                    }

                    var treatment = _newContextHelper.GetInventoryTreatment(detail.TrtmtID ?? 0);
                    if (treatment == null)
                    {
                        Log(new CallbackParameters(CallbackReason.TreatmentNotFound)
                        {
                            tblQuoteDetail = detail
                        });
                        continue;
                    }

                    salesQuote.Items.Add(new SalesQuoteItem
                    {
                        DateCreated  = salesQuote.DateCreated,
                        Sequence     = salesQuote.Sequence,
                        ItemSequence = itemSequence++,

                        QDetailID = detail.QDetail,

                        ProductId          = product.ProductKey.ProductKey_ProductId,
                        PackagingProductId = packaging.Id,
                        TreatmentId        = treatment.Id,

                        Quantity            = (int)(detail.Quantity ?? 0),
                        PriceBase           = (double)(detail.Price ?? 0),
                        PriceFreight        = (double)(detail.FreightP ?? 0),
                        PriceTreatment      = (double)(detail.TrtnmntP ?? 0),
                        PriceWarehouse      = (double)(detail.WHCostP ?? 0),
                        PriceRebate         = (double)(detail.Rebate ?? 0),
                        CustomerProductCode = detail.CustProductCode,
                    });
                }

                LoadCount.AddLoaded(EntityType.SalesQuote);
                LoadCount.AddLoaded(EntityType.SalesQuoteItem, (uint)salesQuote.Items.Count);

                yield return(salesQuote);

                if (!dateSequences.ContainsKey(dateCreated))
                {
                    dateSequences.Add(dateCreated, sequence);
                }
                dateSequences[dateCreated] += 1;
            }
        }
        protected ShipmentInformation CreateShipmentInformation(IShipmentInformationKey shipmentInformationKey, MovementOrderDTO order)
        {
            LoadCount.AddRead(EntityTypes.ShipmentInformation);

            var truncated = false;
            var shipmentInfo = new ShipmentInformation
                {
                    DateCreated = shipmentInformationKey.ShipmentInfoKey_DateCreated,
                    Sequence = shipmentInformationKey.ShipmentInfoKey_Sequence,
                    
                    Status = ShipmentStatusExtensions.FromOrderStatID(order.Status),
                    PalletWeight = (double?) order.PalletOR,
                    PalletQuantity = (int)(order.PalletQty ?? 0),
                    FreightBillType = order.FreightBillType.AnyTruncate(Constants.StringLengths.FreightBillType, ref truncated),
                    ShipmentMethod = order.ShipVia.AnyTruncate(Constants.StringLengths.ShipmentMethod, ref truncated),
                    DriverName = order.Driver.AnyTruncate(Constants.StringLengths.DriverName, ref truncated),
                    CarrierName = order.Carrier.AnyTruncate(Constants.StringLengths.CarrierName, ref truncated),
                    TrailerLicenseNumber = order.TrlNbr.AnyTruncate(Constants.StringLengths.TrailerLicenseNumber, ref truncated),
                    ContainerSeal = order.ContSeal.AnyTruncate(Constants.StringLengths.ContainerSeal, ref truncated),

                    RequiredDeliveryDate = order.DelDueDate,
                    ShipmentDate = order.Date ?? order.SchdShipDate,

                    InternalNotes = order.InternalNotes.AnyTruncate(Constants.StringLengths.ShipmentInformationNotes, ref truncated),
                    ExternalNotes = order.ExternalNotes.AnyTruncate(Constants.StringLengths.ShipmentInformationNotes, ref truncated),
                    SpecialInstructions = order.SpecialInstructions.AnyTruncate(Constants.StringLengths.ShipmentInformationNotes, ref truncated),

                    ShipFrom = new ShippingLabel
                        {
                            Name = order.CCompany.AnyTruncate(Constants.StringLengths.ShippingLabelName, ref truncated),
                            Address = new Address
                            {
                                AddressLine1 = order.CAddress1.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine2 = order.CAddress2.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine3 = order.CAddress3.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                City = order.CCity.AnyTruncate(Constants.StringLengths.AddressCity, ref truncated),
                                State = order.CState.AnyTruncate(Constants.StringLengths.AddressState, ref truncated),
                                PostalCode = order.CZip.AnyTruncate(Constants.StringLengths.AddressPostalCode, ref truncated),
                                Country = order.CCountry.AnyTruncate(Constants.StringLengths.AddressCountry, ref truncated)
                            }
                        },
                    ShipTo = new ShippingLabel
                        {
                            Name = order.SCompany.AnyTruncate(Constants.StringLengths.ShippingLabelName, ref truncated),
                            Phone = order.SPhone.AnyTruncate(Constants.StringLengths.PhoneNumber, ref truncated),
                            Address = new Address
                            {
                                AddressLine1 = order.SAddress1.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine2 = order.SAddress2.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine3 = order.SAddress3.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                City = order.SCity.AnyTruncate(Constants.StringLengths.AddressCity, ref truncated),
                                State = order.SState.AnyTruncate(Constants.StringLengths.AddressState, ref truncated),
                                PostalCode = order.SZip.AnyTruncate(Constants.StringLengths.AddressPostalCode, ref truncated),
                                Country = order.SCountry.AnyTruncate(Constants.StringLengths.AddressCountry, ref truncated)
                            }
                        },
                    FreightBill = new ShippingLabel
                        {
                            Name = order.Company.AnyTruncate(Constants.StringLengths.ShippingLabelName, ref truncated),
                            Phone = order.Phone.AnyTruncate(Constants.StringLengths.PhoneNumber, ref truncated),
                            EMail = order.Email.AnyTruncate(Constants.StringLengths.Email, ref truncated),
                            Fax = order.Fax.AnyTruncate(Constants.StringLengths.Fax, ref truncated),
                            Address = new Address
                            {
                                AddressLine1 = order.Address1.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine2 = order.Address2.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine3 = order.Address3.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                City = order.City.AnyTruncate(Constants.StringLengths.AddressCity, ref truncated),
                                State = order.State.AnyTruncate(Constants.StringLengths.AddressState, ref truncated),
                                PostalCode = order.Zip.AnyTruncate(Constants.StringLengths.AddressPostalCode, ref truncated),
                                Country = order.Country.AnyTruncate(Constants.StringLengths.AddressCountry, ref truncated)
                            }
                        }
                };

            return shipmentInfo;
        }
Exemple #21
0
        internal static SetShipmentInformationWithStatus ToSetShipmentInformationWithStatus(this ShipmentInformation information, Action <SetShipmentInformationWithStatus> initialize = null)
        {
            var parameters = new SetShipmentInformationWithStatus
            {
                ShipmentStatus = information.Status,
                PalletWeight   = information.PalletWeight,
                PalletQuantity = information.PalletQuantity,

                ShippingInstructions = new SetShippingInstructions
                {
                    ShipFromOrSoldTo         = information.ShipFrom,
                    ShipTo                   = information.ShipTo,
                    FreightBillTo            = information.FreightBill,
                    RequiredDeliveryDateTime = information.RequiredDeliveryDate,
                    ShipmentDate             = information.ShipmentDate,
                    InternalNotes            = information.InternalNotes,
                    ExternalNotes            = information.ExternalNotes,
                    SpecialInstructions      = information.SpecialInstructions
                },

                TransitInformation = new SetTransitInformation
                {
                    FreightBillType      = information.FreightBillType,
                    ShipmentMethod       = information.ShipmentMethod,
                    DriverName           = information.DriverName,
                    CarrierName          = information.CarrierName,
                    TrailerLicenseNumber = information.TrailerLicenseNumber,
                    ContainerSeal        = information.ContainerSeal
                }
            };

            if (initialize != null)
            {
                initialize(parameters);
            }

            return(parameters);
        }