Example #1
0
        private ExStoreRtnCodes readCellData(ref ExStoreCell xCell, List <Entity> subE)
        {
            ExStoreRtnCodes result;

            xCell = ExStoreCell.Instance();

            for (var i = 0; i < subE.Count; i++)
            {
                // xCell.Data[i] = xCell.DefaultValues();
                xCell.AddDefault();

                foreach (KeyValuePair <SchemaCellKey, SchemaFieldDef <SchemaCellKey> > kvp in xCell.Fields)
                {
                    SchemaCellKey key       = kvp.Value.Key;
                    string        fieldName = kvp.Value.Name;
                    Field         f         = subE[i].Schema.GetField(fieldName);
                    if (f == null)
                    {
                        return(ExStoreRtnCodes.XRC_FAIL);
                    }

                    Type t = f.ValueType;
                    if (t == null)
                    {
                        return(ExStoreRtnCodes.XRC_FAIL);
                    }


                    if (t?.Equals(typeof(string)) ?? false)
                    {
                        xCell.Data[i][key].Value = subE[i].Get <string>(fieldName);
                    }
                    else if (t?.Equals(typeof(double)) ?? false)
                    {
                        // int i1 = subE[i].Get<int>(fieldName);
                        double d2 = subE[i].Get <double>(fieldName, DisplayUnitType.DUT_GENERAL);

                        xCell.Data[i][key].Value = subE[i].Get <double>(fieldName, DisplayUnitType.DUT_GENERAL);
                    }
                    else if (t?.Equals(typeof(bool)) ?? false)
                    {
                        xCell.Data[i][key].Value = subE[i].Get <bool>(fieldName);
                    }
                }
            }

            return(ExStoreRtnCodes.XRC_GOOD);
        }
Example #2
0
 public SchemaFieldCell(SchemaCellKey sequence, string name, string desc, TD val,
                        RevitUnitType unitType = RevitUnitType.UT_UNDEFINED, string guid = "") :
     base(sequence, name, desc, val, unitType, guid)
 {
 }
Example #3
0
 public ASchemaFieldsCell GetValue2 <TD>(SchemaCellKey key)
 {
     return((ASchemaFieldsCell)Fields[key]);
 }
Example #4
0
 public void SetValue <TD>(SchemaCellKey key, TD value)
 {
     ((SchemaFieldCell <TD>)Fields[key]).Value = value;
 }
Example #5
0
 public TD GetValue <TD>(SchemaCellKey key)
 {
     return(((SchemaFieldCell <TD>)Fields[key]).Value);
 }
Example #6
0
        // public new ISchemaFieldDef<SchemaCellKey> this[SchemaCellKey key] => Fields[key];

        public SchemaFieldCell <TD> GetField <TD>(SchemaCellKey key)
        {
            return((SchemaFieldCell <TD>)Fields[key]);
        }