Example #1
0
        public static bool CreateStationAssignment(Workstation station, InboundShipment shipment, int sortTypeID, string initials)
        {
            //
            bool created = false;
            FreightAssignServiceClient client = new FreightAssignServiceClient();

            try {
                created = client.CreateStationAssignment(shipment.TerminalID, station.WorkStationID, shipment.FreightID, sortTypeID);
                client.Close();

                //Add to station assignment history
                _AssignmentHistory.FreightAssignmentHistoryTable.AddFreightAssignmentHistoryTableRow(DateTime.Today, shipment.TDSNumber, shipment.ClientNumber + "-" + shipment.ClientName, station.Number, DateTime.Now, initials);
                if (AssignmentHistoryChanged != null)
                {
                    AssignmentHistoryChanged(null, EventArgs.Empty);
                }

                RefreshStationAssignments();
            }
            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(created);
        }
Example #2
0
        public static bool DeleteStationAssignment(StationAssignment assignment, string initials)
        {
            //
            bool deleted = false;
            FreightAssignServiceClient client = new FreightAssignServiceClient();

            try {
                deleted = client.DeleteStationAssignment(assignment);
                client.Close();

                //Add to station unassignment history
                _AssignmentHistory.FreightAssignmentHistoryTable.AddFreightAssignmentHistoryTableRow(DateTime.Today, assignment.InboundFreight.TDSNumber, assignment.InboundFreight.ClientName, assignment.SortStation.Number, DateTime.Now, initials);
                if (AssignmentHistoryChanged != null)
                {
                    AssignmentHistoryChanged(null, EventArgs.Empty);
                }

                RefreshStationAssignments();
            }
            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(deleted);
        }
Example #3
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 #4
0
        public static bool StopSort(InboundShipment shipment)
        {
            //
            bool stopped = false;
            FreightAssignServiceClient client = new FreightAssignServiceClient();

            try {
                stopped = client.StopSort(shipment);
                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(stopped);
        }
Example #5
0
        public static InboundShipment GetInboundShipment(string freightID)
        {
            //Return the inbound shipment for the specified terminal and freightID
            InboundShipment            shipment = null;
            FreightAssignServiceClient client   = new FreightAssignServiceClient();

            try {
                shipment = client.GetInboundShipment(int.Parse(Program.TerminalCode), freightID);
                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(shipment);
        }
Example #6
0
        public bool DeleteStationAssignment(StationAssignment assignment)
        {
            //
            bool deleted = false;
            FreightAssignServiceClient client = new FreightAssignServiceClient();

            try {
                deleted = client.DeleteStationAssignment(assignment);
                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(deleted);
        }
Example #7
0
        public bool CreateStationAssignment(Workstation station, InboundShipment shipment, int sortTypeID)
        {
            //
            bool created = false;
            FreightAssignServiceClient client = new FreightAssignServiceClient();

            try {
                created = client.CreateStationAssignment(shipment.TerminalID, station.WorkStationID, shipment.FreightID, sortTypeID);
                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(created);
        }
Example #8
0
        public TerminalDataset GetTerminals()
        {
            //Get a list of Argix terminals
            TerminalDataset            terminals = new TerminalDataset();
            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 fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(terminals);
        }
Example #9
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);
        }
Example #10
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 #11
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);
                      }
            }
        }
Example #12
0
        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);
                      }
            }
        }
Example #13
0
        public WorkstationDataset GetAssignableSortStations(int terminalID, string freightID, int sortTypeID)
        {
            //
            WorkstationDataset         sortStations = new WorkstationDataset();
            FreightAssignServiceClient client       = new FreightAssignServiceClient();

            try {
                DataSet ds = client.GetAssignableSortStations(terminalID, freightID, sortTypeID);
                client.Close();
                if (ds != null)
                {
                    sortStations.Merge(ds);
                }
            }
            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);
        }
Example #14
0
        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);
        }