/// <summary>
 /// Learns formatting data from source
 /// </summary>
 /// <param name="source">The source.</param>
 public void Learn(MetaTableProperty source)
 {
     if (ValueTypeName.isNullOrEmpty())
     {
         ValueTypeName = source.ValueTypeName;
     }
     if (ValueFormat.isNullOrEmpty())
     {
         ValueFormat = source.ValueFormat;
     }
     if (decimalDelimiter.isNullOrEmpty())
     {
         decimalDelimiter = source.decimalDelimiter;
     }
     if (thousantDelimiter.isNullOrEmpty())
     {
         thousantDelimiter = source.thousantDelimiter;
     }
     if (ContentType == CellContentType.unknown)
     {
         ContentType = source.ContentType;
     }
     if (AllContentTypes == CellContentType.unknown)
     {
         AllContentTypes = source.AllContentTypes;
     }
     factor = source.factor;
 }
Exemplo n.º 2
0
 public String GetStoredValue(MetaTableProperty property)
 {
     if (!properties.ContainsKey(property.PropertyName))
     {
         return(property.GetDefaultData());
     }
     return(properties[property.PropertyName]);
 }
Exemplo n.º 3
0
 public SourceTableCell GetLinkedCell(MetaTableProperty property)
 {
     if (!HasLinkedCell(property))
     {
         return(null);
     }
     return(sourceCellLinks[property.PropertyName]);
 }
Exemplo n.º 4
0
 public Object GetOutputValue(MetaTableProperty property)
 {
     if (!properties.ContainsKey(property.PropertyName))
     {
         return(property.GetDefaultData());
     }
     return(property.GetValue(properties[property.PropertyName]));
 }
Exemplo n.º 5
0
 public Boolean HasLinkedCell(MetaTableProperty property)
 {
     if (!sourceCellLinks.ContainsKey(property.PropertyName))
     {
         return(false);
     }
     if (sourceCellLinks[property.PropertyName] == null)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 6
0
        public Int32 ApplySchema(IEnumerable <MetaTableProperty> schemaProperties)
        {
            Int32 c = 0;

            foreach (MetaTableProperty sp in schemaProperties)
            {
                MetaTableProperty p = properties.Get(sp.PropertyName);
                if (p != null)
                {
                    p.Learn(sp);
                    c++;
                }
            }

            return(c);
        }
Exemplo n.º 7
0
        public List <String> GetAllValuesForProperty(MetaTableProperty property)
        {
            List <String> output = new List <string>();

            if (property == null)
            {
                return(output);
            }
            if (!Any())
            {
                return(output);
            }

            foreach (MetaTableEntry entry in items)
            {
                if (entry != null)
                {
                    output.Add(entry.GetStoredValue(property));
                }
            }

            return(output);
        }
Exemplo n.º 8
0
        public DataColumn GetColumn(MetaTableProperty property, DataTable output, RefinedPropertyStats propertyStats = null)
        {
            if (!output.Columns.Contains(property.PropertyName))
            {
                DataColumn cl = output.Columns.Add(property.PropertyName);

                cl.SetHeading(property.DisplayName);
                cl.SetValueType(property.GetValueType());

                if (!property.ValueFormat.isNullOrEmpty())
                {
                    cl.SetFormat(property.ValueFormat);
                }
                cl.SetLetter(property.PropertyName);

                if (propertyStats != null)
                {
                    cl.SetWidth(Math.Min(propertyStats.max_width, 30));
                }

                StringBuilder sb = new StringBuilder();
                sb.Append("Content: " + property.ContentType.ToString());
                //sb.Append("Property name: " + property.PropertyName);
                if (!property.ValueTypeName.isNullOrEmpty())
                {
                    sb.Append(" ValueType: " + property.ValueTypeName);
                }

                cl.SetDesc(sb.ToString());

                return(cl);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 9
0
 public Boolean HasValueFor(MetaTableProperty property)
 {
     return(properties.ContainsKey(property.PropertyName));
 }