Beispiel #1
0
        /// <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));
        }
Beispiel #2
0
        /// <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() })));
        }
Beispiel #3
0
        /// <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));
            }
        }
Beispiel #4
0
        /// <summary>
        /// 根据角色获取相应的机构。
        /// </summary>
        /// <param name="hosting"></param>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public async Task <JsonResult> GetOrgsByRole([FromServices] JsonSerializeOptionHosting hosting, int?roleId)
        {
            if (roleId == null)
            {
                return(Json(new string[0]));
            }

            var converter = new DynamicTreeNodeJsonConverter <SysOrg>(s => s.Name, s => s.Permissible, s => s.FullName);

            hosting.Option.Converters.Add(converter);

            var list = await _adminService.GetOrgsByRoleAsync((int)roleId);

            return(Json(list));
        }
Beispiel #5
0
        /// <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));
        }
Beispiel #6
0
        /// <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() })));
            }
        }
Beispiel #7
0
        /// <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() })));
        }