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); }
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); } }
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; } } }