コード例 #1
0
        public static Assignments chooseAssignment()
        {
            IndividualPartBModel db             = new IndividualPartBModel();
            List <Assignments>   assignmentList = db.Assignments.ToList();

            HelperDB.showDbByType(assignmentList);
            int         listPosition = Helper.menuSelectionChecker(assignmentList.Count, false) - 1;
            Assignments assignment   = assignmentList[listPosition];

            return(assignment);
        }
コード例 #2
0
        public static Trainers chooseTrainer()
        {
            IndividualPartBModel db          = new IndividualPartBModel();
            List <Trainers>      trainerList = db.Trainers.OrderBy(x => x.lastName).ToList();

            HelperDB.showDbByType(trainerList);
            int      listPosition = Helper.menuSelectionChecker(trainerList.Count, false) - 1;
            Trainers trainer      = trainerList[listPosition];

            return(trainer);
        }
コード例 #3
0
        public static Students chooseStudent()
        {
            IndividualPartBModel db          = new IndividualPartBModel();
            List <Students>      studentList = db.Students.OrderBy(x => x.lastName).ToList();

            HelperDB.showDbByType(studentList);
            int      listPosition = Helper.menuSelectionChecker(studentList.Count, false) - 1;
            Students student      = studentList[listPosition];

            return(student);
        }
コード例 #4
0
        public static Courses chooseCourse()
        {
            IndividualPartBModel db         = new IndividualPartBModel();
            List <Courses>       courseList = db.Courses.ToList();

            HelperDB.showDbByType(courseList);
            int     listPosition = Helper.menuSelectionChecker(courseList.Count, false) - 1;
            Courses course       = courseList[listPosition];

            return(course);
        }
コード例 #5
0
        public static menuIDs trainertMenu()
        {
            //menuID = "130";
            Console.WriteLine("Trainer menu\n");
            Console.WriteLine("Please choose what you want to do:\n" +
                              "1. back\n" +
                              "2. add a new trainer\n" +
                              "3. see all trainers\n" +
                              "4. assign a trainer to a course\n" +
                              "5. see all the connections of all trainers\n" +
                              "EXIT to exit program\n");

            int selection = Helper.menuSelectionChecker(5, true);

            menuIDs IDselect = menuIDs.trainertMenu;

            switch (selection)
            {
            case 1:
                IDselect = menuIDs.centralMenu;
                break;

            case 2:
                ProjectHelper.addNew(availableTypes.Trainer);
                break;

            case 3:
                IndividualPartBModel db = new IndividualPartBModel();
                HelperDB.showDbByType(db.Trainers.ToList());
                break;

            case 4:
                ProjectHelper.addToCourse(availableTypes.Trainer);
                break;

            case 5:
                ProjectHelper.showAllConnections(availableTypes.Trainer);
                break;

            default:
                IDselect = menuIDs.exit;
                break;
            }
            if (selection == 3 || selection == 5)
            {
                Console.WriteLine("Please press any key to continue.");
                Console.ReadKey();
            }
            return(IDselect);
        }
コード例 #6
0
        public static menuIDs studentMenu()
        {
            //menuID = "120";
            Console.WriteLine("Student menu\n");
            Console.WriteLine("Please choose what you want to do:\n" +
                              "1. back\n" +
                              "2. add a new student\n" +
                              "3. see all students\n" +
                              "4. see infos about students\n" +
                              "5. add a course to a student\n" +
                              "EXIT to exit program\n");

            int selection = Helper.menuSelectionChecker(5, true);

            menuIDs IDselect = menuIDs.studentMenu;

            switch (selection)
            {
            case 1:
                IDselect = menuIDs.centralMenu;
                break;

            case 2:
                ProjectHelper.addNew(availableTypes.Student);
                break;

            case 3:
                IndividualPartBModel db = new IndividualPartBModel();
                HelperDB.showDbByType(db.Students.ToList());
                break;

            case 4:
                IDselect = menuIDs.infoStudentMenu;
                break;

            case 5:
                ProjectHelper.addToCourse(availableTypes.Student);
                break;

            default:
                IDselect = menuIDs.exit;
                break;
            }
            if (selection == 3)
            {
                Console.WriteLine("Please press any key to continue.");
                Console.ReadKey();
            }
            return(IDselect);
        }
コード例 #7
0
        public static menuIDs infoStudentMenu()
        {
            //menuID = "121";
            Console.WriteLine("Student info menu\n");
            Console.WriteLine("Please choose what you want to do:\n" +
                              "1. back\n" +
                              "2. see all the assignments of a student\n" +
                              "3. see all the courses of a student\n" +
                              "4. see the students with more than one courses\n" +
                              "5. see all the connections of all the students\n" +
                              "EXIT to exit program\n");

            int selection = Helper.menuSelectionChecker(5, true);

            menuIDs IDselect = menuIDs.infoStudentMenu;

            switch (selection)
            {
            case 1:
                IDselect = menuIDs.studentMenu;
                break;

            case 2:
                ProjectHelper.showStudentInfo(availableTypes.Assignment);
                break;

            case 3:
                ProjectHelper.showStudentInfo(availableTypes.Course);
                break;

            case 4:
                HelperDB.showStudentsWithMultipleCourses();
                break;

            case 5:
                ProjectHelper.showAllConnections(availableTypes.Student);
                break;

            default:
                IDselect = menuIDs.exit;
                break;
            }
            if (selection == 4 || selection == 5)
            {
                Console.WriteLine("Please press any key to continue.");
                Console.ReadKey();
            }
            return(IDselect);
        }
