/// <summary>
        /// 描述:查询出转班时需要销毁的课次
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-7</para>
        /// </summary>
        /// <returns>要销毁的课次集合</returns>
        public List <LessonFinisherInfo> GetLessonFinisherInfo()
        {
            //根据转出班级ID,查询出要销毁的课次
            var service = new StudentTimetableService(base._entity.SchoolId, base._entity.StudentId);

            //var outLessonNum = service.GetRollOutClassLessons(base._entity.OutClassId, base._entity.OutDate, base._unitOfWork);

            List <int> lessonTypeList = new List <int> {
                (int)LessonType.RegularCourse
            };

            //获取学生转出班级课次列表
            var stuTransferOutClassLessonList =
                service.GetStudentTransferOutClassLessonList(base._entity.OutClassId,
                                                             base._entity.OutDate, lessonTypeList, base._unitOfWork);

            var outLessonNumEntity = stuTransferOutClassLessonList.FirstOrDefault();

            if (outLessonNumEntity != null)
            {
                this.EnrollOrderItemId = outLessonNumEntity.EnrollOrderItemId;
            }

            var result = stuTransferOutClassLessonList.Select(x => new LessonFinisherInfo
            {
                LessonId     = x.LessonId,
                BusinessId   = base._entity.ChangeClassId,
                BusinessType = BusinessType,
                Remark       = LessonProcessConstants.ChangeClassLessonReamrk
            }).ToList();

            return(result);
        }
Example #2
0
        /// <summary>
        /// 描述:添加转班记录
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-7</para>
        /// </summary>
        /// <param name="dto">要添加的状态信息</param>
        /// <param name="outClassTimes">转出课次</param>
        /// <param name="unitOfWork">工作单元事务</param>
        /// <exception cref="AMS.Core.BussinessException">
        /// 异常Id:40,异常描述:找不到该报名订单课程
        /// </exception>
        /// <returns>转班信息</returns>
        private TblTimChangeClass AddTimChangeClass(ChangeClassAddRequest dto, int outClassTimes, UnitOfWork unitOfWork)
        {
            //所属报名订单课程Id
            long       enrollOrderItemId = 0;
            var        service           = new StudentTimetableService(this._schoolId, this._studentId);
            List <int> lessonTypeList    = new List <int> {
                (int)LessonType.RegularCourse
            };
            //获取转出班级课次信息
            var outClassLessonList = service.GetStudentTransferOutClassLessonList(dto.OutClassId, dto.OutDate, lessonTypeList, unitOfWork);

            if (outClassLessonList.FirstOrDefault() != null)  //如果转出班级课次信息不为空,则找到报名订单Id,否则抛出异常
            {
                enrollOrderItemId = outClassLessonList.FirstOrDefault().EnrollOrderItemId;
            }
            else
            {
                throw new BussinessException((byte)ModelType.Timetable, 40);
            }

            var entity = new TblTimChangeClass
            {
                ChangeClassId     = IdGenerator.NextId(),
                SchoolId          = _schoolId,
                StudentId         = _studentId,
                EnrollOrderItemId = enrollOrderItemId,
                OutClassId        = dto.OutClassId,
                InClassId         = dto.InClassId,
                InDate            = dto.InDate,
                OutDate           = dto.OutDate,
                ClassTimes        = outClassTimes,
                Remark            = dto.Remark,
                CreateTime        = DateTime.Now
            };
            var tblTimChangeClassRepository = unitOfWork.GetCustomRepository <TblTimChangeClassRepository, TblTimChangeClass>();

            tblTimChangeClassRepository.Add(entity);
            return(entity);
        }