public void DeleteBusOnTrip(int license, int lineID, TimeSpan takeOff) { BusOnTrip cur = DataSource.BusesOnTrip.FirstOrDefault(curBus => curBus.LicenseNum == license && curBus.LineId == lineID && curBus.PlannedTakeOff == takeOff && !curBus.Deleted); if (cur == null) { throw new BusOnTripExceptions(license, lineID, takeOff, false); } cur.Deleted = true; }
public void UpdateBusOnTrip(BusOnTrip busOnTrip) { BusOnTrip cur = DataSource.BusesOnTrip.FirstOrDefault(curBus => curBus.LicenseNum == busOnTrip.LicenseNum && curBus.LineId == busOnTrip.LineId && curBus.PlannedTakeOff == busOnTrip.PlannedTakeOff && !curBus.Deleted); if (cur == null) { throw new BusOnTripExceptions(busOnTrip.LicenseNum, busOnTrip.LineId, busOnTrip.PlannedTakeOff, false); } DataSource.BusesOnTrip.Remove(cur); DataSource.BusesOnTrip.Add(busOnTrip.Clone()); }
public void UpdateBusOnTrip(BusOnTrip busOn) { try { dl.UpdateBusOnTrip(BusOnTripBoDoAdapter(busOn)); } catch (DO.BadIdBUTException ex) { throw new BO.BadIDBusONeException(ex.Message, ex); } }
//obselete #region BusOnTrip public void AddBusOnTrip(BusOnTrip busOnTrip) { if (DataSource.BusesOnTrip.FirstOrDefault(curBus => curBus.LicenseNum == busOnTrip.LicenseNum && curBus.LineId == busOnTrip.LineId && curBus.PlannedTakeOff == busOnTrip.PlannedTakeOff && !curBus.Deleted) != null) { throw new BusOnTripExceptions(busOnTrip.LicenseNum, busOnTrip.LineId, busOnTrip.PlannedTakeOff, true); } else { DataSource.BusesOnTrip.Add(busOnTrip.Clone()); } }
public BusOnTrip GetBusOnTrip(int license, int lineID, TimeSpan takeOff) { BusOnTrip retValue = DataSource.BusesOnTrip.FirstOrDefault(curBus => curBus.LicenseNum == license && curBus.LineId == lineID && curBus.PlannedTakeOff == takeOff && !curBus.Deleted); if (retValue != null) { return(retValue.Clone()); } else { throw new BusOnTripExceptions(license, lineID, takeOff, false); } }