public static int getNumberofClassesEnrolled(string email) { int id = 0; int count = 0; SE_ProjectEntities db = new SE_ProjectEntities(); if (db.StudentTbls.Any(s => s.Email.Equals(email))) { id = DLSInterface.GetIdByEmail(email); foreach (StudentClassOTM k in db.StudentClassOTMs) { if (k.Student_Id == id) { count++; } } } else { id = DLSInterface.GetIdByEmail(email); foreach (TeacherClassOTM s in db.TeacherClassOTMs) { if (s.Teacher_Id == id) { count++; } } } return(count); }
public static bool isTeacher(string email) { SE_ProjectEntities db = new SE_ProjectEntities(); if (db.TeacherTbls.Any(t => t.Email.Equals(email))) { return(true); } return(false); }
public static void ImageFromEmail(string email) { SE_ProjectEntities db = new SE_ProjectEntities(); if (db.Profiles.Any(p => p.Email.Equals(email))) { profileImage = db.Profiles.Where(p => p.Email.Equals(email)).FirstOrDefault().ProfilePicture; } else { profileImage = null; } }
public static string getNameByEmail(string email) { SE_ProjectEntities db = new SE_ProjectEntities(); string result = ""; if (db.TeacherTbls.Any(t => t.Email.Equals(email))) { result = db.TeacherTbls.Where(t => t.Email.Equals(email)).FirstOrDefault().Name; } else if (db.StudentTbls.Any(s => s.Email.Equals(email))) { result = db.StudentTbls.Where(t => t.Email.Equals(email)).FirstOrDefault().Name; } return(result); }
public static string GetNameById(int id) { SE_ProjectEntities db = new SE_ProjectEntities(); if (db.TeacherTbls.Any(t => t.Id == id)) { return(db.TeacherTbls.Where(t => t.Id == id).FirstOrDefault().Name); } else if (db.StudentTbls.Any(s => s.Id == id)) { return(db.StudentTbls.Where(s => s.Id == id).FirstOrDefault().Name); } else { return(null); } }
public static int GetIdByEmail(string email) { SE_ProjectEntities db = new SE_ProjectEntities(); foreach (TeacherTbl k in db.TeacherTbls) { if (k.Email == email) { return(k.Id); } } foreach (StudentTbl s in db.StudentTbls) { if (s.Email == email) { return(s.Id); } } return(-1); }