Ejemplo n.º 1
0
 /// <summary>
 /// Handles errors for File I/O operations.
 /// </summary>
 /// <param name="exc"></param>
 private static void CatchIOExceptions(Exception exc)
 {
     if (exc is DriveNotFoundException)
     {
         //Display the error message on the screen.
         ConsoleView.DisplayErrorMessage(exc.Message.ToString());
         Console.ReadKey();
         return;
     }
     else if (exc is DirectoryNotFoundException)
     {
         //Display the error message on the screen.
         ConsoleView.DisplayErrorMessage(exc.Message.ToString());
         Console.ReadKey();
         return;
     }
     else if (exc is FileNotFoundException)
     {
         //Display the error message on the screen.
         ConsoleView.DisplayErrorMessage(exc.Message.ToString());
         Console.ReadKey();
         return;
     }
     else if (exc is EndOfStreamException)
     {
         //Display the error message on the screen.
         ConsoleView.DisplayErrorMessage(exc.Message.ToString());
         Console.ReadKey();
         return;
     }
     else if (exc is ArgumentException)
     {
         //Display the error message on the screen.
         ConsoleView.DisplayErrorMessage(exc.Message.ToString());
         Console.ReadKey();
         return;
     }
     else if (exc is Exception)
     {
         //Display the error message on the screen.
         ConsoleView.DisplayErrorMessage(exc.Message.ToString());
         Console.ReadKey();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Displays a list of all ski runs
        /// </summary>
        /// <param name="skiRunRepository"></param>
        private static void DisplaySkiRunDetail()
        {
            SkiRunBusiness skiRunBusiness = new SkiRunBusiness(skiRunRepository);

            ConsoleView.DisplayReset();
            //ConsoleView.DisplayHeader("Display Ski Run Information");
            using (skiRunBusiness)
            {
                try
                {
                    //Display the ski run information on the screen.
                    ConsoleView.DisplaySkiRunDetail(skiRunRepository.SelectById(ConsoleView.GetIntegerFromUser("Enter the ID for the Ski Run: ")));
                    ConsoleView.DisplayContinuePrompt();
                }
                catch (Exception ex)
                {
                    ConsoleView.DisplayErrorMessage(ex.Message);
                    ConsoleView.DisplayContinuePrompt();
                }
            }
        }