Exemplo n.º 1
0
        public static bool UpdateShipScheduleTrip(ShipScheduleDataset.ShipScheduleTripTableRow trip)
        {
            //
            bool updated = false;
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                //Map datarow to data transfer object
                ShipScheduleTrip sstrip = new ShipScheduleTrip();
                sstrip.TripID           = trip.TripID;
                sstrip.ScheduleID       = trip.ScheduleID;
                sstrip.TemplateID       = trip.TemplateID;
                sstrip.BolNumber        = !trip.IsBolNumberNull() ? trip.BolNumber : 0;
                sstrip.CarrierServiceID = !trip.IsCarrierServiceIDNull() ? trip.CarrierServiceID : 0;
                sstrip.LoadNumber       = !trip.IsLoadNumberNull() ? trip.LoadNumber : "";
                sstrip.TrailerNumber    = !trip.IsTrailerNumberNull() ? trip.TrailerNumber : "";
                sstrip.TractorNumber    = !trip.IsTractorNumberNull() ? trip.TractorNumber : "";
                sstrip.DriverName       = !trip.IsDriverNameNull() ? trip.DriverName : "";
                if (!trip.IsScheduledCloseNull())
                {
                    sstrip.ScheduledClose = trip.ScheduledClose;
                }
                if (!trip.IsScheduledDepartureNull())
                {
                    sstrip.ScheduledDeparture = trip.ScheduledDeparture;
                }
                sstrip.IsMandatory = !trip.IsIsMandatoryNull() ? trip.IsMandatory : (byte)0;
                if (!trip.IsFreightAssignedNull())
                {
                    sstrip.FreightAssigned = trip.FreightAssigned;
                }
                if (!trip.IsTrailerCompleteNull())
                {
                    sstrip.TrailerComplete = trip.TrailerComplete;
                }
                if (!trip.IsPaperworkCompleteNull())
                {
                    sstrip.PaperworkComplete = trip.PaperworkComplete;
                }
                if (!trip.IsTrailerDispatchedNull())
                {
                    sstrip.TrailerDispatched = trip.TrailerDispatched;
                }
                if (!trip.IsCanceledNull())
                {
                    sstrip.Canceled = trip.Canceled;
                }
                sstrip.LastUpdated = DateTime.Now;
                sstrip.UserID      = Environment.UserName;
                sstrip.RowVersion  = trip.RowVersion;

                updated = client.UpdateShipScheduleTrip(int.Parse(Program.TerminalCode), sstrip);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> ssf) { client.Abort(); throw new ApplicationException(ssf.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(updated);
        }
Exemplo n.º 2
0
 public static void WriteLogEntry(TraceMessage m)
 {
     //Get the operating enterprise terminal
     try {
         _Client = new ShipScheduleServiceClient();
         _Client.WriteLogEntry(m);
         _Client.Close();
     }
     catch (FaultException fe) { throw new ApplicationException("WriteLogEntry() service error.", fe); }
     catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("WriteLogEntry() timeout error.", te); }
     catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("WriteLogEntry() communication error.", ce); }
 }
Exemplo n.º 3
0
        public static void WriteLogEntry(TraceMessage m)
        {
            //Get the operating enterprise terminal
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                client.WriteLogEntry(int.Parse(Program.TerminalCode), m);
                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); }
        }
Exemplo n.º 4
0
 public static System.IO.Stream GetExportDefinition()
 {
     //
     System.IO.Stream xml = null;
     try {
         _Client = new ShipScheduleServiceClient();
         xml     = _Client.GetExportDefinition();
         _Client.Close();
     }
     catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException(te.Message, te.InnerException); }
     catch (FaultException fe) { throw new ApplicationException(fe.Message, fe.InnerException); }
     catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException(ce.Message, ce.InnerException); }
     return(xml);
 }
Exemplo n.º 5
0
        public static DataSet GetSortCenters()
        {
            //Get a list of sortCenters (terminals or shippers)
            DataSet sortCenters = null;
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                sortCenters = client.GetSortCenters(int.Parse(Program.TerminalCode));
                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(sortCenters);
        }
