/// <summary> /// Deprecated Method for adding a new object to the departments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTodepartments(department department) { base.AddObject("departments", department); }
/// <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; }
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); } }
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); } }
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); } }
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); } }
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); } }