示例#1
0
 public void AddMetaRangeFrom(PropertyCollectionExtended pce)
 {
     foreach (KeyValuePair <Object, PropertyEntry> pePair in pce.entries)
     {
         AddMetaFrom(pePair.Value, false, true);
     }
 }
        /// <summary>
        /// Gets the data for entry.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public PropertyCollectionExtended getDataForEntry(Int32 key)
        {
            if (timeSeries.Count() < key)
            {
                new ArgumentOutOfRangeException("key", "Larger then timeseries");
            }
            PropertyCollectionExtended output = new PropertyCollectionExtended();

            output.AddRange(shema, false, false, false);
            output.AddRange(timeSeries[key], false);
            return(output);
        }
        /// <summary>
        /// Builds the data fields for category.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public PropertyCollectionExtended buildDataFieldsForCategory(String category, T instance)
        {
            PropertyCollectionExtended pce   = new PropertyCollectionExtended();
            PropertyCollectionExtended shema = this[category];

            pce.name        = shema.name;
            pce.description = shema.description;
            pce.AddMetaRangeFrom(shema);

            pce.setFromObject(instance);

            return(pce);
        }
示例#4
0
#pragma warning disable CS1574 // XML comment has cref attribute 'overwriteExistingIfEmptyOrNull' that could not be resolved
        /// <summary>
        /// Adds the range. When <c>skipExisting</c> booleans are <c>true</c> it applies <see cref="aceCommonTypes.enums.existingDataMode.overwriteExistingIfEmptyOrNull"/> for smarter data gathering
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="skipExistingValues">if set to <c>true</c> [skip existing values].</param>
        /// <param name="skipExistingMeta">if set to <c>true</c> it will keep existing <c>PropertyEntry</c> when overlapped with source</param>
        /// <param name="strictMetaKeyMatch">If set to <c>true</c> it will not introduce new columns into data set. If <c>false</c> it will upgrade data set with not existing columns found at <c>source</c></param>
        public void AddRange(PropertyCollectionExtended source, Boolean skipExistingValues, Boolean skipExistingMeta, Boolean strictMetaKeyMatch)
#pragma warning restore CS1574 // XML comment has cref attribute 'overwriteExistingIfEmptyOrNull' that could not be resolved
        {
            foreach (KeyValuePair <Object, PropertyEntry> pePair in source.entries)
            {
                PropertyEntry pe = pePair.Value;

                if (ContainsKey(pePair.Key))
                {
                    if (!skipExistingValues)
                    {
                        this[pePair.Key] = source[pePair.Key];
                    }
                    else
                    {
                        if (imbSciStringExtensions.isNullOrEmptyString(this[pePair.Key]))
                        {
                            this[pePair.Key] = source[pePair.Key];
                        }
                    }
                }
                else
                {
                    base.Add(pePair.Key, pePair.Value);
                }
                if (entries.ContainsKey(pePair.Key))
                {
                    PropertyEntry oldPe = entries[pePair.Key];
                    if (skipExistingMeta)
                    {
                        oldPe.AppendData(pePair.Value, existingDataMode.overwriteExistingIfEmptyOrNull);
                    }
                    else
                    {
                        oldPe.AppendData(pePair.Value, existingDataMode.overwriteExisting);
                    }

                    // update
                }
                else
                {
                    if (!strictMetaKeyMatch)
                    {
                        entries.Add(pePair.Key, pePair.Value);
                    }
                    // insert
                }
            }
        }
        /// <summary>
        /// Builds the data table for category.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException">-- not implemented --</exception>
        public DataTable buildDataTableForCategory(String category, T instance)
        {
            PropertyCollectionExtended pce   = new PropertyCollectionExtended();
            PropertyCollectionExtended shema = this[category];

            pce.name        = shema.name;
            pce.description = shema.description;
            pce.AddMetaRangeFrom(shema);

            pce.setFromObject(instance);

            throw new NotImplementedException("-- not implemented --");

            return(null); // pce.buildDataTableVertical(category, shema.description);
        }
        /// <summary>
        /// Builds the property collection extended list.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="instances">The instances.</param>
        /// <param name="instanceNameProperty">The instance name property.</param>
        /// <returns></returns>
        public PropertyCollectionExtendedList buildPropertyCollectionExtendedList(String category, IEnumerable <T> instances, String instanceNameProperty)
        {
            PropertyCollectionExtended shema = this[category];

            PropertyCollectionExtendedList output = new PropertyCollectionExtendedList();

            foreach (T instance in instances)
            {
                PropertyCollectionExtended pce = new PropertyCollectionExtended();
                pce.name        = shema.name;
                pce.description = shema.description;
                pce.AddMetaRangeFrom(shema);
                // String iName =
                //instance.GetPropertyValue().toStringSafe();
                pce.name = getName(instance, instanceNameProperty);

                output.Add(pce, pce.name, true);
            }

            return(output);
        }
        /// <summary>
        /// Builds the data table.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="instances">The instances.</param>
        /// <param name="instanceNameProperty">The instance name property.</param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException">-- not implemented yet --</exception>
        public DataTable buildDataTable(String category, IEnumerable <T> instances, String instanceNameProperty)
        {
            PropertyCollectionExtended shema = this[category];

            DataTable output = shema.getDataTable();

            foreach (T instance in instances)
            {
                PropertyCollectionExtended pce = new PropertyCollectionExtended();
                pce.name        = shema.name;
                pce.description = shema.description;
                pce.AddMetaRangeFrom(shema);
                pce.name = getName(instance, instanceNameProperty);

                // output.Add(pce, pce.name, true);

                throw new NotImplementedException("-- not implemented yet --");

                // output.AddDataTableRow(instance, imbDataTableExtensions.buildDataTableOptions.none);
            }

            return(output);
        }