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 ActionResult Check(int id, int status) { var result = "-1"; var request = "-1"; var resultCoreInfo = _coreInfoService.GetCourseInfoForEdit(new NullableIdDto <long>() { Id = id }); if (resultCoreInfo != null) { #region 操作必学人员接口 if (status == 1) { //个人信息 var personList = _boundPerPostService.GetCourseBoundUserByCourseId((int)resultCoreInfo.CourseInfo.Id); if (personList != null && personList.Any()) { foreach (var Pitem in personList) { HttpRequestExamRequire((int)ConfigureType.Personal, Pitem.AccountSysNo, Pitem.AccountUserName, resultCoreInfo.CourseInfo.ExaminationId); } } //类型访问 var type = _conTypePostService.GetCTypeByCourseId((int)resultCoreInfo.CourseInfo.Id); if (type != null && type.Any()) { foreach (var Citem in type) { HttpRequestExamRequire(Citem.type, Citem.BusinessId, Citem.BusinessName, resultCoreInfo.CourseInfo.ExaminationId); } } request = "0"; } #endregion if (request == "0" && status == 1) { resultCoreInfo.CourseInfo.Status = (int)CourseStatus.Audited; } else if (status == 0) { resultCoreInfo.CourseInfo.Status = (int)CourseStatus.Fail; } _coreInfoService.UpdateCourseInfo(resultCoreInfo.CourseInfo); result = "0"; } return(Content(result)); }