예제 #1
0
        private static void AddSkiRun()
        {
            SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL();
            SkiRun skiRun = new SkiRun();

            skiRun = ConsoleView.AddSkiRun();
            using (skiRunRepository)
            {
                skiRunRepository.InsertSkiRun(skiRun);
            }

            ConsoleView.DisplayContinuePrompt();
        }
예제 #2
0
        private static void DisplaySkiRunDetail()
        {
            SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL();
            List<SkiRun> skiRuns;
            SkiRun skiRun = new SkiRun();
            int skiRunID;

            using (skiRunRepository)
            {
                skiRuns = skiRunRepository.SelectAllSkiRuns();
            }

            skiRunID = ConsoleView.GetSkiRunID(skiRuns);

            using (skiRunRepository)
            {
                skiRun = skiRunRepository.SelectSkiRun(skiRunID);
            }

            ConsoleView.DisplaySkiRun(skiRun);
            ConsoleView.DisplayContinuePrompt();
        }
예제 #3
0
        private static void DeleteSkiRun()
        {
            SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL();
            List<SkiRun> skiRuns = skiRunRepository.SelectAllSkiRuns();
            SkiRun skiRun = new SkiRun();
            int skiRunID;
            string message;

            skiRunID = ConsoleView.GetSkiRunID(skiRuns);

            using (skiRunRepository)
            {
                skiRunRepository.DeleteSkiRun(skiRunID);
            }

            ConsoleView.DisplayReset();

            // TODO refactor
            message = String.Format("Ski Run ID: {0} had been deleted.", skiRunID);

            ConsoleView.DisplayMessage(message);
            ConsoleView.DisplayContinuePrompt();
        }
예제 #4
0
        private static void ListAllSkiRuns()
        {
            SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL();
            List<SkiRun> skiRuns;

            using (skiRunRepository)
            {
                skiRuns = skiRunRepository.SelectAllSkiRuns();
                ConsoleView.DisplayAllSkiRuns(skiRuns);
                ConsoleView.DisplayContinuePrompt();
            }
        }
예제 #5
0
        private static void UpdateSkiRun()
        {
            SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL();
            List<SkiRun> skiRuns = skiRunRepository.SelectAllSkiRuns();
            SkiRun skiRun = new SkiRun();
            int skiRunID;

            using (skiRunRepository)
            {
                skiRuns = skiRunRepository.SelectAllSkiRuns();
            }

            skiRunID = ConsoleView.GetSkiRunID(skiRuns);

            using (skiRunRepository)
            {
                skiRun = skiRunRepository.SelectSkiRun(skiRunID);
            }

            skiRun = ConsoleView.UpdateSkiRun(skiRun);

            using (skiRunRepository)
            {
                skiRunRepository.UpdateSkiRun(skiRun);
            }
        }
예제 #6
0
        private static void QuerySkiRunsByVertical()
        {
            SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL();
            List<SkiRun> matchingSkiRuns = new List<SkiRun>();
            int minimumVertical;
            int maximumVertical;

            ConsoleView.GetVerticalQueryMinMaxValues(out minimumVertical, out maximumVertical);

            using (skiRunRepository)
            {
                matchingSkiRuns = skiRunRepository.QueryByVertical(minimumVertical, maximumVertical);
            }

            ConsoleView.DisplayQueryResults(matchingSkiRuns);
            ConsoleView.DisplayContinuePrompt();
        }