Esempio n. 1
0
 public void DeleteRoute()
 {
     RouteDataAccess.DeleteRoute(SelectedRoute.Id);
     RouteList.Remove(SelectedRoute);
     RouteId = 0;
     NotifyOfPropertyChange(() => RouteList);
 }
        /// <summary>
        /// Method to delete checkpoint
        /// </summary>
        /// <param name="checkpointID"></param>
        /// <returns></returns>
        public bool DeleteCheckpoint(string journeyID, string checkpointID)
        {
            if (DeleteCheckpointMessage(journeyID, checkpointID) != "valid")
            {
                return(false);
            }

            //Deletes every booking and routes linked to this checkpoint
            foreach (Route route in routeDataAccess.GetCheckpointRoutes(journeyID, checkpointID))
            {
                bookingDataAccess.DeleteBookingsOfRoute(route.Route_ID);
                routeDataAccess.DeleteRoute(route.Route_ID);
            }

            return(checkpointDataAccess.DeleteCheckpoint(checkpointID));
        }
Esempio n. 3
0
        /// <summary>
        /// Method to delete a route
        /// </summary>
        /// <param name="checkpointID"></param>
        /// <returns></returns>
        public bool DeleteRoute(string routeId)
        {
            bool isBookingsDeleted = false;

            List <Booking> routeBookings = bookingDataAccess.GetAllBookingsByRouteID(routeId);

            if (routeBookings.Count == 0)
            {
                isBookingsDeleted = true;
            }

            foreach (Booking booking in routeBookings)
            {
                isBookingsDeleted = bookingDataAccess.DeleteBooking(booking.Booking_ID);
            }

            return(isBookingsDeleted && routeDataAccess.DeleteRoute(routeId));
        }