コード例 #1
0
        public static StudentAssignments CreateStudentAssignments()
        {
            StudentAssignments s = new StudentAssignments();

            s.Student = CreateStudent();
            ListDatabase.AllStudents.Add(s.Student);
            Console.Write("In how many courses is the student enrolled:");
            int x;

            while (!Int32.TryParse(Console.ReadLine(), out x) && x < 0)
            {
                Console.Write("Enter a positive number: ");
            }
            for (int i = 0; i < x; i++)
            {
                var obj = CreateAssignmentPerCourse(ListDatabase.AllCourses);
                AddToAList(s.AssignmentPerCourseList, obj);
                AddToAList(ListDatabase.AllAssignmentsPerCourse, obj);
            }
            AddToAList(ListDatabase.AllStudentAssignments, s);

            return(s);
        }
コード例 #2
0
        public static void SeedStudentsAssignments()
        {
            StudentAssignments spapc1 = new StudentAssignments();

            spapc1.Student.FirstName   = "Kostas";
            spapc1.Student.LastName    = "Grodis";
            spapc1.Student.DateOfBirth = new DateTime(1990, 04, 15);
            spapc1.Student.TuitionFees = 2500;
            CommonTools.AddToAList(Students, spapc1.Student);

            AssignmentPerCourse aspc1 = new AssignmentPerCourse();

            aspc1.course.Title      = "CB15";
            aspc1.course.Stream     = "Full time";
            aspc1.course.Type       = "C#";
            aspc1.course.Start_Date = new DateTime(2022, 06, 01);
            aspc1.course.End_Date   = new DateTime(2022, 09, 01);
            CommonTools.AddToAList(CourseList, aspc1.course);

            StudentPerCourse stpc1 = new StudentPerCourse();

            stpc1.course = aspc1.course;
            stpc1.StudentsPerCourse.Add(spapc1.Student);
            CommonTools.AddToAList(StudentsPerCourse, stpc1);

            Assignment a1 = new Assignment();

            a1.Title       = "Area of Triangle";
            a1.Description = "Calculate the area of a triangle";
            a1.SubDateTime = new DateTime(2019, 06, 20);
            a1.OralMark    = 50;
            a1.TotalMark   = 50;

            Assignment a2 = new Assignment();

            a2.Title       = "Area of Square";
            a2.Description = "Calculate the area of a square";
            a2.SubDateTime = new DateTime(2019, 06, 19);
            a2.OralMark    = 50;
            a2.TotalMark   = 50;

            CommonTools.AddToAList(Assignments, a1);
            CommonTools.AddToAList(Assignments, a2);
            CommonTools.AddToAList(aspc1.AssignmentsPerCourse, a1);
            CommonTools.AddToAList(aspc1.AssignmentsPerCourse, a2);
            CommonTools.AddToAList(AssignmentsPerCourse, aspc1);


            CommonTools.AddToAList(spapc1.AssignmentPerCourseList, aspc1);

            AssignmentPerCourse aspc2 = new AssignmentPerCourse();

            aspc2.course.Title      = "CB15";
            aspc2.course.Stream     = "Part time";
            aspc2.course.Type       = "C#";
            aspc2.course.Start_Date = new DateTime(2022, 06, 01);
            aspc2.course.End_Date   = new DateTime(2022, 12, 01);
            CommonTools.AddToAList(CourseList, aspc2.course);

            StudentPerCourse studpc = new StudentPerCourse();

            studpc.course = aspc2.course;
            studpc.StudentsPerCourse.Add(spapc1.Student);
            CommonTools.AddToAList(StudentsPerCourse, studpc);

            Assignment a3 = new Assignment();

            a3.Title       = "Sum three strings";
            a3.Description = "Write function to sum three strings";
            a3.SubDateTime = new DateTime(2019, 06, 21);
            a3.OralMark    = 50;
            a3.TotalMark   = 50;

            Assignment a4 = new Assignment();

            a4.Title       = "Website";
            a4.Description = "Create a static web page";
            a4.SubDateTime = new DateTime(2019, 06, 17);
            a4.OralMark    = 50;
            a4.TotalMark   = 50;

            CommonTools.AddToAList(Assignments, a3);
            CommonTools.AddToAList(Assignments, a4);
            CommonTools.AddToAList(aspc2.AssignmentsPerCourse, a3);
            CommonTools.AddToAList(aspc2.AssignmentsPerCourse, a4);
            CommonTools.AddToAList(AssignmentsPerCourse, aspc2);

            CommonTools.AddToAList(spapc1.AssignmentPerCourseList, aspc2);
            CommonTools.AddToAList(StudentAssignments, spapc1);


            StudentAssignments spapc2 = new StudentAssignments();

            spapc2.Student.FirstName   = "Mary";
            spapc2.Student.LastName    = "Ioannou";
            spapc2.Student.DateOfBirth = new DateTime(1993, 11, 30);
            spapc2.Student.TuitionFees = 2500;
            CommonTools.AddToAList(Students, spapc2.Student);

            spapc2.AssignmentPerCourseList.Add(AssignmentsPerCourse[0]);
            spapc2.AssignmentPerCourseList.Add(AssignmentsPerCourse[1]);

            StudentPerCourse stpc2 = new StudentPerCourse();

            stpc2.course = spapc2.AssignmentPerCourseList[0].course;
            stpc2.StudentsPerCourse.Add(spapc2.Student);
            StudentPerCourse stpc3 = new StudentPerCourse();

            stpc3.course = spapc2.AssignmentPerCourseList[1].course;
            stpc3.StudentsPerCourse.Add(spapc2.Student);

            CommonTools.AddToAList(StudentsPerCourse, stpc2);
            CommonTools.AddToAList(StudentsPerCourse, stpc3);



            CommonTools.AddToAList(StudentAssignments, spapc2);
        }