/// <summary> delete traveling from the db /// </summary> public static void DeleteTraveling(TravelingDriverDTO traveling) { TravelingDriver travelingD = TravelingDriverDal.GetTraveling(traveling.TravelingIdDriver); if (travelingD.FromDate.Date == traveling.FromDate.Date && travelingD.ToDate.Date == traveling.ToDate.Date) { TravelingDriverDal.DeleteTraveling(travelingD.TravelingIdDriver); } else { TravelingDriverDal.DeleteTravelingRange(TravelingDriverConverters.GetTraveling(traveling)); } }
/// <summary> add a new traveling in the db /// </summary> public static void Add(TravelingDriverDTO travelingD) { TravelingDriver t = TravelingDriverConverters.GetTraveling(travelingD); t.TravelingIdDriver = TravelingDriverDal.AddTraveling(t); travelingD.TravelingIdDriver = t.TravelingIdDriver; TravelDriverRangeDAL.AddTravelRange(t); List <TravelingPassenger> travelPassengersSuitable = TravelingPassengerDal.GetTravelSuitableP(t); foreach (var travelP in travelPassengersSuitable) { Mail.sendMailSuitableDriver(travelP, travelingD); } }