Example #1
0
        public DataSet GetSortCenters(int terminalID)
        {
            DataSet sortCenters = new DataSet();
            DataSet ds          = null;

            try {
                if (terminalID == 0)
                {
                    ds = new TsortGateway(terminalID).GetTerminals();
                    if (ds != null && ds.Tables["TerminalTable"] != null && ds.Tables["TerminalTable"].Rows.Count > 0)
                    {
                        sortCenters.Merge(ds.Tables["TerminalTable"].Select("", "Description ASC"));
                    }
                }
                else if (terminalID == 1)
                {
                    ds = new TsortGateway(terminalID).GetShippers();
                    if (ds != null && ds.Tables["TerminalTable"] != null && ds.Tables["TerminalTable"].Rows.Count > 0)
                    {
                        sortCenters.Merge(ds.Tables["TerminalTable"].Select("", "Description ASC"));
                    }
                }
                else if (terminalID > 1)
                {
                    ds = new TsortGateway(terminalID).GetTerminals();
                    if (ds != null && ds.Tables["TerminalTable"] != null && ds.Tables["TerminalTable"].Rows.Count > 0)
                    {
                        sortCenters.Merge(ds.Tables["TerminalTable"].Select("", "Description ASC"));
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(sortCenters);
        }
Example #2
0
        public DateTime FindEarlierTripOnCurrentSchedule(int terminalID, 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;

            try {
                //Get all earlier trips (open, not cancelled)
                DataSet schedule = new DataSet();
                DataSet ds       = new TsortGateway(terminalID).GetPriorTrips(tripID, freightID);
                if (ds != null && ds.Tables["ShipScheduleViewTable"] != null && ds.Tables["ShipScheduleViewTable"].Rows.Count > 0)
                {
                    schedule.Merge(ds);
                    int tag = 0;
                    for (int i = 0; i < schedule.Tables["ShipScheduleViewTable"].Rows.Count; i++)
                    {
                        //Select only trips with the same schedule date as this.mScheduleDate
                        DataRow  _trip         = schedule.Tables["ShipScheduleViewTable"].Rows[i];
                        DateTime _scheduleDate = DateTime.Parse(_trip["ScheduleDate"].ToString());
                        if (_scheduleDate.CompareTo(scheduleDate) == 0)
                        {
                            //Capture the trip with the largest tag #
                            int _tag = int.Parse(_trip["Tag"].ToString().Trim());
                            if (_tag > tag)
                            {
                                tag      = _tag;
                                tripDate = _scheduleDate;
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(tripDate);
        }
Example #3
0
        public string GetExportFilename(int terminalID, string counterKey)
        {
            string filename = "";

            try {
                filename = new TsortGateway(terminalID).GetExportFilename(counterKey);
            }
            catch (Exception ex) { throw new FaultException <ISDExportFault>(new ISDExportFault(ex.Message), "Service Error"); }
            return(filename);
        }
Example #4
0
        public DateTime FindShipSchedule(int terminalID, string tlNumber)
        {
            //Find a TL on an existing ship schedule
            DateTime schedulDate = DateTime.MinValue;

            try {
                schedulDate = new TsortGateway(terminalID).FindShipSchedule(tlNumber);
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(schedulDate);
        }
Example #5
0
        public bool UpdateShipScheduleTripStop(int terminalID, ShipScheduleStop stop)
        {
            //Update the specified ship schedule stop
            bool updated = false;

            try {
                updated = new TsortGateway(terminalID).UpdateShipScheduleTripStop(stop);
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(updated);
        }
Example #6
0
        public string FindShipScheduleTrip(int terminalID, DateTime scheduleDate, long carrierServiceID, string loadNumber)
        {
            //Find a ship schedue trip for the specified scheduleDate, carrierServiceID, and loadNumber
            string tripID = "";

            try {
                tripID = new TsortGateway(terminalID).FindShipScheduleTrip(scheduleDate, carrierServiceID, loadNumber);
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(tripID);
        }
Example #7
0
        public string CreateShipScheduleTrip(int terminalID, string scheduleID, string templateID, DateTime lastUpdated, string userID)
        {
            //Create a new ship schedule trip from a template specified by templateID on the ship schedule specified by scheduleID
            string tripID = "";

            try {
                tripID = new TsortGateway(terminalID).CreateShipScheduleTrip(scheduleID.Trim(), templateID.Trim(), lastUpdated, userID);
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(tripID);
        }
Example #8
0
        public bool DeleteISDClient(int terminalID, ISDClient client)
        {
            //
            bool deleted = false;

            try {
                deleted = new TsortGateway(terminalID).DeleteISDClient(client);
            }
            catch (Exception ex) { throw new FaultException <ISDExportFault>(new ISDExportFault(ex.Message), "Service Error"); }
            return(deleted);
        }
Example #9
0
        public bool OpenTrip(int terminalID, string tripID)
        {
            //Open a trip to further TL assignments
            bool ret = false;

            try {
                //Validate, then open
                ret = new TsortGateway(terminalID).UpdateTripStatus(tripID, 0);
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(ret);
        }
Example #10
0
        public DataSet GetISDClients(int terminalID, string clientNumber)
        {
            DataSet clients = new DataSet();

            try {
                DataSet ds = new TsortGateway(terminalID).ReadISDClients(clientNumber);
                if (ds != null && ds.Tables["ClientTable"] != null && ds.Tables["ClientTable"].Rows.Count > 0)
                {
                    clients.Merge(ds);
                }
            }
            catch (Exception ex) { throw new FaultException <ISDExportFault>(new ISDExportFault(ex.Message), "Service Error"); }
            return(clients);
        }
Example #11
0
        public DataSet GetSortedItems(int terminalID, string pickupID)
        {
            //Get sorted items for a pickup
            DataSet items = new DataSet();

            try {
                DataSet ds = new TsortGateway(terminalID).GetSortedItems(pickupID);
                if (ds != null && ds.Tables["SortedItemTable"] != null && ds.Tables["SortedItemTable"].Rows.Count > 0)
                {
                    items.Merge(ds);
                }
            }
            catch (Exception ex) { throw new FaultException <ISDExportFault>(new ISDExportFault(ex.Message), "Service Error"); }
            return(items);
        }
Example #12
0
        public DataSet GetPickups(int terminalID, DateTime pickupDate)
        {
            //Get a collection of all pickups for the terminal on the local LAN database
            DataSet pickups = new DataSet();

            try {
                DataSet ds = new TsortGateway(terminalID).GetPickups(pickupDate);
                if (ds != null && ds.Tables["PickupTable"] != null && ds.Tables["PickupTable"].Rows.Count > 0)
                {
                    pickups.Merge(ds);
                }
            }
            catch (Exception ex) { throw new FaultException <ISDExportFault>(new ISDExportFault(ex.Message), "Service Error"); }
            return(pickups);
        }
Example #13
0
        public DataSet GetCarriers(int terminalID)
        {
            DataSet carriers = new DataSet();

            try {
                if (terminalID >= 0)
                {
                    DataSet ds = new TsortGateway(terminalID).GetCarriers();
                    if (ds != null && ds.Tables["CarrierTable"] != null && ds.Tables["CarrierTable"].Rows.Count > 0)
                    {
                        carriers.Merge(ds.Tables["CarrierTable"].Select("", "Description ASC"));
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(carriers);
        }
Example #14
0
        public DateTime FindEarlierTripOnPriorSchedule(int terminalID, DateTime scheduleDate, string tripID, string freightID)
        {
            //Return an earlier trip from a schedule prior to the one specified
            DateTime tripDate = DateTime.MinValue;

            try {
                //Get all earlier trips (open, not cancelled)
                DataSet schedule = new DataSet();
                DataSet ds       = new TsortGateway(terminalID).GetPriorTrips(tripID, freightID);
                if (ds != null && ds.Tables["ShipScheduleViewTable"] != null && ds.Tables["ShipScheduleViewTable"].Rows.Count > 0)
                {
                    schedule.Merge(ds);
                    DateTime date = scheduleDate.AddYears(-5);
                    int      tag  = 0;
                    for (int i = 0; i < schedule.Tables["ShipScheduleViewTable"].Rows.Count; i++)
                    {
                        //Select a trip with the most recent schedule date (not including trip.ScheduleDate)
                        DataRow  _trip         = schedule.Tables["ShipScheduleViewTable"].Rows[i];
                        DateTime _scheduleDate = DateTime.Parse(_trip["ScheduleDate"].ToString());
                        if (_scheduleDate.CompareTo(scheduleDate) < 0)
                        {
                            //Capture the most recent trip date
                            if (_scheduleDate.CompareTo(date) > 0)
                            {
                                date = _scheduleDate; tag = 0;
                            }
                            if (_scheduleDate.CompareTo(date) == 0)
                            {
                                //Capture the trip that is most recent and with the largest tag #
                                int _tag = int.Parse(_trip["Tag"].ToString().Trim());
                                if (_tag > tag)
                                {
                                    tag      = _tag;
                                    tripDate = _scheduleDate;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(tripDate);
        }
Example #15
0
        public DataSet GetShipScheduleView(int terminalID, DateTime scheduleDate)
        {
            //Return a ship schedule for the specified terminal
            DataSet schedule = new DataSet();

            try {
                //AgentLineHaulDataset trips = new AgentLineHaulDataset();
                DataSet trips = new TsortGateway(terminalID).GetTrips(scheduleDate);
                if (trips != null && trips.Tables["ShipScheduleViewTable"] != null && trips.Tables["ShipScheduleViewTable"].Rows.Count > 0)
                {
                    schedule.Merge(trips);
                    string scheduleID = trips.Tables["ShipScheduleViewTable"].Rows[0]["ScheduleID"].ToString();

                    //AgentLineHaulDataset tls = new AgentLineHaulDataset();
                    DataSet tls = new TsortGateway(terminalID).GetTLs(scheduleID);
                    if (tls != null && tls.Tables["ShipScheduleTLTable"] != null && tls.Tables["ShipScheduleTLTable"].Rows.Count > 0)
                    {
                        schedule.Merge(tls);
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(schedule);
        }