Ejemplo n.º 1
0
        internal List <string> Columns(ColumnsType type)
        {
            List <string> list = new List <string>();

            for (int i = 1; i <= this.Column; i++)
            {
                list.Add((type == ColumnsType.String) ? GetColumnName(i) : i.ToString());
            }
            return(list);
        }
Ejemplo n.º 2
0
                public static string GetTypeID(ColumnsType col, out int boFieldTypes, out int boFldSubTypes)
                {
                    boFldSubTypes = 0; //None

                    switch (col)
                    {
                    case SAPTables.ColumnsType.Special_MD5:
                    case SAPTables.ColumnsType.Special_YesOrNo:
                    case SAPTables.ColumnsType.Special_StatusQueue:
                    case ColumnsType.AlphaNumeric_Regular:
                        boFieldTypes = 0;
                        return("A");

                    case ColumnsType.AlphaNumeric_Address:
                        boFieldTypes  = 0;
                        boFldSubTypes = 63;
                        return("A?");

                    case ColumnsType.AlphaNumeric_Phone:
                        boFieldTypes  = 0;
                        boFldSubTypes = 35;
                        return("A#");

                    case ColumnsType.AlphaNumeric_Text:
                        boFieldTypes = 1;
                        return("M");

                    case ColumnsType.Numeric:
                        boFieldTypes = 2;
                        return("N");

                    case ColumnsType.DateTime_Date:
                        boFieldTypes = 3;
                        return("D");

                    case ColumnsType.DateTime_Hour:
                        boFieldTypes  = 3;
                        boFldSubTypes = 84;
                        return("NT");

                    //case ColumnsType.UnitsAndTotals_Rate: return "BR";
                    //case ColumnsType.UnitsAndTotals_Amount: return "BS";
                    //case ColumnsType.UnitsAndTotals_Price: return "BP";
                    //case ColumnsType.UnitsAndTotals_Quantity: return "BQ";
                    //case ColumnsType.UnitsAndTotals_Percents: return "B%";
                    //case ColumnsType.UnitsAndTotals_Measure: return "BM";
                    //case ColumnsType.General_Link: return "MB";
                    //case ColumnsType.General_Image: return "AI";
                    //case ColumnsType.Special_MD5: return "A#";
                    //case ColumnsType.Special_YesOrNo: return "A";
                    //case ColumnsType.Special_StatusQueue: return "A";
                    default: throw new NotImplementedException(col.ToString());
                    }
                }
Ejemplo n.º 3
0
        public List <ReportColumn> GetColumnList()
        {
            var list = new List <ReportColumn>();

            if (!ColumnList.Any())
            {
                return(list);
            }

            IDictionary <string, PropertyItem> propertyItems = null;
            IDictionary <string, PropertyInfo> propertyInfos = null;
            Row basedOnRow = null;

            if (ColumnsType != null)
            {
                propertyItems = LocalCache.Get("DynamicDataReport:Columns:" + ColumnsType.FullName, TimeSpan.Zero,
                                               () => PropertyItemHelper.GetPropertyItemsFor(ColumnsType).ToDictionary(x => x.Name));

                propertyInfos = ColumnsType.GetProperties().ToDictionary(x => x.Name);

                var basedOnAttr = ColumnsType.GetCustomAttribute <BasedOnRowAttribute>();
                if (basedOnAttr != null &&
                    basedOnAttr.RowType != null &&
                    typeof(Row).IsAssignableFrom(basedOnAttr.RowType))
                {
                    basedOnRow = (Row)Activator.CreateInstance(basedOnAttr.RowType);
                }
            }

            foreach (var columnName in ColumnList)
            {
                PropertyItem item;
                if (!propertyItems.TryGetValue(columnName, out item))
                {
                    continue;
                }

                var basedOnField = basedOnRow == null ? (Field)null :
                                   (basedOnRow.FindField(columnName) ?? basedOnRow.FindFieldByPropertyName(columnName));

                PropertyInfo p;
                if (propertyInfos == null || !propertyInfos.TryGetValue(columnName, out p))
                {
                    p = null;
                }

                list.Add(FromPropertyItem(item, basedOnField, p));
            }

            return(list);
        }
Ejemplo n.º 4
0
        public GridColumn(string data, ColumnsType type = ColumnsType.None)
        {
            this.data = data;
            this.type = type;
            var    align   = ColumnsTextAlign.None;
            string vRender = null;

            if ((type == ColumnsType.Date || type == ColumnsType.DateTime) && string.IsNullOrEmpty(vRender))
            {
                vRender = "function (data, type, full, meta) {return $.jsonDateToFormat(data";
                if (type == ColumnsType.DateTime)
                {
                    render += ",'DD/MM/YYYY HH:mm:ss'";
                }
                vRender += ");}";
                align    = ColumnsTextAlign.Center;
            }

            if ((type == ColumnsType.Number ||
                 type == ColumnsType.NumberFormat ||
                 type == ColumnsType.NumberFormat2 ||
                 type == ColumnsType.NumberFormat3 ||
                 type == ColumnsType.NumberFormat4 ||
                 type == ColumnsType.NumberFormat6 ||
                 type == ColumnsType.NumberFormat8 ||
                 type == ColumnsType.NumberFormat10
                 ) && string.IsNullOrEmpty(vRender))
            {
                align = ColumnsTextAlign.Right;
                if (type != ColumnsType.Number)
                {
                    var digitLength = 0;
                    if (type == ColumnsType.NumberFormat2)
                    {
                        digitLength = 2;
                    }
                    else if (type == ColumnsType.NumberFormat3)
                    {
                        digitLength = 3;
                    }
                    else if (type == ColumnsType.NumberFormat4)
                    {
                        digitLength = 4;
                    }
                    else if (type == ColumnsType.NumberFormat6)
                    {
                        digitLength = 6;
                    }
                    else if (type == ColumnsType.NumberFormat8)
                    {
                        digitLength = 8;
                    }
                    else if (type == ColumnsType.NumberFormat10)
                    {
                        digitLength = 10;
                    }
                    if (digitLength > 0)
                    {
                        vRender = "function (data, type, full, meta) {return digitsFormat(toNumberFormat(data)," + digitLength + ");}";
                    }
                    else
                    {
                        vRender = "function (data, type, full, meta) {return toNumberFormat(data);}";
                    }
                }
            }

            if (type == ColumnsType.File ||
                type == ColumnsType.FileMultiple)
            {
                vRender  = "function (data, type, full, meta) {return '<table id=\"Grid|tplName|";
                vRender += data;
                vRender += "\" class=\"table table-striped table-bordered table-hover gridInGrid\"></table>';}";
            }
            this.render    = vRender;
            this.className = align != ColumnsTextAlign.None ? align.GetDescription() : null;
        }
Ejemplo n.º 5
0
        public GridColumn(string data, string title, int?width, ColumnsType type = ColumnsType.None, ColumnsTextAlign align = ColumnsTextAlign.None, string render = null)
        {
            this.data  = data;
            this.title = title;
            this.width = width != null?Convert.ToString(width) : null;

            this.type = type;
            if ((type == ColumnsType.Date ||
                 type == ColumnsType.DateTime) && string.IsNullOrEmpty(render))
            {
                render = "function (data, type, full, meta) {return $.jsonDateToFormat(data";
                if (type == ColumnsType.DateTime)
                {
                    render += ",'DD/MM/YYYY HH:mm:ss'";
                }
                render += ");}";
                if (align == ColumnsTextAlign.None)
                {
                    align = ColumnsTextAlign.Center;
                }
            }

            if (type == ColumnsType.Time && string.IsNullOrEmpty(render))
            {
                render = "function (data, type, full, meta) {return $.jsonDateToFormat(data";
                if (type == ColumnsType.Time)
                {
                    render += ",'HH:mm:ss'";
                }
                render += ");}";
                if (align == ColumnsTextAlign.None)
                {
                    align = ColumnsTextAlign.Center;
                }
            }

            if ((type == ColumnsType.NumberFormat ||
                 type == ColumnsType.NumberFormat2 ||
                 type == ColumnsType.NumberFormat3 ||
                 type == ColumnsType.NumberFormat4 ||
                 type == ColumnsType.NumberFormat6 ||
                 type == ColumnsType.NumberFormat8 ||
                 type == ColumnsType.NumberFormat10
                 ) && string.IsNullOrEmpty(render))
            {
                if (align == ColumnsTextAlign.None)
                {
                    align = ColumnsTextAlign.Right;
                }
                var digitLength = 0;
                if (type == ColumnsType.NumberFormat2)
                {
                    digitLength = 2;
                }
                else if (type == ColumnsType.NumberFormat3)
                {
                    digitLength = 3;
                }
                else if (type == ColumnsType.NumberFormat4)
                {
                    digitLength = 4;
                }
                else if (type == ColumnsType.NumberFormat6)
                {
                    digitLength = 6;
                }
                else if (type == ColumnsType.NumberFormat8)
                {
                    digitLength = 8;
                }
                else if (type == ColumnsType.NumberFormat10)
                {
                    digitLength = 10;
                }

                if (digitLength > 0)
                {
                    render = "function (data, type, full, meta) {return digitsFormat(toNumberFormat(data)," + digitLength + ");}";
                }
                else
                {
                    render = "function (data, type, full, meta) {return toNumberFormat(data);}";
                }
            }

            if (type == ColumnsType.Checkbox)
            {
                if (align == ColumnsTextAlign.None)
                {
                    align = ColumnsTextAlign.Center;
                }
                render  = "function (data, type, full, meta) {";
                render += "var tag = '<i class=\"ace-icon fa fa-square-o\"></i>';";
                render += "if(data == 'Y'){";
                render += "tag = '<i class=\"ace-icon fa fa-check-square-o\"></i>';}";
                render += "return tag;}";
            }
            this.render    = render;
            this.className = align != ColumnsTextAlign.None ? align.GetDescription() : null;
        }