Ejemplo n.º 1
0
        public JsonResult ArrangeCourseCreate(int accBranchId, int accCourseId, int accTeacherId, int accClassRoomId, DateTime accBeginDate, int accStudentId, int bookRequirementId)
        {
            var strMessage = "受理失败!";

            var branchId = accBranchId;
            var courseId = accCourseId;
            var teacherId = accTeacherId;
            var classroomId = accClassRoomId;

            var beginDate = accBeginDate;
            var beginHour = beginDate.Hour;
            var beginTime = new DateTime(beginDate.Year, beginDate.Month, beginDate.Day, beginHour, 0, 0);

            // 根据课时长,计算出课程结束时间
            var classTime = ProductBLL.GetProductLevelCourseTypeCourseById(courseId).Course.ClassTime;
            var endTime = beginTime.AddMinutes(classTime);

            var arrange = new ArrangeCourse()
            {
                V3ArrangeId = null,
                ProductLevelCourseTypeCourseId = courseId,
                BranchId = branchId,
                ClassroomId = CommonHelper.To<int?>(classroomId),
                BeginTime = beginTime,
                EndTime = endTime,
                OpenTime = DateTime.Now,
                IsOnline = false,
                IsVip = true,
                CurrentBookNum = 1,
                MaxBookNum = 1, //VIP 最大人数为1
                IsBookQueue = false,
                BookQueueNum = 0,
                IsSystem = false,
                AdjustTime = null,
                IsRate = ProductBLL.IsAllowRateFromProductCourseTypeConfig(branchId, courseId),    // 从配置中查找是否允许课后点评
                StoTRateType = ConvertEnum.RateTypeForCourseRateStoT,
                TtoSRateType = ConvertEnum.RateTypeForCourseRateTtoS,
                Status = CommonHelper.To<int>(StatusType.Active),
                UpdateBy = null,
                UpdateTime = null,
                CreateBy = LoginUserManager.CurrLoginUser.UserId,
                CreateTime = DateTime.Now
            };

            var result = StudyBLL.CreateArrangeCourseTopic(arrange, teacherId, accStudentId, bookRequirementId, LoginUserManager.CurrLoginUser.UserId, courseId);

            switch (result)
            {
                case 100:
                    strMessage = "受理成功!";
                    break;
                case 101:
                    strMessage = "教师日期已有安排!";
                    break;
                case 102:
                    strMessage = "教室已被占用!";
                    break;
                case 103:
                    strMessage = "受理失败!";
                    break;
                default:
                    strMessage = "操作异常,请联系管理员";
                    break;
            }

            if (result == 100)
            {
                //获取已经存好的时间提报
                var modelList = Session["GetStudentBookRequirementList"] as List<GetBookRequirementList_Result>;
                foreach (var ui in modelList.Where(a => a.BookRequirementId == bookRequirementId))
                {
                    ui.ProductLevelCourseTypeCourseId = courseId;
                    var courseModel = ProductBLL.GetProductLevelCourseTypeCourseById(courseId);
                    ui.CourseName = courseModel.Course.CName;
                    ui.IsSuccessful = true;
                }
                Session["GetStudentBookRequirementList"] = modelList;
            }

            return Json(new { status = result, msg = strMessage });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="arrangeCourse"></param>
        /// <returns></returns>
        private int GetUserScheduleCourseStatus(ArrangeCourse arrangeCourse)
        {
            var resultCode = 100;
            if (arrangeCourse.EndTime < DateTime.Now)
            {

                var pstype = CommonHelper.To<int>(PassStatusType.NoScoring);
                if (arrangeCourse.BookRecord.Any(b => b.ArrangeCourseId == arrangeCourse.Id
                    && arrangeCourse.Status == ConvertEnum.StatusTypeForActive
                    && b.PassStatusType == pstype
                    && b.Status == ConvertEnum.StatusTypeForActive && !b.IsUnBook))
                {
                    resultCode = 101;//To Be Closed
                }
                else
                {
                    resultCode = 102; //Closed
                }

            }
            else if (arrangeCourse.BeginTime <= DateTime.Now && arrangeCourse.EndTime >= DateTime.Now) //Class In Process
            {
                resultCode = 103; //Class In Process
            }
            else
            {
                resultCode = 104; //Pending Class
            }
            return resultCode;
        }