public ActionResult Index() { var examViewModel = new ExamViewModel(); var departs = _departmentInfoAppService.GetAllDepartmentInfos().OrderBy(p => p.Path).Select(p => new ComboboxItemDto(p.DepartmentId.ToString() + "," + p.DisplayName, new string(' ', p.Level * 2) + " " + p.DisplayName)) .ToList(); examViewModel.departLists = departs; return(View(examViewModel)); }
public ActionResult Index() { var examViewModel = new ExamViewModel(); examViewModel.departs = _departmentInfoAppService.GetAllDepartmentInfos(); return(View(examViewModel)); }
// GET: Admin/Poll public ActionResult Index() { var pollViewModel = new PollViewModel(); pollViewModel.departs = _departmentInfoAppService.GetAllDepartmentInfos(); return(View(pollViewModel)); }
/// <summary> /// 部门树状下拉 /// </summary> /// <returns></returns> public ActionResult GetDTreeSelectJson() { var data = departmentService.GetAllDepartmentInfos(); var treeList = new List <TreeSelectModel>(); foreach (DepartmentInfoListDto item in data) { TreeSelectModel treeModel = new TreeSelectModel(); treeModel.id = item.DepartmentId + ""; treeModel.text = item.DisplayName; treeModel.parentId = item.ParentId + ""; treeList.Add(treeModel); } return(Content(treeList.TreeSelectJson())); }
/// <summary> /// 获取部门下的所有用户 /// </summary> public List <UserAccount> GetUserDateByDepartment(int courseId, DepartmentInfoListDto department) { List <UserAccount> accountlist = new List <UserAccount>(); //获取当前部门以及子集部门 var departmentList = departmentService.GetAllDepartmentInfos().Where(c => c.Path.StartsWith(department.Path)).Select(v => v.DepartmentId); if (departmentList.Any()) { var userAccountDataList = userAccountService.GetAccountData().Where(c => departmentList.Contains(c.DepartmentID)); //获取部门下的所有用户 var CBCTUserSysNoList = GetCourseBoundUserId(courseId); //获取课程下的所有用户Id if (userAccountDataList.Any()) { accountlist = userAccountDataList.Where(v => !CBCTUserSysNoList.Contains(v.SysNO)).ToList();//排除课程下的用户 } } return(accountlist); }
public ActionResult SetBoundCourseByType(int courseId, int typeId, int typeCaseId) { var result = new resultData(); result.status = "-1"; var courseDate = courseInfoService.GetCourseInfoById(new EntityDto <long>() { Id = courseId }); //课程数据 if (courseDate.Status != (int)CourseStatus.Pending) { return(Content(Serialize(new resultData() { status = "-2", msg = "当前课程状态为:待审核,才能添加人员" }))); } if (typeId == (int)ConfigureType.Class && courseDate != null && courseDate.Status != (int)CourseStatus.Completed && typeCaseId > 0) { var configure = configureTypeService.GetCTypeByClassIdOrType(typeCaseId, typeId); //班级的数据 var configureByCourseId = configureTypeService.GetCTypeByCourseIdOrType(courseId, typeId); //课程和班级数量 if ((configure != null && configure.Count > 0) || (configureByCourseId != null && configureByCourseId.Count > 0)) { return(Content(Serialize(new resultData() { status = "-1", msg = "班级和课程只能关联一次,不允许添加" }))); } } if (courseDate != null && typeId >= 0 && typeCaseId > 0) { var create = new CourseBoundConfigureTypeEditDto(); //实例化对象Bound对象 var boundData = configureTypeService.GetCTypeByCourseIdOrTypeId((int)courseDate.Id, typeId, typeCaseId); //绑定的数据 if (boundData == null) //如果没就增加 { create.CourseId = (int)courseDate.Id; create.CourseName = courseDate.CourseName; create.type = typeId; switch (typeId)//类型 { case (int)ConfigureType.Department: #region 部门操作 var department = departmentService.GetAllDepartmentInfos().FirstOrDefault(v => v.DepartmentId == typeCaseId); //获取部门唯一数据 if (department != null) { var createDataDUser = cbPersonnelService.GetUserDateByDepartment((int)courseDate.Id, department); foreach (var itemD in createDataDUser) //循环遍历插入 { CourseBoundPersonnelEditDto cbp = new CourseBoundPersonnelEditDto(); cbp.CourseId = (int)courseDate.Id; cbp.CourseName = courseDate.CourseName; cbp.AccountSysNo = itemD.SysNO; cbp.AccountUserName = itemD.DisplayName; cbPersonnelService.CreateCourseBoundPersonnel(cbp); } create.BusinessId = department.DepartmentId; create.BusinessName = department.DisplayName; } #endregion break; case (int)ConfigureType.Post: #region 岗位操作 var post = jobService.GetJobPostById(new EntityDto <long>() { Id = typeCaseId }); //获取唯一岗位 if (post != null) { var creatDataPUser = cbPersonnelService.GetUserDateByJobPost((int)courseDate.Id, post); foreach (var itemP in creatDataPUser) //循环遍历插入 { CourseBoundPersonnelEditDto cbp = new CourseBoundPersonnelEditDto(); cbp.CourseId = (int)courseDate.Id; cbp.CourseName = courseDate.CourseName; cbp.AccountSysNo = itemP.SysNO; cbp.AccountUserName = itemP.DisplayName; cbPersonnelService.CreateCourseBoundPersonnel(cbp); } create.BusinessId = (int)post.Id; create.BusinessName = post.Name; } #endregion break; case (int)ConfigureType.Class: #region 班级操作 var classes = classService.GetClassesInfoById(new EntityDto <long>() { Id = typeCaseId }); //获取唯一课程数据 if (classes != null) { var creatUserDate = cbPersonnelService.GetUserDateByClasses((int)courseDate.Id, classes); foreach (var itemC in creatUserDate) //循环遍历插入 { CourseBoundPersonnelEditDto cbp = new CourseBoundPersonnelEditDto(); cbp.CourseId = (int)courseDate.Id; cbp.CourseName = courseDate.CourseName; cbp.AccountSysNo = itemC.SysNO; cbp.AccountUserName = itemC.DisplayName; cbPersonnelService.CreateCourseBoundPersonnel(cbp); } create.BusinessId = (int)classes.Id; create.BusinessName = classes.ClassesName; } #endregion break; default: break; } configureTypeService.CreateCourseBoundConfigureType(create); result.msg = ""; } else { result.msg = boundData.BusinessName; } result.status = "0"; } return(Content(Serialize(result))); }