private void _populateUnitViewRelationships(CswNbtView UnitView, string PhysicalState, bool ExcludeEach) { CswNbtMetaDataObjectClass UnitOfMeasureOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.UnitOfMeasureClass); CswNbtMetaDataNodeType EachNT = null; foreach (CswNbtMetaDataNodeType UnitOfMeasureNodeType in UnitOfMeasureOC.getNodeTypes()) { CswNbtMetaDataNodeTypeProp UnitTypeProp = UnitOfMeasureNodeType.getNodeTypePropByObjectClassProp(CswNbtObjClassUnitOfMeasure.PropertyName.UnitType); if (UnitTypeProp.HasDefaultValue()) { CswEnumNbtUnitTypes UnitType = (CswEnumNbtUnitTypes)UnitTypeProp.getDefaultValue(false).AsList.Value; if (_physicalStateMatchesUnitType(PhysicalState, UnitType, ExcludeEach)) { if (UnitType == CswEnumNbtUnitTypes.Each) { EachNT = UnitOfMeasureNodeType; } else { UnitView.AddViewRelationship(UnitOfMeasureNodeType, true); } } } } if (null != EachNT) //Case 29933 - Each units always go at the end of the list { UnitView.AddViewRelationship(EachNT, true); } }
public static JObject getImportBtnItems(CswNbtResources CswNbtResources) { JObject ImportableNodeTypes = new JObject(); Collection <CswEnumNbtObjectClass> MaterialPropSetMembers = CswNbtPropertySetMaterial.Members(); foreach (CswEnumNbtObjectClass ObjectClassName in MaterialPropSetMembers) { CswNbtMetaDataObjectClass ObjectClass = CswNbtResources.MetaData.getObjectClass(ObjectClassName); foreach (CswNbtMetaDataNodeType CurrentNT in ObjectClass.getNodeTypes()) { CswNbtMetaDataNodeTypeProp IsConstituentNTP = CurrentNT.getNodeTypePropByObjectClassProp(CswNbtPropertySetMaterial.PropertyName.IsConstituent); if (IsConstituentNTP.HasDefaultValue() && CswEnumTristate.False == IsConstituentNTP.getDefaultValue(false).AsLogical.Checked) { JObject NodeType = new JObject(); ImportableNodeTypes[CurrentNT.NodeTypeName] = NodeType; NodeType["nodetypename"] = CurrentNT.NodeTypeName; NodeType["nodetypeid"] = CurrentNT.NodeTypeId.ToString(); NodeType["iconfilename"] = CswNbtMetaDataObjectClass.IconPrefix16 + CurrentNT.IconFileName; NodeType["objclass"] = ObjectClassName.ToString(); } } } return(ImportableNodeTypes); }//getImportBtnItems()
} // getFieldTypeValue() public CswNbtNodePropWrapper getDefaultValue(bool CreateIfMissing) { CswNbtNodePropWrapper ret = null; if (null != _NodeTypeProp) { ret = _NodeTypeProp.getDefaultValue(CreateIfMissing); } return(ret); } // getDefaultValue()
public void _NodeTypeName_Change(CswNbtNodeProp Prop, bool Creating) { //if( null != RelationalNodeType && RelationalNodeType.getObjectClass().ObjectClass == CswEnumNbtObjectClass.InspectionDesignClass ) if (null != RelationalNodeType && null != ObjectClassPropertyValue && ObjectClassPropertyValue.ObjectClass == CswEnumNbtObjectClass.InspectionDesignClass) { // Set 'Name' default value = nodetypename CswNbtMetaDataNodeTypeProp NameProp = RelationalNodeType.getNodeTypePropByObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.Name); NameProp.getDefaultValue(true).AsText.Text = RelationalNodeType.NodeTypeName; } if (false == CswTools.IsValidName(NodeTypeName.Text)) { throw new CswDniException(CswEnumErrorType.Warning, "NodeType Name must start with a letter, and can only contain alphanumeric characters and spaces.", "Attempted to name the NodeType '" + NodeTypeName.Text + "'"); } } // _NodeTypeName_Change()
public override void update() { // Remove default value from Specific Gravity and Physical State CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass ); foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp SpecificGravityNTP = ChemicalNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.SpecificGravity ); SpecificGravityNTP.getDefaultValue( false ).ClearValue(); SpecificGravityNTP.updateLayout( CswEnumNbtLayoutType.Add, true, Int32.MinValue, 5, 1 ); CswNbtMetaDataNodeTypeProp PhysicalStateNTP = ChemicalNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.PhysicalState ); PhysicalStateNTP.getDefaultValue( false ).ClearValue(); PhysicalStateNTP.updateLayout( CswEnumNbtLayoutType.Add, true, Int32.MinValue, 3, 1 ); } } // update()
} // afterPromoteNode() private void _OnMakeNewInspectionDesignNodeType(CswNbtMetaDataNodeType NewNodeType) { CswNbtMetaDataNodeTypeProp NameProp = NewNodeType.getNodeTypePropByObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.Name); CswNbtMetaDataNodeTypeProp DateProp = NewNodeType.getNodeTypePropByObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.DueDate); CswNbtMetaDataNodeTypeProp SetPreferredProp = NewNodeType.getNodeTypePropByObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.SetPreferred); CswNbtMetaDataNodeTypeProp FinishedProp = NewNodeType.getNodeTypePropByObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.Finish); CswNbtMetaDataNodeTypeProp CancelledProp = NewNodeType.getNodeTypePropByObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.Cancel); CswNbtMetaDataNodeTypeProp CancelReasonProp = NewNodeType.getNodeTypePropByObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.CancelReason); // CIS-52810 - properties can be null if the nodetype is being copied instead of created if (null != NameProp) { // Set 'Name' default value = nodetypename NameProp.getDefaultValue(true).AsText.Text = NewNodeType.NodeTypeName; // The following changes for new forms only if (NewNodeType.VersionNo == 1 && false == InternalCreate) { // Set nametemplate = Name + Date this.NameTemplateText.Text = CswNbtMetaData.MakeTemplateEntry(NameProp.PropName) + " " + CswNbtMetaData.MakeTemplateEntry(DateProp.PropName); // Set first tab to be "Details" CswNbtMetaDataNodeTypeTab FirstTab = NewNodeType.getNodeTypeTab(NewNodeType.NodeTypeName); if (null != FirstTab) { //FirstTab = NewNodeType.getSecondNodeTypeTab(); FirstTab.DesignNode.TabName.Text = "Details"; FirstTab.DesignNode.Order.Value = 10; FirstTab.DesignNode.IncludeInReport.Checked = CswEnumTristate.False; FirstTab.DesignNode.postChanges(false); } // case 20951 - Add an Action tab CswNbtMetaDataNodeTypeTab ActionTab = NewNodeType.getNodeTypeTab("Action"); if (ActionTab == null) { ActionTab = _CswNbtResources.MetaData.makeNewTab(NewNodeType, "Action", 9); } _CswNbtResources.MetaData.NodeTypeLayout.updatePropLayout(CswEnumNbtLayoutType.Edit, NewNodeType.NodeTypeId, SetPreferredProp, true, ActionTab.TabId, 1, 1); _CswNbtResources.MetaData.NodeTypeLayout.updatePropLayout(CswEnumNbtLayoutType.Edit, NewNodeType.NodeTypeId, FinishedProp, true, ActionTab.TabId, 2, 1); _CswNbtResources.MetaData.NodeTypeLayout.updatePropLayout(CswEnumNbtLayoutType.Edit, NewNodeType.NodeTypeId, CancelledProp, true, ActionTab.TabId, 3, 1); _CswNbtResources.MetaData.NodeTypeLayout.updatePropLayout(CswEnumNbtLayoutType.Edit, NewNodeType.NodeTypeId, CancelReasonProp, true, ActionTab.TabId, 4, 1); } // if( NewNodeType.VersionNo == 1 && !IsCopy ) } // if( null != NameProp ) } // OnMakeNewInspectionDesignNodeType()
/// <summary> /// The default value of the property /// </summary> public CswNbtNodePropWrapper getDefaultValue(bool CreateIfMissing) { return(_CswNbtMetaDataNodeTypeProp.getDefaultValue(CreateIfMissing)); }
public static void initializeCreateMaterial(ICswResources CswResources, MaterialResponse Response, string NodeId) { if (null != CswResources) { CswNbtResources NbtResources = (CswNbtResources)CswResources; CswNbtActCreateMaterial CreateMaterialAction = new CswNbtActCreateMaterial(NbtResources); // Get/Create a node CswPrimaryKey NodePk = CreateMaterialAction.makeTemp(NodeId); CswNbtNode TempNode = NbtResources.getNode(NodePk, null); Response.Data.TempNode = new CswNbtNode.Node(TempNode); Response.Data.TempNodeObjClassId = CswConvert.ToString(TempNode.getObjectClassId()); // Suppliers view CswNbtView SupplierView = CreateMaterialAction.getMaterialSuppliersView(); if (null != SupplierView) { Response.Data.SuppliersView.SessionViewId = SupplierView.SessionViewId; } // CIS-53353 - Allow adding suppliers if the user has Create on any Vendor nodetype Response.Data.AllowSupplierAdd = false; CswNbtMetaDataObjectClass VendorOC = NbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.VendorClass); foreach (CswNbtMetaDataNodeType VendorNT in VendorOC.getNodeTypes()) { if (NbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Create, VendorNT)) { Response.Data.AllowSupplierAdd = true; } } //Determine the steps int StepNo = 1; MaterialResponse.WizardStep TypeAndIdentity = new MaterialResponse.WizardStep() { StepNo = StepNo, StepName = "Choose Type and Identity" }; Response.Data.Steps.Add(TypeAndIdentity); StepNo++; MaterialResponse.WizardStep AdditionalProps = new MaterialResponse.WizardStep() { StepNo = StepNo, StepName = "Additional Properties" }; Response.Data.Steps.Add(AdditionalProps); StepNo++; #region Alert wizard to active modules bool ContainersEnabled = NbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.Containers); if (ContainersEnabled) { bool CanSize = false; CswNbtMetaDataObjectClass SizeOC = NbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.SizeClass); foreach (CswNbtMetaDataNodeType SizeNT in SizeOC.getNodeTypes()) { if (NbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Create, SizeNT)) { CanSize = true; } } if (CanSize) { MaterialResponse.WizardStep Sizes = new MaterialResponse.WizardStep() { StepNo = StepNo, StepName = "Size(s)" }; Response.Data.Steps.Add(Sizes); Response.Data.ContainerLimit = CswConvert.ToInt32(NbtResources.ConfigVbls.getConfigVariableValue(CswEnumNbtConfigurationVariables.container_receipt_limit.ToString())); StepNo++; } else { ContainersEnabled = false; } } Response.Data.ContainersModuleEnabled = ContainersEnabled; bool SDSEnabled = NbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.SDS); if (SDSEnabled) { MaterialResponse.WizardStep AttachSDS = new MaterialResponse.WizardStep() { StepNo = StepNo, StepName = "Attach SDS" }; Response.Data.Steps.Add(AttachSDS); // Permission is a separate check now because we still want to show the Attach SDS step // even if the User doesn't have permission. If they don't have permission, we display // a message on the client. CswNbtMetaDataNodeType SDSNT = NbtResources.MetaData.getNodeType("SDS Document"); Response.Data.addSDSPermission = null != SDSNT && NbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Create, SDSNT); } Response.Data.SDSModuleEnabled = SDSEnabled; #endregion Alert wizard to active modules // Get the ChemicalObjClassId CswNbtMetaDataObjectClass ChemicalOC = NbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ChemicalClass); Response.Data.ChemicalObjClassId = CswConvert.ToString(ChemicalOC.ObjectClassId); // Determine Constituent NodeTypes CswCommaDelimitedString ConstituentNodeTypeIds = new CswCommaDelimitedString(); foreach (CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes()) { CswNbtMetaDataNodeTypeProp IsConstituentNTP = ChemicalNT.getNodeTypePropByObjectClassProp(CswNbtObjClassChemical.PropertyName.IsConstituent); // Yes this is a weird way to know whether a nodetype is a Constituent nodetype, // but as long as this property remains servermanaged, this will work if (IsConstituentNTP.HasDefaultValue() && CswEnumTristate.True == IsConstituentNTP.getDefaultValue(false).AsLogical.Checked) { ConstituentNodeTypeIds.Add(ChemicalNT.NodeTypeId.ToString()); } } Response.Data.ConstituentNodeTypeIds = ConstituentNodeTypeIds.ToString(); } }