/// <summary> /// /// </summary> /// <param name="newStudent"></param> public void Update(Model.NewStudent newStudent) { try { //this.dbContext.Set<Model.NewStudent>().Update(newStudent); this.dbContext.SaveChanges(); } catch (Exception ex) { throw (ex); } }
/// <summary> /// /// </summary> /// <param name="newStudent"></param> public void SetAsScience(Model.NewStudent newStudent) { try { newStudent.sfwk = 0; this.dbContext.SaveChanges(); } catch (Exception ex) { throw (ex); } }
/// <summary> /// /// </summary> /// <param name="newStudent"></param> public void Update(Model.NewStudent newStudent) { try { this.dbContext.Set <Model.NewStudent>().Update(newStudent); this.dbContext.SaveChanges(); } catch { throw; } }
/// <summary> /// /// </summary> /// <param name="newStudent"></param> public void SetAsLiberalArts(Model.NewStudent newStudent) { try { newStudent.sfwk = 1; this.dbContext.SaveChanges(); } catch (Exception ex) { throw (ex); } }
/// <summary> /// /// </summary> /// <param name="newStudent"></param> /// <param name="enrollment"></param> public void SetAsEnroll(Model.NewStudent newStudent, Model.Enrollment enrollment) { enrollment.NewStudentId = newStudent.NewStudentId; try { this.dbContext.Set <Model.Enrollment>().Add(enrollment); this.dbContext.SaveChanges(); } catch (Exception ex) { throw (ex); } }
public void ChangeStudentClass(Model.NewStudent s, Model.Class newClass, Model.Class oldClass) { try { Model.ClassAssignment assignment = this.dbContext.Set <Model.ClassAssignment>().Single(x => x.ClassId == oldClass.ClassId && x.NewStudentId == s.NewStudentId); assignment.ClassId = newClass.ClassId; this.dbContext.SaveChanges(); } catch (Exception ex) { throw (ex); } }
/// <summary> /// /// </summary> /// <param name="s"></param> /// <param name="c"></param> public void RemoveStudentFromClass(Model.NewStudent s, Model.Class c) { try { Model.ClassAssignment assignment = this.dbContext.Set <Model.ClassAssignment>().Single(x => x.ClassId == c.ClassId && x.NewStudentId == s.NewStudentId); this.dbContext.Set <Model.ClassAssignment>().Remove(assignment); this.dbContext.SaveChanges(); } catch (Exception ex) { throw (ex); } }
/// <summary> /// /// </summary> /// <param name="newStudent"></param> public void Delete(Model.NewStudent newStudent) { //1. 删除student //2. 删除报到信息 try { this.dbContext.Set <Model.NewStudent>().Remove(newStudent); this.dbContext.SaveChanges(); } catch (Exception ex) { throw (ex); } }
/// <summary> /// /// </summary> /// <param name="s"></param> /// <param name="c"></param> public void AddStudentToClass(Model.NewStudent s, Model.Class c) { Model.ClassAssignment assignment = new Model.ClassAssignment(); assignment.ClassId = c.ClassId; assignment.NewStudentId = s.NewStudentId; try { this.dbContext.Set <Model.ClassAssignment>().Add(assignment); this.dbContext.SaveChanges(); } catch (Exception ex) { throw(ex); } }
/// <summary> /// /// </summary> /// <param name="newStudent"></param> public void SetAsNotEnroll(Model.NewStudent newStudent) { try { Model.Enrollment enrollment = this.dbContext.Set <Model.Enrollment>().Single(x => x.EnrollmentId == newStudent.NewStudentId); if (enrollment != null) { this.dbContext.Set <Model.Enrollment>().Remove(enrollment); this.dbContext.SaveChanges(); } } catch (Exception ex) { throw (ex); } }
public bool IsEnroll(Model.NewStudent newStudent) { //return newStudent.Enrollment != null; return(true); }
public bool IsEnroll(Model.NewStudent newStudent) { return(newStudent.Enrollment != null); }