Example #1
0
        public static ShipScheduleDataset GetAvailableTrips(DateTime scheduleDate, long agentTerminalID)
        {
            //Get trips for the specified main zone and date that are available for assignment
            ShipScheduleDataset      trips  = new ShipScheduleDataset();
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                DataSet             ds        = client.GetShipScheduleView(int.Parse(Program.TerminalCode), scheduleDate);
                ShipScheduleDataset _schedule = new ShipScheduleDataset();
                if (ds != null)
                {
                    _schedule.Merge(ds);
                }
                if (_schedule.ShipScheduleViewTable.Rows.Count > 0)
                {
                    ShipScheduleDataset __schedule = new ShipScheduleDataset();
                    __schedule.Merge(_schedule.ShipScheduleViewTable.Select("AgentTerminalID='" + agentTerminalID + "' OR S2AgentTerminalID=" + agentTerminalID));
                    trips.Merge(__schedule.ShipScheduleViewTable.Select("IsNull(FreightAssigned, #08/02/61#) = #08/02/61#"));
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> 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(trips);
        }
Example #2
0
        public static void RefreshZones(bool assignableOnly)
        {
            //Update a collection (dataset) of all open TLs for the terminal on the local LAN database
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                _Zones.Clear();
                if (assignableOnly)
                {
                    _Zones.Merge(client.GetUnassignedTLs(int.Parse(Program.TerminalCode)));
                }
                else
                {
                    _Zones.Merge(client.GetTLs(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 (ZonesChanged != null)
                      {
                          ZonesChanged(null, EventArgs.Empty);
                      }
            }
        }
Example #3
0
        public static ShipScheduleDataset GetShipSchedule(DateTime scheduleDate, long agentTerminalID)
        {
            //Get a ship schedule (collection of ttrips and associated tls) for the specified terminal, date, and agent
            ShipScheduleDataset      schedule = new ShipScheduleDataset();
            ZoneClosingServiceClient client   = new ZoneClosingServiceClient();

            try {
                DataSet             ds        = client.GetShipScheduleView(int.Parse(Program.TerminalCode), scheduleDate);
                ShipScheduleDataset _schedule = new ShipScheduleDataset();
                if (ds != null)
                {
                    _schedule.Merge(ds);
                }
                if (_schedule.ShipScheduleViewTable.Rows.Count > 0)
                {
                    string filter1 = agentTerminalID > 0 ? "AgentTerminalID=" + agentTerminalID + " OR S2AgentTerminalID=" + agentTerminalID : "";
                    string filter2 = agentTerminalID > 0 ? "AgentTerminalID=" + agentTerminalID : "";
                    if (filter1.Length > 0)
                    {
                        schedule.Merge(_schedule.ShipScheduleViewTable.Select(filter1));
                        schedule.Merge(_schedule.ShipScheduleTLTable.Select(filter2));
                    }
                    else
                    {
                        schedule.Merge(_schedule);
                    }
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> 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(schedule);
        }
Example #4
0
        public static DateTime FindShipSchedule(string tlNumber)
        {
            //Find a ship schedule that contains the specified TL
            DateTime scheduleDate           = DateTime.MinValue;
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                scheduleDate = client.FindShipSchedule(int.Parse(Program.TerminalCode), tlNumber);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> 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(scheduleDate);
        }
Example #5
0
        public static DateTime FindEarlierTripOnCurrentSchedule(DateTime scheduleDate, string tripID, string freightID)
        {
            //Return an earlier trip from the current schedule than the one specified if one exists
            DateTime tripDate = DateTime.MinValue;
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                tripDate = client.FindEarlierTripOnCurrentSchedule(int.Parse(Program.TerminalCode), scheduleDate, tripID, freightID);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> 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(tripDate);
        }
Example #6
0
        public static bool CloseZone(Zone zone)
        {
            //
            bool closed = false;
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                closed = client.CloseZone(int.Parse(Program.TerminalCode), zone);
                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(closed);
        }
Example #7
0
        public static bool Close(string tripID)
        {
            //Close a trip from further TL assignments
            bool closed = false;
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                closed = client.CloseTrip(int.Parse(Program.TerminalCode), tripID);
                client.Close();
                RefreshTrips();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> 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(closed);
        }
Example #8
0
        public static bool MoveTL(string tripID, string tlNumber)
        {
            //Move a closed TL to this trip
            bool moved = false;
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                moved = client.MoveTL(int.Parse(Program.TerminalCode), tripID, tlNumber);
                client.Close();
                RefreshTrips();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> 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(moved);
        }
Example #9
0
        public static bool UnassignTL(string tlNumber)
        {
            //Unassign an open TL from this trip
            bool unassigned = false;
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                unassigned = client.UnassignTL(int.Parse(Program.TerminalCode), tlNumber);
                client.Close();
                RefreshTrips();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> 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(unassigned);
        }
Example #10
0
        public ZoneDataset GetZones(int terminalID)
        {
            //Get a list of open TLs
            ZoneDataset zones = new ZoneDataset();
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                DataSet ds = client.GetTLs(terminalID);
                if (ds != null)
                {
                    zones.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(zones);
        }
Example #11
0
        public static FreightDataset GetLanes()
        {
            //
            FreightDataset           lanes  = new FreightDataset();
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                DataSet ds = client.GetLanes(int.Parse(Program.TerminalCode));
                if (ds != null)
                {
                    lanes.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(lanes);
        }
Example #12
0
        public static void RefreshTLs()
        {
            //Update a collection (dataset) of all closed TLs for the terminal on the local LAN database
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                _TLs.Clear();
                _TLs.Merge(client.GetUnassignedClosedTLs(int.Parse(Program.TerminalCode), App.Config.ClosedTLsDays));
                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 (TLsChanged != null)
                      {
                          TLsChanged(null, EventArgs.Empty);
                      }
            }
        }
Example #13
0
        public ZoneDataset GetZone(int terminalID, string zoneCode)
        {
            //Get a single open TL
            ZoneDataset zone = new ZoneDataset();
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                DataSet ds = client.GetTLs(terminalID);
                if (ds != null)
                {
                    ZoneDataset _zones = new ZoneDataset();
                    _zones.Merge(ds);
                    zone.Merge(_zones.ZoneTable.Select("Zone='" + zoneCode + "'"));
                }
                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(zone);
        }
Example #14
0
        public static void RefreshTrips()
        {
            //Update a collection (dataset) of all ship schedule trips for the terminal on the local LAN database
            ZoneClosingServiceClient client = new ZoneClosingServiceClient();

            try {
                //Clear and update cached trips/stops for current schedule date
                _ScheduleID = "";
                _Trips.Clear();
                DataSet             ds        = client.GetShipScheduleView(int.Parse(Program.TerminalCode), _ScheduleDate);
                ShipScheduleDataset _schedule = new ShipScheduleDataset();
                if (ds != null)
                {
                    _schedule.Merge(ds);
                }
                if (_schedule.ShipScheduleViewTable.Rows.Count > 0)
                {
                    _ScheduleID = _schedule.ShipScheduleViewTable[0].ScheduleID;
                    string filter1 = _AgentTerminalID > 0 ? "AgentTerminalID=" + _AgentTerminalID + " OR S2AgentTerminalID=" + _AgentTerminalID : "";
                    string filter2 = _AgentTerminalID > 0 ? "AgentTerminalID=" + _AgentTerminalID : "";
                    if (filter1.Length > 0)
                    {
                        _Trips.Merge(_schedule.ShipScheduleViewTable.Select(filter1));
                        _Trips.Merge(_schedule.ShipScheduleTLTable.Select(filter2));
                    }
                    else
                    {
                        _Trips.Merge(_schedule);
                    }
                }
                client.Close();
            }
            catch (ConstraintException ex) { throw new ApplicationException(ex.Message, ex); }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            finally { if (Changed != null)
                      {
                          Changed(null, EventArgs.Empty);
                      }
            }
        }