Exemple #1
0
        private IGridColumnCollection <TModel> SubstituteColumns <TModel, TProperty>(IGridColumn <TModel> gridColumn)
        {
            IGridColumnCollection <TModel> columns = Substitute.For <IGridColumnCollection <TModel> >();

            columns.Add(Arg.Any <Expression <Func <TModel, TProperty> > >()).Returns(gridColumn);
            columns.Add().Returns(gridColumn);

            return(columns);
        }
    public static void CreateColumns <T>(IGridColumnCollection <T> columns)
    {
        Type         t           = typeof(T);
        PropertyInfo title       = t.GetProperty("Title");
        PropertyInfo description = t.GetProperty("Description");

        columns.Add(title)
        .Titled("MyTitle")
        .SetWidth(100);
        columns.Add(description)
        .Sortable(true);
    }
Exemple #3
0
 public static IGridColumn <T> AddProperty <T, TProperty>(this IGridColumnCollection <T> column, Expression <Func <T, TProperty> > property)
 {
     return(column
            .Add(property)
            .Css(GetCssClassFor(property))
            .Titled(ResourceProvider.GetPropertyTitle(property)));
 }
 public HtmlGridView <T> AutoGenerateColumns()
 {
     PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
     foreach (PropertyInfo pi in properties)
     {
         if (pi.CanRead)
         {
             _columns.Add(pi);
         }
     }
     return(this);
 }
Exemple #5
0
        public static IGridColumn <T> AddActionLink <T>(this IGridColumnCollection <T> column, String action, String iconClass)
        {
            if (Authorization.Provider != null && !Authorization.Provider.IsAuthorizedFor(CurrentAccountId, CurrentArea, CurrentController, action))
            {
                return(null);
            }

            return(column
                   .Add()
                   .Encoded(false)
                   .Sanitized(false)
                   .Css("action-cell")
                   .RenderAction(action, iconClass));
        }
Exemple #6
0
        public static IGridColumn <T> AddActionLink <T>(this IGridColumnCollection <T> column, LinkAction action)
        {
            if (Authorization.Provider != null && !Authorization.Provider.IsAuthorizedFor(CurrentAccountId, CurrentArea, CurrentController, action.ToString()))
            {
                return(null);
            }

            IGridColumn <T> gridColumn = column
                                         .Add()
                                         .SetWidth(20)
                                         .Encoded(false)
                                         .Sanitized(false)
                                         .Css("action-cell");

            AddLinkAction(gridColumn, action);

            return(gridColumn);
        }