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); }
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); } } }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); } } }
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); }