Example #1
0
 public ActionResult DataLogGridData(int id)
 {
     GridRequest request = new GridRequest(Request);
     if (id > 0)
     {
         request.FilterGroup.Rules.Add(new FilterRule("OperateLog.Id", id));
     }
     int total;
     var datas = GetQueryData<DataLog, int>(LoggingContract.DataLogs, out total, request).Select(m => new
     {
         m.Id,
         m.EntityKey,
         m.Name,
         m.EntityName,
         m.OperateType,
         LogItems = m.LogItems.Select(n => new
         {
             n.Field,
             n.FieldName,
             n.OriginalValue,
             n.NewValue,
             n.DataType
         })
     }).ToList();
     return Json(new GridData<object>(datas, total), JsonRequestBehavior.AllowGet);
 }
 public ActionResult GridData()
 {
     GridRequest request = new GridRequest(Request);
     if (request.PageCondition.SortConditions.Length == 0)
     {
         request.PageCondition.SortConditions = new[]
         {
             new SortCondition("Area"),
             new SortCondition("Controller"), 
             new SortCondition("Name")
         };
     }
     Expression<Func<Function, bool>> predicate = FilterHelper.GetExpression<Function>(request.FilterGroup);
     var page = SecurityContract.Functions.ToPage(predicate,
         request.PageCondition,
         m => new
         {
             m.Id,
             m.Name,
             m.Url,
             m.FunctionType,
             m.OperateLogEnabled,
             m.DataLogEnabled,
             m.CacheExpirationSeconds,
             m.IsCacheSliding,
             m.Area,
             m.Controller,
             m.Action,
             m.IsController,
             m.IsAjax,
             m.IsChild,
             m.IsLocked,
             m.IsTypeChanged,
             m.IsCustom
         });
     GridData<object> gridData = new GridData<object>() { Total = page.Total };
     gridData.Rows = page.Data.Select(m => new
     {
         m.Id,
         m.Name,
         m.Url,
         m.FunctionType,
         m.OperateLogEnabled,
         m.DataLogEnabled,
         m.CacheExpirationSeconds,
         m.IsCacheSliding,
         m.Area,
         m.Controller,
         m.Action,
         ModuleName = m.Area + "-" + m.Controller,
         m.IsController,
         m.IsAjax,
         m.IsChild,
         m.IsLocked,
         m.IsTypeChanged,
         m.IsCustom
     }).ToArray();
     return Json(gridData, JsonRequestBehavior.AllowGet);
 }
Example #3
0
 public ActionResult GetOperateLogData()
 {
     int total;
     GridRequest request = new GridRequest(Request);
     if (request.PageCondition.SortConditions.Length == 0)
     {
         request.PageCondition.SortConditions = new[] { new SortCondition("CreatedTime", ListSortDirection.Descending) };
     }
     var datas = GetQueryData<OperateLog, int>(LoggingContract.OperateLogs.Include(p => p.DataLogs), out total, request).Select(m => new
     {
         m.Id,
         m.FunctionName,
         m.Operator.UserId,
         m.Operator.UserName,
         m.Operator.Ip,
         m.CreatedTime
     }).ToList();
     return Json(new GridData<object>(datas, total), JsonRequestBehavior.AllowGet);
 }
 public ActionResult GridData()
 {
     GridRequest request = new GridRequest(Request);
     if (request.PageCondition.SortConditions.Length == 0)
     {
         request.PageCondition.SortConditions = new[]
         {
             new SortCondition("ClassName")
         };
     }
     Expression<Func<EntityInfo, bool>> predicate = FilterHelper.GetExpression<EntityInfo>(request.FilterGroup);
     var page = SecurityContract.EntityInfos.ToPage(predicate,
         request.PageCondition,
         m => new
         {
             m.Id,
             m.Name,
             m.ClassName,
             m.DataLogEnabled
         });
     return Json(page.ToGridData(), JsonRequestBehavior.AllowGet);
 }
Example #5
0
 public ActionResult GridData()
 {
     GridRequest request = new GridRequest(Request);
     request.AddDefaultSortCondition(new SortCondition("CreatedTime", ListSortDirection.Descending));
     var page = GetPageResult(IdentityContract.Users,
         m => new
         {
             m.Id,
             m.UserName,
             m.NickName,
             m.Email,
             m.EmailConfirmed,
             m.PhoneNumber,
             m.PhoneNumberConfirmed,
             m.LockoutEndDateUtc,
             m.AccessFailedCount,
             m.IsLocked,
             m.CreatedTime
         },
         request);
     return Json(page.ToGridData(), JsonRequestBehavior.AllowGet);
 }
