public static void RefreshFreight() { //Refresh the list of inbound shipments for the specified terminal FreightAssignServiceClient client = new FreightAssignServiceClient(); try { _InboundFreight.Clear(); _InboundFreight.Merge(client.GetInboundFreight(int.Parse(Program.TerminalCode), DateTime.Today.AddDays(-(SortedRange - 1)))); client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <TsortFault> dfe) { client.Abort(); throw new ApplicationException(dfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } finally { if (FreightChanged != null) { FreightChanged(null, EventArgs.Empty); } } }
public FreightDataset GetInboundFreight(int terminalID, string freightType) { FreightDataset shipments = new FreightDataset(); FreightAssignServiceClient client = new FreightAssignServiceClient(); try { DataSet ds = client.GetInboundFreight(terminalID, DateTime.Today.AddDays(-this.mSortedDays)); if (ds != null) { FreightDataset _shipments = new FreightDataset(); _shipments.Merge(ds); shipments.Merge(_shipments.InboundFreightTable.Select("FreightType='" + freightType + "'", "TDSNumber ASC")); } client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <TsortFault> dfe) { client.Abort(); throw new ApplicationException(dfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(shipments); }