public static TsortDataset GetStationAssignments(InboundShipment shipment, string workStationID) { //Get a list of station-freight assignments for the specified terminal and workstation TsortDataset assignments = new TsortDataset(); try { TsortDataset _assignments = GetStationAssignments(); TsortDataset selectedAssignments = new TsortDataset(); if (workStationID.Trim().Length == 0) { selectedAssignments.Merge(_assignments.StationFreightAssignmentTable.Select("FreightID = '" + shipment.FreightID + "'")); } else { selectedAssignments.Merge(_assignments.StationFreightAssignmentTable.Select("FreightID = '" + shipment.FreightID + "' AND WorkStationID = '" + workStationID + "'")); } for (int i = 0; i < selectedAssignments.StationFreightAssignmentTable.Rows.Count; i++) { assignments.StationFreightAssignmentTable.ImportRow(selectedAssignments.StationFreightAssignmentTable[i]); } } catch (ApplicationException aex) { throw aex; } catch (Exception ex) { throw new ApplicationException(ex.Message); } return(assignments); }
public static bool HasAssignments(string freightID) { //Determine if the specified fright has assignments TsortDataset assignments = new TsortDataset(); assignments.Merge(StationAssignments.StationFreightAssignmentTable.Select("FreightID = '" + freightID + "'")); return(assignments.StationFreightAssignmentTable.Count > 0); }
public static TsortDataset GetAssignableSortStations(InboundShipment shipment, int sortTypeID) { // TsortDataset sortStations = new TsortDataset(); FreightAssignServiceClient client = new FreightAssignServiceClient(); try { DataSet ds = client.GetAssignableSortStations(shipment.TerminalID, shipment.FreightID, sortTypeID); if (ds != null) { sortStations.Merge(ds); } 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(sortStations); }
public static TsortDataset GetStationAssignments() { //Get a list of station-freight assignments for the specified terminal TsortDataset assignments = new TsortDataset(); FreightAssignServiceClient client = new FreightAssignServiceClient(); try { DataSet ds = client.GetStationAssignments(int.Parse(Program.TerminalCode)); if (ds != null) { assignments.Merge(ds); } 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(assignments); }
public static void RefreshStationAssignments() { //Refresh the list of freight assignments for the local terminal FreightAssignServiceClient client = new FreightAssignServiceClient(); try { _Assignments.Clear(); _Assignments.Merge(client.GetStationAssignments(int.Parse(Program.TerminalCode))); 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 (AssignmentsChanged != null) { AssignmentsChanged(null, EventArgs.Empty); } } }
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 static TsortDataset GetTerminals() { // TsortDataset terminals = new TsortDataset(); FreightAssignServiceClient client = new FreightAssignServiceClient(); try { DataSet ds = client.GetTerminals(); if (ds != null) { terminals.Merge(ds); } 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(terminals); }