예제 #1
0
        static public void SyntheticDataMenu()
        {
            Console.Clear();
            Console.WriteLine("Select an option from SyntheticData menu: ");
            Console.Write("0.Back to Main Menu\n1.Insert Courses\n2.Insert Trainers" +
                          "\n3.Insert Students\n4.Insert Assignments\n5.Insert All\n\n------\n>");
            int temp = Input.Integer(0, 5);

            switch (temp)
            {
            case 0:
            {
                Console.Clear();
                MainMenu();
                break;
            }

            case 1:
            {
                if (courses.Any())
                {
                    Console.WriteLine("Already inserted SyntheticData for courses");
                }
                else
                {
                    Console.WriteLine("Succesfully inserted SyntheticData for courses");
                    SyntheticData.Courses(courses);
                }
                Console.Write("Press any button to continue...");
                Console.ReadKey();
                SyntheticDataMenu();
                break;
            }

            case 2:
            {
                if (trainers.Any())
                {
                    Console.WriteLine("Already inserted SyntheticData for trainers");
                }
                else
                {
                    Console.WriteLine("Succesfully inserted SyntheticData for trainers");
                    SyntheticData.Trainers(trainers, courses);
                }
                Console.Write("Press any button to continue...");
                Console.ReadKey();
                SyntheticDataMenu();
                break;
            }

            case 3:
            {
                if (students.Any())
                {
                    Console.WriteLine("Already inserted SyntheticData for students");
                }
                else
                {
                    Console.WriteLine("Succesfully inserted SyntheticData for students");
                    SyntheticData.Students(students, courses);
                }
                Console.Write("Press any button to continue...");
                Console.ReadKey();
                SyntheticDataMenu();
                break;
            }

            case 4:
            {
                if (assignments.Any())
                {
                    Console.WriteLine("Already inserted SyntheticData for assignments");
                }
                else
                {
                    Console.WriteLine("Succesfully inserted SyntheticData for assignments");
                    SyntheticData.Assignments(assignments, courses);
                }
                Console.Write("Press any button to continue...");
                Console.ReadKey();
                SyntheticDataMenu();
                break;
            }

            case 5:
            {
                if (courses.Any())
                {
                    Console.WriteLine("Already inserted SyntheticData for courses");
                }
                else
                {
                    Console.WriteLine("Succesfully inserted SyntheticData for courses");
                    SyntheticData.Courses(courses);
                }
                if (trainers.Any())
                {
                    Console.WriteLine("Already inserted SyntheticData for trainers");
                }
                else
                {
                    Console.WriteLine("Succesfully inserted SyntheticData for trainers");
                    SyntheticData.Trainers(trainers, courses);
                }
                if (students.Any())
                {
                    Console.WriteLine("Already inserted SyntheticData for students");
                }
                else
                {
                    Console.WriteLine("Succesfully inserted SyntheticData for students");
                    SyntheticData.Students(students, courses);
                }
                if (assignments.Any())
                {
                    Console.WriteLine("Already inserted SyntheticData for assignments");
                }
                else
                {
                    Console.WriteLine("Succesfully inserted SyntheticData for assignments");
                    SyntheticData.Assignments(assignments, courses);
                }
                Console.Write("Press any button to continue...");
                Console.ReadKey();
                MainMenu();
                break;
            }
            }
        }
예제 #2
0
        static public void AssignmentsMenu()
        {
            Console.Clear();
            Console.WriteLine("Select an option from Assignments menu: ");
            Console.Write("0.Back to Main Menu\n1.Insert\n2.Display\n3.Exit\n\n------\n>");
            int temp = Input.Integer(0, 3);

            switch (temp)
            {
            case 0:
            {
                MainMenu();
                break;
            }

            case 1:
            {
                do
                {
                    Console.Clear();
                    Console.Write("How many assignments you want to add?\nMaximum number:5\n\n------\n>");
                    temp = Input.Integer(1, 5);
                    for (int i = 1; i <= temp; i++)
                    {
                        Assignment assignment = new Assignment();
                        assignment.TitleInsert(assignments);
                        if (assignment.Title.Contains("exit"))
                        {
                            Console.WriteLine("You exit from register process...");
                            break;
                        }
                        assignment.DescriptionInsert();
                        assignment.SubmissionInsert();
                        assignment.CourseInsert(courses);
                        assignment.MarksInsert();
                        assignment.IdInsert();
                        assignments.Add(assignment);
                    }
                    Console.WriteLine("Do you want to add more assignments? <Y> or <N>?");
                } while (Console.ReadKey(true).Key == ConsoleKey.Y);
                AssignmentsMenu();
                break;
            }

            case 2:
            {
                Console.Clear();
                if (Check.ListEmpty(assignments))
                {
                    if (Check.ListEmpty(courses))
                    {
                        SyntheticData.Courses(courses);
                    }
                    SyntheticData.Assignments(assignments, courses);
                }
                Display.Assignments(assignments);
                Console.WriteLine();
                Console.Write("If you want more info about each assignment please type its id:\nPress 0 to go back\n\n------\n>");
                temp = Input.Integer(0, assignments.Count);
                while (temp != 0)
                {
                    Console.WriteLine("Id Title \t\tDescription\t Submission Date");
                    Console.WriteLine(assignments[temp - 1]);
                    assignments[temp - 1].InfoDisplay();
                    Console.Write("\nIf you want more info about other assignment please type its id:\nPress 0 to go back\n\n------\n>");
                    temp = Input.Integer(0, assignments.Count);
                }
                Console.Write("Press any button to continue...");
                Console.ReadKey();
                AssignmentsMenu();
                break;
            }

            case 3:
            {
                Console.WriteLine("Are you sure want to close the program? <Y> or <N>?");
                if (Console.ReadKey(true).Key == ConsoleKey.Y)
                {
                    Console.WriteLine("\nExiting...\n");
                    break;
                }
                else
                {
                    Console.Clear();
                    AssignmentsMenu();
                    break;
                }
            }
            }
        }