public Subject GetSubjectByID(int idSubject)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Subjects where idSubject == i.SubjectID select i).FirstOrDefault();
     }
     catch { return null; }
 }
 public List<Subject> GetAllSubject()
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Subjects select i).ToList();
     }
     catch { return null; }
 }
 public Class GetClassByID(int idClass)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from c in pdb.Classes where c.ClassID == idClass select c).FirstOrDefault();
     }
     catch { return null; }
 }
 public List<Class> GetAllClass()
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Classes select i).ToList();
     }
     catch { return null; }
 }
 public Subject GetSubjectByName(string nameSubject)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Subjects where nameSubject == i.SubjectName select i).FirstOrDefault();
     }
     catch { return null; }
 }
 public List<Subject> GetSubjectByClassID(int idClass)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Subjects where idClass == i.ClassID select i).ToList();
     }
     catch { return null; }
 }
 public Class GetClassByName(string nameClass)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from c in pdb.Classes where c.ClassName == nameClass select c).FirstOrDefault();
     }
     catch
     {
         return null;
     }
 }
Example #8
0
 public static PESDBDataContext GetDataContext()
 {
     if (HttpContext.Current != null)
     {
         if (HttpContext.Current.Items["MyDataContext"] == null)
             HttpContext.Current.Items["MyDataContext"] = new PESDBDataContext(dbConnection);
         return (PESDBDataContext)HttpContext.Current.Items["MyDataContext"];
     }
     else
     {
         PESDBDataContext context = CallContext.GetData("MyDataContext") as PESDBDataContext;
         if (context == null)
         {
             context = new PESDBDataContext(dbConnection);
             CallContext.SetData("MyDataContext", context);
         }
         return context;
     }
 }
 public List<Exercise> GetExerciseByLessonID(int idLesson)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Exercises where i.LessonID == idLesson select i).ToList();
     }
     catch
     {
         return null;
     }
 }
Example #10
0
 public Exercise GetExerciseByID(int idExercise)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Exercises where i.ExerciseID == idExercise select i).FirstOrDefault();
     }
     catch
     {
         return null;
     }
 }
Example #11
0
 public List<Theory> GetTheoryByLessonID(int idLesson)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Theories where i.LessonID == idLesson select i).ToList();
     }
     catch
     {
         return null;
     }
 }
Example #12
0
 public User GetUserByID(Guid ID)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Users where i.UserID == ID select i).FirstOrDefault();
     }
     catch
     {
         return null;
     }
 }
Example #13
0
 public User GetUserByEmail(string mail)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Users where i.Email == mail select i).FirstOrDefault();
     }
     catch
     {
         return null;
     }
 }
Example #14
0
 public Lesson GetLessonByID(int idLesson)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Lessons where i.LessonID == idLesson select i).FirstOrDefault();
     }
     catch
     {
         return null;
     }
 }
Example #15
0
 public List<Part> GetAllPart()
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Parts select i).ToList();
     }
     catch
     {
         return null;
     }
 }
Example #16
0
 public List<Part> GetPartBySubjectID(int idsubject)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Parts where i.SubjectID == idsubject select i).ToList();
     }
     catch
     {
         return null;
     }
 }
Example #17
0
 public Part GetPartByName(string namePart)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Parts where i.PartName == namePart select i).FirstOrDefault();
     }
     catch
     {
         return null;
     }
 }
Example #18
0
 public List<User> GetAllUser()
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Users select i).ToList();
     }
     catch
     {
         return null;
     }
 }
Example #19
0
 public Lesson GetLessonByName(string nameLesson)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Lessons where i.LessonName == nameLesson select i).FirstOrDefault();
     }
     catch
     {
         return null;
     }
 }
Example #20
0
 public User GetUserByName(string name)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Users where i.UserName == name select i).FirstOrDefault();
     }
     catch 
     {
         return null;
     }
 }
Example #21
0
 public List<Lesson> GetLessonByPartID(int idPart)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Lessons where i.PartID == idPart select i).ToList();
     }
     catch
     {
         return null;
     }
 }
Example #22
0
 public Theory GetTheoryByID(int idTheory)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Theories where i.TheoryID == idTheory select i).FirstOrDefault();
     }
     catch
     {
         return null;
     }
 }
Example #23
0
 public Part GetPartByID(int idPart)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Parts where i.PartID == idPart select i).FirstOrDefault();
     }
     catch
     {
         return null;
     }
 }
Example #24
0
 public List<Lesson> GetLessonByPartname(string partname)
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Lessons where i.PartID == GetPartByName(partname).PartID select i).ToList();
     }
     catch
     {
         return null;
     }
 }