Ejemplo n.º 1
0
        internal void SetPPENodeTypeProp(string ListOptions, string Delimiter = ",", int HideThreshold = 5)
        {
            CswNbtMetaDataNodeType ChemicalNT = _CswNbtResources.MetaData.getNodeType("Chemical");

            if (ChemicalNT != null)
            {
                CswNbtMetaDataNodeTypeProp PPENTP = _CswNbtResources.MetaData.getNodeTypeProp(ChemicalNT.NodeTypeId, "PPE");
                if (PPENTP != null)
                {
                    _ChangedNodeTypePropListOptions.Add(PPENTP.PropId, ListOptions);
                    _ChangedNodeTypePropExtended.Add(PPENTP.PropId, Delimiter);
                    _ChangedNodeTypePropMaxValue.Add(PPENTP.PropId, HideThreshold);
                    //PPENTP.ListOptions = ListOptions;
                    //PPENTP.Extended = Delimiter;
                    //PPENTP.MaxValue = HideThreshold;
                    CswNbtFieldTypeAttribute ListOptionsAttr = PPENTP.getFieldTypeRule().getAttributes().FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Listoptions);
                    CswNbtFieldTypeAttribute ExtendedAttr    = PPENTP.getFieldTypeRule().getAttributes().FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Extended);
                    CswNbtFieldTypeAttribute MaxValueAttr    = PPENTP.getFieldTypeRule().getAttributes().FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Numbermaxvalue);
                    PPENTP.DesignNode.AttributeProperty[ListOptionsAttr.Name].SetSubFieldValue(ListOptionsAttr.SubFieldName, ListOptions);
                    PPENTP.DesignNode.AttributeProperty[ExtendedAttr.Name].SetSubFieldValue(ExtendedAttr.SubFieldName, Delimiter);
                    PPENTP.DesignNode.AttributeProperty[MaxValueAttr.Name].SetSubFieldValue(MaxValueAttr.SubFieldName, HideThreshold);
                    PPENTP.DesignNode.postChanges(false);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Get or set the value of an attribute, by name
 /// Changes temporarily override values from the MetaData database, but are not saved.
 /// </summary>
 public string this[CswEnumNbtPropertyAttributeName AttributeName, CswEnumNbtSubFieldName SubFieldName = null]
 {
     get
     {
         string ret = string.Empty;
         CswNbtFieldTypeAttribute attr = Attributes.FirstOrDefault(a => a.Name == AttributeName && (SubFieldName == null || a.SubFieldName == SubFieldName));
         if (null != attr)
         {
             ret = attr.Value;
         }
         //else
         //{
         //    throw new CswDniException( CswEnumErrorType.Error, "Property Configuration Error",
         //                               "Illegal get; Unrecognized property attribute '" + AttributeName + "' for field type '" + getFieldTypeValue() + "'" );
         //}
         return(ret);
     }
     set
     {
         CswNbtFieldTypeAttribute attr = Attributes.FirstOrDefault(a => a.Name == AttributeName && (SubFieldName == null || a.SubFieldName == SubFieldName));
         if (null != attr)
         {
             attr.Value = value;
         }
         //else
         //{
         //    throw new CswDniException( CswEnumErrorType.Error, "Property Configuration Error",
         //                               "Illegal set; Unrecognized property attribute '" + AttributeName + "' for field type '" + getFieldTypeValue() + "'" );
         //}
     }
 }
        /// <summary>
        /// Update the attributes of an Object Class Prop, and cascade changes to existing NodeTypeProps
        /// </summary>
        public void UpdateObjectClassProp(CswNbtMetaDataObjectClassProp ObjectClassProp, CswEnumNbtObjectClassPropAttributes AttributeColumnName, object Value)
        {
            if (AttributeColumnName != CswResources.UnknownEnum)
            {
                string AttributeColumnNameString = CswNbtMetaDataObjectClassProp.getObjectClassPropAttributesAsString(AttributeColumnName);
                object DBValue = CswConvert.ToDbVal(Value);
                if (ObjectClassProp._DataRow[AttributeColumnNameString] != DBValue)
                {
                    ObjectClassProp._DataRow[AttributeColumnNameString] = DBValue;
                    if (AttributeColumnName == CswEnumNbtObjectClassPropAttributes.setvalonadd)
                    {
                        ObjectClassProp._DataRow[CswNbtMetaDataObjectClassProp.getObjectClassPropAttributesAsString(CswEnumNbtObjectClassPropAttributes.display_col_add)] = DBNull.Value;
                        ObjectClassProp._DataRow[CswNbtMetaDataObjectClassProp.getObjectClassPropAttributesAsString(CswEnumNbtObjectClassPropAttributes.display_row_add)] = DBNull.Value;
                    }
                    _CswNbtMetaDataResources.ObjectClassPropTableUpdate.update(ObjectClassProp._DataRow.Table);

                    foreach (CswNbtMetaDataNodeTypeProp NodeTypeProp in ObjectClassProp.getNodeTypeProps())
                    {
                        CswNbtFieldTypeAttribute attr = NodeTypeProp.getFieldTypeRule().getAttributes().FirstOrDefault(a => a.Column == AttributeColumnName);
                        if (null != attr)
                        {
                            CswNbtNodePropWrapper attrProp = NodeTypeProp.DesignNode.AttributeProperty[attr.Name];
                            attrProp.SetSubFieldValue(attrProp.NodeTypeProp.getFieldTypeRule().SubFields.Default, DBValue);
                        }
                        if (AttributeColumnName == CswEnumNbtObjectClassPropAttributes.setvalonadd)
                        {
                            if (CswConvert.ToBoolean(Value))
                            {
                                NodeTypeProp.updateLayout(CswEnumNbtLayoutType.Add, true);
                            }
                            else
                            {
                                NodeTypeProp.removeFromLayout(CswEnumNbtLayoutType.Add);
                            }
                        }
                    }
                }
            }
        } // UpdateObjectClassProp()
