Exemplo n.º 1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the departments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTodepartments(department department)
 {
     base.AddObject("departments", department);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create a new department object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="facultyId">Initial value of the FacultyId property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static department Createdepartment(global::System.Int64 id, global::System.String name, global::System.Int64 facultyId, global::System.Boolean isDeleted)
 {
     department department = new department();
     department.Id = id;
     department.Name = name;
     department.FacultyId = facultyId;
     department.IsDeleted = isDeleted;
     return department;
 }
Exemplo n.º 3
0
 public void DeleteDepartment(department d)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             d.IsDeleted = true;
             foreach (var i in d.studentsgroups)
                 DeleteStudentGroups(i);
             foreach (var i in d.ref_subject_department)
                 db.ref_subject_department.DeleteObject(i);
             foreach (var i in d.ref_teacher_department)
                 db.ref_teacher_department.DeleteObject(i);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 4
0
 public void EditDepartment(faculty f, department d, string name)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             d.Name = name;
             d.FacultyId = f.Id;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 5
0
 public List<subject> GetSubjectsByDepartment(department d)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             return d.ref_subject_department.Select(i => i.subject).ToList();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 6
0
 public void EditStudentGroup(studentsgroup s, string newName, department d, DateTime dateIn, DateTime dateOut, int course)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             s.Name = newName;
             s.DepartmentId = d.Id;
             s.DateIn = dateIn;
             s.DateOut = dateOut;
             s.Course = course;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
Exemplo n.º 7
0
 public studentsgroup AddStudentGroup(string name, department d, DateTime dateIn, DateTime dateOut, int course)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             studentsgroup s = studentsgroup.Createstudentsgroup(0, name, course, d.Id, dateIn, dateOut, false);
             db.studentsgroups.AddObject(s);
             db.SaveChanges();
             return s;
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }