Exemplo n.º 1
0
        /// <summary>
        /// Appends the vertically.
        /// </summary>
        /// <param name="pData">The p data.</param>
        /// <param name="externalDescriptionLibrary">The external description library.</param>
        /// <param name="excludeCoreColumns">if set to <c>true</c> [exclude core columns].</param>
        public void AppendVertically(PropertyEntry pData, Dictionary <Object, String> externalDescriptionLibrary = null, Boolean excludeCoreColumns = true)
        {
            // if (externalDescriptionLibrary == null) externalDescriptionLibrary = pData.Keys.

            foreach (Object key in pData.Keys)
            {
                Boolean ok = true;
                if (excludeCoreColumns)
                {
                    if (key.isCoreColumn())
                    {
                        ok = false;
                    }
                }
                if (ok)
                {
                    addAsObjectKey(key, pData[key], true, externalDescriptionLibrary);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="__name">The name.</param>
        /// <param name="__description">The description.</param>
        /// <param name="__unit">The unit.</param>
        /// <param name="__letter">The letter.</param>
        /// <param name="__symbol">The symbol.</param>
        /// <returns></returns>
        public PropertyEntry Add(object key, object value, String __name, String __description, String __unit = "", String __letter = "", String __symbol = "")
        {
            if (key == "")
            {
                // key = __name.getFilename();
            }
            if (ContainsKey(key))
            {
                this[key] = value;
            }
            else
            {
                base.Add(key, value);
            }
            PropertyEntry pe = new PropertyEntry(key, value, __name, __description);

            if (!__unit.isNullOrEmpty())
            {
                pe[PropertyEntryColumn.entry_unit] = __unit;
            }
            if (!__letter.isNullOrEmpty())
            {
                pe[PropertyEntryColumn.role_letter] = __letter;
            }
            if (!__symbol.isNullOrEmpty())
            {
                pe[PropertyEntryColumn.role_symbol] = __symbol;
            }

            foreach (PropertyEntryColumn pekey in pe.Keys)
            {
                if (!defaultTableColumn.HasFlag(pekey))
                {
                    _defaultTableColumn |= pekey;
                }
            }

            pe.priority = entries.Count();
            entries.Add(key, pe);
            return(pe);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Builds the data table with columns specified - order of columns as specified
        /// </summary>
        /// <param name="columns">The columns.</param>
        /// <returns></returns>
        public DataTable getDataTable(params PropertyEntryColumn[] columns)
        {
            DataTable  output        = new DataTable();
            DataColumn dc_importance = null;

            output.TableName = name;

            //output.SetTitle(name);
            output.ExtendedProperties[templateFieldDataTable.description] = description;

            output.ExtendedProperties[templateFieldDataTable.data_rowcounttotal] = Count;

            // output.ExtendedProperties[templateFieldStyling.color_paletteRole] = palete;

            List <PropertyEntryColumn> columnList = columns.ToList();

            if ((!columnList.Any()) || columnList.Contains(PropertyEntryColumn.none))
            {
                columnList = defaultTableColumn.getEnumListFromFlags <PropertyEntryColumn>();
            }

            Int32 ci = 0;

            foreach (PropertyEntryColumn column in columnList)
            {
                if (column != PropertyEntryColumn.none)
                {
                    DataColumn dc = output.Columns.Add();
                    column.setDataColumn(dc);
                    if (column == PropertyEntryColumn.entry_importance)
                    {
                        dc_importance = dc;
                    }
                }
            }
            if (autoIncludeImportance)
            {
                if (dc_importance == null)
                {
                    DataColumn dc = output.Columns.Add();
                    PropertyEntryColumn.entry_importance.setDataColumn(dc);
                    dc.ExtendedProperties[templateFieldStyling.render_isHidden] = true;
                    dc_importance = dc;
                }
            }

            PropertyEntry entryMeta        = null;
            String        autocount_format = "D2";

            if (Count > 99)
            {
                autocount_format = "D3";
            }

            List <PropertyEntry> pel = entries.Values.ToList();

            pel.Sort((x, y) => x.priority.CompareTo(y.priority));
            Int32 c = 1;

            foreach (PropertyEntry entry in pel)
            {
                DataRow dr = output.NewRow();

                //entryMeta = entries[entry[PropertyEntryColumn.entry_key];

                foreach (DataColumn dc in output.Columns)
                {
                    PropertyEntryColumn column = (PropertyEntryColumn)dc.ExtendedProperties[templateFieldDataTable.col_name];
                    Object vl = "--";

                    switch (column)
                    {
                    case PropertyEntryColumn.autocount_idcolumn:
                        vl = c.ToString(autocount_format);
                        break;

                    default:
                        vl = entry.getColumn(column, this[entry[PropertyEntryColumn.entry_key]]);
                        break;
                    }

                    if (imbSciStringExtensions.isNullOrEmptyString(vl))
                    {
                        vl = "    ";
                    }

                    if (column == PropertyEntryColumn.autocount_idcolumn)
                    {
                        vl = c;
                    }

                    dr[dc] = vl;
                }
                output.Rows.Add(dr);
                c++;
            }

            return(output);
        }