public ShipmentMapper GetShipment(string shipmentNbr) { try { if (string.IsNullOrEmpty(shipmentNbr)) { shipmentNbr = _browserHelper.GetShipmentUriData().ShipmentNbr; } return(_webServiceHelper.GetShipmentByShipmentId(shipmentNbr)); } catch (NetworkActiveBrowserNotFoundException e) { _messagesProvider.Warn(string.Format(InformationResources.WARN_NO_WAY_TO_GET_SHIPMENT_EXTENDED, e.Message)); throw; } catch (NetworkActiveUriNotFoundException e) { _messagesProvider.Warn(string.Format(InformationResources.WARN_NO_WAY_TO_GET_SHIPMENT_EXTENDED, e.Message)); throw; } catch (Exception e) { _messagesProvider.Error(new NetworkException(InformationResources.ERROR_CANNOT_CONNECT_TO_ACUMATICA)); _messagesProvider.Log(e.Message); throw; } }
private void ProcessShipmentBackground(string args) { //Custom protocol parameters: //acumaticashippingtoolintegration:000021@UPS; if (string.IsNullOrEmpty(args) || !args.Contains("acumaticashippingtoolintegration")) { return; } var argsArray = args.Split(':', '@'); var shipmentNbrParam = argsArray.Length >= 2 ? argsArray[1] : null; var applicationTypeParam = argsArray.Length >= 3 ? argsArray[2] : null; if (!string.IsNullOrEmpty(applicationTypeParam) && !string.IsNullOrEmpty(shipmentNbrParam)) { ApplicationTypes applicationType; switch (applicationTypeParam) { case "FED": applicationType = ApplicationTypes.FedExShipmentManager; break; case "UPS": applicationType = ApplicationTypes.UpsWorldShip; break; default: applicationType = ApplicationTypes.None; _messagesProvider.Error(new ArgumentException("Cannot locate Application type from command arguments. [ " + args + " ]")); break; } if (applicationType != ApplicationTypes.None) { var shipmentNbr = shipmentNbrParam.Trim(); var presenter = _applicationController.GetContainer().Resolve <FloatMenuPresenter>(); presenter.ProcessShipment(applicationType, shipmentNbr); return; } } throw new ArgumentException("Custom protocol parameters should looks like protoName:arg1:arg2. Cannot parse parameter string. [ " + args + " ]"); }