Exemplo n.º 1
0
        /// <summary>
        /// Add the schedules for the flight
        /// </summary>
        /// <parameter name="scheduleInfo"></parameter>
        /// <exception cref="ScheduleManagerException">Thorwn when unable to add the schedule</exception>
        /// <returns>Returns the status of the insertion</returns>
        public bool AddSchedule(Schedule scheduleInfo)
        {
            bool isScheduleInfoValid = ValidateScheduleInfo(scheduleInfo);

            if (isScheduleInfoValid)
            {
                try
                {
                    int noOfRows = scheduleDAO.AddSchedule(scheduleInfo);
                    if (noOfRows > 0)
                    {
                        isScheduleInfoValid = true;
                    }
                }
                catch (RouteNotAvailableForScheduleDAOException ex)
                {
                    throw new RouteNotAvailableException("Route for the given schedule doesnt exist");
                }
                catch (ScheduleDAOException ex)
                {
                    throw new ScheduleManagerException("Unable to add schedule", ex);
                }
            }
            else
            {
                isScheduleInfoValid = false;
            }

            return(isScheduleInfoValid);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Add the schedules for the flight
 /// </summary>
 /// <parameter name="scheduleInfo"></parameter>
 /// <exception cref="ScheduleManagerException">Thorwn when unable to add the schedule</exception>
 /// <returns>Returns the number of rows being affected by the insertion</returns>
 public int AddSchedule(Schedule ScheduleInfo)
 {
     try
     {
         return(scheduleDAO.AddSchedule(ScheduleInfo));
     }
     catch (ScheduleDAOException ex)
     {
         throw new ScheduleManagerException("Unable to add schedule", ex);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Add the schedules for the flight
        /// </summary>
        /// <parameter name="scheduleInfo"></parameter>
        /// <exception cref="ScheduleManagerException">Thorwn when unable to add the schedule</exception>
        /// <returns>Returns the number of rows being affected by the insertion</returns>
        public int AddSchedule(Schedule scheduleInfo)
        {
            try
            {
                CheckIfScheduleAlreadyExists(scheduleInfo, "Add");

                return(scheduleDAO.AddSchedule(scheduleInfo));
            }
            catch (ScheduleManagerException)
            {
                throw;
            }
            catch (ScheduleDAOException ex)
            {
                throw new ScheduleManagerException("Unable to add schedule", ex);
            }
        }