Exemplo n.º 1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the teachers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToteachers(teacher teacher)
 {
     base.AddObject("teachers", teacher);
 }
Exemplo n.º 2
0
 private void dgTeachers_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.dgTeachers.SelectedItem != null)
     {
         this.currentTeacher = this.dgTeachers.SelectedItem as teacher;
     }
     else
     {
         this.currentTeacher = null;
     }
 }
Exemplo n.º 3
0
 public List<dynamic> GetDepartmentsByTeacher(teacher t)
 {
     CheckConnection();
     try
     {
         return t.ref_teacher_department.Select(x => x.department).ToList<dynamic>();
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create a new teacher object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="personId">Initial value of the PersonId property.</param>
 public static teacher Createteacher(global::System.Int64 id, global::System.Int64 personId)
 {
     teacher teacher = new teacher();
     teacher.Id = id;
     teacher.PersonId = personId;
     return teacher;
 }
Exemplo n.º 5
0
 public void DeleteDepartmentFromTeacher(teacher t, dynamic d)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             ref_teacher_department dr = t.ref_teacher_department.FirstOrDefault(x => x.department.Id == d.Id);
             db.ref_teacher_department.DeleteObject(dr);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 6
0
 public void DeleteSubjectFromTeacher(teacher t, dynamic s)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             ref_teacher_subject r = t.ref_teacher_subject.FirstOrDefault(x => x.subject.Id == s.Subject.Id);
             db.ref_teacher_subject.DeleteObject(r);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 7
0
 public void AddDepartmentToTeacher(teacher t, dynamic d)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             ref_teacher_department dr = ref_teacher_department.Createref_teacher_department(0, d.Id, t.Id);
             db.ref_teacher_department.AddObject(dr);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 8
0
 public void AddSubjectToTeacher(teacher t, dynamic s)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             ref_teacher_subject r = ref_teacher_subject.Createref_teacher_subject(0, s.Subject.Id, t.Id);
             db.ref_teacher_subject.AddObject(r);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 9
0
 public void DeleteTeacher(teacher t)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             t.person.IsDeleted = true;
             foreach (var i in t.ref_teacher_department)
                 db.ref_teacher_department.DeleteObject(i);
             foreach (var i in t.ref_teacher_subject)
                 db.DeleteObject(i);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 10
0
 public void EditTeacher(teacher t, person p)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             EditPerson(t.person, p.First_Name, p.Last_Name, p.Middle_Name, p.Birthday, p.H_Phone, p.M_Phone, p.Address, p.Email, p.SomeInformation, p.Photo);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 11
0
 public List<dynamic> GetSubjectsByTeacher(teacher t)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             IEnumerable<dynamic> lst = from i in t.ref_teacher_subject
                                        select new
                                        {
                                            Subject = i.subject
                                        };
             return lst.ToList();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }