/// <summary> /// 编辑班级 /// </summary> public virtual async Task UpdateClassesInfoAsync(ClassesInfoEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _classesInfoRepository.GetAsync(input.Id.Value); input.MapTo(entity); await _classesInfoRepository.UpdateAsync(entity); }
/// <summary> /// 新增班级 /// </summary> public virtual async Task <ClassesInfoEditDto> CreateClassesInfoAsync(ClassesInfoEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = input.MapTo <ClassesInfo>(); entity = await _classesInfoRepository.InsertAsync(entity); return(entity.MapTo <ClassesInfoEditDto>()); }
private void SetMemberCount(int classId) { ClassesInfoEditDto classInfo = new ClassesInfoEditDto(); classInfo = classesInfoAppService.GetClassesInfoEditById(new EntityDto <long>() { Id = classId }); classInfo.MemberCount = CountMembers(classId); classesInfoAppService.UpdateClassesInfoAsync(classInfo); }
public ActionResult ClassesManageSave(ClassesInfoEditDto dto) { try { CheckModelState(); classesinfoService.CreateOrUpdateClassesInfoAsync(new CreateOrUpdateClassesInfoInput { ClassesInfoEditDto = dto }); return(RedirectToAction("ClassesManageIndex")); } catch { return(View()); } }
/// <summary> /// 通过Id获取班级信息进行编辑或修改 /// </summary> public GetClassesInfoForEditOutput GetClassesInfoForEdit(NullableIdDto <long> input) { var output = new GetClassesInfoForEditOutput(); ClassesInfoEditDto classesInfoEditDto; if (input.Id.HasValue) { var entity = _classesInfoRepository.Get(input.Id.Value); classesInfoEditDto = entity.MapTo <ClassesInfoEditDto>(); } else { classesInfoEditDto = new ClassesInfoEditDto(); } output.ClassesInfo = classesInfoEditDto; return(output); }
/// <summary> /// 设置部门 /// </summary> /// <param name="edit"></param> /// <param name="create"></param> /// <param name="bId"></param> /// <param name="cId"></param> protected void SetForDepart(ClassesInfoEditDto edit, ClassDepJobEditDto create, int bId, int cId) { IsParent(cId, bId); //不重复人数 var cuserids = new List <int>();//班级当前人数 var department = departmentService.GetAllDepartmentInfos().FirstOrDefault(t => t.DepartmentId == bId); if (department != null) { create.BusinessId = bId; create.BusinessName = department.DisplayName; //获取当前子部门及自己的部门id var dids = departmentService.GetAllDepartmentInfos().Where(t => t.Path.Contains(department.Path)).Select(t => t.DepartmentId); //获取人员表当前选中部门ids的总人数 var userids = userService.GetAll().Where(t => dids.Contains(t.DepartmentID)).Select(t => t.SysNO).ToList(); foreach (var item in userids) { //班级中已绑定的人员id cuserids = classUserService.GetAll().Where(t => t.ClassId == cId).Select(t => t.UserId).ToList(); if (!cuserids.Contains(item)) { classUserService.CreateClassUser(new ClassUserEditDto { ClassId = cId, UserId = item }); } //判断课程班级表有当前班级没用如果有要更新课程人员表保持一致和手机签到一样 var dto = cbtservic.GetAll().FirstOrDefault(t => t.BusinessId == cId && t.type == 2); if (dto != null && dto.type != 4) { cpservic.CreateCourseBoundPersonnel(new CourseBoundPersonnelEditDto { CourseId = dto.CourseId, AccountSysNo = item, CheckIN = false, IsBound = true }); } } cdjService.CreateClassDepJob(create); } }
/// <summary> /// 设置岗位 /// </summary> /// <param name="edit"></param> /// <param name="create"></param> /// <param name="bId"></param> /// <param name="cId"></param> protected void SetForPost(ClassesInfoEditDto edit, ClassDepJobEditDto create, int bId, int cId) { var cuserids = new List <int>();//班级当前人数 var post = jobPostService.GetJobPostById(new EntityDto <long>() { Id = bId }); if (post != null) { create.BusinessId = (int)post.Id; create.BusinessName = post.Name; //获取人员表当前选中岗位id的总人数 var userids = userService.GetAll().Where(t => t.PostID == bId).Select(t => t.SysNO).ToList(); foreach (var item in userids) { cuserids = classUserService.GetAll().Where(t => t.ClassId == cId).Select(t => t.UserId).ToList(); if (!cuserids.Contains(item)) { classUserService.CreateClassUser(new ClassUserEditDto { ClassId = Convert.ToInt16(cId), UserId = item }); } //判断课程班级表有当前班级没用如果有要更新课程人员表保持一致和手机签到一样 var dto = cbtservic.GetAll().FirstOrDefault(t => t.BusinessId == cId && t.type == 2); if (dto != null && dto.type != 4) { cpservic.CreateCourseBoundPersonnel(new CourseBoundPersonnelEditDto { CourseId = dto.CourseId, AccountSysNo = item, CheckIN = false, IsBound = true }); } } } cdjService.CreateClassDepJob(create); }