Exemplo n.º 1
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += ActionEvent;
            var engine = new SchoolEngine();

            engine.Initialize();
            Printer.DrawTitle("School courses for the jan - jun semester");
            var reporter                 = new Reporter(engine.GetObjectDictionary());
            var evaluationList           = reporter.GetListOfEvaluations();
            var subjectList              = reporter.GetListOfSubjects();
            var evaluationListBySubjects = reporter.GetEvaluationsListBySubject();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += EventAction;
            var engine = new SchoolEngine();

            engine.Initialize();

            Printer.WriteTitle("Welcome to the School");

            var reporter       = new Reporter(engine.GetObjectDictionary());
            var evaList        = reporter.GetEvaluationsList();
            var subjList       = reporter.GetSubjectsList();
            var evalXSubj      = reporter.GetEvaluationsXSubjectDictionary();
            var AvgSubjectList = reporter.GetAvgStudentXSubject();
            var test           = reporter.GetBestAverageXSubject(5);

            Printer.WriteTitle("Capture an evaluation by console");
            var    newEval = new Evaluation();
            string name, scoreString;

            WriteLine("Enter the name of the evaluation");
            Printer.PressEnter();
            name = Console.ReadLine();

            if (string.IsNullOrWhiteSpace(name))
            {
                Printer.WriteTitle("The value of name can't be empty");
                Printer.ExitingProgram();
            }
            else
            {
                newEval.Name = name.ToLower();
                WriteLine("Name has been saved correctly");
            }

            WriteLine("Enter the score of the evaluation");
            Printer.PressEnter();
            scoreString = Console.ReadLine();

            if (string.IsNullOrWhiteSpace(scoreString))
            {
                Printer.WriteTitle("The value of the score can't be empty");
                Printer.ExitingProgram();
            }
            else
            {
                try
                {
                    newEval.Score = float.Parse(scoreString);
                    if (newEval.Score < 0 || newEval.Score > 5)
                    {
                        throw new ArgumentOutOfRangeException("The score must be a value from 0 to 5");
                    }
                    WriteLine("The score has been saved correctly");
                }
                catch (ArgumentOutOfRangeException arge)
                {
                    WriteLine(arge.Message);
                }
                catch (Exception)
                {
                    Printer.WriteTitle("The value of the score isn't valid");
                    Printer.ExitingProgram();
                }
                finally
                {
                    Printer.WriteTitle("FINALLY");
                    Printer.Beeper(2500, 500, 3);
                }
            }
        }