/// <summary>
        /// метод запускает меню предмета
        /// </summary>
        /// <param name="student"></param>
        public static void StartSubjectMenu(IJournalMarks journalMarks, IStudent student, ISubject subject, int index)
        {
            Clear();//очищаем консоль
            do
            {
                WriteLine("       Subject menu:");
                WriteLine((int)SubjectMenu.ShowMarks + " - Show all  marks,");
                WriteLine((int)SubjectMenu.AddMark + " - Add mark,");
                WriteLine((int)SubjectMenu.CorrectMark + " - Correct mark,");
                WriteLine((int)SubjectMenu.DelMark + " - Delete mark,");
                WriteLine((int)SubjectMenu.BackMenu + " - Back");

                string choice = null;
                int    answer = 0;
                do
                {
                    Write("Your choice: ");
                    choice = ReadLine();
                } while (!int.TryParse(choice, out answer));
                WriteLine("--------------------------------");

                switch ((SubjectMenu)answer)
                {
                case SubjectMenu.ShowMarks:
                    ClassSubjectMenu.ShowMarks(subject);
                    break;

                case SubjectMenu.AddMark:
                    ClassSubjectMenu.AddMark(student, subject, index);
                    break;

                case SubjectMenu.CorrectMark:
                    ClassSubjectMenu.CorrectMark(subject);
                    break;

                case SubjectMenu.DelMark:
                    ClassSubjectMenu.DelMark(subject);
                    break;

                case SubjectMenu.BackMenu:
                    StudentMenu.StartStudentMenu(journalMarks, student);
                    break;

                default:
                    WriteLine("Error iteam menu...");
                    break;
                }
                WriteLine("Done!");
                ReadKey(); //пауза
                Clear();   //очистка консоли
            } while (true);
        }
        /// <summary>
        /// выбрать студента
        /// </summary>
        /// <param name="journalMarks"></param>
        public static void ChoiceStudent(IJournalMarks journalMarks)
        {
            WriteLine(journalMarks);

            string data   = null;
            int    number = 0;

            do
            {
                Write("Choice student: ");
                data = ReadLine();
            } while (!int.TryParse(data, out number) || number <= 0 || number > journalMarks.Count);

            StudentMenu.StartStudentMenu(journalMarks, journalMarks.Students[number - 1]);
        }
Beispiel #3
0
        /// <summary>
        /// метод запускает меню студента
        /// </summary>
        /// <param name="student"></param>
        public static void StartStudentMenu(IJournalMarks journalMarks, IStudent student)
        {
            do
            {
                Clear();

                int    number = 0;
                string data   = null;

                WriteLine("       Student menu: ");
                WriteLine((int)MenuStudent.ChoiceSubject + " - Choice subject,");
                WriteLine((int)MenuStudent.BackMenu + " - Back,");
                do
                {
                    Write("Your choice: ");
                    data = ReadLine();
                } while (!int.TryParse(data, out number));
                WriteLine("--------------------------------");

                Student newStudent = student as Student;

                switch ((MenuStudent)number)
                {
                case MenuStudent.ChoiceSubject:
                    StudentMenu.ChoiceSubject(journalMarks, student);
                    break;

                case MenuStudent.BackMenu:
                    JournalMenu.StartMenuJournal(journalMarks);
                    break;

                default:
                    WriteLine("Error iteam menu...");
                    break;
                }
                WriteLine("Done!");
                ReadKey();//пауза
                Clear();
            } while (true);
        }