Example #1
0
partial         void OnTemplate(AdministrationSimpleListTemplate template, ControllerContext controllerContext)
        {
            var urlHelper = new UrlHelper(controllerContext.RequestContext);
            template.GlobalButtons = new List<IClickable>
            {
                new Button(MaintCultureTextResources.Search),
                new Link(MaintCultureTextResources.New, urlHelper.Action("Create", "Role"), LinkStyle.Button),
                new Button(MaintCultureTextResources.Disable, "Disable"),
                new Button(MaintCultureTextResources.Enable, "Enable"),
            };
            var tableBuilder = new TableBuilder<Role>();
            template.Table = tableBuilder.Add(tableBuilder.CheckBox(x => x.RoleId.ToString(), controllerContext, "ids"), "", "RoleId")
                .Add(tableBuilder.Literal(x => x.Name.Format(), controllerContext), MaintCultureTextResources.RoleName, "Name")
                .Add(tableBuilder.Literal(x => x.IsBuildIn.Format(), controllerContext), MaintCultureTextResources.RoleIsBuildIn, "IsBuildIn")
                .Add(tableBuilder.Literal(x => x.IsEnabled.Format(), controllerContext), MaintCultureTextResources.RoleIsEnabled, "IsEnabled")
                .Add(x =>
                {
                    return new ControlCollection()
                    {
                        Controls = new List<Control>
                        {
                            new Link(MaintCultureTextResources.Edit, urlHelper.Action("Edit", "Role", new {id = x.Target.RoleId}), LinkStyle.Normal)
                        }
                    };
                }, MaintCultureTextResources.Operation).Build();
        }
Example #2
0
partial         void OnTemplate(AdministrationSimpleListTemplate template, ControllerContext controllerContext)
        {
            var urlHelper = new UrlHelper(controllerContext.RequestContext);
            template.GlobalButtons = new List<IClickable>
            {
                new Button(MaintCultureTextResources.Search),
                new Link(MaintCultureTextResources.New, urlHelper.Action("Create", "User"), LinkStyle.Button),
                new Button(MaintCultureTextResources.Disable, "Disable"),
                new Button(MaintCultureTextResources.Enable, "Enable"),
            };
            var tableBuilder = new TableBuilder<User>();
            template.Table = tableBuilder
                .Add(tableBuilder.CheckBox(x => x.UserId.Format(), controllerContext, name: "ids"), "", "UserId")
                .Add(tableBuilder.Literal(x => x.UserName.Format(), controllerContext), MaintCultureTextResources.AdminUserUserName, "UserName")
                .Add(tableBuilder.Literal(x => x.LoginName.Format(), controllerContext), MaintCultureTextResources.AdminUserLoginName, "LoginName")
                .Add(tableBuilder.Literal(x => x.Gender.Format(), controllerContext), MaintCultureTextResources.AdminUserGender, "Gender")
                .Add(tableBuilder.Literal(x => x.DateOfBirth.Format(), controllerContext), MaintCultureTextResources.AdminUserDateOfBirth, "DateOfBirth")
                .Add(tableBuilder.Literal(x => x.IsBuildIn.Format(), controllerContext), MaintCultureTextResources.AdminUserIsBuildIn, "IsBuildIn")
                .Add(tableBuilder.Literal(x => x.IsEnabled.Format(), controllerContext), MaintCultureTextResources.AdminUserIsEnabled, "IsEnabled")
                .Add(tableBuilder.Literal(x => x.IsSuper.Format(), controllerContext), MaintCultureTextResources.AdminUserIsSuper, "IsSuper")
                .Add(x => new ControlCollection(
                    new Link(MaintCultureTextResources.Edit, urlHelper.Action("Edit", "User", new { id = x.Target.UserId }), LinkStyle.Normal),
                    new Link(MaintCultureTextResources.UserLoginFailedLogIndex, urlHelper.Action("UserLoginFailedLogIndex", "User", new { UserId = x.Target.UserId }), LinkStyle.Normal)
                    ), MaintCultureTextResources.Operation).Build();
        }
partial         void OnTemplate(AdministrationSimpleListTemplate template, ControllerContext controllerContext)
        {
            var tableBuilder = new TableBuilder<ExceptionLog>();
            template.GlobalButtons = new List<IClickable>
            {
                new Button(MaintCultureTextResources.Search),
            };
            template.Table = tableBuilder
              .Add(tableBuilder.Literal(x => x.CreationTime.Format(), controllerContext), MaintCultureTextResources.ExceptionLogCreationTime, "CreationTime")
              .Add(tableBuilder.Literal(x => x.RouteData.Format(), controllerContext), MaintCultureTextResources.ExceptionLogRouteData, "RouteData")
              .Add(tableBuilder.Literal(x => x.Exception.Format(), controllerContext), MaintCultureTextResources.ExceptionLogException, "Exception")
              .Build();
        }
