public override void update() { _CswNbtSchemaModTrnsctn.createAction( CswEnumNbtActionName.Container_Expiration_Lock, false, String.Empty, "Containers" ); _CswNbtSchemaModTrnsctn.createModuleActionJunction( CswEnumNbtModuleName.Containers, CswEnumNbtActionName.Container_Expiration_Lock ); CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RoleClass ); foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true ) ) { _CswNbtSchemaModTrnsctn.Permit.set( CswEnumNbtActionName.Container_Expiration_Lock, RoleNode.Node, RoleNode.Administrator.Checked == CswEnumTristate.True ); } CswNbtMetaDataPropertySet MaterialSet = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet ); foreach( CswNbtMetaDataObjectClass MaterialOC in MaterialSet.getObjectClasses() ) { foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp ExpirationLockedNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.ContainerExpirationLocked ); ExpirationLockedNTP.removeFromLayout( CswEnumNbtLayoutType.Add ); } foreach( CswNbtPropertySetMaterial MaterialNode in MaterialOC.getNodes( false, false ) ) { MaterialNode.ContainerExpirationLocked.Checked = CswEnumTristate.True; MaterialNode.postChanges( false ); } } } // update()
public override void update() { CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass ); foreach ( CswNbtObjClassMaterial MaterialNode in MaterialOC.getNodes( false, false ) ) { if( MaterialNode.TradeName.Text.Contains("Default") ) { MaterialNode.ApprovedForReceiving.Checked = Tristate.True; MaterialNode.postChanges( true ); MaterialNode.ApprovedForReceiving.Checked = Tristate.False; MaterialNode.postChanges( true ); } } }//Update()
public override void update() { // New 'IsConstituent' property CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet ); foreach( CswNbtMetaDataObjectClass MaterialOC in _CswNbtSchemaModTrnsctn.MetaData.getObjectClassesByPropertySetId( MaterialPS.PropertySetId ) ) { foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp IsConstituentNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.IsConstituent ); IsConstituentNTP.DefaultValue.AsLogical.Checked = CswEnumTristate.False; IsConstituentNTP.removeFromAllLayouts(); foreach( CswNbtPropertySetMaterial MaterialNode in MaterialNT.getNodes( false, true ) ) { MaterialNode.IsConstituent.Checked = CswEnumTristate.False; MaterialNode.postChanges( false ); } } } CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass ); if( null != ChemicalOC.FirstNodeType ) { //1. Create a new NodeType (of ObjClassChemical) called "Constituent" CswNbtMetaDataNodeType ConstituentNT = _CswNbtSchemaModTrnsctn.MetaData.CopyNodeType( ChemicalOC.FirstNodeType, "Constituent" ); CswNbtMetaDataNodeTypeProp TradeNameNTP = ConstituentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.TradeName ); ConstituentNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( TradeNameNTP.PropName ) ); // IsConstituent is true here CswNbtMetaDataNodeTypeProp IsConstituentNTP = ConstituentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent ); IsConstituentNTP.DefaultValue.AsLogical.Checked = CswEnumTristate.True; //2. Set Allow Receiving prop to "false" by default CswNbtMetaDataNodeTypeProp ApprovedReceivingNTP = ConstituentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.ApprovedForReceiving ); ApprovedReceivingNTP.DefaultValue.AsLogical.Checked = CswEnumTristate.False; ApprovedReceivingNTP.ServerManaged = true; Collection<CswNbtMetaDataNodeTypeProp> PropertiesToDelete = new Collection<CswNbtMetaDataNodeTypeProp>(); PropertiesToDelete.Add( ConstituentNT.getNodeTypeProp( "Chemical Sizes" ) ); PropertiesToDelete.Add( ConstituentNT.getNodeTypeProp( "Inventory Levels" ) ); PropertiesToDelete.Add( ConstituentNT.getNodeTypeProp( "Chemical Containers" ) ); PropertiesToDelete.Add( ConstituentNT.getNodeTypeProp( "Components" ) ); foreach( CswNbtMetaDataNodeTypeProp DoomedProp in PropertiesToDelete ) { if( null != DoomedProp ) { _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( DoomedProp ); } } CswNbtMetaDataNodeTypeProp SupplierNTP = ConstituentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.Supplier ); SupplierNTP.removeFromAllLayouts(); // Grant permissions to cispro_admin CswNbtObjClassRole CISProAdminRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "CISPro_Admin" ); CswEnumNbtNodeTypePermission[] AllPerms = new CswEnumNbtNodeTypePermission[] { CswEnumNbtNodeTypePermission.Create, CswEnumNbtNodeTypePermission.Delete, CswEnumNbtNodeTypePermission.Edit, CswEnumNbtNodeTypePermission.View }; _CswNbtSchemaModTrnsctn.Permit.set( AllPerms, ConstituentNT, CISProAdminRole, true ); } // if( null != ChemicalOC.FirstNodeType ) } // update()