Example #1
0
        public void DeleteOfStudentsAsUsers(DataClasses1DataContext db, int studentID, int userID, int courseID, int assignmentIDThisUser)
        {
            ASSIGNMENT_PER_STUDENT assignmnetPerStudent = new ASSIGNMENT_PER_STUDENT();
            STUDENT_PER_COURSE     sTudentPerCourse     = new STUDENT_PER_COURSE();
            StudentPerAssignment   studentPerAssignment = new StudentPerAssignment();
            StudentPerCourse       studentPerCourse     = new StudentPerCourse();
            STUDENT sTudent = new STUDENT();
            Student student = new Student();
            USERR   user    = new USERR();

            if (studentID < 1)
            {
                DeleteUser(user, userID, db);
            }
            else if (studentID > 0 && courseID < 1 && assignmentIDThisUser < 1)
            {
                student.DeleteStudent(db, sTudent, studentID);
                DeleteUser(user, userID, db);
            }
            else if (studentID > 0 && courseID > 0 && assignmentIDThisUser < 1)
            {
                studentPerCourse.DeleteCourses(studentID, sTudentPerCourse, db);
                student.DeleteStudent(db, sTudent, studentID);
                DeleteUser(user, userID, db);
            }
            else if (studentID > 0 && courseID > 0 && assignmentIDThisUser > 0)
            {
                studentPerAssignment.DeleteAssignemnts(studentID, assignmnetPerStudent, db);
                studentPerCourse.DeleteCourses(studentID, sTudentPerCourse, db);
                student.DeleteStudent(db, sTudent, studentID);
                DeleteUser(user, userID, db);
            }
            Console.WriteLine("\n\tDeleted Succesfully!!!");
        }
        public void GetStudentAssignmentPerCourse(int studentID, DataClasses1DataContext db)
        {
            StudentPerAssignment studentPerAssignment = new StudentPerAssignment();

            var getStudentAssignmentPerCourse = from i in db.ASSIGNMENT_PER_COURSEs
                                                from j in db.STUDENT_PER_COURSEs
                                                where j.STUDENT_ID == studentID && j.COURSE_ID == i.COURSE_ID
                                                select new
            {
                assignmentDesc          = i.ASSIGNMENT.DESCRIPTIONN,
                assignmentSubmisionDate = i.ASSIGNMENT.SUBMISSION_DATE_AND_TIME,
                courseTitle             = i.COURSE.TITLE
            };

            Console.WriteLine("\t" + "ASSIGNMENT PER COURSE PER STUDENT" + "\n" + "\t" + "---------------------------------");
            getStudentAssignmentPerCourse.ToList().ForEach(i => Console.WriteLine("\n\t" + $"Course title: {i.courseTitle}" + "\n" +
                                                                                  "\t" + $"Assignment description: {i.assignmentDesc}" + "\n" +
                                                                                  "\t" + $"Assignment submision date: {i.assignmentSubmisionDate}" + "\n"));

            studentPerAssignment.SubmitAssignment(studentID, db);
        }