/// <summary> /// Allows the user to select a list of ski runs based on the vertical value /// </summary> /// <param name="skiRunRepository"></param> private static void QuerySkiRunsByVertical() { SkiRunBusiness skiRunBusiness = new SkiRunBusiness(skiRunRepository); int[] minMaxValues = ConsoleView.DisplayGetSkiRunQuery(); using (skiRunBusiness) { List <SkiRun> results = skiRunBusiness.QueryByVertical(minMaxValues[0], minMaxValues[1]); ConsoleView.DisplayQueryResults(results); } ConsoleView.DisplayContinuePrompt(); }
private static void QuerySkiRunsByVertical() { SkiRunRepositoryXML_DS skiRunRepository = new SkiRunRepositoryXML_DS(); 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(); }
private void ApplicationControl() { SkiRunRepositoryXML skiRunRepository = new SkiRunRepositoryXML(); ConsoleView.DisplayWelcomeScreen(); using (skiRunRepository) { List <SkiRun> skiRuns = skiRunRepository.GetSkiAllRuns(); int skiRunID; SkiRun skiRun; string message; while (active) { AppEnum.ManagerAction userActionChoice; userActionChoice = ConsoleView.GetUserActionChoice(); switch (userActionChoice) { case AppEnum.ManagerAction.None: break; case AppEnum.ManagerAction.ListAllSkiRuns: ConsoleView.DisplayAllSkiRuns(skiRuns); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.DisplaySkiRunDetail: skiRunID = ConsoleView.GetSkiRunID(skiRuns); skiRun = skiRunRepository.GetSkiRunByID(skiRunID); ConsoleView.DisplaySkiRun(skiRun); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.AddSkiRun: skiRun = ConsoleView.AddSkiRun(); skiRunRepository.InsertSkiRun(skiRun); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.UpdateSkiRun: skiRunID = ConsoleView.GetSkiRunID(skiRuns); skiRun = skiRunRepository.GetSkiRunByID(skiRunID); skiRun = ConsoleView.UpdateSkiRun(skiRun); skiRunRepository.UpdateSkiRun(skiRun); break; case AppEnum.ManagerAction.DeleteSkiRun: skiRunID = ConsoleView.GetSkiRunID(skiRuns); skiRunRepository.DeleteSkiRun(skiRunID); ConsoleView.DisplayReset(); message = String.Format("Ski Run ID: {0} had been deleted.", skiRunID); ConsoleView.DisplayMessage(message); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.QuerySkiRunsByVertical: List <SkiRun> matchingSkiRuns = new List <SkiRun>(); int minimumVertical; int maximumVertical; ConsoleView.GetVerticalQueryMinMaxValues(out minimumVertical, out maximumVertical); matchingSkiRuns = skiRunRepository.QueryByVertical(minimumVertical, maximumVertical); ConsoleView.DisplayQueryResults(matchingSkiRuns); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.Quit: active = false; break; default: break; } } } ConsoleView.DisplayExitPrompt(); }