Example #4
0
        public Template CreateTemplate(ControllerContext controllerContext)
        {
            var query = GetDataSource(controllerContext);
            var template = new AdministrationSimpleListTemplate(query)
            {
                Title = Moonlit.Mvc.Maintenance.Properties.MaintCultureTextResources.AdminUserIndex,
                Description = Moonlit.Mvc.Maintenance.Properties.MaintCultureTextResources.AdminUserIndexDescription,
                QueryPanelTitle = Moonlit.Mvc.Maintenance.Properties.MaintCultureTextResources.PanelQuery,
                DefaultSort = OrderBy,
                DefaultPageSize = PageSize,
                Criteria = new FieldsBuilder().ForEntity(this, controllerContext).Build(),
            };

            OnTemplate (template, controllerContext);
            return template;
        }
partial         void OnTemplate(AdministrationSimpleListTemplate template, ControllerContext controllerContext)
        {
            var urlHelper = new UrlHelper(controllerContext.RequestContext);
            template.GlobalButtons = new List<IClickable>
            {
                new Button(MaintCultureTextResources.Search),
                new Button(MaintCultureTextResources.Delete, "Delete"),
            };
            var tableBuilder = new TableBuilder<UserLoginFailedLog>();
            template.Table = tableBuilder
                .Add(tableBuilder.CheckBox(x => x.UserLoginFailedLogId.Format(), controllerContext, name: "ids"), "", "UserLoginFailedLogId")
                .Add(x => new Link(x.Target.User.UserName, urlHelper.Action("Edit", "User", new { id = x.Target.UserId })), MaintCultureTextResources.UserLoginFailedLogUser, "CreateTime")
                .Add(tableBuilder.Literal(x => x.IpAddress.Format(), controllerContext), MaintCultureTextResources.UserLoginFailedLogIpAddress, "IpAddress")
                .Add(tableBuilder.Literal(x => x.CreationTime.Format(), controllerContext), MaintCultureTextResources.UserLoginFailedLogCreateTime, "CreateTime")
                .Build();
        }
Example #6
0
partial         void OnTemplate(AdministrationSimpleListTemplate template, ControllerContext controllerContext)
        {
            var urlHelper = new UrlHelper(controllerContext.RequestContext);
            template.GlobalButtons = new List<IClickable>
            {
                new Button(MaintCultureTextResources.Search),
                new Button(MaintCultureTextResources.Abort, "Abort"),
            };
            var tableBuilder = new TableBuilder<SystemJob>();
            template.Table = tableBuilder
                .Add(tableBuilder.CheckBox(x => x.SystemJobId.Format(), controllerContext, name: "ids"), "")
                .Add(tableBuilder.Literal(x => x.Title.Format(), controllerContext), MaintCultureTextResources.SystemJobTitle, "Title")
                .Add(tableBuilder.Literal(x => x.StartTime.Format(), controllerContext), MaintCultureTextResources.SystemJobStartTime, "StartTime")
                .Add(tableBuilder.Literal(x => x.ExecuteTime.Format(), controllerContext), MaintCultureTextResources.SystemJobExecuteTime, "ExecuteTime")
                .Add(tableBuilder.Literal(x => x.Status.Format(), controllerContext), MaintCultureTextResources.SystemJobStatus, "Status")
                .Add(tableBuilder.Literal(x => x.Result.Format(), controllerContext), MaintCultureTextResources.SystemJobResult, "Result")
                .Add(tableBuilder.Literal(x => x.CreationTime.Format(), controllerContext), MaintCultureTextResources.SystemJobCreationTime, "CreationTime")
                .Build();
        }
partial         void OnTemplate(AdministrationSimpleListTemplate template, ControllerContext controllerContext)
        {
            var urlHelper = new UrlHelper(controllerContext.RequestContext);
            template.GlobalButtons = new List<IClickable>
            {
                new Button(MaintCultureTextResources.Search ),
                new Link(MaintCultureTextResources.New, urlHelper.Action("Create", "CultureText", new {cultureId = this.Culture}), LinkStyle.Button),
                new Button(MaintCultureTextResources.Delete, "Delete"),
                new Link(MaintCultureTextResources.Import, urlHelper.Action("Import", "CultureText", new {cultureId=this.Culture}), LinkStyle.Button),
            };
            var tableBuilder = new TableBuilder<CultureText>();
            template.Table = tableBuilder
                .Add(tableBuilder.CheckBox(x => x.CultureTextId.Format(), controllerContext, name: "ids"), "", "CultureTextId")
                .Add(tableBuilder.Literal(x => x.Name.Format(), controllerContext), MaintCultureTextResources.AdminUserUserName, "CultureTextName")
                .Add(tableBuilder.Literal(x => x.Text.Format(), controllerContext), MaintCultureTextResources.AdminUserLoginName, "CultureTextText")
                .Add(tableBuilder.Literal(x => x.IsEdited.Format(), controllerContext), MaintCultureTextResources.AdminUserGender, "CultureTextIsEdited")
                .Add(x => new ControlCollection(
                    new Link(MaintCultureTextResources.Edit, urlHelper.Action("Edit", "CultureText", new { id = x.Target.CultureTextId }), LinkStyle.Normal)
                    ), MaintCultureTextResources.Operation).Build();
        }
