public void UpdateShipments(List <Shipment> shipments, ISmartShipmentExportContext smartShipmentExportContext) { var currentProcessedShipmentNumber = string.Empty; try { _webServiceHelper.UpdateShipments(shipments, smartShipmentExportContext, ref currentProcessedShipmentNumber); } catch (Exception e) { _messagesProvider.Fatal(e); if (string.IsNullOrEmpty(currentProcessedShipmentNumber)) { _messagesProvider.Error( new NetworkException(InformationResources.ERROR_SHIPMENTS_IS_NOT_UPDATED + AcumaticaErrorMessageParcer.GetUserFriendlyMessage(e.Message))); } else { _messagesProvider.Error( new NetworkException( string.Format(InformationResources.ERROR_SHIPMENTS_NUMBER_IS_NOT_UPDATED, currentProcessedShipmentNumber) + AcumaticaErrorMessageParcer.GetUserFriendlyMessage(e.Message))); } } }
public void RunShipmentApplication(IShipmentApplicationHelper applicationHelper, string shipmentNbr = null) { try { var shipment = GetShipment(shipmentNbr); //Validate shipment var shipmentValidationResult = new ShipmentValidationContext(shipment, _acumaticaNetworkProvider).Validate(); if (shipmentValidationResult.Any()) { _messagesProvider.Warn(shipmentValidationResult.First().Value); return; } if (applicationHelper.RunShipmentApplication(shipment.ShipmentNbr.Value) && applicationHelper.PopulateApplicaitonControlMap()) { _messagesProvider.Log(string.Format(InformationResources.INFO_RECEIVED_SHIPMENT, shipment.ShipmentNbr.Value, shipment.Packages.Count)); applicationHelper.PopulateApplicaitonByShipmentData(shipment); } } catch (Exception e) { if (!(e is NetworkException)) //IAcumaticaNetworkProvider handles own errors someself { _messagesProvider.Fatal(e); } } }