}//afterPopulateProps() public override CswNbtNode CopyNode( bool IsNodeTemp = false, Action<CswNbtNode> OnCopy = null ) { CswNbtNode CopiedNode = _CswNbtResources.Nodes.makeNodeFromNodeTypeId( NodeTypeId, IsTemp : IsNodeTemp, OnAfterMakeNode : delegate( CswNbtNode NewNode ) { //copy each property from the old node NewNode.copyPropertyValues( Node ); //get the landing page items from the original role's welcome page and loop through them, copying each to new page //NOTE: if we ever implement non-welcome page role specific LPIs, this will need to be updated CswNbtLandingPage LandingPageBuilder = new CswNbtLandingPage( _CswNbtResources ); LandingPageData NewNodeLandingPageData = LandingPageBuilder.getWelcomePageItems( this.NodeId ); foreach(LandingPageData.LandingPageItem Item in NewNodeLandingPageData.LandingPageItems) { LandingPageBuilder.copyLandingPageItem( NewNode.NodeId.ToString(), Item ); } //copy the views to the new role _CswNbtResources.ViewSelect.copyViewsByRoleId( NodeId, NewNode.NodeId ); //if the thing that requested this copy had a callback, fire it if( null != OnCopy ) { OnCopy( NewNode ); } }, IsCopy : true ); return CopiedNode; }
} // InitActionPermissionOptions() private void _deleteRelatedPermissionNodes() { CswNbtView PermissionsView = new CswNbtView( _CswNbtResources ); CswNbtMetaDataPropertySet PermissionPS = _CswNbtResources.MetaData.getPropertySet( CswEnumNbtPropertySetName.PermissionSet ); CswNbtViewRelationship RootVR = PermissionsView.AddViewRelationship( PermissionPS, false ); CswNbtViewPropertyFilter Filter = null; foreach( CswNbtMetaDataObjectClass PermOC in PermissionPS.getObjectClasses() ) { if( Filter == null ) { CswNbtMetaDataNodeType PermNT = PermOC.FirstNodeType; if( null != PermNT ) { CswNbtMetaDataNodeTypeProp RoleOCP = PermNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetPermission.PropertyName.Role ); Filter = PermissionsView.AddViewPropertyAndFilter( RootVR, MetaDataProp: RoleOCP, Value: NodeId.PrimaryKey.ToString(), SubFieldName: CswEnumNbtSubFieldName.NodeID, FilterMode: CswEnumNbtFilterMode.Equals ); } } else { break; } } ICswNbtTree PermissionsTree = _CswNbtResources.Trees.getTreeFromView( PermissionsView, false, true, true ); for( int i = 0; i < PermissionsTree.getChildNodeCount(); i++ ) { PermissionsTree.goToNthChild( i ); CswNbtNode PermissionNode = PermissionsTree.getNodeForCurrentPosition(); PermissionNode.delete(); PermissionsTree.goToRoot(); } }
public override void afterPropertySetPopulateProps() { if (Owner.RelatedNodeId != null) { CswNbtNode EquipmentOrAssemblyNode = _CswNbtResources.Nodes[Owner.RelatedNodeId]; if (EquipmentOrAssemblyNode != null) { CswCommaDelimitedString NewYValues = new CswCommaDelimitedString(); if (EquipmentOrAssemblyNode.getObjectClass().ObjectClass == CswEnumNbtObjectClass.EquipmentClass) { CswNbtObjClassEquipment EquipmentNodeAsEquipment = (CswNbtObjClassEquipment)EquipmentOrAssemblyNode; foreach (string YValue in EquipmentNodeAsEquipment.Parts.YValues) { if (EquipmentNodeAsEquipment.Parts.CheckValue(CswNbtObjClassEquipment.PartsXValueName, YValue)) { NewYValues.Add(YValue); } } } else if (EquipmentOrAssemblyNode.getObjectClass().ObjectClass == CswEnumNbtObjectClass.EquipmentAssemblyClass) { CswNbtObjClassEquipmentAssembly AssemblyNodeAsAssembly = (CswNbtObjClassEquipmentAssembly)EquipmentOrAssemblyNode; foreach (string YValue in AssemblyNodeAsAssembly.AssemblyParts.YValues) { if (AssemblyNodeAsAssembly.AssemblyParts.CheckValue(CswNbtObjClassEquipmentAssembly.PartsXValueName, YValue)) { NewYValues.Add(YValue); } } } this.Parts.YValues = NewYValues; } // if( EquipmentOrAssemblyNode != null ) } // if( Owner.RelatedNodeId != null ) } //afterPopulateProps()
private void OnStatusPropChange(CswNbtNodeProp NodeProp, bool Creating) { switch (Status.Value) { case CswEnumNbtInspectionStatus.Completed: case CswEnumNbtInspectionStatus.CompletedLate: if (_InspectionState.Deficient) { Status.Value = CswEnumNbtInspectionStatus.ActionRequired; } else { _toggleButtonVisibility(Finish, IsVisible: false, SaveToDb: true); _toggleButtonVisibility(SetPreferred, IsVisible: false, SaveToDb: true); _toggleButtonVisibility(Cancel, IsVisible: false, SaveToDb: true); Node.setReadOnly(value: true, SaveToDb: true); } break; case CswEnumNbtInspectionStatus.Cancelled: case CswEnumNbtInspectionStatus.Missed: //InspectionDate.DateTimeValue = DateTime.Now; _toggleButtonVisibility(Finish, IsVisible: false, SaveToDb: true); _toggleButtonVisibility(SetPreferred, IsVisible: false, SaveToDb: true); _toggleButtonVisibility(Cancel, IsVisible: false, SaveToDb: true); Node.setReadOnly(value: true, SaveToDb: true); break; case CswEnumNbtInspectionStatus.ActionRequired: _toggleButtonVisibility(Finish, IsVisible: true, SaveToDb: true); _toggleButtonVisibility(SetPreferred, IsVisible: false, SaveToDb: true); _toggleButtonVisibility(Cancel, IsVisible: true, SaveToDb: true); Node.setReadOnly(value: false, SaveToDb: true); break; case CswEnumNbtInspectionStatus.Overdue: case CswEnumNbtInspectionStatus.Pending: _toggleButtonVisibility(Finish, IsVisible: true, SaveToDb: true); _toggleButtonVisibility(SetPreferred, IsVisible: true, SaveToDb: true); _toggleButtonVisibility(Cancel, IsVisible: true, SaveToDb: true); Node.setReadOnly(value: false, SaveToDb: true); break; } // switch( Status.Value ) CswNbtNode ParentNode = _CswNbtResources.Nodes.GetNode(this.Parent.RelatedNodeId); if (ParentNode != null && false == IsTemp) { ICswNbtPropertySetInspectionParent ParentAsParent = CswNbtPropSetCaster.AsPropertySetInspectionParent(ParentNode); bool IsDeficient = areMoreActionsRequired(); //case 25041 String OKStatus = (ParentAsParent.Status.Value == CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Not_Inspected) && Status.Value == CswEnumNbtInspectionStatus.Pending || Status.Value == CswEnumNbtInspectionStatus.Overdue) ? CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Not_Inspected) : CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.OK); ParentAsParent.Status.Value = IsDeficient ? CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Deficient) : OKStatus; //Parent.LastInspectionDate.DateTimeValue = DateTime.Now; ParentNode.postChanges(false); } // if( ParentNode != null ) } // OnStatusPropChange()
public CswNbtObjClassEquipmentAssembly(CswNbtResources CswNbtResources, CswNbtNode Node) : base(CswNbtResources, Node) { _Mover = new CswNbtKioskModeMoveableImpl(CswNbtResources, this); _Ownerer = new CswNbtKioskModeOwnerableImpl(CswNbtResources, this); _Transferer = new CswNbtKioskModeTransferableImpl(CswNbtResources, this); _Statuser = new CswNbtKioskModeStatusableImpl(CswNbtResources, this); }
public Node(CswNbtNode NbtNode) { if (null != NbtNode) { NodeId = NbtNode.NodeId; NodeName = NbtNode.NodeName; } }
public void beforeDeleteNode(bool DeleteAllRequiredRelatedNodes, bool ValidateRequiredRelationships) { beforeDeleteNodeLogic(); if (ValidateRequiredRelationships) { // case 22486 - Don't allow deleting targets of required relationships CswTableSelect JctSelect = _CswNbtResources.makeCswTableSelect("defaultBeforeDeleteNode_jnp_select", "jct_nodes_props"); // Case CIS-52536 - Delete validation should ignore temp nodes string WhereClause = @"np WHERE nodetypepropid IN (SELECT nodetypepropid FROM nodetype_props WHERE isrequired = '1') AND field1_fk = " + _CswNbtNode.NodeId.PrimaryKey.ToString() + @" AND (SELECT istemp FROM nodes n WHERE n.nodeid = np.nodeid) <> '1' "; CswCommaDelimitedString SelectClause = new CswCommaDelimitedString() { "nodeid" }; DataTable MatchTable = JctSelect.getTable(SelectClause, WhereClause); if (MatchTable.Rows.Count > 0) { CswCommaDelimitedString InUseStr = new CswCommaDelimitedString(); foreach (DataRow MatchRow in MatchTable.Rows) { CswPrimaryKey MatchNodePk = new CswPrimaryKey("nodes", CswConvert.ToInt32(MatchRow["nodeid"])); if (DeleteAllRequiredRelatedNodes) { CswNbtNode NodeToDelete = _CswNbtResources.Nodes.GetNode(MatchNodePk); if (null != NodeToDelete) { NodeToDelete.delete(DeleteAllRequiredRelatedNodes: DeleteAllRequiredRelatedNodes); } } else { CswNbtNode RelatedNode = _CswNbtResources.Nodes[MatchNodePk]; if (null != RelatedNode) { InUseStr.Add(RelatedNode.NodeLink); } } } // foreach( DataRow MatchRow in MatchTable.Rows ) if (false == DeleteAllRequiredRelatedNodes) { throw new CswDniException(CswEnumErrorType.Warning, "This " + _CswNbtNode.getNodeType().NodeTypeName + " cannot be deleted because it is in use by: " + InUseStr, "Current user (" + _CswNbtResources.CurrentUser.Username + ") tried to delete a " + _CswNbtNode.getNodeType().NodeTypeName + " that is in use by: " + InUseStr); } } // if( MatchTable.Rows.Count > 0 ) } // if( ValidateRequiredRelationships ) } // baseBeforeDeleteNode()
} // GetNodesToReport() public void AddNodeToReport(CswNbtNode Node) { CswCommaDelimitedString NodesStr = new CswCommaDelimitedString(); NodesStr.FromString(NodesToReport.Text); NodesStr.Add(Node.NodeId.PrimaryKey.ToString(), AllowNullOrEmpty: false, IsUnique: true); NodesToReport.Text = NodesStr.ToString(); } // AddNodeToReport()
private void _deleteFutureNodes() { // BZ 6754 - Delete all future nodes CswNbtMetaDataObjectClass GeneratorObjectClass = ObjectClass; if( TargetType.SelectedNodeTypeIds.Count == 1 ) { Int32 SelectedTargetNtId = CswConvert.ToInt32( TargetType.SelectedNodeTypeIds[0] ); if( Int32.MinValue != SelectedTargetNtId ) { CswNbtMetaDataNodeType TargetNodeType = _CswNbtResources.MetaData.getNodeType( SelectedTargetNtId ); if( null != TargetNodeType ) { CswNbtMetaDataObjectClass TargetObjectClass = TargetNodeType.getObjectClass(); CswNbtObjClass TargetObjClass = CswNbtObjClassFactory.makeObjClass( _CswNbtResources, TargetObjectClass ); if( !( TargetObjClass is CswNbtPropertySetGeneratorTarget ) ) { throw new CswDniException( "CswNbtObjClassGenerator.beforeDeleteNode() got an invalid object class: " + TargetObjectClass.ObjectClass ); } CswNbtMetaDataNodeTypeProp GeneratorProp = TargetNodeType.getNodeTypePropByObjectClassProp( CswNbtPropertySetGeneratorTarget.PropertyName.Generator ); CswNbtMetaDataNodeTypeProp IsFutureProp = TargetNodeType.getNodeTypePropByObjectClassProp( CswNbtPropertySetGeneratorTarget.PropertyName.IsFuture ); CswNbtView View = new CswNbtView( _CswNbtResources ); View.ViewName = "CswNbtObjClassSchedule.beforeDeleteNode()"; CswNbtViewRelationship GeneratorRelationship = View.AddViewRelationship( GeneratorObjectClass, false ); GeneratorRelationship.NodeIdsToFilterIn.Add( _CswNbtNode.NodeId ); CswNbtViewRelationship TargetRelationship = View.AddViewRelationship( GeneratorRelationship, CswEnumNbtViewPropOwnerType.Second, GeneratorProp, false ); CswNbtViewProperty IsFutureProperty = View.AddViewProperty( TargetRelationship, IsFutureProp ); View.AddViewPropertyFilter( IsFutureProperty, CswNbtFieldTypeRuleLogical.SubFieldName.Checked, CswEnumNbtFilterMode.Equals, CswEnumTristate.True ); ICswNbtTree TargetTree = _CswNbtResources.Trees.getTreeFromView( _CswNbtResources.CurrentNbtUser, View, true, false, false ); TargetTree.goToRoot(); if( TargetTree.getChildNodeCount() > 0 ) // should always be the case { TargetTree.goToNthChild( 0 ); if( TargetTree.getChildNodeCount() > 0 ) // might not always be the case { for( int i = 0; i < TargetTree.getChildNodeCount(); i += 1 ) { TargetTree.goToNthChild( i ); CswNbtNode TargetNode = TargetTree.getNodeForCurrentPosition(); TargetNode.delete(); TargetTree.goToParentNode(); } } } } } } }
// _RoleNodeObjClass private void _initRole() { if (Node.NodeId != null) { __RoleNode = _CswNbtResources.Nodes[RoleId]; if (__RoleNode != null) { __RoleNodeObjClass = (CswNbtObjClassRole)__RoleNode; } } // if( Node.NodeId != null ) }
//set available quantity units when rendering the property on the add/edit layout private void _setUnits() { CswNbtNode MaterialNode = _CswNbtResources.Nodes.GetNode(Material.RelatedNodeId); if (MaterialNode != null) { Material.setReadOnly(value: true, SaveToDb: true); CswNbtUnitViewBuilder Vb = new CswNbtUnitViewBuilder(_CswNbtResources); Vb.setQuantityUnitOfMeasureView(MaterialNode, InitialQuantity); } }
public static ICswNbtPropertySetScheduler AsPropertySetScheduler(CswNbtNode Node) { if (Node != null) { if (!(Node.ObjClass is ICswNbtPropertySetScheduler)) { throw (new CswDniException(CswEnumErrorType.Error, "Invalid cast", "Can't cast current object class as ICswNbtPropertySetScheduler; Current object class is " + Node.getObjectClass().ObjectClass)); } return((ICswNbtPropertySetScheduler)Node.ObjClass); } return(null); }//AsPropertySetScheduler
private void onMaterialPropChange(CswNbtNodeProp Prop) { if (CswTools.IsPrimaryKey(Material.RelatedNodeId)) { Material.setReadOnly(value: true, SaveToDb: true); CswNbtNode MaterialNode = _CswNbtResources.Nodes[Material.RelatedNodeId]; CswNbtUnitViewBuilder Vb = new CswNbtUnitViewBuilder(_CswNbtResources); Vb.setQuantityUnitOfMeasureView(MaterialNode, Quantity); Vb.setQuantityUnitOfMeasureView(MaterialNode, TotalDispensed); TotalDispensed.Quantity = 0; } }
// For validating object class casting protected static bool _Validate(CswNbtNode Node, CswEnumNbtObjectClass TargetObjectClass) { if (Node == null) { throw new CswDniException(CswEnumErrorType.Error, "Invalid node", "CswNbtObjClass._Validate was given a null node as a parameter"); } if (!(Node.getObjectClass().ObjectClass == TargetObjectClass)) { throw (new CswDniException(CswEnumErrorType.Error, "Invalid cast", "Can't cast current object class as " + TargetObjectClass.ToString() + "; Current object class is " + Node.getObjectClass().ObjectClass.ToString())); } return(true); }
}//cancelChanges() /// <summary> /// Copies all matching properties (by name and field type) from another node. /// </summary> /// <param name="SourceNode">Node from which to copy property values</param> public void copyPropertyValues(CswNbtNode SourceNode) { foreach (CswNbtNodePropWrapper SourceProp in SourceNode.Properties) { foreach (CswNbtNodePropWrapper ThisProp in this.Properties) { if (ThisProp.PropName == SourceProp.PropName && ThisProp.getFieldTypeValue() == SourceProp.getFieldTypeValue()) { ThisProp.copy(SourceProp); } // if( ThisProp.PropName == SourceProp.PropName && ThisProp.FieldType == SourceProp.FieldType ) } // foreach( CswNbtNodePropWrapper ThisProp in this.Properties ) } // foreach( CswNbtNodePropWrapper SourceProp in SourceNode.Properties ) } // copyPropertyValues()
private void OnMaterialPropChange( CswNbtNodeProp Prop, bool Creating ) { if( CswTools.IsPrimaryKey( Material.RelatedNodeId ) ) { CswNbtNode MaterialNode = _CswNbtResources.Nodes[Material.RelatedNodeId]; if( null != MaterialNode ) { CswNbtUnitViewBuilder Vb = new CswNbtUnitViewBuilder( _CswNbtResources ); Vb.setQuantityUnitOfMeasureView( MaterialNode, CurrentQuantity ); Vb.setQuantityUnitOfMeasureView( MaterialNode, Level ); } } }
protected CswNbtNode CopyNodeImpl(bool IsNodeTemp = false, Action <CswNbtNode> OnCopy = null) { CswNbtNode CopiedNode = _CswNbtResources.Nodes.makeNodeFromNodeTypeId(NodeTypeId, IsTemp : IsNodeTemp, OnAfterMakeNode : delegate(CswNbtNode NewNode) { NewNode.copyPropertyValues(Node); if (null != OnCopy) { OnCopy(NewNode); } }, IsCopy: true); return(CopiedNode); }
protected override void afterPopulateProps() { if (Type.RelatedNodeId != null) { CswNbtNode TypeNode = _CswNbtResources.Nodes[Type.RelatedNodeId]; if (TypeNode != null) { CswNbtObjClassEquipmentType TypeNodeAsType = (CswNbtObjClassEquipmentType)TypeNode; CswDelimitedString PartsString = new CswDelimitedString('\n'); PartsString.FromString(TypeNodeAsType.Parts.Text.Replace("\r", "")); AssemblyParts.YValues = PartsString; } } }//afterPopulateProps()
}//afterWriteNode() public override void beforeDeleteNode(bool DeleteAllRequiredRelatedNodes = false) { // case 22486 - Don't allow deleting targets of required relationships CswTableSelect JctSelect = _CswNbtResources.makeCswTableSelect("defaultBeforeDeleteNode_jnp_select", "jct_nodes_props"); string WhereClause = " where nodetypepropid in (select nodetypepropid from nodetype_props where isrequired = '1') and field1_fk = " + _CswNbtNode.NodeId.PrimaryKey.ToString(); CswCommaDelimitedString SelectClause = new CswCommaDelimitedString() { "nodeid" }; DataTable MatchTable = JctSelect.getTable(SelectClause, WhereClause); if (MatchTable.Rows.Count > 0) { CswCommaDelimitedString InUseStr = new CswCommaDelimitedString(); foreach (DataRow MatchRow in MatchTable.Rows) { CswPrimaryKey MatchNodePk = new CswPrimaryKey("nodes", CswConvert.ToInt32(MatchRow["nodeid"])); if (DeleteAllRequiredRelatedNodes) { CswNbtNode NodeToDelete = _CswNbtResources.Nodes.GetNode(MatchNodePk); if (null != NodeToDelete) { NodeToDelete.delete(DeleteAllRequiredRelatedNodes: DeleteAllRequiredRelatedNodes); } } else { CswNbtNode RelatedNode = _CswNbtResources.Nodes[MatchNodePk]; if (null != RelatedNode) { InUseStr.Add(RelatedNode.NodeLink); } } } if (false == DeleteAllRequiredRelatedNodes) { throw new CswDniException(CswEnumErrorType.Warning, "This " + _CswNbtNode.getNodeType().NodeTypeName + " cannot be deleted because it is in use by: " + InUseStr, "Current user (" + _CswNbtResources.CurrentUser.Username + ") tried to delete a " + _CswNbtNode.getNodeType().NodeTypeName + " that is in use by: " + InUseStr); } } } // beforeDeleteNode()
} //afterWriteNode() public override void beforePropertySetDeleteNode() { //case 26113: check parent for bad inspections CswNbtNode ParentNode = _CswNbtResources.Nodes.GetNode(this.Parent.RelatedNodeId); if (null != ParentNode) { ICswNbtPropertySetInspectionParent ParentAsParent = CswNbtPropSetCaster.AsPropertySetInspectionParent(ParentNode); //CswNbtObjClassInspectionTarget pnodeAsTarget = (CswNbtObjClassInspectionTarget) ParentNode; bool _alreadyDeficient = (ParentAsParent.Status.Value == CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Deficient)); bool _Deficient = areMoreActionsRequired(); if (_Deficient != _alreadyDeficient) { ParentAsParent.Status.Value = _Deficient ? CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Deficient) : CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.OK); ParentNode.postChanges(false); } } } //beforeDeleteNode()
//afterWriteNode() protected override void beforeDeleteNodeLogic() { //prevent user from deleting their own user if (_CswNbtNode.NodeId == _CswNbtResources.CurrentUser.UserId) { throw (new CswDniException(CswEnumErrorType.Warning, "You can not delete your own user account.", "Current user (" + _CswNbtResources.CurrentUser.Username + ") can not delete own UserClass node.")); } // case 22635 - prevent deleting chemsw admin user CswNbtNodePropWrapper UsernamePropWrapper = Node.Properties[PropertyName.Username]; if ( UsernamePropWrapper.GetOriginalPropRowValue( UsernamePropWrapper.NodeTypeProp.getFieldTypeRule().SubFields.Default.Column) == ChemSWAdminUsername && false == (_CswNbtResources.CurrentNbtUser is CswNbtSystemUser)) { throw new CswDniException(CswEnumErrorType.Warning, "The '" + ChemSWAdminUsername + "' user cannot be deleted", "Current user (" + _CswNbtResources.CurrentUser.Username + ") attempted to delete the '" + ChemSWAdminUsername + "' user."); } CswPrimaryKey RoleId = Role.RelatedNodeId; if (RoleId != null) { CswNbtNode RoleNode = _CswNbtResources.Nodes[RoleId]; //prevent user from deleting admin if they are not an admin if (_RoleNodeObjClass.Administrator.Checked == CswEnumTristate.True && _CswNbtResources.CurrentNbtUser.IsAdministrator() != true) { throw (new CswDniException(CswEnumErrorType.Warning, "You can not delete administrator accounts because you are not an administrator.", "Block user account delete because login user (" + _CswNbtResources.CurrentUser.Username + ") is not an administrator.")); } } //case 28010 - delete all view assigned to this user _CswNbtResources.ViewSelect.deleteViewsByUserId(NodeId); }
} // copyPropertyValues() /// <summary> /// Sets the values of all relationships whose target matches /// the ParentNode's nodetypeid or objectclassid to the ParentNode's nodeid. /// </summary> public void RelateToNode(CswNbtNode ParentNode, CswNbtView View) { CswNbtNodePropWrapper Prop = null; // BZ 10372 - Iterate all relationships foreach (CswNbtViewRelationship ViewRelationship in View.Root.GetAllChildrenOfType(CswEnumNbtViewNodeType.CswNbtViewRelationship)) { // BZ 8355 - Set relationships on children pointing to parents, not the other way if (ViewRelationship.PropOwner == CswEnumNbtViewPropOwnerType.Second) { //if( ( ( ViewRelationship.SecondType == NbtViewRelatedIdType.NodeTypeId && ViewRelationship.SecondId == this.NodeTypeId ) || // ( ViewRelationship.SecondType == NbtViewRelatedIdType.ObjectClassId && ViewRelationship.SecondId == this.getObjectClassId() ) ) && // ( ( ViewRelationship.FirstType == NbtViewRelatedIdType.NodeTypeId && ViewRelationship.FirstId == ParentNode.NodeTypeId ) || // ( ViewRelationship.FirstType == NbtViewRelatedIdType.ObjectClassId && ViewRelationship.FirstId == ParentNode.getObjectClassId() ) ) ) if (ViewRelationship.SecondMatches(this.getNodeType()) && ViewRelationship.FirstMatches(ParentNode.getNodeType())) { if (ViewRelationship.PropType == CswEnumNbtViewPropIdType.NodeTypePropId) { Prop = this.Properties[_CswNbtResources.MetaData.getNodeTypeProp(ViewRelationship.PropId)]; } else if (ViewRelationship.PropType == CswEnumNbtViewPropIdType.ObjectClassPropId) { Prop = this.Properties[_CswNbtResources.MetaData.getObjectClassProp(ViewRelationship.PropId).PropName]; } if (Prop != null) { CswEnumNbtFieldType FT = Prop.getFieldTypeValue(); if (FT == CswEnumNbtFieldType.Relationship) { Prop.AsRelationship.RelatedNodeId = ParentNode.NodeId; Prop.AsRelationship.RefreshNodeName(); } if (FT == CswEnumNbtFieldType.Location) { Prop.AsLocation.SelectedNodeId = ParentNode.NodeId; Prop.AsLocation.RefreshNodeName(); } } } } // if( ViewRelationship.PropOwner == PropOwnerType.Second ) } // foreach( CswNbtViewRelationship ViewRelationship in View.Root.GetAllChildrenOfType( NbtViewNodeType.CswNbtViewRelationship ) ) } // RelateToNode()
private CswNbtView _getSampleSizeUnitsView() { CswNbtObjClassCertDefSpec RelatedCertDefSpec = _CswNbtResources.Nodes.GetNode(CertDefSpec.RelatedNodeId); CswNbtObjClassCertificateDefinition RelatedCertDef = _CswNbtResources.Nodes.GetNode(RelatedCertDefSpec.CertDef.RelatedNodeId); CswNbtNode RelatedPart = _CswNbtResources.Nodes.GetNode(RelatedCertDef.Material.RelatedNodeId); CswNbtView SampleSizeUnitsView = null; if (CswEnumNbtObjectClass.ChemicalClass == RelatedPart.getObjectClass().ObjectClass) { SampleSizeUnitsView = _CswNbtResources.ViewSelect.restoreView(GramsViewName, CswEnumNbtViewVisibility.Hidden); } else if (CswEnumNbtObjectClass.EnterprisePartClass == RelatedPart.getObjectClass().ObjectClass) { SampleSizeUnitsView = _CswNbtResources.ViewSelect.restoreView(EachViewName, CswEnumNbtViewVisibility.Hidden); } return(SampleSizeUnitsView); }
}//afterPopulateProps() public override void archiveMatchingDocs() { //Archives existing Documents related to the same Owner. //Existing SDS Documents are only archived if both Language and Format matches. if( Archived.Checked != CswEnumTristate.True && false == String.IsNullOrEmpty( Language.Value ) && false == String.IsNullOrEmpty( Format.Value ) ) { CswNbtNode OwnerNode = _CswNbtResources.Nodes.GetNode( Owner.RelatedNodeId ); if( null != OwnerNode ) { CswNbtView ExistingDocsView = new CswNbtView( _CswNbtResources ); CswNbtViewRelationship DocumentVr = ExistingDocsView.AddViewRelationship( NodeType, false ); ExistingDocsView.AddViewPropertyAndFilter( DocumentVr, Owner.NodeTypeProp, OwnerNode.NodeId.PrimaryKey.ToString(), CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID ); ExistingDocsView.AddViewPropertyAndFilter( DocumentVr, Archived.NodeTypeProp, CswEnumTristate.True.ToString(), FilterMode : CswEnumNbtFilterMode.NotEquals ); ExistingDocsView.AddViewPropertyAndFilter( DocumentVr, Format.NodeTypeProp, Format.Value ); ExistingDocsView.AddViewPropertyAndFilter( DocumentVr, Language.NodeTypeProp, Language.Value ); ICswNbtTree Tree = _CswNbtResources.Trees.getTreeFromView( ExistingDocsView, true, false, false ); Int32 DocCount = Tree.getChildNodeCount(); if( DocCount > 0 ) { for( Int32 I = 0; I < DocCount; I += 1 ) { Tree.goToNthChild( I ); CswNbtNode DocNode = Tree.getNodeForCurrentPosition(); if( DocNode.NodeId != NodeId ) { CswNbtObjClassSDSDocument DocNodeAsDocument = DocNode; DocNodeAsDocument.Archived.Checked = CswEnumTristate.True; DocNode.postChanges( true ); } Tree.goToParentNode(); } } } } }
public override CswNbtNode CopyNode(bool IsNodeTemp = false, Action <CswNbtNode> OnCopy = null) { CswNbtNode CopiedFireClassExemptAmountSetNode = base.CopyNodeImpl(IsNodeTemp, OnCopy); // Copy all Related FireClassExemptAmount Nodes CswNbtMetaDataObjectClass FireClassExemptAmountObjectClass = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.FireClassExemptAmountClass); CswNbtView FCEAView = new CswNbtView(_CswNbtResources); CswNbtViewRelationship FCEARelationship = FCEAView.AddViewRelationship(FireClassExemptAmountObjectClass, false); CswNbtViewProperty SetNameProperty = FCEAView.AddViewProperty(FCEARelationship, FireClassExemptAmountObjectClass.getObjectClassProp(CswNbtObjClassFireClassExemptAmount.PropertyName.SetName)); FCEAView.AddViewPropertyFilter( SetNameProperty, CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID, CswEnumNbtFilterMode.Equals, NodeId.PrimaryKey.ToString()); ICswNbtTree FCEATree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, FCEAView, true, false, false); FCEATree.goToRoot(); Int32 ChildrenCopied = 0; while (ChildrenCopied < FCEATree.getChildNodeCount()) { FCEATree.goToNthChild(ChildrenCopied); CswNbtObjClassFireClassExemptAmount OriginalFCEANode = FCEATree.getNodeForCurrentPosition(); _CswNbtResources.Nodes.makeNodeFromNodeTypeId(OriginalFCEANode.NodeTypeId, delegate(CswNbtNode NewNode) { NewNode.copyPropertyValues(OriginalFCEANode.Node); ((CswNbtObjClassFireClassExemptAmount)NewNode).SetName.RelatedNodeId = CopiedFireClassExemptAmountSetNode.NodeId; }); FCEATree.goToParentNode(); ChildrenCopied++; } return(CopiedFireClassExemptAmountSetNode); }
public CswNbtObjClassGHSPhrase(CswNbtResources CswNbtResources, CswNbtNode Node) : base(CswNbtResources, Node) { }
public CswNbtObjClassGHSClassification(CswNbtResources CswNbtResources, CswNbtNode Node) : base(CswNbtResources, Node) { }
public CswNbtObjClassRequestMaterialDispense(CswNbtResources CswNbtResources, CswNbtNode Node) : base(CswNbtResources, Node) { }//ctor()
public CswNbtObjClassMaterialComponent(CswNbtResources CswNbtResources, CswNbtNode Node) : base(CswNbtResources, Node) { }
public CswNbtObjClassSDSDocument( CswNbtResources CswNbtResources, CswNbtNode Node ) : base( CswNbtResources, Node ) { }