public StationAssignments GetStationAssignments(string freightID) { //Get the operating enterprise terminal StationAssignments assignments = null; FreightServiceClient _Client = null; try { _Client = new FreightServiceClient(); StationAssignments _assignments = _Client.GetStationAssignments(); if (freightID != null && freightID.Length > 0) { assignments = new StationAssignments(); for (int i = 0; i < _assignments.Count; i++) { if (_assignments[i].InboundFreight.FreightID == freightID) { assignments.Add(_assignments[i]); } } } else { assignments = _assignments; } _Client.Close(); } catch (FaultException fe) { throw new ApplicationException("GetStationAssignments() service error.", fe); } catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetStationAssignments() timeout error.", te); } catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetStationAssignments() communication error.", ce); } return(assignments); }
public StationAssignments GetStationAssignments() { //Get a list of station-freight assignments for the local terminal StationAssignments assignments = new StationAssignments(); try { DataSet ds = new DataService().FillDataset(SQL_CONNID, USP_ASSIGNMENTS, TBL_ASSIGNMENTS, new object[] {}); if (ds != null) { FreightDS assignmentsDS = new FreightDS(); assignmentsDS.Merge(ds, false, MissingSchemaAction.Ignore); for (int i = 0; i < assignmentsDS.StationFreightAssignmentTable.Rows.Count; i++) { assignments.Add(new StationAssignment(assignmentsDS.StationFreightAssignmentTable[i])); } } } catch (Exception ex) { throw new FaultException <FreightFault>(new FreightFault(new ApplicationException("Unexpected error while reading station assignments.", ex))); } return(assignments); }