Ejemplo n.º 1
0
 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; }
 }
Ejemplo n.º 2
0
 public List<Subject> GetAllSubject()
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Subjects select i).ToList();
     }
     catch { return null; }
 }
Ejemplo n.º 3
0
 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; }
 }
Ejemplo n.º 4
0
 public List<Class> GetAllClass()
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Classes select i).ToList();
     }
     catch { return null; }
 }
Ejemplo n.º 5
0
 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; }
 }
Ejemplo n.º 6
0
 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; }
 }
Ejemplo n.º 7
0
 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 9
0
 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 15
0
 public List<Part> GetAllPart()
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Parts select i).ToList();
     }
     catch
     {
         return null;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 18
0
 public List<User> GetAllUser()
 {
     try
     {
         pdb = new PESDBDataContext();
         return (from i in pdb.Users select i).ToList();
     }
     catch
     {
         return null;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
     }
 }