Exemplo n.º 1
0
        public static ShipScheduleItem GetTrip(string tripID)
        {
            //Return an existing trip from this ship schedule
            ShipScheduleItem trip = null;

            try {
                //Merge from collection (dataset)
                ShipScheduleDataset.ShipScheduleViewTableRow _trip = (ShipScheduleDataset.ShipScheduleViewTableRow)_Trips.ShipScheduleViewTable.Select("TripID='" + tripID + "'")[0];
                ShipScheduleDataset.ShipScheduleTLTableRow[] _tls  = (ShipScheduleDataset.ShipScheduleTLTableRow[])_Trips.ShipScheduleTLTable.Select("TripID='" + tripID + "'");
                trip = new ShipScheduleItem(_trip, _tls);
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(trip);
        }
Exemplo n.º 2
0
        public void Update()
        {
            //Extract the row versions and update the updated rows. This will keep the selected row in the view
            //Checks for duplicate load number within the same carrier during the past and future 7 days
            try {
                //Determine changes made to the trips in this ship schedule
                ShipScheduleDataset trips = (ShipScheduleDataset)this.mTrips.GetChanges(DataRowState.Modified);
                if (trips != null && trips.ShipScheduleViewTable.Rows.Count > 0)
                {
                    //Update each modified trip
                    foreach (ShipScheduleDataset.ShipScheduleViewTableRow row in trips.ShipScheduleViewTable.Rows)
                    {
                        //Check to see if load# or carrier has changed; if so, then make sure it's unique within the same
                        //carrier (updated once if it's updated along with load#) and during the past one week schedule
                        if (row.LoadNumber.Trim() != row["LoadNumber", DataRowVersion.Original].ToString().Trim() && row.CarrierServiceID.ToString().Trim() == row["CarrierServiceID", DataRowVersion.Original].ToString().Trim())
                        {
                            string tripID = ShipScheduleGateway.FindShipScheduleTrip(row.ScheduleDate, 0, row.LoadNumber.Trim());
                            if (tripID.Trim().Length > 0)
                            {
                                throw new DuplicateLoadNumberException("Duplicate load# found in ship schedule for " + tripID + ".");
                            }
                        }

                        //Save trip details
                        ShipScheduleGateway.UpdateShipSchedule(row);
                        try {
                            //Refresh the details of the current trip (instead of a full refresh)
                            ShipScheduleDataset viewItems = ShipScheduleGateway.GetShipSchedule(row.SortCenterID, row.ScheduleDate);
                            if (viewItems.ShipScheduleViewTable.Rows.Count > 0)
                            {
                                ShipScheduleDataset.ShipScheduleViewTableRow viewItem = viewItems.ShipScheduleViewTable.FindByTripID(row.TripID);
                                ShipScheduleDataset.ShipScheduleViewTableRow trip     = this.mTrips.ShipScheduleViewTable.FindByTripID(row.TripID);
                                trip.SCDERowVersion = viewItem.SCDERowVersion;
                                trip.S1RowVersion   = viewItem.S1RowVersion;
                                if (!row.IsS2StopIDNull())
                                {
                                    trip.S2RowVersion = viewItem.S2RowVersion;
                                }
                                this.mTrips.AcceptChanges();
                            }
                        }
                        catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
                    }
                    //Refresh();		Doing partial refresh above for performance reasons (i.e. cell editing)
                }
            }
            catch (DuplicateLoadNumberException ex) { throw ex; }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
        }
Exemplo n.º 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();
             ShipScheduleDataset.ShipScheduleViewTableRow _trip = (ShipScheduleDataset.ShipScheduleViewTableRow) this.mShipSchedule.ShipScheduleViewTable.Select("TripID='" + id + "'")[0];
             ShipScheduleDataset.ShipScheduleTLTableRow[] _tls  = (ShipScheduleDataset.ShipScheduleTLTableRow[]) this.mShipSchedule.ShipScheduleTLTable.Select("TripID='" + id + "'");
             this.mDestinationTrip = new ShipScheduleItem(_trip, _tls);
         }
     }
     catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); }
     finally { OnValidateForm(null, null); }
 }
