public override void update() { CswNbtMetaDataNodeType ControlZoneNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Control Zone" ); if( null != ControlZoneNt ) { CswNbtMetaDataNodeTypeTab LocationsTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( ControlZoneNt, "Locations", 2 ); CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.LocationClass ); CswNbtMetaDataObjectClassProp ControlZoneOCP = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProp( LocationOC.ObjectClassId, CswNbtObjClassLocation.PropertyName.ControlZone ); CswNbtMetaDataNodeTypeProp LocationsNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ControlZoneNt, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Grid ), "Locations" ) { TabId = LocationsTab.TabId } ); CswNbtView LocationsView = _CswNbtSchemaModTrnsctn.makeNewView( "Control_Zone_Locations", NbtViewVisibility.Property ); LocationsNTP.ViewId = LocationsView.ViewId; LocationsView.Root.ChildRelationships.Clear(); LocationsView.SetViewMode( NbtViewRenderingMode.Grid ); LocationsView.Visibility = NbtViewVisibility.Property; CswNbtViewRelationship RootRel = LocationsView.AddViewRelationship( ControlZoneNt, true ); CswNbtViewRelationship LocationRel = LocationsView.AddViewRelationship( RootRel, NbtViewPropOwnerType.Second, ControlZoneOCP, false ); LocationsView.AddViewProperty( LocationRel, LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.Barcode ) ); LocationsView.AddViewProperty( LocationRel, LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.Name ) ); LocationsView.AddViewProperty( LocationRel, LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.Location ) ); LocationsView.save(); } }
public void afterCreateNodeTypeProp(CswNbtMetaDataNodeTypeProp NodeTypeProp) { //Case 53001 - grid properties need to have the the current NT set as the root CswNbtView propView = _CswNbtFieldResources.CswNbtResources.ViewSelect.restoreView(NodeTypeProp.ViewId); propView.SetViewMode(CswEnumNbtViewRenderingMode.Grid); propView.AddViewRelationship(NodeTypeProp.getNodeType(), true); propView.save(); _CswNbtFieldTypeRuleDefault.afterCreateNodeTypeProp(NodeTypeProp); }
public static void RunStructureSearch(ICswResources CswResources, StructureSearchDataReturn Return, StructureSearchViewData StructureSearchData) { CswNbtResources NbtResources = (CswNbtResources)CswResources; string molData = StructureSearchData.molString; bool exact = StructureSearchData.exact; Collection <CswPrimaryKey> results = new Collection <CswPrimaryKey>(); //If the DirectStructureSearch module is enabled, use AcclDirect to run a search. Otherwise use the legacy code if (NbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.DirectStructureSearch)) { DataTable resultsTbl = NbtResources.AcclDirect.RunStructureSearch(molData, exact); foreach (DataRow row in resultsTbl.Rows) { results.Add(new CswPrimaryKey("nodes", CswConvert.ToInt32(row["nodeid"]))); } } else { Dictionary <int, string> resultsDict = NbtResources.StructureSearchManager.RunSearch(molData, exact); foreach (int nodeidPk in resultsDict.Keys) { results.Add(new CswPrimaryKey("nodes", nodeidPk)); } } CswNbtView searchView = new CswNbtView(NbtResources); searchView.SetViewMode(CswEnumNbtViewRenderingMode.Table); searchView.Category = "Recent"; searchView.ViewName = "Structure Search Results"; if (results.Count > 0) { CswNbtMetaDataObjectClass materialOC = NbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ChemicalClass); CswNbtMetaDataObjectClassProp molCOP = materialOC.getObjectClassProp(CswNbtObjClassChemical.PropertyName.Structure); CswNbtViewRelationship parent = searchView.AddViewRelationship(materialOC, false); searchView.AddViewProperty(parent, molCOP); foreach (CswPrimaryKey nodeId in results) { parent.NodeIdsToFilterIn.Add(nodeId); } } searchView.SaveToCache(false); StructureSearchData.viewId = searchView.SessionViewId.ToString(); StructureSearchData.viewMode = searchView.ViewMode.ToString(); Return.Data = StructureSearchData; }
public override void update() { CswNbtMetaDataObjectClass TaskOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.TaskClass ); CswNbtMetaDataObjectClassProp DueDataOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.DueDate ); CswNbtMetaDataObjectClassProp DoneOnOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.DoneOn ); CswNbtMetaDataObjectClassProp CompletedOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.Completed ); CswNbtMetaDataObjectClassProp SummaryOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.Summary ); CswNbtMetaDataObjectClassProp OwnerOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.Owner ); //Equipment or Assembly for NTs CswNbtMetaDataObjectClassProp TechOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.Technician ); //Location could not be upgraded to an OCP (See BV) so we just get the first Location NTP CswNbtMetaDataNodeTypeProp LocationNTP = null; CswNbtMetaDataNodeType FirstTaskNT = TaskOC.getNodeTypes().FirstOrDefault(); if( null != FirstTaskNT ) { LocationNTP = FirstTaskNT.getNodeTypeProp( "Location" ); } CswNbtView CompletedTasks = _CswNbtSchemaModTrnsctn.makeSafeView( "Tasks: Completed", CswEnumNbtViewVisibility.Global ); CompletedTasks.SetViewMode( CswEnumNbtViewRenderingMode.Grid ); CompletedTasks.Category = "Tasks"; CswNbtViewRelationship parent = CompletedTasks.AddViewRelationship( TaskOC, true ); CompletedTasks.AddViewProperty( parent, DueDataOCP, 1 ); CompletedTasks.AddViewProperty( parent, DoneOnOCP, 2 ); CswNbtViewProperty completedVP = CompletedTasks.AddViewProperty( parent, CompletedOCP ); CompletedTasks.AddViewPropertyFilter( completedVP, Value: true.ToString() ); completedVP.ShowInGrid = false; CompletedTasks.AddViewProperty( parent, SummaryOCP, 3 ); CompletedTasks.AddViewProperty( parent, OwnerOCP, 4 ); if( null != LocationNTP ) { CompletedTasks.AddViewProperty( parent, LocationNTP, 5 ); } CompletedTasks.AddViewProperty( parent, TechOCP, 6 ); CompletedTasks.save(); } // update()
public override void update() { CswNbtMetaDataObjectClass locationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.LocationClass ); CswNbtMetaDataObjectClass containerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.ContainerClass ); CswNbtMetaDataObjectClassProp locationOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Location ); CswNbtMetaDataObjectClassProp barcodeOCP = containerOC.getBarcodeProp(); CswNbtMetaDataObjectClassProp materialOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Material ); CswNbtMetaDataObjectClassProp ownerOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Owner ); CswNbtMetaDataObjectClassProp statusOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Status ); CswNbtMetaDataObjectClassProp expDateOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.ExpirationDate ); CswNbtMetaDataObjectClassProp quantOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Quantity ); CswNbtView containersByLocation = _CswNbtSchemaModTrnsctn.makeView(); containersByLocation.SetViewMode( NbtViewRenderingMode.Grid ); CswNbtViewRelationship locationParent = containersByLocation.AddViewRelationship( locationOC, true ); CswNbtViewRelationship containerParent = containersByLocation.AddViewRelationship( locationParent, NbtViewPropOwnerType.Second, locationOCP, true ); containersByLocation.AddViewProperty( containerParent, barcodeOCP ); containersByLocation.AddViewProperty( containerParent, materialOCP ); containersByLocation.AddViewProperty( containerParent, ownerOCP ); containersByLocation.AddViewProperty( containerParent, expDateOCP ); containersByLocation.AddViewProperty( containerParent, statusOCP ); containersByLocation.AddViewProperty( containerParent, quantOCP ); CswTableUpdate tu = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "fixLocationsContainersView_28507", "node_views" ); DataTable node_views = tu.getTable( "where viewname = 'Containers' and visibility = 'Property'" ); foreach( DataRow row in node_views.Rows ) { row["viewxml"] = containersByLocation.ToString(); } tu.update( node_views ); } //Update()
public override void update() { // Recreate the Inventory Level Grid view on Location OC CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.LocationClass ); CswNbtMetaDataObjectClassProp InventoryLevelsOCP = LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.InventoryLevels ); CswNbtMetaDataObjectClass InventoryLvlsOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.InventoryLevelClass ); CswNbtMetaDataObjectClassProp LocationOCP = InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Location ); CswNbtView InventoryLevelsView = _CswNbtSchemaModTrnsctn.makeView(); InventoryLevelsView.ViewName = CswNbtObjClassLocation.PropertyName.InventoryLevels; InventoryLevelsView.SetViewMode( CswEnumNbtViewRenderingMode.Grid ); CswNbtViewRelationship LocationRel = InventoryLevelsView.AddViewRelationship( LocationOC, false ); CswNbtViewRelationship InventoryLvlsRel = InventoryLevelsView.AddViewRelationship( LocationRel, CswEnumNbtViewPropOwnerType.Second, LocationOCP, true ); InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.CurrentQuantity ), 1 ); InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Level ), 2 ); InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Material ), 3 ); InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Status ), 4 ); InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Type ), 5 ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( InventoryLevelsOCP, CswEnumNbtObjectClassPropAttributes.viewxml, InventoryLevelsView.ToString() ); } // update()
public override void update() { CswNbtMetaDataObjectClass feedbackOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.FeedbackClass, "docs.gif", false, false ); CswNbtMetaDataObjectClassProp caseNumberOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.CaseNumberPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Sequence } ); Int32 userOCID = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassId( CswNbtMetaDataObjectClass.NbtObjectClass.UserClass ); CswNbtMetaDataObjectClassProp authorOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.AuthorPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Relationship, IsFk = true, FkType = NbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = userOCID, ServerManaged = true, SetValOnAdd = true } ); CswNbtMetaDataObjectClassProp dateSubmittedOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.DateSubmittedPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.DateTime, Extended = CswNbtNodePropDateTime.DateDisplayMode.DateTime.ToString(), ServerManaged = true, SetValOnAdd = true } ); CswNbtMetaDataObjectClassProp categoryOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.CategoryPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.List, ListOptions = "Bug Report,Feature Request,Question,Praise", SetValOnAdd = true } ); CswNbtMetaDataObjectClassProp subjectOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.SubjectPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Text, SetValOnAdd = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.SummaryPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Memo, SetValOnAdd = true } ); CswNbtMetaDataObjectClassProp statusOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.StatusPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.List, ListOptions = "Pending review,Resolved,Awaiting author response" } ); statusOCP.DefaultValue.Field1 = "Pending review"; //indicates the ball is in supports/admins court statusOCP.DefaultValue.Gestalt = "Pending review"; _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.LoadUserContextPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Button } ); CswNbtMetaDataObjectClassProp commentsOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.DiscussionPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Comments } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.SelectedNodeIDPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Text, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.ViewPropertyName, //FieldType = CswNbtMetaDataFieldType.NbtFieldType.ViewPickList, FieldType = CswNbtMetaDataFieldType.NbtFieldType.ViewReference, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.ActionPropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Text, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( feedbackOC, new CswNbtWcfMetaDataModel.ObjectClassProp() { PropName = CswNbtObjClassFeedback.CurrentViewModePropertyName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Text, ServerManaged = true } ); //create a default node-type of feedbackobj called feedback CswNbtMetaDataNodeType feedbackNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( feedbackOC.ObjectClassId, "Feedback", "System" ); feedbackNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassFeedback.CaseNumberPropertyName ) ); CswNbtMetaDataObjectClass roleObj = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RoleClass ); //set default permissions Collection<CswNbtNode> roles = roleObj.getNodes( false, true ); foreach( CswNbtObjClassRole role in roles ) { _CswNbtSchemaModTrnsctn.Permit.set( Security.CswNbtPermit.NodeTypePermission.Create, feedbackNT, role, true ); _CswNbtSchemaModTrnsctn.Permit.set( Security.CswNbtPermit.NodeTypePermission.View, feedbackNT, role, true ); _CswNbtSchemaModTrnsctn.Permit.set( Security.CswNbtPermit.NodeTypePermission.Edit, feedbackNT, role, true ); } Int32 sequenceId = _CswNbtSchemaModTrnsctn.makeSequence( new CswSequenceName( "Feedback CaseNo" ), "F", "", 6, 1 ); CswNbtMetaDataNodeTypeProp caseNumberNTP = feedbackNT.getNodeTypePropByObjectClassProp( CswNbtObjClassFeedback.CaseNumberPropertyName ); caseNumberNTP.setSequence( sequenceId ); caseNumberNTP.ReadOnly = true; //default to read-only, but allow it to be changed CswNbtMetaDataNodeTypeProp authorNTP = feedbackNT.getNodeTypePropByObjectClassProp( CswNbtObjClassFeedback.AuthorPropertyName ); authorNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add ); CswNbtMetaDataNodeTypeProp dateNTP = feedbackNT.getNodeTypePropByObjectClassProp( CswNbtObjClassFeedback.DateSubmittedPropertyName ); dateNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add ); CswNbtMetaDataNodeTypeProp viewNTP = feedbackNT.getNodeTypePropByObjectClassProp( CswNbtObjClassFeedback.ViewPropertyName ); viewNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit ); CswNbtMetaDataNodeTypeProp actionNTP = feedbackNT.getNodeTypePropByObjectClassProp( CswNbtObjClassFeedback.ActionPropertyName ); actionNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit ); CswNbtMetaDataNodeTypeProp selectedNodeIdNTP = feedbackNT.getNodeTypePropByObjectClassProp( CswNbtObjClassFeedback.SelectedNodeIDPropertyName ); selectedNodeIdNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit ); CswNbtMetaDataNodeTypeProp currentViewModeNTP = feedbackNT.getNodeTypePropByObjectClassProp( CswNbtObjClassFeedback.CurrentViewModePropertyName ); currentViewModeNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit ); currentViewModeNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add ); //create the role view for admins CswNbtNode adminRoleNode = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "Administrator" ); if( null != adminRoleNode ) { CswNbtView feedbackView = _CswNbtSchemaModTrnsctn.makeView(); feedbackView.makeNew( "Feedback", NbtViewVisibility.Role, adminRoleNode.NodeId ); feedbackView.Category = "System"; //add root CswNbtViewRelationship ParentRelationship = feedbackView.AddViewRelationship( feedbackOC, true ); //add properties CswNbtViewProperty caseNumberVP = feedbackView.AddViewProperty( ParentRelationship, caseNumberOCP ); CswNbtViewProperty dateSubmittedVp = feedbackView.AddViewProperty( ParentRelationship, dateSubmittedOCP ); CswNbtViewProperty categoryVP = feedbackView.AddViewProperty( ParentRelationship, categoryOCP ); CswNbtViewProperty authorVP = feedbackView.AddViewProperty( ParentRelationship, authorOCP ); CswNbtViewProperty subjectVP = feedbackView.AddViewProperty( ParentRelationship, subjectOCP ); CswNbtViewProperty statusVP = feedbackView.AddViewProperty( ParentRelationship, statusOCP ); CswNbtViewProperty commentsVP = feedbackView.AddViewProperty( ParentRelationship, commentsOCP ); caseNumberVP.Order = 1; dateSubmittedVp.Order = 2; categoryVP.Order = 3; authorVP.Order = 4; subjectVP.Order = 5; statusVP.Order = 6; commentsVP.Order = 7; caseNumberVP.Width = 15; dateSubmittedVp.Width = 20; categoryVP.Width = 20; authorVP.Width = 20; subjectVP.Width = 25; statusVP.Width = 20; commentsVP.Width = 100; feedbackView.SetViewMode( NbtViewRenderingMode.Grid ); CswNbtViewPropertyFilter feedbackViewFilter = feedbackView.AddViewPropertyFilter( statusVP, FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals, Value: "Pending review", ShowAtRuntime: true ); feedbackView.save(); } // create the global view for all users to view their own feedback CswNbtView myFeedbackView = _CswNbtSchemaModTrnsctn.makeView(); myFeedbackView.makeNew( "My Feedback", NbtViewVisibility.Global ); myFeedbackView.Category = "System"; //add root CswNbtViewRelationship myParentRelationship = myFeedbackView.AddViewRelationship( feedbackOC, true ); //add properties CswNbtViewProperty myCaseNumberVP = myFeedbackView.AddViewProperty( myParentRelationship, caseNumberOCP ); CswNbtViewProperty myDateSubmittedVp = myFeedbackView.AddViewProperty( myParentRelationship, dateSubmittedOCP ); CswNbtViewProperty myCategoryVP = myFeedbackView.AddViewProperty( myParentRelationship, categoryOCP ); CswNbtViewProperty myAuthorVP = myFeedbackView.AddViewProperty( myParentRelationship, authorOCP ); CswNbtViewProperty mySubjectVP = myFeedbackView.AddViewProperty( myParentRelationship, subjectOCP ); CswNbtViewProperty myStatusVP = myFeedbackView.AddViewProperty( myParentRelationship, statusOCP ); CswNbtViewProperty myCommentsVP = myFeedbackView.AddViewProperty( myParentRelationship, commentsOCP ); myCaseNumberVP.Order = 1; myDateSubmittedVp.Order = 2; myCategoryVP.Order = 3; myAuthorVP.Order = 4; mySubjectVP.Order = 5; myStatusVP.Order = 6; myCommentsVP.Order = 7; myCaseNumberVP.Width = 15; myDateSubmittedVp.Width = 20; myCategoryVP.Width = 20; myAuthorVP.Width = 20; mySubjectVP.Width = 25; myStatusVP.Width = 20; myCommentsVP.Width = 100; myFeedbackView.SetViewMode( NbtViewRenderingMode.Grid ); //observe "me", this is voodoo (or magic...w/e) and sets it to the current user (from steve) CswNbtViewPropertyFilter myFeedbackViewFilter = myFeedbackView.AddViewPropertyFilter( myAuthorVP, FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals, Value: "me", ShowAtRuntime: false ); myFeedbackView.save(); }//Update()
public override void update() { #region Create DSD Phrase OC CswNbtMetaDataObjectClass DSDPhraseOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.DSDPhraseClass ); if( null == DSDPhraseOC ) { DSDPhraseOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswEnumNbtObjectClass.DSDPhraseClass, "warning.png", false ); _CswNbtSchemaModTrnsctn.createObjectClassProp( DSDPhraseOC, new CswNbtWcfMetaDataModel.ObjectClassProp( DSDPhraseOC ) { PropName = CswNbtObjClassDSDPhrase.PropertyName.Code, FieldType = CswEnumNbtFieldType.Text } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( DSDPhraseOC, new CswNbtWcfMetaDataModel.ObjectClassProp( DSDPhraseOC ) { PropName = CswNbtObjClassDSDPhrase.PropertyName.Category, FieldType = CswEnumNbtFieldType.List, ListOptions = "Risk,Safety,Hazard" } ); foreach( string Language in CswNbtPropertySetPhrase.SupportedLanguages.All ) { _CswNbtSchemaModTrnsctn.createObjectClassProp( DSDPhraseOC, new CswNbtWcfMetaDataModel.ObjectClassProp( DSDPhraseOC ) { PropName = Language, FieldType = CswEnumNbtFieldType.Text } ); } } #endregion #region Create DSD Chemical Props CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass ); const string _pre = "Images/cispro/DSD/"; CswDelimitedString dsdImgs = new CswDelimitedString( '\n' ) { _pre + "none.gif", _pre + "e.gif", _pre + "o.gif", _pre + "f.gif", _pre + "f_plus.gif", _pre + "t.gif", _pre + "t_plus.gif", _pre + "xn.gif", _pre + "xi.gif", _pre + "c.gif", _pre + "n.gif" }; CswDelimitedString dsdValues = new CswDelimitedString( '\n' ) { "None","Explosive","Oxidizing","Highly flammable","Extremely flammable","Toxic","Very Toxic","Harmful","Irritant","Corrosive","Dangerous for the environment" }; CswNbtMetaDataObjectClassProp PictorgramsOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.Pictograms ) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp( ChemicalOC, new CswNbtWcfMetaDataModel.ObjectClassProp( ChemicalOC ) { PropName = CswNbtObjClassChemical.PropertyName.Pictograms, FieldType = CswEnumNbtFieldType.ImageList, ListOptions = dsdValues.ToString(), ValueOptions = dsdImgs.ToString(), Extended = true.ToString() } ); CswNbtMetaDataObjectClassProp LabelCodesOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.LabelCodes ) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp( ChemicalOC, new CswNbtWcfMetaDataModel.ObjectClassProp( ChemicalOC ) { PropName = CswNbtObjClassChemical.PropertyName.LabelCodes, FieldType = CswEnumNbtFieldType.MultiList, ListOptions = "" //Intentionally empty - will be dynamic } ); CswNbtView DSDLabelCodesView = _CswNbtSchemaModTrnsctn.makeSafeView( "DSD Label Codes Property Grid", CswEnumNbtViewVisibility.Hidden ); DSDLabelCodesView.SetViewMode( CswEnumNbtViewRenderingMode.Grid ); DSDLabelCodesView.AddViewRelationship( DSDPhraseOC, false ); DSDLabelCodesView.save(); CswNbtMetaDataObjectClassProp LabelCodesGridOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.LabelCodesGrid ) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp( ChemicalOC, new CswNbtWcfMetaDataModel.ObjectClassProp( ChemicalOC ) { PropName = CswNbtObjClassChemical.PropertyName.LabelCodesGrid, FieldType = CswEnumNbtFieldType.Grid, ViewXml = DSDLabelCodesView.ToString(), Extended = "Small" } ); #endregion } // update()
public override void update() { // Make the Batch Operation Object Class and default NodeType CswNbtMetaDataObjectClass BatchOpOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, "clock.gif", false, false ); CswNbtMetaDataObjectClass UserOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.UserClass ); CswCommaDelimitedString StatusOptions = new CswCommaDelimitedString() { NbtBatchOpStatus.Pending.ToString(), NbtBatchOpStatus.Processing.ToString(), NbtBatchOpStatus.Completed.ToString(), NbtBatchOpStatus.Error.ToString() }; CswNbtMetaDataObjectClassProp BatchDataOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.BatchDataPropertyName, CswNbtMetaDataFieldType.NbtFieldType.Memo, ServerManaged: true ); CswNbtMetaDataObjectClassProp EndDateOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.EndDatePropertyName, CswNbtMetaDataFieldType.NbtFieldType.DateTime, ServerManaged: true ); CswNbtMetaDataObjectClassProp LogOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.LogPropertyName, CswNbtMetaDataFieldType.NbtFieldType.Comments, ServerManaged: true ); CswNbtMetaDataObjectClassProp OpNameOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.OpNamePropertyName, CswNbtMetaDataFieldType.NbtFieldType.List, ServerManaged: true ); CswNbtMetaDataObjectClassProp PercentDoneOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.PercentDonePropertyName, CswNbtMetaDataFieldType.NbtFieldType.Number, ServerManaged: true ); CswNbtMetaDataObjectClassProp PriorityOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.PriorityPropertyName, CswNbtMetaDataFieldType.NbtFieldType.Number ); CswNbtMetaDataObjectClassProp CreatedDateOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.CreatedDatePropertyName, CswNbtMetaDataFieldType.NbtFieldType.DateTime, ServerManaged: true ); CswNbtMetaDataObjectClassProp StartDateOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.StartDatePropertyName, CswNbtMetaDataFieldType.NbtFieldType.DateTime, ServerManaged: true ); CswNbtMetaDataObjectClassProp StatusOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.StatusPropertyName, CswNbtMetaDataFieldType.NbtFieldType.List, ServerManaged: true, ListOptions: StatusOptions.ToString() ); CswNbtMetaDataObjectClassProp UserOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( CswNbtMetaDataObjectClass.NbtObjectClass.BatchOpClass, CswNbtObjClassBatchOp.UserPropertyName, CswNbtMetaDataFieldType.NbtFieldType.Relationship, IsFk: true, FkType: NbtViewRelatedIdType.ObjectClassId.ToString(), FkValue: UserOC.ObjectClassId ); PriorityOCP.DefaultValue.Field1_Numeric = 0; PriorityOCP.DefaultValue.Gestalt = "0"; PercentDoneOCP.DefaultValue.Field1_Numeric = 0; PercentDoneOCP.DefaultValue.Gestalt = "0"; _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( CreatedDateOCP, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.extended, CswNbtNodePropDateTime.DateDisplayMode.DateTime.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( StartDateOCP, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.extended, CswNbtNodePropDateTime.DateDisplayMode.DateTime.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( EndDateOCP, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.extended, CswNbtNodePropDateTime.DateDisplayMode.DateTime.ToString() ); CswNbtMetaDataNodeType BatchOpNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( BatchOpOC.ObjectClassId, "Batch Operation", "System" ); BatchOpNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( OpNameOCP.PropName ) + " " + CswNbtMetaData.MakeTemplateEntry( CreatedDateOCP.PropName ) ); CswNbtMetaDataNodeTypeTab BatchOpTab = BatchOpNT.getFirstNodeTypeTab(); CswNbtMetaDataNodeTypeProp OpNameNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.OpNamePropertyName ); CswNbtMetaDataNodeTypeProp UserNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.UserPropertyName ); CswNbtMetaDataNodeTypeProp PercentDoneNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.PercentDonePropertyName ); CswNbtMetaDataNodeTypeProp PriorityNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.PriorityPropertyName ); CswNbtMetaDataNodeTypeProp StatusNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.StatusPropertyName ); CswNbtMetaDataNodeTypeProp CreatedDateNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.CreatedDatePropertyName ); CswNbtMetaDataNodeTypeProp StartDateNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.StartDatePropertyName ); CswNbtMetaDataNodeTypeProp EndDateNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.EndDatePropertyName ); CswNbtMetaDataNodeTypeProp BatchDataNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.BatchDataPropertyName ); CswNbtMetaDataNodeTypeProp LogNTP = BatchOpNT.getNodeTypePropByObjectClassProp( CswNbtObjClassBatchOp.LogPropertyName ); // Set tab layout OpNameNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 1, 1 ); UserNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 2, 1 ); PriorityNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 3, 1 ); PercentDoneNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 4, 1 ); StatusNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 5, 1 ); CreatedDateNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 6, 1 ); StartDateNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 7, 1 ); EndDateNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 8, 1 ); BatchDataNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 9, 1 ); LogNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, BatchOpTab.TabId, 10, 1 ); _CswNbtSchemaModTrnsctn.MetaData.refreshAll(); // Batch Operations (all) view for chemsw_admin_role CswNbtNode ChemSwAdminRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( CswNbtObjClassRole.ChemSWAdminRoleName ); CswNbtView BatchOpView = _CswNbtSchemaModTrnsctn.makeView(); BatchOpView.makeNew( "Batch Operations (all)", NbtViewVisibility.Role, ChemSwAdminRole.NodeId ); BatchOpView.Category = "System"; BatchOpView.SetViewMode( NbtViewRenderingMode.Grid ); CswNbtViewRelationship BatchOpViewRel = BatchOpView.AddViewRelationship( BatchOpOC, true ); BatchOpView.AddViewProperty( BatchOpViewRel, OpNameOCP ); BatchOpView.AddViewProperty( BatchOpViewRel, UserOCP ); CswNbtViewProperty BatchStatusViewProp = BatchOpView.AddViewProperty( BatchOpViewRel, StatusOCP ); CswNbtViewProperty BatchPriorityViewProp = BatchOpView.AddViewProperty( BatchOpViewRel, PriorityOCP ); BatchOpView.AddViewPropertyFilter( BatchStatusViewProp, Value: NbtBatchOpStatus.Completed.ToString(), FilterMode: CswNbtPropFilterSql.PropertyFilterMode.NotEquals, ShowAtRuntime: true ); BatchOpView.setSortProperty( BatchPriorityViewProp, NbtViewPropertySortMethod.Descending ); BatchOpView.save(); // Batch Operations (all) view for Administrator CswNbtNode AdminRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "Administrator" ); if( AdminRole != null ) { CswNbtView BatchOpView2 = _CswNbtSchemaModTrnsctn.makeView(); BatchOpView2.makeNew( "Batch Operations (all)", NbtViewVisibility.Role, AdminRole.NodeId, null, BatchOpView ); BatchOpView2.save(); } // My Batch Operations view for everyone else CswNbtView BatchOpView3 = _CswNbtSchemaModTrnsctn.makeView(); BatchOpView3.makeNew( "My Batch Operations", NbtViewVisibility.Global ); BatchOpView3.Category = "System"; BatchOpView3.SetViewMode( NbtViewRenderingMode.Tree ); CswNbtViewRelationship BatchOpViewRel3 = BatchOpView3.AddViewRelationship( BatchOpOC, true ); BatchOpView3.AddViewPropertyAndFilter( BatchOpViewRel3, StatusOCP, Value: NbtBatchOpStatus.Completed.ToString(), FilterMode: CswNbtPropFilterSql.PropertyFilterMode.NotEquals, ShowAtRuntime: true ); BatchOpView3.AddViewPropertyAndFilter( BatchOpViewRel3, UserOCP, Value: "me", FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals ); BatchOpView3.save(); // Batch operation scheduled rule _CswNbtSchemaModTrnsctn.createScheduledRule( Sched.NbtScheduleRuleNames.BatchOp, MtSched.Core.Recurrence.NSeconds, 5 ); // Batch threshold config var _CswNbtSchemaModTrnsctn.createConfigurationVariable( "batchthreshold", "If an operation affects this number of nodes, run as a batch operation instead", "10", false ); // case 26446 - All users should have View permissions to batch ops CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RoleClass ); foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, false ) ) { _CswNbtSchemaModTrnsctn.Permit.set( Security.CswNbtPermit.NodeTypePermission.View, BatchOpNT, RoleNode, true ); } }//Update()
public override void update() { #region part 1 - container group NT CswNbtMetaDataObjectClass containerGroupOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.ContainerGroupClass ); CswNbtMetaDataNodeType containerGroupNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Container Group" ); if( null == containerGroupNT ) { containerGroupNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( containerGroupOC.ObjectClassId, "Container Group", "MLM (demo)" ); } CswNbtMetaDataNodeTypeProp barcodeNTP = containerGroupNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainerGroup.PropertyName.Barcode ); if( null != barcodeNTP ) { //set the sequence id of the NTP if( Int32.MinValue == barcodeNTP.SequenceId ) { int containerGroupSequenceId = _CswNbtSchemaModTrnsctn.makeSequence( new CswSequenceName( "ContainerGroup" ), "G", "", 6, 0 ); barcodeNTP.setSequence( containerGroupSequenceId ); } } CswNbtMetaDataNodeTypeProp nameNTP = containerGroupNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainerGroup.PropertyName.Name ); nameNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, null, false ); string template = CswNbtMetaData.MakeTemplateEntry( nameNTP.PropName ); template += " " + CswNbtMetaData.MakeTemplateEntry( barcodeNTP.PropName ); containerGroupNT.setNameTemplateText( template ); _CswNbtSchemaModTrnsctn.createModuleNodeTypeJunction( CswNbtModuleName.CISPro, containerGroupNT.NodeTypeId ); //create demo view CswNbtView containerGroupView = _CswNbtSchemaModTrnsctn.restoreView( "Container Groups" ); if( null == containerGroupView ) { containerGroupView = _CswNbtSchemaModTrnsctn.makeNewView( "Container Groups", NbtViewVisibility.Global ); containerGroupView.Category = "MLM (demo)"; containerGroupView.SetViewMode( NbtViewRenderingMode.Tree ); containerGroupView.IsDemo = true; containerGroupView.AddViewRelationship( containerGroupNT, true ); containerGroupView.save(); } #endregion #region part 2 - new container props CswNbtMetaDataNodeType containerNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Container" ); if( null != containerNT ) { CswNbtMetaDataNodeTypeProp lotControlledNTP = containerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.LotControlled ); lotControlledNTP.removeFromAllLayouts(); CswNbtMetaDataNodeTypeProp requisitionableNTP = containerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.Requisitionable ); requisitionableNTP.removeFromAllLayouts(); CswNbtMetaDataNodeTypeProp reservedForNTP = containerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.ReservedFor ); reservedForNTP.removeFromAllLayouts(); if( _CswNbtSchemaModTrnsctn.Modules.IsModuleEnabled( CswNbtModuleName.MLM ) ) { CswNbtMetaDataNodeTypeTab cmgTab = containerNT.getNodeTypeTab( "Central Material Group" ); if( null == cmgTab ) { cmgTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( containerNT, "Central Material Group", containerNT.getMaximumTabOrder() + 1 ); } lotControlledNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, false, cmgTab.TabId ); requisitionableNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, false, cmgTab.TabId ); reservedForNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, false, cmgTab.TabId ); } } #endregion }
public override void update() { //Make the Container.Missing OCP default to false and set IsRequired = true CswNbtMetaDataObjectClass containerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.ContainerClass ); CswNbtMetaDataObjectClassProp missingOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Missing ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( missingOCP, false ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( missingOCP, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isrequired, true ); //set all existing containers.missing to false if null foreach( CswNbtObjClassContainer containerNode in containerOC.getNodes( false, false, false, true ) ) { if( Tristate.Null == containerNode.Missing.Checked ) { containerNode.Missing.Checked = Tristate.False; containerNode.postChanges( false ); } } //Update the Missing Containers View to have a filter Missing = True CswNbtView missingContainersView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( "Missing Containers", NbtViewVisibility.Global ); if( null != missingContainersView ) { CswNbtMetaDataObjectClass materialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass ); CswNbtMetaDataObjectClassProp tradeNameOCP = materialOC.getObjectClassProp( CswNbtObjClassMaterial.PropertyName.Tradename ); CswNbtMetaDataObjectClassProp partNoOCP = materialOC.getObjectClassProp( CswNbtObjClassMaterial.PropertyName.PartNumber ); CswNbtMetaDataObjectClassProp supplierOCP = materialOC.getObjectClassProp( CswNbtObjClassMaterial.PropertyName.Supplier ); CswNbtMetaDataObjectClassProp disposedOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Disposed ); CswNbtMetaDataObjectClassProp barcodeOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Barcode ); CswNbtMetaDataObjectClassProp expDateOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.ExpirationDate ); CswNbtMetaDataObjectClassProp quantityOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Quantity ); CswNbtMetaDataObjectClassProp locationOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Location ); CswNbtMetaDataObjectClassProp materialOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Material ); missingContainersView.Clear(); missingContainersView.SetViewMode( NbtViewRenderingMode.Grid ); missingContainersView.Category = "Containers"; missingContainersView.ViewName = "Missing Containers"; missingContainersView.Visibility = NbtViewVisibility.Global; CswNbtViewRelationship containerParent = missingContainersView.AddViewRelationship( containerOC, true ); missingContainersView.AddViewPropertyAndFilter( containerParent, MetaDataProp: missingOCP, Value: true.ToString(), FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals, ShowInGrid: false ); CswNbtViewProperty barcodeVP = missingContainersView.AddViewProperty( containerParent, barcodeOCP ); barcodeVP.Order = 1; CswNbtViewProperty expDateVP = missingContainersView.AddViewProperty( containerParent, expDateOCP ); expDateVP.Order = 2; CswNbtViewProperty quantVP = missingContainersView.AddViewProperty( containerParent, quantityOCP ); quantVP.Order = 3; CswNbtViewProperty locationVP = missingContainersView.AddViewProperty( containerParent, locationOCP ); locationVP.Order = 4; CswNbtViewRelationship materialParent = missingContainersView.AddViewRelationship( containerParent, NbtViewPropOwnerType.First, materialOCP, true ); CswNbtViewProperty tradeNameVP = missingContainersView.AddViewProperty( materialParent, tradeNameOCP ); tradeNameVP.Order = 5; CswNbtViewProperty partNoVP = missingContainersView.AddViewProperty( materialParent, partNoOCP ); partNoVP.Order = 6; CswNbtViewProperty supplierVP = missingContainersView.AddViewProperty( materialParent, supplierOCP ); supplierVP.Order = 7; missingContainersView.save(); } } //Update()
public override void update() { //get field types used for this class CswNbtMetaDataFieldType memoFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Memo ); CswNbtMetaDataFieldType logicalFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Logical ); CswNbtMetaDataFieldType textFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Text ); #region CREATE THE REGULATORY LIST OC AND IT'S PROPS CswNbtMetaDataObjectClass regulatoryListOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RegulatoryListClass, "doc.png", true, true ); CswNbtMetaDataObjectClassProp nameOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( regulatoryListOC ) { PropName = CswNbtObjClassRegulatoryList.PropertyName.Name, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Text, IsFk = false, IsRequired = true, IsUnique = true } ); CswNbtMetaDataObjectClassProp casNumbersOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( regulatoryListOC ) { PropName = CswNbtObjClassRegulatoryList.PropertyName.CASNumbers, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Memo, IsFk = false, IsRequired = true } ); #endregion #region CREATE THE REGULATORY LIST NODETYPE CswNbtMetaDataNodeType regulatoryListNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( regulatoryListOC.ObjectClassId, "Regulatory List", "Materials" ); regulatoryListNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassRegulatoryList.PropertyName.Name ) ); //set display name CswNbtMetaDataNodeTypeProp casNosNTP = regulatoryListNT.getNodeTypePropByObjectClassProp( CswNbtObjClassRegulatoryList.PropertyName.CASNumbers ); casNosNTP.HelpText = "The CASNos property should be a comma delimited set of CASNos in this regulatory list. Example: \"CASNo1,CASNo2,CASNo3\""; #endregion #region CREATE REGULATORY LISTS VIEW CswNbtObjClassRole cisProAdminRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "CISPro_Admin" ); if( null != cisProAdminRole ) { CswNbtView regListsView = _CswNbtSchemaModTrnsctn.makeNewView( "Regulatory Lists", NbtViewVisibility.Role, cisProAdminRole.NodeId ); regListsView.SetViewMode( NbtViewRenderingMode.Tree ); regListsView.Category = "CISPro Configuration"; CswNbtViewRelationship parent = regListsView.AddViewRelationship( regulatoryListOC, false ); regListsView.save(); } #endregion #region ADD REGULATORY LIST NODETYPE PERMISSIONS TO CISPro_Admin if( null != cisProAdminRole ) { _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.View, regulatoryListNT, cisProAdminRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Create, regulatoryListNT, cisProAdminRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Edit, regulatoryListNT, cisProAdminRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Delete, regulatoryListNT, cisProAdminRole, true ); } #endregion }//Update()