public UpdateParcelsRequestType Map(CentiroUpdateParcels report) { if (report == null) { return(null); } UpdateParcelsRequestType request = new UpdateParcelsRequestType(); request.SenderCode = SafeSubstring(report.senderCode, 0, 50); request.ShipmentIdentifier = report.shipmentIdentifier; if (report.aggregateParcels.Equals("1")) { request.AggregateParcels = true; } else { request.AggregateParcels = false; } List <CentiroService.Parcel> l = new List <CentiroService.Parcel>(); CentiroUpdateParcelsParcels Parcels = report.Parcels; foreach (CentiroUpdateParcelType p in Parcels.Parcel) { CentiroService.Parcel Parcel = new CentiroService.Parcel(); Parcel.DeliveryInstruction1 = SafeSubstring(p.deliveryInstructions, 0, 50); Parcel.DeliveryInstruction2 = SafeSubstring(p.deliveryInstructions, 50, 50); Parcel.DeliveryInstruction3 = SafeSubstring(p.deliveryInstructions, 100, 50); Parcel.DeliveryInstruction4 = SafeSubstring(p.deliveryInstructions, 150, 50); Parcel.Height = Convert.ToDouble(p.height, _numFormatInfo); Parcel.LastModifiedBy = p.lastModifiedBy; Parcel.Length = Convert.ToDouble(p.length, _numFormatInfo); Parcel.LoadingMeasure = Convert.ToDouble(p.loadingMeasure, _numFormatInfo); Parcel.NetWeight = Convert.ToDouble(p.netWeight, _numFormatInfo); Parcel.ParcelIdentifier = p.parcelIdentifier; Parcel.SequenceNo = p.sequenceNo; Parcel.SequenceNoSSCC = p.sequenceNoSSCC; Parcel.ShippingLocation = p.shippingLocation; Parcel.TransportInstruction1 = SafeSubstring(p.transportInstructions, 0, 50); Parcel.TransportInstruction2 = SafeSubstring(p.transportInstructions, 50, 50); Parcel.TransportInstruction3 = SafeSubstring(p.transportInstructions, 100, 50); Parcel.TypeOfGoods = p.typeOfGoods; Parcel.TypeOfPackage = p.typeOfPackage; Parcel.Weight = Convert.ToDouble(p.weight, _numFormatInfo); Parcel.Width = Convert.ToDouble(p.width, _numFormatInfo); Parcel.Volume = Convert.ToDouble(p.volume, _numFormatInfo); l.Add(Parcel); } request.Parcels = l; return(request); }
private void UpdateParcel(string requestClob) { CentiroUpdateParcels report = _updateParcelSerializer.Deserialize(new StringReader(requestClob)) as CentiroUpdateParcels; UpdateParcelsRequestType request = _businessDataMapper.Map(report); if (request == null) { throw new CentiroAdapterException( string.Format("Failed to deserialize UpdateParcel clob. Data = {0}", requestClob)); } else { MessageId = Convert.ToString(DateTime.Now.Ticks); request.MessageId = MessageId; if (_isXmlDumpEnabled) { new XMLHelper().DumpToFile(new XMLHelper().InterfaceClassToXml(request), LogFileName("UpdateParcel_Request")); } CentiroServiceAgent csAdapter = GetCachedAdapter(report.url); UpdateParcelsResponseType ur = csAdapter.UpdateParcels(request, _isXmlDumpEnabled); } }