Exemplo n.º 4
0
 public ShipScheduleItem(ShipScheduleDataset.ShipScheduleViewTableRow viewRow, ShipScheduleDataset.ShipScheduleTLTableRow[] tls)
 {
     //Constructor
     try {
         this.mAssignedTLs = new ShipScheduleDataset();
         if (viewRow != null)
         {
             this._scheduleid   = viewRow.ScheduleID;
             this._sortcenterid = viewRow.SortCenterID;
             if (!viewRow.IsSortCenterNull())
             {
                 this._sortcenter = viewRow.SortCenter;
             }
             this._scheduledate = viewRow.ScheduleDate;
             this._tripid       = viewRow.TripID;
             if (!viewRow.IsTemplateIDNull())
             {
                 this._templateid = viewRow.TemplateID;
             }
             if (!viewRow.IsBolNumberNull())
             {
                 this._bolnumber = viewRow.BolNumber;
             }
             if (!viewRow.IsCarrierServiceIDNull())
             {
                 this._carrierserviceid = viewRow.CarrierServiceID;
             }
             if (!viewRow.IsCarrierNull())
             {
                 this._carrier = viewRow.Carrier;
             }
             if (!viewRow.IsLoadNumberNull())
             {
                 this._loadnumber = viewRow.LoadNumber;
             }
             if (!viewRow.IsTrailerIDNull())
             {
                 this._trailerid = viewRow.TrailerID;
             }
             if (!viewRow.IsTrailerNumberNull())
             {
                 this._trailernumber = viewRow.TrailerNumber;
             }
             if (!viewRow.IsTractorNumberNull())
             {
                 this._tractornumber = viewRow.TractorNumber;
             }
             if (!viewRow.IsScheduledCloseNull())
             {
                 this._scheduledclose = viewRow.ScheduledClose;
             }
             if (!viewRow.IsScheduledDepartureNull())
             {
                 this._scheduleddeparture = viewRow.ScheduledDeparture;
             }
             if (!viewRow.IsIsMandatoryNull())
             {
                 this._ismandatory = viewRow.IsMandatory;
             }
             if (!viewRow.IsFreightAssignedNull())
             {
                 this._freightassigned = viewRow.FreightAssigned;
             }
             if (!viewRow.IsTrailerCompleteNull())
             {
                 this._trailercomplete = viewRow.TrailerComplete;
             }
             if (!viewRow.IsPaperworkCompleteNull())
             {
                 this._paperworkcomplete = viewRow.PaperworkComplete;
             }
             if (!viewRow.IsTrailerDispatchedNull())
             {
                 this._trailerdispatched = viewRow.TrailerDispatched;
             }
             if (!viewRow.IsCanceledNull())
             {
                 this._canceled = viewRow.Canceled;
             }
             if (!viewRow.IsSCDEUserIDNull())
             {
                 this._scdeuserid = viewRow.SCDEUserID;
             }
             if (!viewRow.IsSCDELastUpdatedNull())
             {
                 this._scdelastupdated = viewRow.SCDELastUpdated;
             }
             if (!viewRow.IsSCDERowVersionNull())
             {
                 this._scderowversion = viewRow.SCDERowVersion;
             }
             if (!viewRow.IsStopIDNull())
             {
                 this._stopid = viewRow.StopID;
             }
             if (!viewRow.IsStopNumberNull())
             {
                 this._stopnumber = viewRow.StopNumber;
             }
             if (!viewRow.IsAgentTerminalIDNull())
             {
                 this._agentterminalid = viewRow.AgentTerminalID;
             }
             if (!viewRow.IsAgentNumberNull())
             {
                 this._agentnumber = viewRow.AgentNumber;
             }
             if (!viewRow.IsMainZoneNull())
             {
                 this._mainzone = viewRow.MainZone;
             }
             if (!viewRow.IsTagNull())
             {
                 this._tag = viewRow.Tag;
             }
             if (!viewRow.IsNotesNull())
             {
                 this._notes = viewRow.Notes;
             }
             if (!viewRow.IsScheduledArrivalNull())
             {
                 this._scheduledarrival = viewRow.ScheduledArrival;
             }
             if (!viewRow.IsScheduledOFD1Null())
             {
                 this._scheduledofd1 = viewRow.ScheduledOFD1;
             }
             if (!viewRow.IsS1UserIDNull())
             {
                 this._s1userid = viewRow.S1UserID;
             }
             if (!viewRow.IsS1LastUpdatedNull())
             {
                 this._s1lastupdated = viewRow.S1LastUpdated;
             }
             if (!viewRow.IsS1RowVersionNull())
             {
                 this._s1rowversion = viewRow.S1RowVersion;
             }
             if (!viewRow.IsS2StopIDNull())
             {
                 this._s2stopid = viewRow.S2StopID;
             }
             if (!viewRow.IsS2StopNumberNull())
             {
                 this._s2stopnumber = viewRow.S2StopNumber;
             }
             if (!viewRow.IsS2AgentTerminalIDNull())
             {
                 this._s2agentterminalid = viewRow.S2AgentTerminalID;
             }
             if (!viewRow.IsS2AgentNumberNull())
             {
                 this._s2agentnumber = viewRow.S2AgentNumber;
             }
             if (!viewRow.IsS2MainZoneNull())
             {
                 this._s2mainzone = viewRow.S2MainZone;
             }
             if (!viewRow.IsS2TagNull())
             {
                 this._s2tag = viewRow.S2Tag;
             }
             if (!viewRow.IsS2NotesNull())
             {
                 this._s2notes = viewRow.S2Notes;
             }
             if (!viewRow.IsS2ScheduledArrivalNull())
             {
                 this._s2scheduledarrival = viewRow.S2ScheduledArrival;
             }
             if (!viewRow.IsS2ScheduledOFD1Null())
             {
                 this._s2scheduledofd1 = viewRow.S2ScheduledOFD1;
             }
             if (!viewRow.IsS2UserIDNull())
             {
                 this._s2userid = viewRow.S2UserID;
             }
             if (!viewRow.IsS2LastUpdatedNull())
             {
                 this._s2lastupdated = viewRow.S2LastUpdated;
             }
             if (!viewRow.IsS2RowVersionNull())
             {
                 this._s2rowversion = viewRow.S2RowVersion;
             }
             if (!viewRow.IsNextCarrierNull())
             {
                 this._nextcarrier = viewRow.NextCarrier;
             }
             if (!viewRow.IsCarrierIDNull())
             {
                 this._carrierid = viewRow.CarrierID;
             }
             if (tls != null)
             {
                 ShipScheduleDataset.ShipScheduleViewTableRow _trip = this.mAssignedTLs.ShipScheduleViewTable.NewShipScheduleViewTableRow();
                 _trip.ScheduleID   = this.ScheduleID;
                 _trip.SortCenterID = this.SortCenterID;
                 _trip.TripID       = this.TripID;
                 this.mAssignedTLs.ShipScheduleViewTable.AddShipScheduleViewTableRow(_trip);
                 this.mAssignedTLs.Merge(tls);
             }
         }
     }
     catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
 }
Exemplo n.º 5
0
 public ShipScheduleItem(ShipScheduleDataset.ShipScheduleViewTableRow viewRow) : this(viewRow, null)
 {
 }
Exemplo n.º 6
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);
        }