Example #8
0
 public ActionResult Index(UserListQueryModel model)
 {
     var datasources = GetDataSources();
     if (!string.IsNullOrWhiteSpace(model.UserName))
     {
         datasources = datasources.Where(x => x.UserName.Contains(model.UserName));
     }
     var template = new AdministrationSimpleListTemplate(datasources)
     {
         Title = "用户列表",
         Description = "管理系统中所有用户",
         Criteria = new[]
         {
             new Field
             {
                 Width = 6,
                 Label = "用户名",
                 FieldName = "UserName",
                 Control = new TextBox()
                 {
                     MaxLength = 12,
                     Value = model.UserName
                 }
             },
             new Field
             {
                 Width = 6,
                 Label = "用户名",
                 FieldName = "UserName2",
                 Control = new TextBox()
                 {
                     MaxLength = 12,
                 }
             }
         },
         DefaultSort = "UserName",
         DefaultPageSize = 3,
         DefaultPageIndex = 1,
         Table = new Table
         {
             Columns = new TableColumn[]
             {
                 new TableColumn()
                 {
                 },
                 new TableColumn()
                 {
                     Sort = "UserName",
                     Header = "用户名",
                     CellTemplate = (x)=> new Literal()
                     {
                         Text =  ((User)x.Target).UserName
                     }
                 },
                 new TableColumn
                 {
                     Sort = "Gender",
                     Header= "性别",
                     CellTemplate = (x)=> new Literal()
                     {
                         Text =  ((User)x.Target).Gender.ToDisplayString()
                     }
                 },
                 new TableColumn
                 {
                     Sort = "DateOfBirth",
                     Header= "出生日期",
                     CellTemplate = (x)=> new Literal()
                     {
                         Text = string.Format("{0:yyyy-MM-dd}", ((User)x.Target).DateOfBirth)
                     }
                 }
             }
         },
         GlobalButtons = new IClickable[]
         {
             new Button()
             {
                 Text = "搜索",
                 ActionName = "",
             }
         }
     };
     return Template(template);
 }
Example #9
0
partial         void OnTemplate(AdministrationSimpleListTemplate template, ControllerContext controllerContext);
Example #10
0
        public Template CreateTemplate(ControllerContext controllerContext, ICacheManager cacheManager, CacheKeyManager cacheKeyManager)
        {
            var query = cacheKeyManager.AllKeys.Select(x => new
            {
                Name = x,
                IsNull = !cacheManager.Exist(x)
            }).ToList().AsQueryable();

            if (!string.IsNullOrWhiteSpace(Name))
            {
                var name = Name.Trim();

                query = query.Where(x => x.Name.Contains(name));
            }

            var template = new AdministrationSimpleListTemplate(query)
            {
                Title = MaintCultureTextResources.CacheIndex,
                Description = MaintCultureTextResources.CacheIndexDescription,
                QueryPanelTitle = MaintCultureTextResources.PanelQuery,
                DefaultSort = "Name",
                DefaultPageSize = 10,
                Criteria = new FieldsBuilder().ForEntity(this, controllerContext).Build(),
                GlobalButtons = new List<IClickable>
                {
                    new Button(MaintCultureTextResources.Search),
                    new Button(MaintCultureTextResources.Clear, "Clear"),
                },
                Table = new Table
                {
                    Columns = new List<TableColumn>
                    {
                        new TableColumn
                        {
                            Sort = "Name",
                            Header = MaintCultureTextResources.CacheName,
                            CellTemplate = x => new Literal
                            {
                                Text = ((dynamic) x.Target).Name
                            }
                        },
                        new TableColumn
                        {
                            Sort = "Exist",
                            Header = MaintCultureTextResources.Null,
                            CellTemplate = x => new Literal
                            {
                                Text = ((dynamic) x.Target).IsNull == true ? MaintCultureTextResources.Yes : MaintCultureTextResources.No
                            }
                        }

                    }
                }
            };
            return template;
        }