Beispiel #1
0
        public static BearwareTrip GetTripAssignment(string stationNumber)
        {
            //Get the trip assigned to the specified station
            BearwareTrip trip = null;

            try {
                DataSet ds = App.Mediator.FillDataset(USP_TRIP_ASSIGNMENT, TBL_TRIP_ASSIGNMENT, new object[] { stationNumber });
                if (ds.Tables[TBL_TRIP_ASSIGNMENT].Rows.Count == 0)
                {
                    throw new ApplicationException("There are no trips assigned to station " + stationNumber + ".");
                }
                else if (ds.Tables[TBL_TRIP_ASSIGNMENT].Rows.Count > 0)
                {
                    BearwareDS dsAssignment = new BearwareDS();
                    dsAssignment.Merge(ds);
                    BearwareDS.BwareTripTableRow row = (BearwareDS.BwareTripTableRow)dsAssignment.BwareTripTable.Rows[0];
                    trip               = new BearwareTrip();
                    trip.Number        = row.Number.TrimEnd();
                    trip.CartonCount   = row.IsCartonCountNull() ? 0 : row.CartonCount;
                    trip.Carrier       = row.IsCarrierNull() ? "" : row.Carrier.TrimEnd();
                    trip.TrailerNumber = row.IsTrailerNumberNull() ? "" : row.TrailerNumber.TrimEnd();
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error reading trip assignments for station " + stationNumber + ".", ex); }
            return(trip);
        }
Beispiel #2
0
 public BearwareTrip(BearwareDS.BwareTripTableRow trip)
 {
     //Constructor
     try {
         if (trip != null)
         {
             this.mNumber = trip.Number.Trim();
             if (!trip.IsCartonCountNull())
             {
                 this.mCartonCount = trip.CartonCount;
             }
             if (!trip.IsCarrierNull())
             {
                 this.mCarrier = trip.Carrier;
             }
             if (!trip.IsTrailerNumberNull())
             {
                 this.mTrailerNumber = trip.TrailerNumber;
             }
             if (!trip.IsStartedNull())
             {
                 this.mStarted = trip.Started;
             }
             if (!trip.IsExportedNull())
             {
                 this.mExported = trip.Exported;
             }
             if (!trip.IsStoppedNull())
             {
                 this.mStopped = trip.Stopped;
             }
             if (!trip.IsImportedNull())
             {
                 this.mImported = trip.Imported;
             }
             if (!trip.IsScannedNull())
             {
                 this.mScanned = trip.Scanned;
             }
             if (!trip.IsOSDSendNull())
             {
                 this.mOSDSend = trip.OSDSend;
             }
             if (!trip.IsReceivedNull())
             {
                 this.mReceived = trip.Received;
             }
             if (!trip.IsCartonsExportedNull())
             {
                 this.mCartonsExported = trip.CartonsExported;
             }
         }
     }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new BearwareTrip instance.", ex); }
 }
Beispiel #3
0
 public BearwareTrip(BearwareDS.BwareTripTableRow trip)
 {
     //Constructor
     if (trip != null)
     {
         this.mNumber = trip.Number.Trim();
         if (!trip.IsCartonCountNull())
         {
             this.mCartonCount = trip.CartonCount;
         }
         if (!trip.IsCarrierNull())
         {
             this.mCarrier = trip.Carrier;
         }
         if (!trip.IsTrailerNumberNull())
         {
             this.mTrailerNumber = trip.TrailerNumber;
         }
         if (!trip.IsStartedNull())
         {
             this.mStarted = trip.Started;
         }
         if (!trip.IsExportedNull())
         {
             this.mExported = trip.Exported;
         }
         if (!trip.IsStoppedNull())
         {
             this.mStopped = trip.Stopped;
         }
         if (!trip.IsImportedNull())
         {
             this.mImported = trip.Imported;
         }
         if (!trip.IsScannedNull())
         {
             this.mScanned = trip.Scanned;
         }
         if (!trip.IsOSDSendNull())
         {
             this.mOSDSend = trip.OSDSend;
         }
         if (!trip.IsReceivedNull())
         {
             this.mReceived = trip.Received;
         }
         if (!trip.IsCartonsExportedNull())
         {
             this.mCartonsExported = trip.CartonsExported;
         }
     }
 }
Beispiel #4
0
        public DataSet ToDataSet()
        {
            //Return a dataset containing values for this terminal
            BearwareDS ds = null;

            try {
                ds = new BearwareDS();
                BearwareDS.BwareTripTableRow trip = ds.BwareTripTable.NewBwareTripTableRow();
                trip.Number        = this.mNumber;
                trip.CartonCount   = this.mCartonCount;
                trip.Carrier       = this.mCarrier;
                trip.TrailerNumber = this.mTrailerNumber;
                if (this.mStarted != Convert.ToDateTime(null))
                {
                    trip.Started = this.mStarted;
                }
                if (this.mExported != Convert.ToDateTime(null))
                {
                    trip.Exported = this.mExported;
                }
                if (this.mStopped != Convert.ToDateTime(null))
                {
                    trip.Stopped = this.mStopped;
                }
                if (this.mImported != Convert.ToDateTime(null))
                {
                    trip.Imported = this.mImported;
                }
                if (this.mScanned != Convert.ToDateTime(null))
                {
                    trip.Scanned = this.mScanned;
                }
                if (this.mOSDSend != Convert.ToDateTime(null))
                {
                    trip.OSDSend = this.mOSDSend;
                }
                if (this.mReceived != Convert.ToDateTime(null))
                {
                    trip.Received = this.mReceived;
                }
                if (this.mCartonsExported != -1)
                {
                    trip.CartonsExported = this.mCartonsExported;
                }
                ds.BwareTripTable.AddBwareTripTableRow(trip);
            }
            catch (Exception) { }
            return(ds);
        }
Beispiel #5
0
        public static BearwareTrip GetFreight(string tripNumber)
        {
            //Get a Bearware trip
            BearwareTrip trip = null;

            try {
                if (tripNumber.Length > 0)
                {
                    //Merge from collection (dataset)
                    BearwareDS.BwareTripTableRow row = (BearwareDS.BwareTripTableRow)_InboundFreight.BwareTripTable.Select("Number='" + tripNumber + "'")[0];
                    trip = new BearwareTrip(row);
                }
                else
                {
                    trip = new BearwareTrip();
                }
                trip.Changed += new EventHandler(OnTripChanged);
            }
            catch (Exception ex) { throw ex; }
            return(trip);
        }