Example #1
0
        public AssignmentDataset GetStationAssignments(int terminalID, string freightID)
        {
            //Get a list of station-freight assignments for the specified terminal
            AssignmentDataset          assignments = new AssignmentDataset();
            FreightAssignServiceClient client      = new FreightAssignServiceClient();

            try {
                AssignmentDataset _assignments = new AssignmentDataset();
                DataSet           ds           = client.GetStationAssignments(terminalID);
                if (ds != null)
                {
                    _assignments.Merge(ds);
                }
                client.Close();

                if (freightID != null && freightID.Length > 0)
                {
                    assignments.Merge(_assignments.StationFreightAssignmentTable.Select("FreightID='" + freightID + "'", "StationNumber ASC"));
                }
                else
                {
                    assignments.Merge(_assignments.StationFreightAssignmentTable.Select("", "StationNumber ASC"));
                }
            }
            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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
                      }
            }
        }