Example #6
0
        public ActionResult GridData(int? id)
        {
            GridRequest request = new GridRequest(Request);
            if (id.HasValue && id.Value > 0)
            {
                request.FilterGroup.Rules.Add(new FilterRule("Organization.Id", id.Value));
            }
            var page = GetPageResult(IdentityContract.Roles, m => new
            {
                m.Id,
                m.Name,
                m.Remark,
                m.IsAdmin,
                m.IsSystem,
                m.IsLocked,
                m.CreatedTime,
                OrganizationId = m.Organization == null ? 0 : m.Organization.Id,
                OrganizationName = m.Organization.Name
            }, request);

            return Json(page.ToGridData(), JsonRequestBehavior.AllowGet);
        }
Example #7
0
        public ActionResult GetOrganizationData(int? parentId)
        {
            int total;
            GridRequest request = new GridRequest(Request);
            if (parentId.HasValue && parentId.Value > 0)
            {
                request.FilterGroup.Rules.Add(new FilterRule("Parent.Id", parentId.Value));
            }

            var datas =
                GetQueryData<SysOrganization, int>(IdentityContract.Organizations.Include(p => p.Parent), out total,
                    request).Select(m => new
                    {
                        m.Id,
                        m.Name,
                        m.Remark,
                        m.SortCode,
                        ParentId = m.Parent == null ? 0 : m.Parent.Id,
                        m.CreatedTime
                    });
            return Json(new GridData<object>(datas, total), JsonRequestBehavior.AllowGet);
        }
Example #8
0
        public async Task<ActionResult> GetFunctionData(Guid controllerId)
        {
            var controller = await SecurityContract.Functions.SingleAsync(p => p.Id == controllerId) ?? new Function();

            int total;
            GridRequest request = new GridRequest(Request);
            var datas =
                GetQueryData<Function, Guid>(
                    SecurityContract.Functions.Where(
                        p => p.Area == controller.Area && p.Controller == controller.Controller && p.PlatformToken == controller.PlatformToken),
                    out total, request).Select(m => new
                    {
                        m.Id,
                        m.Name,
                        m.OrderNo,
                        m.FunctionType,
                        m.OperateLogEnabled,
                        m.DataLogEnabled,
                        m.CacheExpirationSeconds,
                        m.IsCacheSliding,
                        m.Area,
                        m.Controller,
                        m.Action,
                        m.IsController,
                        m.IsAjax,
                        ControllerId = controllerId,
                        m.IsLocked,
                    });
            return Json(new GridData<object>(datas, total), JsonRequestBehavior.AllowGet);
        }
Example #9
0
 public ActionResult GetUserData()
 {
     int total;
     GridRequest request = new GridRequest(Request);
     var datas = GetQueryData<SysUser, int>(IdentityContract.Users, out total, request).Select(m => new
     {
         m.Id,
         m.UserName,
         m.NickName,
         m.Email,
         m.IsLocked,
         m.CreatedTime,
     });
     return Json(new GridData<object>(datas, total), JsonRequestBehavior.AllowGet);
 }
Example #10
0
        public ActionResult GetRoleData(int? organizationId)
        {
            int total;
            GridRequest request = new GridRequest(Request);
            if (organizationId.HasValue && organizationId.Value > 0)
            {
                request.FilterGroup.Rules.Add(new FilterRule("Organization.Id", organizationId.Value));
            }

            var datas = GetQueryData<SysRole, int>(IdentityContract.Roles.Include(p => p.Organization), out total, request).Select(m => new
            {
                m.Id,
                m.Name,
                m.Remark,
                m.IsAdmin,
                m.IsLocked,
                m.CreatedTime,
                OrganizationId = m.Organization == null ? 0 : m.Organization.Id,
                OrganizationName = m.Organization.Name
            });
            return Json(new GridData<object>(datas, total), JsonRequestBehavior.AllowGet);
        }
Example #11
0
 public ActionResult GetEntityInfoData()
 {
     int total;
     GridRequest request = new GridRequest(Request);
     if (request.PageCondition.SortConditions.Length == 0)
     {
         request.PageCondition.SortConditions = new[]
         {
             new SortCondition("ClassName")
         };
     }
     var datas = GetQueryData<EntityInfo, Guid>(SecurityContract.EntityInfos,
             out total, request).Select(m => new
             {
                 m.Id,
                 m.Name,
                 m.ClassName,
                 m.DataLogEnabled
             });
     return Json(new GridData<object>(datas, total), JsonRequestBehavior.AllowGet);
 }