public ICswNbtMetaDataProp getBarcodeProperty() { if (null == _BarcodeProp) { _BarcodeProp = (from _Prop in _CswNbtMetaDataResources.ObjectClassPropsCollection.getObjectClassPropsByObjectClass(ObjectClassId) where _Prop.getFieldTypeValue() == CswEnumNbtFieldType.Barcode select _Prop).FirstOrDefault(); } return(_BarcodeProp); }
} // DeleteObjectClass() /// <summary> /// Set the default value for an object class prop, and cascade the change to all existing NodeTypeProps /// </summary> /// <param name="ObjectClassProp"></param> /// <param name="Value"></param> /// <param name="SubFieldName">Optional. Use the default subfield if null.</param> /// public void SetObjectClassPropDefaultValue(CswNbtMetaDataObjectClassProp ObjectClassProp, object Value, CswEnumNbtSubFieldName SubFieldName = null) { if (null != ObjectClassProp) { SubFieldName = SubFieldName ?? ObjectClassProp.getFieldTypeRule().SubFields.Default.Name; ObjectClassProp.DefaultValue.SetPropRowValue(SubFieldName, ObjectClassProp.getFieldTypeRule().SubFields[SubFieldName].Column, Value); // We're going to regret this day ObjectClassProp.DefaultValue.SetPropRowValue(CswEnumNbtSubFieldName.Gestalt, CswEnumNbtPropColumn.Gestalt, Value); foreach (CswNbtMetaDataNodeTypeProp NodeTypeProp in ObjectClassProp.getNodeTypeProps()) { //NodeTypeProp.DefaultValue.SetPropRowValue( ObjectClassProp.getFieldTypeRule().SubFields[SubFieldName].Column, Value ); //NodeTypeProp.DefaultValue.SetPropRowValue( CswEnumNbtSubFieldName.Gestalt, CswEnumNbtPropColumn.Gestalt, Value ); NodeTypeProp.getDefaultValue(true).SetSubFieldValue(SubFieldName, Value); } } }
/// <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()
} // makeMissingNodeTypeProps() /// <summary> /// Deletes an object class prop and all nodetype props from the database and metadata collection /// </summary> public Collection <CswNbtMetaDataNodeTypeProp> DeleteObjectClassProp(CswNbtMetaDataObjectClassProp ObjectClassProp, bool DeleteNodeTypeProps) { Collection <CswNbtMetaDataNodeTypeProp> Ret = new Collection <CswNbtMetaDataNodeTypeProp>(); //Collection<CswNbtMetaDataNodeTypeProp> DoomedProps = new Collection<CswNbtMetaDataNodeTypeProp>(); Collection <CswNbtObjClassDesignNodeTypeProp> DoomedProps = new Collection <CswNbtObjClassDesignNodeTypeProp>(); foreach (CswNbtMetaDataNodeTypeProp Prop in ObjectClassProp.getNodeTypeProps()) { if (DeleteNodeTypeProps) { DoomedProps.Add(Prop.DesignNode); } else { Prop.DesignNode.ObjectClassPropName.Text = string.Empty; Prop.DesignNode.postChanges(false); //Prop._DataRow["objectclasspropid"] = DBNull.Value; //_CswNbtMetaDataResources.NodeTypePropTableUpdate.update( Prop._DataRow.Table ); Ret.Add(Prop); } } foreach (CswNbtObjClassDesignNodeTypeProp Prop in DoomedProps) { //DeleteNodeTypeProp( Prop, true ); Prop.InternalDelete = true; Prop.Node.delete(false, true); } // Update MetaData _CswNbtMetaDataResources.ObjectClassPropsCollection.clearCache(); // Delete the Object Class Prop ObjectClassProp._DataRow.Delete(); _CswNbtMetaDataResources.ObjectClassPropTableUpdate.update(ObjectClassProp._DataRow.Table); return(Ret); } // DeleteObjectClassProp()
public void AddToCache( CswNbtMetaDataObjectClassProp NewObj ) { _CollImpl.AddToCache( NewObj ); }
public CswNbtMetaDataNodeTypeProp getNodeTypePropByObjectClassProp(CswNbtMetaDataObjectClassProp ObjectClassProp) { return(_CswNbtMetaDataResources.NodeTypePropsCollection.getNodeTypePropByObjectClassProp(NodeTypeId, ObjectClassProp.PropName)); }
} // getLayout() /// <summary> /// Updates the given layout by placing the given property in the specified locaiton (or at the bottom) /// </summary> /// <param name="LayoutType">Add, Edit, Preview, or Table (Search)</param> /// <param name="NodeTypeId">NodetypeId of the NodeType to which the prop belongs</param> /// <param name="NtProp">Prop to move</param> /// <param name="DoMove">If true, remove the prop from other tab(s) before moving to the new one (Edit Layout only)</param> /// <param name="TabId">TabId to which the prop should be added (Edit Layout Only)</param> /// <param name="DisplayRow">Row number to place the property. If the cell is taken, it will be placed beneath the pre-existing prop</param> /// <param name="DisplayColumn">Column number to place the property. If the cell is taken, it will be placed beneath the pre-existing prop</param> /// <param name="TabGroup">(Optional) specify the name of the TabGroup with which to place the prop (if it doesn't exist, one will be created)</param> public void updatePropLayout(CswEnumNbtLayoutType LayoutType, Int32 NodeTypeId, CswNbtMetaDataNodeTypeProp NtProp, bool DoMove, Int32 TabId = Int32.MinValue, Int32 DisplayRow = Int32.MinValue, Int32 DisplayColumn = Int32.MinValue, string TabGroup = "") { if (LayoutType != CswEnumNbtLayoutType.Unknown && null != NtProp) { if (DoMove) { removePropFromLayout(LayoutType, NtProp, Int32.MinValue); } CswTableUpdate LayoutUpdate = _CswNbtMetaDataResources.CswNbtResources.makeCswTableUpdate("updatePropLayout_Update", "nodetype_layout"); string WhereClause = "where layouttype = '" + LayoutType.ToString() + "' and nodetypepropid = " + NtProp.PropId.ToString(); if (TabId != Int32.MinValue && LayoutType == CswEnumNbtLayoutType.Edit) { WhereClause += " and nodetypetabsetid = " + TabId.ToString(); } DataTable LayoutTable = LayoutUpdate.getTable(WhereClause); DataRow Row = null; if (LayoutTable.Rows.Count > 0) { Row = LayoutTable.Rows[0]; } else { Row = LayoutTable.NewRow(); LayoutTable.Rows.Add(Row); } Row["layouttype"] = LayoutType.ToString(); Row["nodetypeid"] = CswConvert.ToDbVal(NodeTypeId); Row["nodetypepropid"] = CswConvert.ToDbVal(NtProp.PropId); Row["auditlevel"] = NtProp.AuditLevel.ToString(); // layout audit goes with property audit if (LayoutType == CswEnumNbtLayoutType.Edit) { if (TabId != Int32.MinValue) { Row["nodetypetabsetid"] = CswConvert.ToDbVal(TabId); } else { throw new CswDniException(CswEnumErrorType.Error, "Tab is required", "CswNbtMetaDataNodeTypeLayoutMgr.updatePropLayout() requires a valid TabId for Edit layouts"); } } Int32 FinalDisplayRow = DisplayRow; Int32 FinalDisplayCol = DisplayColumn; //Very special case for 'Save'--it is always last if (FinalDisplayRow == Int32.MaxValue) { CswNbtMetaDataObjectClassProp Ocp = NtProp.getObjectClassProp(); if (null == Ocp || Ocp.PropName != CswNbtObjClass.PropertyName.Save) { FinalDisplayRow = Int32.MaxValue - 1; } } else { if (FinalDisplayRow <= 0) { FinalDisplayRow = getCurrentMaxDisplayRow(NodeTypeId, TabId, LayoutType) + 1; } if (FinalDisplayCol <= 0) { FinalDisplayCol = 1; } } Row["display_row"] = CswConvert.ToDbVal(FinalDisplayRow); Row["display_column"] = CswConvert.ToDbVal(FinalDisplayCol); Row["tabgroup"] = TabGroup; LayoutUpdate.update(LayoutTable); } // if( Type != CswEnumNbtLayoutType.Unknown && Prop != null ) if (_Cache.ContainsKey(NodeTypeId)) { _Cache.Remove(NodeTypeId); } } // updatePropLayout()