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