Ejemplo n.º 1
0
        /// <summary>
        /// 查找学生状态
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间:2018-11-14 </para>
        /// </summary>
        /// <param name="leave">休学信息</param>
        /// <param name="school">校区学生信息</param>
        private static void GetStudentStatus(TblOdrLeaveSchoolOrder leave, TblCstSchoolStudent school)
        {
            // 如果退费订单不存在
            if (leave == null)
            {
                return;
            }

            // 在读:学生总的剩余课次大于0
            if (school.RemindClassTimes > 0)
            {
                school.StudyStatus = (byte)StudyStatus.Reading;
            }

            // 休学:剩余课次等于0,并且当前时间处于 休学开始日期至复课日期之间)  休学开始日期<=当前时间<=复课日期之间 或者剩余课次等于0 && 当前时间< 休学开始日期
            if (school.RemindClassTimes <= 0 && (DateTime.Now >= leave.LeaveTime && DateTime.Now < leave.ResumeTime) ||
                DateTime.Now < leave.LeaveTime)
            {
                school.StudyStatus = (byte)StudyStatus.Suspension;
            }

            // 流失:剩余课次等于0,并且当前时间不处于 休学的开始日期至复课日期之间 当前时间>复课日期 或者当前时间<休学的开始日期
            if (school.RemindClassTimes <= 0 && DateTime.Now > leave.ResumeTime)
            {
                school.StudyStatus = (byte)StudyStatus.Loss;
            }
        }
        /// <summary>
        /// 描述:根据校区和学生Id获取休学信息
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-12-5</para>
        /// </summary>
        /// <param name="unitOfWork">工作单元事务</param>
        /// <returns>休学订单详情</returns>

        internal TblOdrLeaveSchoolOrder GetLeaveSchoolList(UnitOfWork unitOfWork = null)
        {
            TblOdrRefundOrderRepository      tblOdrRefundOrderRepository      = null;
            TblOdrLeaveSchoolOrderRepository tblOdrLeaveSchoolOrderRepository = null;

            if (unitOfWork != null)
            {
                tblOdrRefundOrderRepository      = unitOfWork.GetCustomRepository <TblOdrRefundOrderRepository, TblOdrRefundOrder>();
                tblOdrLeaveSchoolOrderRepository = unitOfWork.GetCustomRepository <TblOdrLeaveSchoolOrderRepository, TblOdrLeaveSchoolOrder>();
            }
            else
            {
                tblOdrRefundOrderRepository      = new TblOdrRefundOrderRepository();
                tblOdrLeaveSchoolOrderRepository = new TblOdrLeaveSchoolOrderRepository();
            }

            var entity          = new TblOdrLeaveSchoolOrder();
            var refundOrderInfo = tblOdrRefundOrderRepository.GetRefundOrderBySchOrStu(this._schoolId, this._studentId);

            if (refundOrderInfo != null)
            {
                entity = tblOdrLeaveSchoolOrderRepository.GetLeaveSchoolIdByOrder(refundOrderInfo.RefundOrderId);
            }
            return(entity);
        }
        /// <summary>
        /// 描述:添加附件
        /// <para>作    者:瞿  琦</para>
        /// <para>创建时间:2018-12-20</para>
        /// </summary>
        /// <param name="request">要写入的休学数据</param>
        /// <param name="leaveSchoolOrder">休学订单详情</param>
        /// <param name="unitOfWork">工作单元事务</param>
        /// <returns>无</returns>

        private void AddAttachment(LeaveSchoolOrderAddRequest request, TblOdrLeaveSchoolOrder leaveSchoolOrder, UnitOfWork unitOfWork)
        {
            //添加上传申请表附件到数据库
            foreach (var item in request.AttachmentUrlList)
            {
                item.AttchmentType = AttchmentType.LEAVE_SCHOOL_APPLY;
                item.BusinessId    = leaveSchoolOrder.RefundOrderId;
            }
            var attchmentService = new AttchmentService(base._schoolId, unitOfWork);

            attchmentService.Add(request.AttachmentUrlList);  //添加附件
        }
        /// <summary>
        /// 描述:写入休学表详细信息表
        /// <para>作    者:瞿  琦</para>
        /// <para>创建时间:2018-12-20</para>
        /// </summary>
        /// <param name="request">要写入的休学数据</param>
        /// <param name="courseLessonList">休学课程明细</param>
        /// <param name="refundOrder">退费订单信息</param>
        /// <param name="unitOfWork">工作单元事务</param>
        /// <returns>休学订单详情</returns>

        private TblOdrLeaveSchoolOrder AddOdrLeaveSchoolOrder(LeaveSchoolOrderAddRequest request, List <RefundOrderTransactDetailListResponse> courseLessonList, TblOdrRefundOrder refundOrder, UnitOfWork unitOfWork)
        {
            var leaveSchoolOrder = new TblOdrLeaveSchoolOrder
            {
                RefundOrderId          = refundOrder.RefundOrderId, // refundOrderId,
                SchoolId               = this._schoolId,
                LeaveTime              = request.LeaveTime,
                ResumeTime             = request.ResumeTime,
                TotalRefundLessonCount = courseLessonList.Sum(x => x.LeaveSchoolLessons),
                TotalUseLessonCount    = courseLessonList.Sum(x => x.HaveClassLesson),
                Remark = request.Remark,
                Reason = request.Reason
            };
            var tblOdrLeaveSchoolOrderRepository = unitOfWork.GetCustomRepository <TblOdrLeaveSchoolOrderRepository, TblOdrLeaveSchoolOrder>();

            tblOdrLeaveSchoolOrderRepository.Add(leaveSchoolOrder);
            return(leaveSchoolOrder);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 设置学生状态
 /// <para>作     者:Huang GaoLiang </para>
 /// <para>创建时间:2018-11-26 </para>
 /// </summary>
 /// <param name="status">学生状态</param>
 /// <param name="stu">学生信息</param>
 /// <param name="leave">退费订单信息</param>
 private static void SetStudyStatus(StudyStatus?status, TblCstSchoolStudent stu, TblOdrLeaveSchoolOrder leave)
 {
     // 如果剩余课次大于0
     if (stu.RemindClassTimes > 0)
     {
         stu.StudyStatus = (int)StudyStatus.Reading; //总剩余课次大于0
     }
     else
     {
         // 如果学生状态存在并且当前时间不大于休学时间
         if (status.HasValue && leave != null && DateTime.Now <= leave.LeaveTime)
         {
             stu.StudyStatus = (int)status;
         }
         // 如果学生状态存在并且当前时间不小于休学时间
         else if (status.HasValue && leave != null && DateTime.Now >= leave.ResumeTime)
         {
             stu.StudyStatus = (int)status;
         }
         // 如果学生状态存在并且当前时间不小于休学时间并且当前时间不大于休学时间
         else if (status.HasValue && leave != null && DateTime.Now >= leave.LeaveTime && DateTime.Now <= leave.ResumeTime)
         {
             stu.StudyStatus = (int)status;
         }
         else
         {
             stu.StudyStatus = (int)StudyStatus.Loss; //如果课次全部转校转出,则该学生的状态为流失 2018年12月3日
         }
     }
 }
        private const string _remark = "休学";                                //备注

        /// <summary>
        /// 描述:实例化一个休学课次销毁者
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-7</para>
        /// </summary>
        /// <param name="tblOdrRefundOrder">退费订单信息</param>
        /// <param name="tblOdrLeaveSchoolOrder">休学订单信息</param>
        /// <param name="unitOfWork">工作单元事务</param>
        public LeaveSchoolLessonFinisher(TblOdrRefundOrder tblOdrRefundOrder, TblOdrLeaveSchoolOrder tblOdrLeaveSchoolOrder, UnitOfWork unitOfWork)
        {
            _tblOdrRefundOrder      = tblOdrRefundOrder;
            _tblOdrLeaveSchoolOrder = tblOdrLeaveSchoolOrder;
            _unitOfWork             = unitOfWork;
        }