Ejemplo n.º 1
0
        string RenderHeader(Func <string, string> translationDelegate)
        {
            bool filterExists = false;

            string[] headerNames = ConvertFields(x => {
                HeaderNameAttribute attr = (HeaderNameAttribute)
                                           x.GetCustomAttributes(typeof(HeaderNameAttribute), false)[0];

                MultiColumn[] multicolumn = (MultiColumn[])
                                            x.GetCustomAttributes(typeof(MultiColumn), false);

                ColumnFilterTypeAttribute[] colfilter = (ColumnFilterTypeAttribute[])
                                                        x.GetCustomAttributes(typeof(ColumnFilterTypeAttribute), false);
                filterExists |= colfilter.Length != 0;

                if (multicolumn.Length > 0)
                {
                    string header = "";
                    for (int i = 0; i < multicolumn[0].Size; i++)
                    {
                        header += MakeColumnHeader(x, attr, translationDelegate);
                    }

                    return(header);
                }

                return(MakeColumnHeader(x, attr, translationDelegate));
            });

            return(string.Join("\r\n", headerNames) + (filterExists ? "</tr><tr>" + string.Join("\r\n", ConvertFields(x => MakeColumnFilter(x))) : ""));
        }
Ejemplo n.º 2
0
        private static string MakeColumnHeader(FieldInfo x, HeaderNameAttribute attr, Func <string, string> translationDelegate)
        {
            ColumnSizeAttribute[] colsize = (ColumnSizeAttribute[])
                                            x.GetCustomAttributes(typeof(ColumnSizeAttribute), false);

            ColumnClassAttribute[] colclass = (ColumnClassAttribute[])
                                              x.GetCustomAttributes(typeof(ColumnClassAttribute), false);

            return("<th" + InsertColClass(colclass) + InsertColSize(colsize) + ">" + translationDelegate(attr.Name) + "</th>");
        }