private TblDatOperationLog _log;                 // 操作日志

        /// <summary>
        /// 描述:删除补课周补课
        /// <para>作    者:Huang GaoLiang </para>
        /// <para>创建时间:2019-03-11</para>
        /// </summary>
        /// <param name="schoolId">校区编号</param>
        /// <param name="studentId">学生编号</param>
        /// <param name="adjustLesson">课次调整业务表</param>
        /// <param name="datClass">班级信息</param>
        /// <param name="log">操作日志</param>
        /// <param name="unitOfWork">事务单元</param>
        public AdjustLessonReplenishWeekFinisher(string schoolId, long studentId, List <TblTimAdjustLesson> adjustLesson, TblDatClass datClass, TblDatOperationLog log, UnitOfWork unitOfWork)
        {
            this._schoolId     = schoolId;
            this._studentId    = studentId;
            this._adjustLesson = adjustLesson;
            this._datClass     = datClass;
            this._log          = log;
            this._unitOfWork   = unitOfWork;
        }
예제 #2
0
        /// <summary>
        /// 添加操作日记
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-02-20</para>
        /// </summary>
        /// <param name="model">内部操作直接传实体即可</param>
        internal void Add(TblDatOperationLog model, UnitOfWork unitOfWork = null)
        {
            TblDatOperationLogRepository repository = null;

            if (unitOfWork == null)
            {
                repository = new TblDatOperationLogRepository();
            }
            else
            {
                repository = unitOfWork.GetCustomRepository <TblDatOperationLogRepository, TblDatOperationLog>();
            }
            repository.Add(model);
        }
        /// <summary>
        /// 描述:添加操作日记
        /// <para>作    者:蔡亚康</para>
        /// <para>创建时间:2019-03-07</para>
        /// </summary>
        /// <param name="passport">用户账号信息</param>
        private void AddOperationLog(TblHssPassport passport)
        {
            OperationLogService operationLogService = new OperationLogService();
            TblDatOperationLog  log = new TblDatOperationLog()
            {
                BusinessId     = passport.PassporId,
                BusinessType   = (int)LogBusinessType.HssLogin,
                FlowStatus     = (int)OperationFlowStatus.Finish,
                OperationLogId = IdGenerator.NextId(),
                OperatorId     = "",
                OperatorName   = "",
                Remark         = $"用户{passport.UserCode} 于 {DateTime.Now} 登陆了家校互联",
                CreateTime     = DateTime.Now,
                SchoolId       = ""
            };

            operationLogService.Add(log);
        }
예제 #4
0
        /// <summary>
        /// 添加操作日记
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间: 2019-03-15 </para>
        /// </summary>
        /// <param name="rawStudent">原学生</param>
        /// <param name="newStudent">新学生</param>
        /// <param name="request">原始提交学生信息</param>
        private static void AddOperationLog(TblCstStudent rawStudent, TblCstStudent newStudent, StudentRegisterRequest request)
        {
            string             remark = $"将ID是{ rawStudent.StudentId}学生的姓名{ rawStudent.StudentName}改为 { request.StudentName}; 手机号{ rawStudent.LinkMobile}改为{ newStudent.LinkMobile}";
            TblDatOperationLog log    = new TblDatOperationLog()
            {
                OperationLogId = IdGenerator.NextId(),
                SchoolId       = request.SchoolId,
                BusinessType   = (int)LogBusinessType.Student,
                BusinessId     = rawStudent.StudentId,
                FlowStatus     = (int)OperationFlowStatus.Submit,
                OperatorId     = request.UserId,
                OperatorName   = request.UserName,
                Remark         = remark,
                CreateTime     = DateTime.Now,
            };

            new OperationLogService().Add(log);
        }
예제 #5
0
        /// <summary>
        /// 删除已安排的补课周课次
        /// <para>作    者:Huang GaoLiang </para>
        /// <para>创建时间:2019-03-12 </para>
        /// </summary>
        /// <param name="adjustLessonIds">安排补课班级记录编号</param>
        /// <exception>
        /// 异常ID:1,未找到数据
        /// </exception>
        public void RemoveClassTime(List <long> adjustLessonIds)
        {
            var adjustLesson = _timAdjustLessonRepository.Value.GetTimAdjustLessonList(adjustLessonIds);

            if (!adjustLesson.Any())
            {
                throw new BussinessException((byte)ModelType.Default, 1);
            }

            lock (LocalThreadLock.GetLockKeyName(LockKeyNames.LOCK_AMSSCHOOLSTUDENT, this._schoolId, adjustLesson.FirstOrDefault().StudentId.ToString()))
            {
                // 获取班级信息
                TimAdjustLessonInDto inDto = new TimAdjustLessonInDto
                {
                    SchoolId     = this._schoolId,
                    ToTeacherId  = this._teacherId,
                    BusinessType = ProcessBusinessType.C_AdjustLessonReplenishWeek
                };
                long        classId  = _timAdjustLessonRepository.Value.Load(adjustLesson.FirstOrDefault().AdjustLessonId).ClassId;
                TblDatClass datClass = new ReplenishWeekClassService(classId).TblDatClass;

                // 操作日志
                TblDatOperationLog log = new TblDatOperationLog()
                {
                    OperationLogId = IdGenerator.NextId(),
                    SchoolId       = this._schoolId,
                    BusinessType   = (int)LogBusinessType.ReplenishWeekCancel,
                    BusinessId     = adjustLesson.FirstOrDefault().AdjustLessonId,
                    FlowStatus     = (int)OperationFlowStatus.Cancel,
                    OperatorId     = this._teacherId,
                    OperatorName   = this._teacherName,
                    Remark         = JsonConvert.SerializeObject($"ID是{adjustLesson.FirstOrDefault().StudentId}学生,被删除班级ID是{adjustLesson.FirstOrDefault().ClassId},上课时间是{adjustLesson.FirstOrDefault().ClassDate.ToString("yyyy-MM-dd")}     {adjustLesson.FirstOrDefault().ClassBeginTime}"),
                    CreateTime     = DateTime.Now,
                };

                // 要判断该课次是否该老师的课次,防止别人乱传ID
                if (adjustLesson.FirstOrDefault().ToTeacherId == this._teacherId)
                {
                    adjustLesson.FirstOrDefault().Status = (int)TimAdjustLessonStatus.Invalid;

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

                            // 调用课次服务
                            var adjustLessonWeekRevokeFinisher = new AdjustLessonReplenishWeekFinisher(this._schoolId, adjustLesson.FirstOrDefault().StudentId, adjustLesson, datClass, log, unitOfWork);

                            LessonService lessonService = new LessonService(unitOfWork);
                            lessonService.Finish(adjustLessonWeekRevokeFinisher);

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