Exemplo n.º 6
0
        public static ServiceInfo GetServiceInfo()
        {
            ServiceInfo si = null;
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                si = client.GetServiceInfo(int.Parse(Program.TerminalCode));
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ConfigurationFault> 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(si);
        }
Exemplo n.º 7
0
        public static Terminals GetShippersAndTerminals()
        {
            //Get terminals list
            Terminals terminals = null;

            try {
                _Client   = new ShipScheduleServiceClient();
                terminals = _Client.GetShippersAndTerminals();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetShippersAndTerminals() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetShippersAndTerminals() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetShippersAndTerminals() communication error.", ce); }
            return(terminals);
        }
Exemplo n.º 8
0
        public static DataSet GetDaysOfWeek()
        {
            //Get days of the week list
            DataSet days = null;

            try {
                _Client = new ShipScheduleServiceClient();
                days    = _Client.GetDaysOfWeek();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetDaysOfWeek() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetDaysOfWeek() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetDaysOfWeek() communication error.", ce); }
            return(days);
        }
Exemplo n.º 9
0
        public static TerminalInfo GetTerminalInfo()
        {
            //Get the operating enterprise terminal
            TerminalInfo terminal = null;

            try {
                _Client  = new ShipScheduleServiceClient();
                terminal = _Client.GetTerminalInfo();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetTerminalInfo() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetTerminalInfo() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetTerminalInfo() communication error.", ce); }
            return(terminal);
        }
Exemplo n.º 10
0
        public static UserConfiguration GetUserConfiguration(string application, string[] usernames)
        {
            //Get the operating enterprise terminal
            UserConfiguration config = null;

            try {
                _Client = new ShipScheduleServiceClient();
                config  = _Client.GetUserConfiguration(application, usernames);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetUserConfiguration() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetUserConfiguration() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetUserConfiguration() communication error.", ce); }
            return(config);
        }
Exemplo n.º 11
0
        public static int GetWeekday(string weekdayName)
        {
            //Get weekday as a number
            int weekday = 0;

            try {
                _Client = new ShipScheduleServiceClient();
                weekday = _Client.GetWeekday(weekdayName);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetWeekday() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetWeekday() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetWeekday() communication error.", ce); }
            return(weekday);
        }
Exemplo n.º 12
0
        public static Agents GetAgents()
        {
            //Get agents list
            Agents agents = null;

            try {
                _Client = new ShipScheduleServiceClient();
                agents  = _Client.GetAgents();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetAgents() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetAgents() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetAgents() communication error.", ce); }
            return(agents);
        }
Exemplo n.º 13
0
        public static string CreateShipScheduleTrip(string scheduleID, string templateID, DateTime lastUpdated, string userID)
        {
            //Create a new ship schedule trip for the specified schedule using the specified template
            string tripID = "";
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                tripID = client.CreateShipScheduleTrip(int.Parse(Program.TerminalCode), scheduleID, templateID, lastUpdated, userID);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> ssf) { client.Abort(); throw new ApplicationException(ssf.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(tripID);
        }
Exemplo n.º 14
0
        public static string FindShipScheduleTrip(DateTime scheduleDate, long carrierServiceID, string loadNumber)
        {
            //
            string tripID = "";
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                tripID = client.FindShipScheduleTrip(int.Parse(Program.TerminalCode), scheduleDate, carrierServiceID, loadNumber);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> ssf) { client.Abort(); throw new ApplicationException(ssf.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(tripID);
        }
Exemplo n.º 15
0
        public static bool UpdateTemplate(ShipScheduleTemplate template)
        {
            //
            bool ret = false;

            try {
                _Client = new ShipScheduleServiceClient();
                ret     = _Client.UpdateTemplate(template);
                _Client.Close();
            }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException(te.Message, te.InnerException); }
            catch (FaultException <ShipScheduleFault> ssf) { throw new ApplicationException(ssf.Reason.ToString(), ssf.InnerException); }
            catch (FaultException fe) { throw new ApplicationException(fe.Message, fe.InnerException); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException(ce.Message, ce.InnerException); }
            return(ret);
        }
Exemplo n.º 16
0
        public static ShipScheduleDataset GetShipSchedules(DateTime scheduleDate)
        {
            //Get a list of ship schedules for the specified date
            ShipScheduleDataset       schedules = new ShipScheduleDataset();
            ShipScheduleServiceClient client    = new ShipScheduleServiceClient();

            try {
                schedules.Merge(client.GetShipSchedules(int.Parse(Program.TerminalCode), scheduleDate));
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> ssf) { client.Abort(); throw new ApplicationException(ssf.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(schedules);
        }
Exemplo n.º 17
0
        public static UserConfiguration GetUserConfiguration(string application, string[] usernames)
        {
            //Get the operating enterprise terminal
            UserConfiguration         config = null;
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                config = client.GetUserConfiguration(int.Parse(Program.TerminalCode), application, usernames);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ConfigurationFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(config);
        }
Exemplo n.º 18
0
        public static TemplateDS GetTemplates()
        {
            //Get templates list
            TemplateDS templates = null;

            try {
                templates = new TemplateDS();
                _Client   = new ShipScheduleServiceClient();
                DataSet ds = _Client.GetTemplates();
                templates.Merge(ds);
                _Client.Close();
            }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException(te.Message, te.InnerException); }
            catch (FaultException <ShipScheduleFault> ssf) { throw new ApplicationException(ssf.Reason.ToString(), ssf.InnerException); }
            catch (FaultException fe) { throw new ApplicationException(fe.Message, fe.InnerException); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException(ce.Message, ce.InnerException); }
            return(templates);
        }
Exemplo n.º 19
0
        public static DataSet GetCarriers()
        {
            //
            DataSet carriers = new DataSet();
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                DataSet ds = client.GetCarriers(int.Parse(Program.TerminalCode));
                if (ds != null)
                {
                    carriers.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(carriers);
        }
Exemplo n.º 20
0
        public static bool UpdateShipScheduleTripStop(ShipScheduleDataset.ShipScheduleStopTableRow stop)
        {
            //
            bool updated = false;
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                //Map datarow to data transfer object
                ShipScheduleStop ssstop = new ShipScheduleStop();
                ssstop.StopID          = stop.StopID;
                ssstop.TripID          = stop.TripID;
                ssstop.StopNumber      = !stop.IsStopNumberNull() ? stop.StopNumber : "";
                ssstop.AgentTerminalID = !stop.IsAgentTerminalIDNull() ? stop.AgentTerminalID : 0;
                ssstop.Tag             = !stop.IsTagNull() ? stop.Tag : "";
                ssstop.Notes           = !stop.IsNotesNull() ? stop.Notes : "";
                if (!stop.IsScheduledArrivalNull())
                {
                    ssstop.ScheduledArrival = stop.ScheduledArrival;
                }
                if (!stop.IsScheduledOFD1Null())
                {
                    ssstop.ScheduledOFD1 = stop.ScheduledOFD1;
                }
                ssstop.LastUpdated = DateTime.Now;
                ssstop.UserID      = Environment.UserName;
                ssstop.RowVersion  = stop.RowVersion;

                updated = client.UpdateShipScheduleTripStop(int.Parse(Program.TerminalCode), ssstop);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> ssf) { client.Abort(); throw new ApplicationException(ssf.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(updated);
        }
Exemplo n.º 21
0
        public static bool UpdateShipSchedule(ShipScheduleDataset.ShipScheduleViewTableRow viewItem)
        {
            //
            bool updated = false;
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                //Map datarows to data transfer objects
                ShipScheduleTrip sstrip = new ShipScheduleTrip();
                sstrip.TripID           = viewItem.TripID;
                sstrip.ScheduleID       = viewItem.ScheduleID;
                sstrip.TemplateID       = viewItem.TemplateID;
                sstrip.BolNumber        = !viewItem.IsBolNumberNull() ? viewItem.BolNumber : 0;
                sstrip.CarrierServiceID = !viewItem.IsCarrierServiceIDNull() ? viewItem.CarrierServiceID : 0;
                sstrip.LoadNumber       = !viewItem.IsLoadNumberNull() ? viewItem.LoadNumber : "";
                sstrip.TrailerNumber    = !viewItem.IsTrailerNumberNull() ? viewItem.TrailerNumber : "";
                sstrip.TractorNumber    = !viewItem.IsTractorNumberNull() ? viewItem.TractorNumber : "";
                sstrip.DriverName       = !viewItem.IsDriverNameNull() ? viewItem.DriverName : "";
                if (!viewItem.IsScheduledCloseNull())
                {
                    sstrip.ScheduledClose = viewItem.ScheduledClose;
                }
                if (!viewItem.IsScheduledDepartureNull())
                {
                    sstrip.ScheduledDeparture = viewItem.ScheduledDeparture;
                }
                sstrip.IsMandatory = !viewItem.IsIsMandatoryNull() ? viewItem.IsMandatory : (byte)0;
                if (!viewItem.IsFreightAssignedNull())
                {
                    sstrip.FreightAssigned = viewItem.FreightAssigned;
                }
                if (!viewItem.IsTrailerCompleteNull())
                {
                    sstrip.TrailerComplete = viewItem.TrailerComplete;
                }
                if (!viewItem.IsPaperworkCompleteNull())
                {
                    sstrip.PaperworkComplete = viewItem.PaperworkComplete;
                }
                if (!viewItem.IsTrailerDispatchedNull())
                {
                    sstrip.TrailerDispatched = viewItem.TrailerDispatched;
                }
                if (!viewItem.IsCanceledNull())
                {
                    sstrip.Canceled = viewItem.Canceled;
                }
                sstrip.LastUpdated = DateTime.Now;
                sstrip.UserID      = Environment.UserName;
                sstrip.RowVersion  = viewItem.SCDERowVersion;

                ShipScheduleStop ssstop1 = new ShipScheduleStop();
                ssstop1.StopID          = viewItem.StopID;
                ssstop1.TripID          = viewItem.TripID;
                ssstop1.StopNumber      = !viewItem.IsStopNumberNull() ? viewItem.StopNumber : "";
                ssstop1.AgentTerminalID = !viewItem.IsAgentTerminalIDNull() ? viewItem.AgentTerminalID : 0;
                ssstop1.Tag             = !viewItem.IsTagNull() ? viewItem.Tag : "";
                ssstop1.Notes           = !viewItem.IsNotesNull() ? viewItem.Notes : "";
                if (!viewItem.IsScheduledArrivalNull())
                {
                    ssstop1.ScheduledArrival = viewItem.ScheduledArrival;
                }
                if (!viewItem.IsScheduledOFD1Null())
                {
                    ssstop1.ScheduledOFD1 = viewItem.ScheduledOFD1;
                }
                ssstop1.LastUpdated = DateTime.Now;
                ssstop1.UserID      = Environment.UserName;
                ssstop1.RowVersion  = viewItem.S1RowVersion;

                ShipScheduleStop ssstop2 = null;
                if (!viewItem.IsS2MainZoneNull() && viewItem.S2MainZone.Trim().Length > 0)
                {
                    ssstop2                 = new ShipScheduleStop();
                    ssstop2.StopID          = viewItem.S2StopID;
                    ssstop2.TripID          = viewItem.TripID;
                    ssstop2.StopNumber      = !viewItem.IsS2StopNumberNull() ? viewItem.S2StopNumber : "";
                    ssstop2.AgentTerminalID = !viewItem.IsS2AgentTerminalIDNull() ? viewItem.S2AgentTerminalID : 0;
                    ssstop2.Tag             = !viewItem.IsS2TagNull() ? viewItem.S2Tag : "";
                    ssstop2.Notes           = !viewItem.IsS2NotesNull() ? viewItem.S2Notes : "";
                    if (!viewItem.IsS2ScheduledArrivalNull())
                    {
                        ssstop2.ScheduledArrival = viewItem.S2ScheduledArrival;
                    }
                    if (!viewItem.IsS2ScheduledOFD1Null())
                    {
                        ssstop2.ScheduledOFD1 = viewItem.S2ScheduledOFD1;
                    }
                    ssstop2.LastUpdated = DateTime.Now;
                    ssstop2.UserID      = Environment.UserName;
                    ssstop2.RowVersion  = viewItem.S2RowVersion;
                }

                updated = client.UpdateShipSchedule(int.Parse(Program.TerminalCode), sstrip, ssstop1, ssstop2);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> ssf) { client.Abort(); throw new ApplicationException(ssf.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(updated);
        }