public ActionResult CheckIn(int CourseId)
        {
            int    uId      = int.Parse(CookieHelper.GetCookieValue("UserId").ToString());
            string UserName = CookieHelper.GetCookieValue("DisplayName").ToString();
            var    dto      = courseBoundService.GetCourseBoundUserByCourseId(CourseId).FirstOrDefault(t => t.AccountSysNo == uId).MapTo <CourseBoundPersonnelEditDto>();

            ViewBag.Stauts = 0;
            if (dto != null)
            {
                if (dto.CheckIN == true)
                {
                    ViewBag.Stauts = 1;
                }
                else
                {
                    dto.CheckIN = true;
                    courseBoundService.UpdateCourseBoundPersonnel(dto);
                    //更新课程表签到人数
                    var cdto = courseService.GetCourseInfoEditById(new EntityDto <long> {
                        Id = dto.CourseId
                    });
                    cdto.CheckinNum++;
                    courseService.UpdateCourseInfo(cdto);
                    ViewBag.Stauts = 2;
                }
            }
            else//不是已绑定到课程的人员
            {
                courseBoundService.CreateCourseBoundPersonnel(new CourseBoundPersonnelEditDto {
                    CourseId = CourseId, AccountSysNo = uId, CheckIN = true, IsBound = false, AccountUserName = UserName
                });
                ViewBag.Stauts = 2;
            }
            //查到线下培训课程所对就的班级
            var configu = _courseBoundConfigureTypeAppService.GetCTypeByCIdOrByType(CourseId, (int)ConfigureType.Class);

            if (configu != null)
            {
                //班级人员关联关系数据添加
                var classUser = new ClassUserEditDto();
                classUser.ClassId = configu.BusinessId;
                classUser.UserId  = uId;
                classuserService.CreateClassUser(classUser);
                //把人员添加到班级中
                var classInfo = _classesInfoAppService.GetClassesInfoForEdit(new NullableIdDto <long>()
                {
                    Id = configu.BusinessId
                });
                classInfo.ClassesInfo.MemberCount++;
                _classesInfoAppService.UpdateClassesInfoAsync(classInfo.ClassesInfo);
            }
            return(View());
        }
        public JsonResult SingleUpCourse(int courseId)
        {
            //课程对像
            var courseDate = _courseInfoAppService.GetCourseInfoById(new EntityDto <long>()
            {
                Id = courseId
            });                                                                                               //课程数据

            if (courseDate != null)
            {
                int userId    = int.Parse(CookieHelper.GetCookieValue("UserId").ToString());
                var user      = _userAccountService.GetUserAccountBySysNo(userId);                                                            //查询用户数据
                var boundData = _courseBoundPersonnelAppService.GetCourseBoundByUserIdOrCourseId(user.SysNO, Convert.ToInt32(courseDate.Id)); //绑定数据
                if (boundData == null)
                {
                    //增加人员
                    var create = new CourseBoundPersonnelEditDto();
                    create.AccountSysNo    = user.SysNO;
                    create.AccountUserName = user.DisplayName;
                    create.CourseId        = Convert.ToInt32(courseDate.Id);
                    create.CourseName      = courseDate.CourseName;
                    _courseBoundPersonnelAppService.CreateCourseBoundPersonnel(create);
                }


                var configu = _courseBoundConfigureTypeAppService.GetCTypeByCIdOrType((int)courseDate.Id, (int)ConfigureType.Personal, user.SysNO);
                //增加关系
                if (configu == null)
                {
                    var createConfigure = new CourseBoundConfigureTypeEditDto();
                    createConfigure.CourseId     = (int)courseDate.Id;
                    createConfigure.CourseName   = courseDate.CourseName;
                    createConfigure.type         = (int)ConfigureType.Personal;
                    createConfigure.BusinessId   = user.SysNO;
                    createConfigure.BusinessName = user.DisplayName;
                    _courseBoundConfigureTypeAppService.CreateCourseBoundConfigureType(createConfigure);
                }
                //如果是线个考试则把人员配置到班级中
                if (courseDate.Type == 4)
                {
                    //查到线下培训课程所对就的班级
                    configu = _courseBoundConfigureTypeAppService.GetCTypeByCIdOrByType((int)courseDate.Id, (int)ConfigureType.Class);
                    if (configu != null)
                    {
                        //班级人员关联关系数据添加
                        var classUser = new ClassUserEditDto();
                        classUser.ClassId = configu.BusinessId;
                        classUser.UserId  = userId;
                        _classUserAppService.CreateClassUser(classUser);
                        //把人员添加到班级中
                        var classInfo = _classesInfoAppService.GetClassesInfoForEdit(new NullableIdDto <long>()
                        {
                            Id = configu.BusinessId
                        });
                        classInfo.ClassesInfo.MemberCount++;
                        _classesInfoAppService.UpdateClassesInfoAsync(classInfo.ClassesInfo);
                    }
                }
            }
            return(Json(courseDate, JsonRequestBehavior.AllowGet));
        }