예제 #1
0
        //Activates when a student leaves a subject
        public static void leaveSubjectNotification(int userID)
        {
            //if(teacherID == null)
            //{
            //    return;
            //}

            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                //int userID = db.tblTeachers.Where(x => x.teacherID == teacherID).FirstOrDefault().userID;

                tblStudent student = db.tblStudents.Where(x => x.userID == SessionManager.UserID).FirstOrDefault();

                tblNotification notification = new tblNotification
                {
                    notificationMessage = student.studentFullName + " left your class",
                    userID = userID,
                    notificationDateTime = DateTime.UtcNow,
                    notificationType     = "S",
                    notificationLink     = "TeacherStudents.aspx",
                    isSeen = false
                };

                db.tblNotifications.InsertOnSubmit(notification);
                db.SubmitChanges();
            }
        }
예제 #2
0
        // Activates when a teacher removes a student
        public static void removeStudentNotification(int userID)
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                tblTeacher teacher = db.tblTeachers.Where(x => x.userID == SessionManager.UserID).FirstOrDefault();

                string subjectTitle = db.tblSubjects.Where(x => x.subjectCode == teacher.subjectCode).FirstOrDefault().subjectTitle;

                tblNotification notification = new tblNotification
                {
                    notificationMessage = teacher.teacherFullName + " removed you from " + subjectTitle + "(" + teacher.subjectCode + ")",
                    userID = userID,
                    notificationDateTime = DateTime.UtcNow,
                    notificationType     = "S",
                    notificationLink     = "StudentSubjects.aspx",
                    isSeen = false
                };

                db.tblNotifications.InsertOnSubmit(notification);
                db.SubmitChanges();
            }
        }
예제 #3
0
        public static void assignmentCreateNotification(int userID)
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                tblTeacher teacher = db.tblTeachers.Where(x => x.userID == SessionManager.UserID).FirstOrDefault();
                tblSubject subject = db.tblSubjects.Where(x => x.subjectCode == teacher.subjectCode).FirstOrDefault();



                tblNotification notification = new tblNotification
                {
                    notificationMessage = "You have a new assignment for " + subject.subjectTitle + "(" + subject.subjectCode + ")",
                    userID = userID,
                    notificationDateTime = DateTime.UtcNow,
                    notificationType     = "A",
                    notificationLink     = "StudentAssignments.aspx",
                    isSeen = false
                };

                db.tblNotifications.InsertOnSubmit(notification);
                db.SubmitChanges();
            }
        }