Beispiel #1
0
        /// <summary>
        /// 描述:获取更新代课老师要销毁的课次
        /// <para>作者:瞿琦</para>
        /// <para>创建时间:2019-3-8</para>
        /// </summary>
        /// <exception cref="AMS.Core.BussinessException">
        /// 异常ID:44,异常描述:找不到课次调整业务Id
        /// </exception>
        /// <returns>要销毁的课次列表</returns>
        public List <LessonFinisherInfo> GetLessonFinisherInfo()
        {
            var result = new List <LessonFinisherInfo>();

            foreach (var item in _lessonList)
            {
                var adjustLessonEntity = _adjustLessonList.FirstOrDefault(k => k.FromLessonId == item.LessonId);
                if (adjustLessonEntity == null)  //如果课次调整信息为空,则提示找不到课次调整信息
                {
                    throw new BussinessException((byte)ModelType.Timetable, 44);
                }
                //待添加异常处理
                var lissonEntity = new LessonFinisherInfo
                {
                    BusinessId   = adjustLessonEntity.AdjustLessonId,
                    BusinessType = this.BusinessType,
                    LessonId     = item.LessonId,
                    Remark       = LessonProcessConstants.LessonTeacherRemark
                };
                result.Add(lissonEntity);
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 描述:撤销排课
        /// <para>作    者:Huang GaoLiang </para>
        /// <para>创建时间:2019-03-11</para>
        /// </summary>
        /// <param name="iRequest">撤销排课请求参数</param>
        /// <exception>
        /// 异常ID:1,未找到数据
        /// 异常ID:46,该课程已考勤,不能撤销!
        /// </exception>
        public override void Adjust(IAdjustLessonRequest iRequest)
        {
            AdjustRevokeRequest request = iRequest as AdjustRevokeRequest;

            lock (LocalThreadLock.GetLockKeyName(LockKeyNames.LOCK_AMSSCHOOLSTUDENT, this._schoolId, request.StudentId.ToString()))
            {
                LessonFinisherInfo info = new LessonFinisherInfo();

                // 根据课次编号获取学生课次信息
                var timLessonStudent = new StudentTimetableService(this._schoolId, request.StudentId).GetStudentTimLessonByLessId(request.LessonId);
                if (timLessonStudent == null)
                {
                    throw new BussinessException(ModelType.Default, 1);
                }

                // 如果考勤状态是已考勤或者是已补签
                if (timLessonStudent.AttendStatus == (int)AttendStatus.Normal || timLessonStudent.AdjustType == (int)AdjustType.SUPPLEMENTCONFIRMED)
                {
                    throw new BussinessException(ModelType.Timetable, 46);
                }

                // 根据课次编号获取学生排课记录信息
                TblTimLesson       timLesson       = new StudentTimetableService(this._schoolId, request.StudentId).GetTimLessonById(request.LessonId);
                TblTimAdjustLesson timAdjustLesson = new TblTimAdjustLesson
                {
                    AdjustLessonId = IdGenerator.NextId(),
                    SchoolId       = this._schoolId,
                    BatchNo        = IdGenerator.NextId(),
                    FromLessonId   = timLesson.LessonId,
                    FromTeacherId  = timLesson.TeacherId,
                    ToTeacherId    = "",
                    StudentId      = request.StudentId,
                    ClassRoomId    = timLesson.ClassRoomId,
                    ClassId        = timLesson.ClassId,
                    SchoolTimeId   = 0,
                    ClassDate      = timLesson.ClassDate,
                    ClassBeginTime = timLesson.ClassBeginTime,
                    ClassEndTime   = timLesson.ClassEndTime,
                    BusinessType   = (int)LessonBusinessType.CancelMakeLess,
                    Remark         = LessonProcessConstants.Remark,
                    Status         = (int)TimAdjustLessonStatus.Invalid,
                    CreateTime     = DateTime.Now,
                };

                using (var unitOfWork = new UnitOfWork())
                {
                    try
                    {
                        unitOfWork.BeginTransaction();

                        // 1、写入调整课次业务表
                        unitOfWork.GetCustomRepository <TblTimAdjustLessonRepository, TblTimAdjustLesson>().Add(timAdjustLesson);

                        // 2、调用课次服务
                        var           adjustLessonRevokeFinisher = new AdjustLessonRevokeFinisher(this._schoolId, request.StudentId, request.LessonId, unitOfWork);
                        LessonService lessonService = new LessonService(unitOfWork);
                        lessonService.Finish(adjustLessonRevokeFinisher);

                        unitOfWork.CommitTransaction();
                    }
                    catch (Exception ex)
                    {
                        unitOfWork.RollbackTransaction();
                        throw ex;
                    }
                }
            }
        }