/// <summary> /// 根据查询条件获取机构。 /// </summary> /// <param name="id"></param> /// <param name="targetId"></param> /// <param name="currentId"></param> /// <param name="attribute"></param> /// <param name="state"></param> /// <param name="attType">附加的信息。</param> /// <param name="flag"></param> /// <returns></returns> public JsonResult DataDemand(int?id, int?targetId, int?currentId, OrgAttribute?attribute = null, StateFlags?state = null, ItemFlag?flag = null) { var converter = new DynamicTreeNodeJsonConverter <SysOrg>(s => s.Name, s => s.Code, s => s.AttributeName, s => s.State); var list = adminService.GetOrgs(id, targetId, currentId, state, null, attribute); return(this.Json(id != null ? list : ItemFlagHelper.Insert(list, flag, s => new { id = 0, text = s.GetDescription() }), converter)); }
/// <summary> /// 绑定枚举类型。 /// </summary> /// <param name="url"></param> /// <param name="enumType">枚举类型。</param> /// <param name="flag"></param> /// <returns></returns> public static IHtmlString BindEnum(this UrlHelper url, Type enumType, ItemFlag?flag = null) { var list = enumType.GetEnumList().OrderBy(s => s.Key).Select(s => new { Value = s.Key, Name = s.Value }); var list1 = ItemFlagHelper.Insert(list, flag, s => new { Value = string.Empty, Name = s.GetDescription() }); return(MvcHtmlString.Create(new JsonSerializer().Serialize(list1))); }
/// <summary> /// 根据查询条件获取机构。 /// </summary> /// <param name="hosting">用来往 <see cref="JsonSerializeOption"/> 里加自定义的转换器。</param> /// <param name="id"></param> /// <param name="targetId"></param> /// <param name="currentId"></param> /// <param name="attribute"></param> /// <param name="state"></param> /// <param name="attType">附加的信息。</param> /// <param name="flag"></param> /// <returns></returns> public async Task <JsonResult> DataDemand([FromServices] JsonSerializeOptionHosting hosting, int?id, int?targetId, int?currentId, OrgAttribute?attribute = null, StateFlags?state = null, ItemFlag?flag = null) { var converter = new DynamicTreeNodeJsonConverter <SysOrg>(s => s.Name, s => s.Code, s => s.AttributeName, s => s.State); hosting.Option.Converters.Add(converter); var list = await adminService.GetOrgsAsync(id, targetId, currentId, state, null, attribute); return(Json(id != null ? list : ItemFlagHelper.Insert(list, flag, s => new { id = 0, text = s.GetDescription() }))); }
/// <summary> /// 根据查询条件获取模块。 /// </summary> /// <param name="id"></param> /// <param name="targetId"></param> /// <param name="currentId"></param> /// <param name="flag"></param> /// <returns></returns> public async Task <JsonResult> Data(int?id, int?targetId, int?currentId, ItemFlag?flag = null) { var converter = new DynamicTreeNodeJsonConverter <SysModule>(s => s.Name, s => s.Url, s => s.State); var list = await adminService.GetModulesAsync(id, targetId, currentId, null); if (id != null) { return(this.Json(list, converter)); } else { return(this.Json(ItemFlagHelper.Insert(list, flag, s => new { id = 0, text = s.GetDescription() }), converter)); } }
/// <summary> /// 根据查询条件获取机构。 /// </summary> /// <param name="targetId"></param> /// <param name="attribute"></param> /// <param name="attType">附加的信息。</param> /// <param name="corpType">企业类别。</param> /// <param name="flag"></param> /// <returns></returns> public JsonResult Data(int?targetId, OrgAttribute?attribute = null, ItemFlag?flag = null) { var converter = new DynamicTreeNodeJsonConverter <SysOrg>(s => s.Name, s => s.Code, s => s.AttributeName, s => s.State); var session = HttpContext.GetSession(); var list = adminService.GetOrgs(session.UserID, null, attribute); if (targetId != null) { ExpandTarget(list, (int)targetId); } return(this.Json(ItemFlagHelper.Insert(list, flag, s => new { id = 0, text = s.GetDescription() }), converter)); }
/// <summary> /// 根据查询条件获取模块。 /// </summary> /// <param name="hosting">用来往 <see cref="JsonSerializeOption"/> 里加自定义的转换器。</param> /// <param name="id"></param> /// <param name="targetId"></param> /// <param name="currentId"></param> /// <param name="flag"></param> /// <returns></returns> public async Task <JsonResult> Data([FromServices] JsonSerializeOptionHosting hosting, int?id, int?targetId, int?currentId, ItemFlag?flag = null) { var converter = new DynamicTreeNodeJsonConverter <SysModule>(s => s.Name, s => s.Url, s => s.State); hosting.Option.Converters.Add(converter); var list = await adminService.GetModulesAsync(id, targetId, currentId, null); if (id != null) { return(Json(list)); } else { return(Json(ItemFlagHelper.Insert(list, flag, s => new { id = 0, text = s.GetDescription() }))); } }
/// <summary> /// 根据查询条件获取机构。 /// </summary> /// <param name="hosting">用来往 <see cref="JsonSerializeOption"/> 里加自定义的转换器。</param> /// <param name="targetId"></param> /// <param name="attribute"></param> /// <param name="attType">附加的信息。</param> /// <param name="corpType">企业类别。</param> /// <param name="flag"></param> /// <returns></returns> public async Task <JsonResult> Data([FromServices] JsonSerializeOptionHosting hosting, int?targetId, OrgAttribute?attribute = null, ItemFlag?flag = null) { var converter = new DynamicTreeNodeJsonConverter <SysOrg>(s => s.Name, s => s.Code, s => s.AttributeName, s => s.State); hosting.Option.Converters.Add(converter); var session = HttpContext.GetSession(); var list = await adminService.GetOrgsAsync(session.UserID, null, attribute); if (targetId != null) { await ExpandTargetAsync(list, (int)targetId); } return(Json(ItemFlagHelper.Insert(list, flag, s => new { id = 0, text = s.GetDescription() }))); }