public InboundFreight GetInboundFreight(int terminalID, string freightType) { //Get the operating enterprise terminal InboundFreight shipments = null; FreightServiceClient _Client = null; try { _Client = new FreightServiceClient(); InboundFreight _shipments = _Client.GetInboundFreight(terminalID, 0); if (freightType != null && freightType.Length > 0) { shipments = new InboundFreight(); for (int i = 0; i < _shipments.Count; i++) { if (_shipments[i].FreightType.Trim().ToLower() == freightType.ToLower()) { shipments.Add(_shipments[i]); } } } else { shipments = _shipments; } _Client.Close(); } catch (FaultException fe) { throw new ApplicationException("GetInboundFreight() service error.", fe); } catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetInboundFreight() timeout error.", te); } catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetInboundFreight() communication error.", ce); } return(shipments); }
public InboundFreight GetInboundFreight(int terminalID, int sortedRange) { //Get a list of inbound shipments for the specified terminal InboundFreight shipments = new InboundFreight(); try { DataSet ds = new DataService().FillDataset(SQL_CONNID, USP_FREIGHT, TBL_FREIGHT, new object[] { terminalID, DateTime.Today.AddDays(-sortedRange) }); if (ds != null) { FreightDS freight = new FreightDS(); freight.Merge(ds, true); for (int i = 0; i < freight.InboundFreightTable.Rows.Count; i++) { shipments.Add(new InboundShipment(freight.InboundFreightTable[i])); } } } catch (Exception ex) { throw new FaultException <FreightFault>(new FreightFault(new ApplicationException("Unexpected error while reading inbound freight.", ex))); } return(shipments); }