Example #1
0
        public ActionResult GetPlistAccounts(GetPlistAccounts input)
        {
            if (!ModelState.IsValid)
            {
                return(ModelState.ToJsonResult());
            }
            foreach (var filter in input.Filters)
            {
                PropertyState property;
                if (!AcDomain.EntityTypeSet.TryGetProperty(base.EntityType, filter.field, out property))
                {
                    throw new ValidationException("意外的Account实体类型属性" + filter.field);
                }
            }
            input.IncludeDescendants = input.IncludeDescendants ?? false;
            List <DicReader> userAccountTrs = null;

            // 如果组织机构为空则需要检测是否是开发人员,因为只有开发人员才可以看到全部用户。目录为空表示查询全部目录。
            if (string.IsNullOrEmpty(input.CatalogCode))
            {
                if (!AcSession.IsDeveloper())
                {
                    throw new ValidationException("对不起,您没有查看全部账户的权限");
                }
                else
                {
                    userAccountTrs = GetRequiredService <IAccountQuery>().GetPlistAccountTrs(input.Filters, input.CatalogCode
                                                                                             , input.IncludeDescendants.Value, input);
                }
            }
            else
            {
                userAccountTrs = GetRequiredService <IAccountQuery>().GetPlistAccountTrs(input.Filters, input.CatalogCode
                                                                                         , input.IncludeDescendants.Value, input);
            }
            Debug.Assert(input.Total != null, "requestModel.total != null");
            var data = new MiniGrid <Dictionary <string, object> > {
                total = input.Total.Value, data = userAccountTrs
            };

            return(this.JsonResult(data));
        }
Example #2
0
        public ActionResult GetPlistAccounts(GetPlistAccounts input)
        {
            if (!ModelState.IsValid)
            {
                return ModelState.ToJsonResult();
            }
            foreach (var filter in input.Filters)
            {
                PropertyState property;
                if (!AcDomain.EntityTypeSet.TryGetProperty(base.EntityType, filter.field, out property))
                {
                    throw new ValidationException("意外的Account实体类型属性" + filter.field);
                }
            }
            input.IncludeDescendants = input.IncludeDescendants ?? false;
            List<DicReader> userAccountTrs = null;
            // 如果组织机构为空则需要检测是否是开发人员,因为只有开发人员才可以看到全部用户。目录为空表示查询全部目录。
            if (string.IsNullOrEmpty(input.CatalogCode))
            {
                if (!AcSession.IsDeveloper())
                {
                    throw new ValidationException("对不起,您没有查看全部账户的权限");
                }
                else
                {
                    userAccountTrs = GetRequiredService<IAccountQuery>().GetPlistAccountTrs(input.Filters, input.CatalogCode
                        , input.IncludeDescendants.Value, input);
                }
            }
            else
            {
                userAccountTrs = GetRequiredService<IAccountQuery>().GetPlistAccountTrs(input.Filters, input.CatalogCode
                    , input.IncludeDescendants.Value, input);
            }
            Debug.Assert(input.Total != null, "requestModel.total != null");
            var data = new MiniGrid<Dictionary<string, object>> { total = input.Total.Value, data = userAccountTrs };

            return this.JsonResult(data);
        }