コード例 #8
0
        public static Trainers createTrainer()
        {
            Console.WriteLine("Please give the First Name of the trainer.");
            string firstName = Helper.noEmptyStringInputChecker();

            Console.WriteLine("Please give the Last Name of the trainer.");
            string lastName = Helper.noEmptyStringInputChecker();

            Console.WriteLine("Please give the Subject of the trainer.");
            string subject = Helper.noEmptyStringInputChecker();

            Trainers trainer = new Trainers(firstName, lastName, subject);

            HelperDB.addToDb(trainer);
            return(trainer);
        }
コード例 #9
0
        public static Students createStudent()
        {
            Console.WriteLine("Please give the First Name of the student.");
            string firstName = Helper.noEmptyStringInputChecker();

            Console.WriteLine("Please give the Last Name of the student.");
            string lastName = Helper.noEmptyStringInputChecker();

            Console.WriteLine("Please give the birth date of the student. (DD/MM/YYYY)");
            DateTime birthDate = Helper.validDateTimeInput(new DateTime(2020 - 120, 01, 01), DateTime.Now);

            Console.WriteLine("Please give the tuition fees of the student.");
            decimal tuitionFees = Helper.decimalInput(0, 9999.99m);

            Students student = new Students(firstName, lastName, birthDate, tuitionFees);

            HelperDB.addToDb(student);
            return(student);
        }
コード例 #10
0
        public static Assignments createAssignment(Courses course)
        {
            Console.WriteLine("Please give the Title of the assignment.");
            string title = Helper.noEmptyStringInputChecker();

            Console.WriteLine("Please give the Description of the assignment.");
            string description = Helper.noEmptyStringInputChecker();

            Console.WriteLine("Please give the SubDate of the assignment. (DD/MM/YYYY)");
            DateTime subDate = Helper.validDateTimeInput(course.start_date, course.end_date, true);

            Console.WriteLine("Please give the oralMark of the assignment, as an integer between 1 and 100.");
            int oralMark = Helper.intInput(1, 100);

            Console.WriteLine("Please give the totalMark of the assignment, as an integer between 1 and 100.");
            int totalMark = Helper.intInput(1, 100);

            Assignments assignment = new Assignments(title, description, subDate, oralMark, totalMark);

            HelperDB.addToDb(assignment);
            return(assignment);
        }
コード例 #11
0
        public static Courses createCourse()
        {
            Console.WriteLine("Please give the Title of the course.");
            string title = Helper.noEmptyStringInputChecker();

            Console.WriteLine("Please give the Stream of the course.");
            string stream = Helper.noEmptyStringInputChecker();

            Console.WriteLine("Please give the Type of the course.");
            string type = Helper.noEmptyStringInputChecker();

            Console.WriteLine("Please give the Start Date of the course. (DD/MM/YYYY)");
            DateTime startDate = Helper.validDateTimeInput(new DateTime(1753, 01, 01), new DateTime(9999, 12, 31));

            Console.WriteLine("Please give the End Date of the course. (DD/MM/YYYY)");
            DateTime endDate = Helper.validDateTimeInput(startDate, new DateTime(9999, 12, 31));

            Courses course = new Courses(title, stream, type, startDate, endDate);

            HelperDB.addToDb(course);
            return(course);
        }
コード例 #12
0
        public static void showAssignmentDates()
        {
            IndividualPartBModel db = new IndividualPartBModel();

            do
            {
                List <Assignments> assignmentsToSubmit = new List <Assignments>();
                Console.WriteLine("Please give a date to see if there are any assignments to be submitted.");
                DateTime dt      = Helper.validDateTimeInput();
                DateTime startDt = Helper.startOfCalendarWeek(dt);
                DateTime endDt   = startDt.AddDays(6);
                foreach (Assignments assignment in db.Assignments.ToList())
                {
                    if (assignment.subDateTime >= startDt && assignment.subDateTime <= endDt)
                    {
                        assignmentsToSubmit.Add(assignment);
                    }
                }
                Console.WriteLine("\nAssignments to be submitted between {0} and {1} :\n", startDt.ToString("dd/MM/yyyy"), endDt.ToString("dd/MM/yyyy"));
                if (assignmentsToSubmit.Count() == 0)
                {
                    Console.WriteLine("None assignment.");
                }
                else
                {
                    int assignmentCounter = 1;
                    foreach (Assignments assignment in assignmentsToSubmit)
                    {
                        HelperDB.show(assignment, assignmentCounter + ". ");
                        Console.WriteLine("\nStudents:");
                        assignment.showConnections(availableTypes.Student, false);
                        assignmentCounter++;
                    }
                }
                Console.WriteLine("\nWould you like to check another Date? (y/n)");
            } while (Helper.yesInput());
        }