Пример #1
0
        public static ShipScheduleTrip GetEarlierTripFromThisSchedule(string tripID, string freightID)
        {
            //Return an earlier trip from the current schedule than the one specified if one exists
            ShipScheduleTrip earlierTrip = null;

            try {
                //Get all earlier trips (open, not cancelled)
                DataSet ds = App.Mediator.FillDataset(USP_SHIPSCHEDULE_PRIORTRIPS, TBL_SHIPSCHEDULE_PRIORTRIPS, new object[] { tripID, freightID });
                if (ds.Tables[TBL_SHIPSCHEDULE_PRIORTRIPS].Rows.Count > 0)
                {
                    ShipScheduleDS schedule = new ShipScheduleDS();
                    schedule.Merge(ds);
                    int tag = 0;
                    for (int i = 0; i < schedule.ShipScheduleMasterTable.Rows.Count; i++)
                    {
                        //Select only trips with the same schedule date as this.mScheduleDate
                        ShipScheduleDS.ShipScheduleMasterTableRow trip = (ShipScheduleDS.ShipScheduleMasterTableRow)schedule.ShipScheduleMasterTable.Rows[i];
                        if (trip.ScheduleDate.CompareTo(_ScheduleDate) == 0)
                        {
                            //Capture the trip with the largest tag #
                            if (int.Parse(trip.Tag.Trim()) > tag)
                            {
                                tag         = int.Parse(trip.Tag.Trim());
                                earlierTrip = new ShipScheduleTrip(trip);
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Failed determine if an earlier ship schedule trip exists.", ex); }
            return(earlierTrip);
        }
Пример #2
0
        public static ShipScheduleTrip GetTrip(string tripID)
        {
            //Return an existing trip from this ship schedule
            ShipScheduleTrip trip = null;

            try {
                //Merge from collection (dataset)
                ShipScheduleDS.ShipScheduleMasterTableRow   _trip = (ShipScheduleDS.ShipScheduleMasterTableRow)_Trips.ShipScheduleMasterTable.Select("TripID='" + tripID + "'")[0];
                ShipScheduleDS.ShipScheduleDetailTableRow[] _tls  = (ShipScheduleDS.ShipScheduleDetailTableRow[])_Trips.ShipScheduleDetailTable.Select("TripID='" + tripID + "'");
                trip = new ShipScheduleTrip(_trip, _tls);
            }
            catch (Exception ex) { throw new ApplicationException("Failed to get trip " + tripID + ".", ex); }
            return(trip);
        }
Пример #3
0
 private void OnTripSelectionChanged(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
 {
     //Event handler for change in trip selections
     try {
         //Clear reference to prior trip object
         this.mDestinationTrip = null;
         if (this.grdShipSchedule.Selected.Rows.Count > 0)
         {
             //Get a trip object for the selected trip record
             string id = this.grdShipSchedule.Selected.Rows[0].Cells["TripID"].Value.ToString();
             ShipScheduleDS.ShipScheduleMasterTableRow row = (ShipScheduleDS.ShipScheduleMasterTableRow) this.mShipScheduleDS.ShipScheduleMasterTable.Select("TripID='" + id + "'")[0];
             this.mDestinationTrip = new ShipScheduleTrip(row);
         }
     }
     catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); }
     finally { OnValidateForm(null, null); }
 }
Пример #4
0
        public static ShipScheduleTrip GetEarlierTripFromAPriorSchedule(string tripID, string freightID)
        {
            //Return an earlier trip from a schedule prior to the one specified
            ShipScheduleTrip earlierTrip = null;

            try {
                //Get all earlier trips (open, not cancelled)
                DataSet ds = App.Mediator.FillDataset(USP_SHIPSCHEDULE_PRIORTRIPS, TBL_SHIPSCHEDULE_PRIORTRIPS, new object[] { tripID, freightID });
                if (ds.Tables[TBL_SHIPSCHEDULE_PRIORTRIPS].Rows.Count > 0)
                {
                    ShipScheduleDS schedule = new ShipScheduleDS();
                    schedule.Merge(ds);
                    DateTime date = _ScheduleDate.AddYears(-5);
                    int      tag  = 0;
                    for (int i = 0; i < schedule.ShipScheduleMasterTable.Rows.Count; i++)
                    {
                        //Select a trip with the most recent schedule date (not including this.mScheduleDate)
                        ShipScheduleDS.ShipScheduleMasterTableRow trip = (ShipScheduleDS.ShipScheduleMasterTableRow)schedule.ShipScheduleMasterTable.Rows[i];
                        if (trip.ScheduleDate.CompareTo(_ScheduleDate) < 0)
                        {
                            //Capture the most recent trip date
                            if (trip.ScheduleDate.CompareTo(date) > 0)
                            {
                                date = trip.ScheduleDate; tag = 0;
                            }
                            if (trip.ScheduleDate.CompareTo(date) == 0)
                            {
                                //Capture the trip taht is most recent and with the largest tag #
                                if (int.Parse(trip.Tag.Trim()) > tag)
                                {
                                    tag         = int.Parse(trip.Tag.Trim());
                                    earlierTrip = new ShipScheduleTrip(trip);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Failed determine if an earlier ship schedule trip exists.", ex); }
            return(earlierTrip);
        }
Пример #5
0
 public ShipScheduleTrip(ShipScheduleDS.ShipScheduleMasterTableRow trip, ShipScheduleDS.ShipScheduleDetailTableRow[] tls)
 {
     //Constructor
     try {
         this.mAssignedTLs = new ShipScheduleDS();
         if (trip != null)
         {
             this._scheduleid   = trip.ScheduleID;
             this._sortcenterid = trip.SortCenterID;
             if (!trip.IsSortCenterNull())
             {
                 this._sortcenter = trip.SortCenter;
             }
             this._scheduledate = trip.ScheduleDate;
             this._tripid       = trip.TripID;
             if (!trip.IsTemplateIDNull())
             {
                 this._templateid = trip.TemplateID;
             }
             if (!trip.IsBolNumberNull())
             {
                 this._bolnumber = trip.BolNumber;
             }
             if (!trip.IsCarrierServiceIDNull())
             {
                 this._carrierserviceid = trip.CarrierServiceID;
             }
             if (!trip.IsCarrierNull())
             {
                 this._carrier = trip.Carrier;
             }
             if (!trip.IsLoadNumberNull())
             {
                 this._loadnumber = trip.LoadNumber;
             }
             if (!trip.IsTrailerIDNull())
             {
                 this._trailerid = trip.TrailerID;
             }
             if (!trip.IsTrailerNumberNull())
             {
                 this._trailernumber = trip.TrailerNumber;
             }
             if (!trip.IsTractorNumberNull())
             {
                 this._tractornumber = trip.TractorNumber;
             }
             if (!trip.IsScheduledCloseNull())
             {
                 this._scheduledclose = trip.ScheduledClose;
             }
             if (!trip.IsScheduledDepartureNull())
             {
                 this._scheduleddeparture = trip.ScheduledDeparture;
             }
             if (!trip.IsIsMandatoryNull())
             {
                 this._ismandatory = trip.IsMandatory;
             }
             if (!trip.IsFreightAssignedNull())
             {
                 this._freightassigned = trip.FreightAssigned;
             }
             if (!trip.IsTrailerCompleteNull())
             {
                 this._trailercomplete = trip.TrailerComplete;
             }
             if (!trip.IsPaperworkCompleteNull())
             {
                 this._paperworkcomplete = trip.PaperworkComplete;
             }
             if (!trip.IsTrailerDispatchedNull())
             {
                 this._trailerdispatched = trip.TrailerDispatched;
             }
             if (!trip.IsCanceledNull())
             {
                 this._canceled = trip.Canceled;
             }
             if (!trip.IsSCDEUserIDNull())
             {
                 this._scdeuserid = trip.SCDEUserID;
             }
             if (!trip.IsSCDELastUpdatedNull())
             {
                 this._scdelastupdated = trip.SCDELastUpdated;
             }
             if (!trip.IsSCDERowVersionNull())
             {
                 this._scderowversion = trip.SCDERowVersion;
             }
             if (!trip.IsStopIDNull())
             {
                 this._stopid = trip.StopID;
             }
             if (!trip.IsStopNumberNull())
             {
                 this._stopnumber = trip.StopNumber;
             }
             if (!trip.IsAgentTerminalIDNull())
             {
                 this._agentterminalid = trip.AgentTerminalID;
             }
             if (!trip.IsAgentNumberNull())
             {
                 this._agentnumber = trip.AgentNumber;
             }
             if (!trip.IsMainZoneNull())
             {
                 this._mainzone = trip.MainZone;
             }
             if (!trip.IsTagNull())
             {
                 this._tag = trip.Tag;
             }
             if (!trip.IsNotesNull())
             {
                 this._notes = trip.Notes;
             }
             if (!trip.IsScheduledArrivalNull())
             {
                 this._scheduledarrival = trip.ScheduledArrival;
             }
             if (!trip.IsScheduledOFD1Null())
             {
                 this._scheduledofd1 = trip.ScheduledOFD1;
             }
             if (!trip.IsS1UserIDNull())
             {
                 this._s1userid = trip.S1UserID;
             }
             if (!trip.IsS1LastUpdatedNull())
             {
                 this._s1lastupdated = trip.S1LastUpdated;
             }
             if (!trip.IsS1RowVersionNull())
             {
                 this._s1rowversion = trip.S1RowVersion;
             }
             if (!trip.IsS2StopIDNull())
             {
                 this._s2stopid = trip.S2StopID;
             }
             if (!trip.IsS2StopNumberNull())
             {
                 this._s2stopnumber = trip.S2StopNumber;
             }
             if (!trip.IsS2AgentTerminalIDNull())
             {
                 this._s2agentterminalid = trip.S2AgentTerminalID;
             }
             if (!trip.IsS2AgentNumberNull())
             {
                 this._s2agentnumber = trip.S2AgentNumber;
             }
             if (!trip.IsS2MainZoneNull())
             {
                 this._s2mainzone = trip.S2MainZone;
             }
             if (!trip.IsS2TagNull())
             {
                 this._s2tag = trip.S2Tag;
             }
             if (!trip.IsS2NotesNull())
             {
                 this._s2notes = trip.S2Notes;
             }
             if (!trip.IsS2ScheduledArrivalNull())
             {
                 this._s2scheduledarrival = trip.S2ScheduledArrival;
             }
             if (!trip.IsS2ScheduledOFD1Null())
             {
                 this._s2scheduledofd1 = trip.S2ScheduledOFD1;
             }
             if (!trip.IsS2UserIDNull())
             {
                 this._s2userid = trip.S2UserID;
             }
             if (!trip.IsS2LastUpdatedNull())
             {
                 this._s2lastupdated = trip.S2LastUpdated;
             }
             if (!trip.IsS2RowVersionNull())
             {
                 this._s2rowversion = trip.S2RowVersion;
             }
             if (!trip.IsNextCarrierNull())
             {
                 this._nextcarrier = trip.NextCarrier;
             }
             if (!trip.IsCarrierIDNull())
             {
                 this._carrierid = trip.CarrierID;
             }
             if (tls != null)
             {
                 ShipScheduleDS.ShipScheduleMasterTableRow _trip = this.mAssignedTLs.ShipScheduleMasterTable.NewShipScheduleMasterTableRow();
                 _trip.ScheduleID   = this.ScheduleID;
                 _trip.SortCenterID = this.SortCenterID;
                 _trip.TripID       = this.TripID;
                 this.mAssignedTLs.ShipScheduleMasterTable.AddShipScheduleMasterTableRow(_trip);
                 this.mAssignedTLs.Merge(tls);
             }
         }
     }
     catch (Exception ex) { throw new ApplicationException("Could not create a new ship schedule trip.", ex); }
 }
Пример #6
0
 public ShipScheduleTrip(ShipScheduleDS.ShipScheduleMasterTableRow trip) : this(trip, null)
 {
 }