public DataSet ToDataSet() { //Return a dataset containing values for this object BearwareDS ds = null; try { ds = new BearwareDS(); ds.Merge(this.mStation.ToDataSet()); ds.Merge(this.mFreight.ToDataSet()); ds.AcceptChanges(); } catch (Exception) { } return(ds); }
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 static void RefreshStationAssignments() { //Refresh the list of freight assignments for the local terminal try { _Assignments.Clear(); DataSet ds = App.Mediator.FillDataset(USP_ASSIGNMENTVIEW, TBL_ASSIGNMENTVIEW, null); if (ds != null) { _Assignments.Merge(ds, false, MissingSchemaAction.Ignore); } } catch (Exception ex) { throw ex; } finally { if (AssignmentsChanged != null) { AssignmentsChanged(null, new EventArgs()); } } }
public static void RefreshFreight() { //Refresh the list of inbound trips for the local terminal try { _InboundFreight.Clear(); DateTime date = DateTime.Today.AddDays(-(_SortedDays - 1)); DataSet ds = App.Mediator.FillDataset(USP_TRIPVIEW, TBL_TRIPVIEW, new object[] { date }); if (ds != null) { _InboundFreight.Merge(ds, false, MissingSchemaAction.Ignore); } } catch (Exception ex) { throw ex; } finally { if (FreightChanged != null) { FreightChanged(null, new EventArgs()); } } }