Ejemplo n.º 4
0
 internal void RevertNodeTypePropAttributes()
 {
     foreach (KeyValuePair <int, string> OriginalNodeTypePropId in _ChangedNodeTypePropListOptions)
     {
         CswNbtMetaDataNodeTypeProp OriginalNodeTypeProp = _CswNbtResources.MetaData.getNodeTypeProp(OriginalNodeTypePropId.Key);
         if (null != OriginalNodeTypeProp)
         {
             //OriginalNodeTypeProp.ListOptions = OriginalNodeTypePropId.Value;
             CswNbtFieldTypeAttribute attr = OriginalNodeTypeProp.getFieldTypeRule().getAttributes().FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Listoptions);
             OriginalNodeTypeProp.DesignNode.AttributeProperty[attr.Name].SetSubFieldValue(attr.SubFieldName, OriginalNodeTypePropId.Value);
             OriginalNodeTypeProp.DesignNode.postChanges(false);
         }
     }
     foreach (KeyValuePair <int, string> OriginalNodeTypePropId in _ChangedNodeTypePropExtended)
     {
         CswNbtMetaDataNodeTypeProp OriginalNodeTypeProp = _CswNbtResources.MetaData.getNodeTypeProp(OriginalNodeTypePropId.Key);
         if (null != OriginalNodeTypeProp)
         {
             //OriginalNodeTypeProp.Extended = OriginalNodeTypePropId.Value;
             CswNbtFieldTypeAttribute attr = OriginalNodeTypeProp.getFieldTypeRule().getAttributes().FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Extended);
             OriginalNodeTypeProp.DesignNode.AttributeProperty[attr.Name].SetSubFieldValue(attr.SubFieldName, OriginalNodeTypePropId.Value);
             OriginalNodeTypeProp.DesignNode.postChanges(false);
         }
     }
     foreach (KeyValuePair <int, int> OriginalNodeTypePropId in _ChangedNodeTypePropMaxValue)
     {
         CswNbtMetaDataNodeTypeProp OriginalNodeTypeProp = _CswNbtResources.MetaData.getNodeTypeProp(OriginalNodeTypePropId.Key);
         if (null != OriginalNodeTypeProp)
         {
             //OriginalNodeTypeProp.MaxValue = OriginalNodeTypePropId.Value;
             CswNbtFieldTypeAttribute attr = OriginalNodeTypeProp.getFieldTypeRule().getAttributes().FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Numbermaxvalue);
             OriginalNodeTypeProp.DesignNode.AttributeProperty[attr.Name].SetSubFieldValue(attr.SubFieldName, OriginalNodeTypePropId.Value);
             OriginalNodeTypeProp.DesignNode.postChanges(false);
         }
     }
 }