예제 #1
0
 /// <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);
     }
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="newStudent"></param>
 public void SetAsScience(Model.NewStudent newStudent)
 {
     try
     {
         newStudent.sfwk = 0;
         this.dbContext.SaveChanges();
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
예제 #3
0
 /// <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;
     }
 }
예제 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="newStudent"></param>
 public void SetAsLiberalArts(Model.NewStudent newStudent)
 {
     try
     {
         newStudent.sfwk = 1;
         this.dbContext.SaveChanges();
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
예제 #5
0
 /// <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);
     }
 }
예제 #6
0
 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);
     }
 }
예제 #7
0
 /// <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);
     }
 }
예제 #8
0
 /// <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);
     }
 }
예제 #9
0
        /// <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);
            }
        }
예제 #10
0
        /// <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);
            }
        }
예제 #11
0
 public bool IsEnroll(Model.NewStudent newStudent)
 {
     //return newStudent.Enrollment != null;
     return(true);
 }
예제 #12
0
 public bool IsEnroll(Model.NewStudent newStudent)
 {
     return(newStudent.Enrollment != null);
 }