protected void _getFilterProps(CswNbtViewEditorData Return) { string viewStr = CurrentView.ToString(); CswNbtView TempView = new CswNbtView(_CswNbtResources); TempView.LoadXml(viewStr); HashSet <string> seenProps = new HashSet <string>(); CswNbtViewRelationship Relationship = (CswNbtViewRelationship)TempView.FindViewNodeByArbitraryId(Request.Relationship.ArbitraryId); if (null != Relationship) { foreach (CswNbtViewProperty viewProp in Relationship.Properties.Where(p => CswEnumNbtFieldType.Button != p.FieldType)) { seenProps.Add(viewProp.TextLabel); Return.Step4.Properties.Add(viewProp); } if (Relationship.SecondType.Equals(CswEnumNbtViewRelatedIdType.PropertySetId)) { CswNbtMetaDataPropertySet PropSet = _CswNbtResources.MetaData.getPropertySet(Relationship.SecondId); if (null != PropSet) { foreach (CswNbtMetaDataObjectClass ObjClass in PropSet.getObjectClasses()) { IEnumerable <CswNbtViewProperty> props = _getProps(ObjClass, TempView, seenProps, Relationship).Where(p => CswEnumNbtFieldType.Button != p.FieldType);; foreach (CswNbtViewProperty vp in props) { Return.Step4.Properties.Add(vp); } } } } else if (Relationship.SecondType.Equals(CswEnumNbtViewRelatedIdType.ObjectClassId)) { CswNbtMetaDataObjectClass ObjClass = _CswNbtResources.MetaData.getObjectClass(Relationship.SecondId); if (null != ObjClass) { IEnumerable <CswNbtViewProperty> props = _getProps(ObjClass, TempView, seenProps, Relationship).Where(p => CswEnumNbtFieldType.Button != p.FieldType);; foreach (CswNbtViewProperty vp in props) { Return.Step4.Properties.Add(vp); } } } else if (Relationship.SecondType.Equals(CswEnumNbtViewRelatedIdType.NodeTypeId)) { CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType(Relationship.SecondId); if (null != NodeType) { IEnumerable <CswNbtViewProperty> props = _getProps(NodeType, TempView, seenProps, Relationship).Where(p => CswEnumNbtFieldType.Button != p.FieldType); foreach (CswNbtViewProperty vp in props) { Return.Step4.Properties.Add(vp); } } } } Collection <CswNbtViewProperty> sortedProps = new Collection <CswNbtViewProperty>(); foreach (CswNbtViewProperty prop in Return.Step4.Properties.OrderBy(vp => vp.TextLabel)) { sortedProps.Add(prop); } Return.Step4.Properties = sortedProps; Return.Step4.ViewJson = TempView.ToJson().ToString(); }
public override void update() { #region Init CswNbtLandingPageTable LandingPageObj = _CswNbtSchemaModTrnsctn.getLandingPageTable(); string CreateMaterialActionId = _CswNbtSchemaModTrnsctn.Actions[CswNbtActionName.Create_Material].ActionId.ToString(); string RoleId = "nodes_1"; CswNbtObjClassRole AdminRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "Administrator" ); if( null != AdminRole ) { RoleId = AdminRole.NodeId.ToString(); } CswNbtMetaDataObjectClass MaterialOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass ); #endregion Init #region Create Another Material LandingPageData.Request Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "Action", PkValue = CreateMaterialActionId, NodeTypeId = String.Empty, Text = "Create Another Material", RoleId = RoleId, ActionId = CreateMaterialActionId, NewRow = 1, NewColumn = 3 }; LandingPageObj.addLandingPageItem( Request ); #endregion Create Another Material #region Receive this Material CswNbtMetaDataObjectClassProp ReceiveProp = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProp( MaterialOc.ObjectClassId, CswNbtObjClassMaterial.PropertyName.Receive ); if( null != ReceiveProp ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Button, ViewType = String.Empty, PkValue = ReceiveProp.PropId.ToString(), NodeTypeId = String.Empty, Text = "Receive this Material", RoleId = RoleId, ActionId = CreateMaterialActionId, NewRow = 1, NewColumn = 1 }; LandingPageObj.addLandingPageItem( Request ); } #endregion Receive this Material #region Request this Material CswNbtMetaDataObjectClassProp RequestProp = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProp(MaterialOc.ObjectClassId, CswNbtObjClassMaterial.PropertyName.Request); if( null != RequestProp ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Button, ViewType = String.Empty, PkValue = RequestProp.PropId.ToString(), NodeTypeId = String.Empty, Text = "Request this Material", RoleId = RoleId, ActionId = CreateMaterialActionId, NewRow = 1, NewColumn = 2 }; LandingPageObj.addLandingPageItem( Request ); } #endregion Request this Material #region Define Sizes for this Material CswNbtMetaDataObjectClass SizeOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.SizeClass ); CswNbtMetaDataNodeType SizeNt = SizeOc.FirstNodeType; if( null != SizeNt ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Add, ViewType = String.Empty, PkValue = String.Empty, NodeTypeId = SizeNt.NodeTypeId.ToString(), Text = "Define Sizes for this Material", RoleId = RoleId, ActionId = CreateMaterialActionId, NewRow = 2, NewColumn = 1 }; LandingPageObj.addLandingPageItem(Request); } #endregion Define Sizes for this Material #region Enter GHS Data for this Material foreach( CswNbtMetaDataNodeType MaterialNt in MaterialOc.getNodeTypes() ) { if( MaterialNt.NodeTypeName == "Chemical" ) { CswNbtMetaDataNodeTypeTab GHSTab = MaterialNt.getNodeTypeTab( "GHS" ); if( null != GHSTab ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Tab, ViewType = "View", PkValue = GHSTab.TabId.ToString(), NodeTypeId = MaterialNt.NodeTypeId.ToString(), Text = "Enter GHS Data for this Material", RoleId = RoleId, ActionId = CreateMaterialActionId, NewRow = 2, NewColumn = 2 }; LandingPageObj.addLandingPageItem( Request ); } } } #endregion Enter GHS Data for this Material } //Update()
}//createBalanceConfigurationObjectClass() public void _createBalanceObjectClass() { CswNbtMetaDataObjectClass BalanceOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.BalanceClass ); CswNbtMetaDataObjectClass BalanceConfigurationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.BalanceConfigurationClass ); if( null == BalanceOC && null != BalanceConfigurationOC ) { BalanceOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswEnumNbtObjectClass.BalanceClass, "harddrive.png", false ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( BalanceOC ) { PropName = CswNbtObjClassBalance.PropertyName.Name, FieldType = CswEnumNbtFieldType.Text, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( BalanceOC ) { PropName = CswNbtObjClassBalance.PropertyName.Quantity, FieldType = CswEnumNbtFieldType.Quantity, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( BalanceOC ) { PropName = CswNbtObjClassBalance.PropertyName.LastActive, FieldType = CswEnumNbtFieldType.DateTime, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( BalanceOC ) { PropName = CswNbtObjClassBalance.PropertyName.Manufacturer, FieldType = CswEnumNbtFieldType.Text, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( BalanceOC ) { PropName = CswNbtObjClassBalance.PropertyName.Device, FieldType = CswEnumNbtFieldType.Text, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( BalanceOC ) { PropName = CswNbtObjClassBalance.PropertyName.Operational, FieldType = CswEnumNbtFieldType.Logical, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( BalanceOC ) { PropName = CswNbtObjClassBalance.PropertyName.BalanceConfiguration, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = BalanceConfigurationOC.ObjectClassId, ServerManaged = true } ); }//if ( null == BalanceOC ) }//createBalanceObjectClass()
private void _upgradeLocationNTP() { CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.LocationClass); _createGridOCPFromNTP(LocationOC, CswNbtObjClassLocation.PropertyName.InventoryLevels); }
public override void update() { #region Update all NTPs "Hidden" column to "false" _CswNbtSchemaModTrnsctn.execArbitraryPlatformNeutralSql( "update nodetype_props set hidden = " + CswConvert.ToDbVal( false ) ); #endregion #region CISPro CswNbtMetaDataObjectClass UserOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.UserClass ); foreach( CswNbtMetaDataNodeType UserNT in UserOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp UserJurisdictionNTP = UserNT.getNodeTypePropByObjectClassProp( CswNbtObjClassUser.PropertyName.Jurisdiction ); if( null != UserJurisdictionNTP ) { UserJurisdictionNTP.updateLayout( CswEnumNbtLayoutType.Add, false ); UserJurisdictionNTP.updateLayout( CswEnumNbtLayoutType.Edit, DoMove: false, TabId: UserNT.getFirstNodeTypeTab().TabId ); } } #endregion #region Containers CswNbtMetaDataObjectClass locationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.LocationClass ); foreach( int NodeTypeId in locationOC.getNodeTypeIds() ) { _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( NodeTypeId, CswNbtObjClassLocation.PropertyName.Containers, "Containers" ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( NodeTypeId, "Inventory Levels", "Inventory Levels", 2 ); _CswNbtSchemaModTrnsctn.Modules.AddPropToFirstTab( NodeTypeId, CswNbtObjClassLocation.PropertyName.AllowInventory ); _CswNbtSchemaModTrnsctn.Modules.AddPropToFirstTab( NodeTypeId, CswNbtObjClassLocation.PropertyName.InventoryGroup ); _CswNbtSchemaModTrnsctn.Modules.AddPropToFirstTab( NodeTypeId, CswNbtObjClassLocation.PropertyName.StorageCompatibility ); CswNbtMetaDataNodeTypeProp AllowInvNTP = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( NodeTypeId, CswNbtObjClassLocation.PropertyName.AllowInventory ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Add, NodeTypeId, AllowInvNTP, false ); CswNbtMetaDataNodeTypeProp InvGrpNTP = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( NodeTypeId, CswNbtObjClassLocation.PropertyName.InventoryGroup ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Add, NodeTypeId, InvGrpNTP, false ); CswNbtMetaDataNodeTypeProp StorageCompatNTP = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( NodeTypeId, CswNbtObjClassLocation.PropertyName.StorageCompatibility ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Add, NodeTypeId, StorageCompatNTP, false ); } CswNbtMetaDataPropertySet MaterialSet = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet ); foreach( CswNbtMetaDataObjectClass materialOC in MaterialSet.getObjectClasses() ) { foreach( CswNbtMetaDataNodeType materialNT in _CswNbtSchemaModTrnsctn.MetaData.getNodeTypes( materialOC.ObjectClassId ) ) { string sizesNTPName = materialNT.NodeTypeName + " Sizes"; _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( materialNT.NodeTypeId, sizesNTPName, "Containers", 99 ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( materialNT.NodeTypeId, "Inventory Levels", "Containers", 99 ); string containersNTPName = materialNT.NodeTypeName + " Containers"; _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( materialNT.NodeTypeId, containersNTPName, "Containers", 99 ); CswNbtMetaDataNodeTypeTab materialNTT = materialNT.getFirstNodeTypeTab(); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( materialNT.NodeTypeId, CswNbtObjClassChemical.PropertyName.ApprovedForReceiving, materialNTT ); CswNbtMetaDataNodeTypeTab materialIdentityNTT = materialNT.getIdentityTab(); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( materialNT.NodeTypeId, CswNbtObjClassChemical.PropertyName.Receive, materialIdentityNTT, 2, 2 ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( materialNT.NodeTypeId, CswNbtObjClassChemical.PropertyName.Request, materialIdentityNTT, 1, 2 ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( materialNT.NodeTypeId, CswNbtObjClassChemical.PropertyName.StorageCompatibility, "Hazards" ); } } #endregion #region Fire Code CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.LocationClass ); foreach( int LocationNTId in LocationOC.getNodeTypeIds() ) { _CswNbtSchemaModTrnsctn.Modules.AddPropToFirstTab( LocationNTId, CswNbtObjClassLocation.PropertyName.ControlZone ); CswNbtMetaDataNodeTypeProp CtrlZoneNTP = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( LocationNTId, CswNbtObjClassLocation.PropertyName.ControlZone ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Add, LocationNTId, CtrlZoneNTP, false ); } CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass ); foreach( CswNbtMetaDataNodeType ChemicalNT in _CswNbtSchemaModTrnsctn.MetaData.getNodeTypes( ChemicalOC.ObjectClassId ) ) { foreach( CswNbtMetaDataNodeTypeTab Tab in ChemicalNT.getNodeTypeTabs() ) { if( Tab.TabOrder >= 4 ) Tab.TabOrder += 1; } CswNbtMetaDataNodeTypeTab HazardsTab = ChemicalNT.getNodeTypeTab( "Hazards" ); if( null == HazardsTab ) { HazardsTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( ChemicalNT, "Hazards", 4 ); } _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ChemicalNT.NodeTypeId, "Material Type", HazardsTab, 4, 2, "Fire Reporting" ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ChemicalNT.NodeTypeId, "Special Flags", HazardsTab, 5, 2, "Fire Reporting" ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ChemicalNT.NodeTypeId, "Hazard Categories", HazardsTab, 6, 2, "Fire Reporting" ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ChemicalNT.NodeTypeId, "Hazard Classes", HazardsTab, 7, 2, "Fire Reporting" ); } CswNbtMetaDataObjectClass ContainerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ContainerClass ); foreach( int ContainerNTId in ContainerOC.getNodeTypeIds() ) { _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ContainerNTId, "Storage Pressure", "Fire Code" ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ContainerNTId, "Storage Temperature", "Fire Code" ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ContainerNTId, "Use Type", "Fire Code" ); } #endregion #region Manufacturer Lot Info CswNbtMetaDataObjectClass ReceiptLotOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ReceiptLotClass ); foreach( CswNbtMetaDataNodeType ReceiptLotNT in ReceiptLotOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp ManufacturerNTP = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( ReceiptLotNT.NodeTypeId, CswNbtObjClassReceiptLot.PropertyName.Manufacturer ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Edit, ReceiptLotNT.NodeTypeId, ManufacturerNTP, true, ReceiptLotNT.getFirstNodeTypeTab().TabId, 7, 1 ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Add, ReceiptLotNT.NodeTypeId, ManufacturerNTP, true ); CswNbtMetaDataNodeTypeProp ManufacturerLotNoNTP = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( ReceiptLotNT.NodeTypeId, CswNbtObjClassReceiptLot.PropertyName.ManufacturerLotNo ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Edit, ReceiptLotNT.NodeTypeId, ManufacturerLotNoNTP, true, ReceiptLotNT.getFirstNodeTypeTab().TabId, 8, 1 ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Add, ReceiptLotNT.NodeTypeId, ManufacturerLotNoNTP, true ); CswNbtMetaDataNodeTypeProp ManufacturedDateNTP = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( ReceiptLotNT.NodeTypeId, CswNbtObjClassReceiptLot.PropertyName.ManufacturedDate ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Edit, ReceiptLotNT.NodeTypeId, ManufacturedDateNTP, true, ReceiptLotNT.getFirstNodeTypeTab().TabId, 9, 1 ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswEnumNbtLayoutType.Add, ReceiptLotNT.NodeTypeId, ManufacturedDateNTP, true ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ReceiptLotNT.NodeTypeId, CswNbtObjClassReceiptLot.PropertyName.AssignedCofA, ReceiptLotNT.getFirstNodeTypeTab(), 10, 1 ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ReceiptLotNT.NodeTypeId, CswNbtObjClassReceiptLot.PropertyName.ViewCofA, ReceiptLotNT.getIdentityTab(), 1, 1 ); } foreach( CswNbtMetaDataNodeType ContainerNT in ContainerOC.getNodeTypes() ) { _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ContainerNT.NodeTypeId, "View C of A", ContainerNT.getIdentityTab(), 1, 3 ); } #endregion #region MLM CswNbtMetaDataObjectClass containerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ContainerClass ); foreach( CswNbtMetaDataNodeType containerNT in containerOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeTab cmgTab = containerNT.getNodeTypeTab( "Central Material Group" ); if( null == cmgTab ) { cmgTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( containerNT, "Central Material Group", containerNT.getMaximumTabOrder() + 1 ); } CswNbtMetaDataNodeTypeProp lotControlledNTP = containerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.LotControlled ); lotControlledNTP.updateLayout( CswEnumNbtLayoutType.Edit, false, TabId: cmgTab.TabId ); CswNbtMetaDataNodeTypeProp requisitionableNTP = containerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.Requisitionable ); requisitionableNTP.updateLayout( CswEnumNbtLayoutType.Edit, false, TabId: cmgTab.TabId ); CswNbtMetaDataNodeTypeProp reservedForNTP = containerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.ReservedFor ); reservedForNTP.updateLayout( CswEnumNbtLayoutType.Edit, false, TabId: cmgTab.TabId ); CswNbtMetaDataNodeTypeProp receiptLotNTP = containerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.ReceiptLot ); CswNbtMetaDataNodeTypeTab firstTab = containerNT.getFirstNodeTypeTab(); receiptLotNTP.updateLayout( CswEnumNbtLayoutType.Edit, false, TabId: firstTab.TabId ); } CswNbtMetaDataObjectClass RequestMatDispOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RequestMaterialDispenseClass ); foreach( CswNbtMetaDataNodeType NodeType in RequestMatDispOc.getLatestVersionNodeTypes() ) { CswNbtMetaDataNodeTypeTab CmgTab = NodeType.getNodeTypeTab( "Central Material Group" ) ?? _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( NodeType, "Central Material Group", NodeType.getNextTabOrder() ); CswNbtMetaDataNodeTypeProp RofNtp = NodeType.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestMaterialDispense.PropertyName.RecurringFrequency ); RofNtp.updateLayout( CswEnumNbtLayoutType.Edit, true, CmgTab.TabId ); CswNbtMetaDataNodeTypeProp NrdNtp = NodeType.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestMaterialDispense.PropertyName.NextReorderDate ); NrdNtp.updateLayout( CswEnumNbtLayoutType.Edit, RofNtp, true ); CswNbtMetaDataNodeTypeProp LastNtp = NrdNtp; foreach( string CmgTabProp in CswNbtObjClassRequestMaterialDispense.PropertyName.MLMCmgTabProps ) { CswNbtMetaDataNodeTypeProp CmgNtp = NodeType.getNodeTypePropByObjectClassProp( CmgTabProp ); CmgNtp.updateLayout( CswEnumNbtLayoutType.Edit, LastNtp, true ); LastNtp = CmgNtp; } CswNbtMetaDataNodeTypeTab ReceiveTab = NodeType.getNodeTypeTab( "Receive" ) ?? _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( NodeType, "Receive", NodeType.getNextTabOrder() ); foreach( string ReceiveTabProp in CswNbtObjClassRequestMaterialDispense.PropertyName.MLMReceiveTabProps ) { CswNbtMetaDataNodeTypeProp ReceiveNtp = NodeType.getNodeTypePropByObjectClassProp( ReceiveTabProp ); ReceiveNtp.updateLayout( CswEnumNbtLayoutType.Edit, true, ReceiveTab.TabId ); } } //Case 28339 // Show Vendor.VendorType and CorporateEntity // Add a filter to Material.Supplier where VendorType = 'Coporate' CswNbtMetaDataObjectClass vendorOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.VendorClass ); foreach( CswNbtMetaDataNodeType vendorNT in vendorOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeTab firstTab = vendorNT.getFirstNodeTypeTab(); CswNbtMetaDataNodeTypeProp vendorTypeNTP = vendorNT.getNodeTypePropByObjectClassProp( CswNbtObjClassVendor.PropertyName.VendorTypeName ); vendorTypeNTP.updateLayout( CswEnumNbtLayoutType.Edit, true, TabId: firstTab.TabId ); vendorTypeNTP.updateLayout( CswEnumNbtLayoutType.Add, true, TabId: firstTab.TabId ); CswNbtMetaDataNodeTypeProp corporateEntityNTP = vendorNT.getNodeTypePropByObjectClassProp( CswNbtObjClassVendor.PropertyName.CorporateEntityName ); corporateEntityNTP.updateLayout( CswEnumNbtLayoutType.Edit, true, TabId: firstTab.TabId ); } _toggleMaterialRequestApprovalLevel( CswEnumNbtObjectClass.RequestMaterialCreateClass, false ); _toggleMaterialRequestApprovalLevel( CswEnumNbtObjectClass.RequestMaterialDispenseClass, false ); #endregion #region SDS foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes() ) { foreach( CswNbtMetaDataNodeTypeTab Tab in ChemicalNT.getNodeTypeTabs() ) { if( Tab.TabOrder >= 3 ) Tab.TabOrder += 1; } CswNbtMetaDataNodeTypeTab HazardsTab = ChemicalNT.getNodeTypeTab( "Hazards" ) ?? _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( ChemicalNT, "Hazards", 3 ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ChemicalNT.NodeTypeId, "Assigned SDS", HazardsTab, 1, 1 ); _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ChemicalNT.NodeTypeId, "View SDS", ChemicalNT.getIdentityTab(), 3, 2 ); } //Show the following Container properties... // View SDS if( _CswNbtSchemaModTrnsctn.Modules.IsModuleEnabled( CswEnumNbtModuleName.Containers ) ) { foreach( CswNbtMetaDataNodeType ContainerNT in ContainerOC.getNodeTypes() ) { _CswNbtSchemaModTrnsctn.Modules.AddPropToTab( ContainerNT.NodeTypeId, "View SDS", ContainerNT.getIdentityTab(), 1, 2 ); } } #endregion } // update()
private void _upgradeTaskNTPs() { CswNbtMetaDataObjectClass TaskOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.TaskClass); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.CalibrationDate, FieldType = CswEnumNbtFieldType.DateTime }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.CalibrationResult, FieldType = CswEnumNbtFieldType.Number }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.CompletionDescription, FieldType = CswEnumNbtFieldType.Memo }); CswNbtMetaDataObjectClass DepartmentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.DepartmentClass); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.Department, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = DepartmentOC.ObjectClassId }); CswCommaDelimitedString EventTypeOptions = new CswCommaDelimitedString { "Calibration", "Inspection", "Maintenance" }; _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.EventType, FieldType = CswEnumNbtFieldType.List, ListOptions = EventTypeOptions.ToString(), SetValOnAdd = true }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.FileLink, FieldType = CswEnumNbtFieldType.Link }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.IgnoreCalibrationResult, FieldType = CswEnumNbtFieldType.Logical }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.IsCriticalTest, FieldType = CswEnumNbtFieldType.Logical }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.LaborCost, FieldType = CswEnumNbtFieldType.Text }); //Can't do Location because the related NodeTypeProp is different for each Task NodeType _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.LowerLimit, FieldType = CswEnumNbtFieldType.Number }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.OtherCost, FieldType = CswEnumNbtFieldType.Text }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.OtherCostName, FieldType = CswEnumNbtFieldType.Text }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.PartsCost, FieldType = CswEnumNbtFieldType.Text }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.SOPRef, FieldType = CswEnumNbtFieldType.Text }); CswNbtMetaDataObjectClass UserOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.UserClass); CswNbtMetaDataObjectClassProp TechnicianOCP = _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.Technician, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = UserOC.ObjectClassId }); CswNbtMetaDataObjectClassProp UserPhoneOCP = UserOC.getObjectClassProp(CswNbtObjClassUser.PropertyName.Phone); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.TechnicianPhone, FieldType = CswEnumNbtFieldType.PropertyReference, IsFk = true, FkType = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString(), FkValue = TechnicianOCP.PropId, ValuePropType = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString(), ValuePropId = UserPhoneOCP.PropId }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.TravelCost, FieldType = CswEnumNbtFieldType.Text }); _addOCP(TaskOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassTask.PropertyName.UpperLimit, FieldType = CswEnumNbtFieldType.Number }); }
private void _upgradeRegulatoryListNTP() { CswNbtMetaDataObjectClass RegulatoryListOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.RegulatoryListClass); _createGridOCPFromNTP(RegulatoryListOC, CswNbtObjClassRegulatoryList.PropertyName.Chemicals); }
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() { CswNbtMetaDataObjectClass UoMOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.UnitOfMeasureClass ); CswNbtMetaDataObjectClassProp BaseUnitOCP = UoMOC.getObjectClassProp( CswNbtObjClassUnitOfMeasure.PropertyName.BaseUnit ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( BaseUnitOCP, CswEnumNbtObjectClassPropAttributes.servermanaged, true ); } // update()
public override void update() { Int32 AdminRolePk = Int32.MinValue; CswCommaDelimitedString AdminRoles = new CswCommaDelimitedString(); // Change the visibilily of the 'Roles and Users' view to global CswNbtView RolesAndUsersView = _CswNbtSchemaModTrnsctn.restoreView( "Roles and Users" ); if( null != RolesAndUsersView ) { RolesAndUsersView.SetVisibility( CswEnumNbtViewVisibility.Global, null, null ); RolesAndUsersView.save(); // For any roles that aren't Administrator roles, remove any role permissions CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RoleClass ); foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true, false ) ) { if( CswEnumTristate.True != RoleNode.Administrator.Checked ) { foreach( CswEnumNbtNodeTypePermission Permission in CswEnumNbtNodeTypePermission.Members ) { RoleNode.NodeTypePermissions.RemoveValue( CswNbtObjClassRole.MakeNodeTypePermissionValue( RoleOC.FirstNodeType.NodeTypeId, Permission ) ); } RoleNode.NodeTypePermissions.SyncGestalt(); RoleNode.postChanges( false ); } else { AdminRoles.Add( CswConvert.ToString( RoleNode.NodeId.PrimaryKey ) ); } // We need this because setting the landing page for this Role is a special case if( RoleNode.Name.Text == "Administrator" ) { AdminRolePk = RoleNode.NodeId.PrimaryKey; } } // Redirect Welcome Landingpage items CswTableUpdate TableUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "updateLandingPageItems_Case28518", "landingpage" ); DataTable LandingPageDt = TableUpdate.getTable( "where for_roleid in (" + AdminRoles.ToString() + ")" ); foreach( DataRow CurrentRow in LandingPageDt.Rows ) { if( CswConvert.ToInt32( CurrentRow["for_roleid"] ) == AdminRolePk ) { if( CswConvert.ToString( CurrentRow["to_nodeviewid"] ) == "19" ) { CurrentRow["displaytext"] = RolesAndUsersView.ViewName; } } if( CswConvert.ToString( CurrentRow["displaytext"] ) == "Roles and Users" ) { CurrentRow["to_nodeviewid"] = RolesAndUsersView.ViewId.get(); } } TableUpdate.update( LandingPageDt ); }//if( null != RolesAndUsersView ) }// update()
} // _getOptions() #endregion Relationship Properties and Functions #region Serialization public override void ToJSON(JObject ParentObject) { bool allowAdd = false; ParentObject["nodetypeid"] = string.Empty; ParentObject["objectclassid"] = string.Empty; if (RelationshipType == CswEnumNbtViewPropIdType.NodeTypePropId) { CswNbtMetaDataNodeTypeProp RelationshipNTP = _CswNbtResources.MetaData.getNodeTypeProp(RelationshipId); CswNbtMetaDataNodeType RelationshipNT = RelationshipNTP.getNodeType(); if (null != RelationshipNT) { ParentObject["nodetypeid"] = RelationshipNT.NodeTypeId; CswNbtMetaDataObjectClass RelationshipOC = RelationshipNT.getObjectClass(); if (null != RelationshipOC) { ParentObject["objectclassid"] = RelationshipOC.ObjectClassId; allowAdd = (RelationshipOC.CanAdd && _CswNbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Create, RelationshipNT)); } } } else if (RelationshipType == CswEnumNbtViewPropIdType.ObjectClassPropId) { CswNbtMetaDataObjectClassProp RelationshipOCP = _CswNbtResources.MetaData.getObjectClassProp(RelationshipId); CswNbtMetaDataObjectClass RelationshipOC = RelationshipOCP.getObjectClass(); if (null != RelationshipOC) { ParentObject["objectclassid"] = RelationshipOC.ObjectClassId; allowAdd = RelationshipOC.CanAdd; if (allowAdd) { foreach (CswNbtMetaDataNodeType NodeType in RelationshipOC.getLatestVersionNodeTypes()) { allowAdd = _CswNbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Create, NodeType); if (allowAdd) { break; } } } } } ParentObject["allowadd"] = allowAdd; JArray JOptions = new JArray(); ParentObject["options"] = JOptions; ParentObject["relatednodeid"] = string.Empty; ParentObject["relatednodename"] = string.Empty; Dictionary <CswPrimaryKey, string> Options = _getOptions(); CswPrimaryKey SelectedNodeId = null; if (null != SetSelected) { SelectedNodeId = SetSelected(); } bool first = true; foreach (CswPrimaryKey NodePk in Options.Keys) { if (first || (null != NodePk && NodePk == SelectedNodeId)) { // Choose first option by default ParentObject["relatednodeid"] = NodePk.ToString(); ParentObject["relatednodename"] = Options[NodePk]; first = false; } if (NodePk != null && NodePk.PrimaryKey != Int32.MinValue) { JObject JOption = new JObject(); JOption["id"] = NodePk.ToString(); JOption["value"] = Options[NodePk]; JOptions.Add(JOption); } } } // ToJson()
public override void update() { CswNbtMetaDataObjectClass RequestItemOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RequestItemClass ); CswNbtMetaDataObjectClassProp TypeOcp = RequestItemOc.getObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Type ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( TypeOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isrequired, true ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( TypeOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.servermanaged, true ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( TypeOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.setvalonadd, false ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( TypeOcp, TypeOcp.getFieldTypeRule().SubFields.Default.Name, CswNbtObjClassRequestItem.Types.Request ); CswNbtMetaDataObjectClass RequestOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RequestClass ); CswNbtMetaDataObjectClassProp RequestGroupOcp = RequestOc.getObjectClassProp( CswNbtObjClassRequest.PropertyName.InventoryGroup.ToString() ); CswNbtMetaDataObjectClassProp RequestOcp = RequestItemOc.getObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Request ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( RequestItemOc ) { PropName = CswNbtObjClassRequestItem.PropertyName.InventoryGroup, FieldType = CswNbtMetaDataFieldType.NbtFieldType.PropertyReference, IsFk = true, FkType = NbtViewPropIdType.ObjectClassPropId.ToString(), FkValue = RequestOcp.PropId, ValuePropId = RequestGroupOcp.PropId, ValuePropType = NbtViewPropIdType.ObjectClassPropId.ToString() } ); foreach( CswNbtMetaDataNodeType RequestItemNt in RequestItemOc.getLatestVersionNodeTypes() ) { CswNbtMetaDataNodeTypeProp TypeNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Type ); TypeNtp.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add ); CswNbtMetaDataNodeTypeProp StatusNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Status ); CswNbtMetaDataNodeTypeProp MaterialNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Material ); CswNbtMetaDataNodeTypeProp NumberNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Number ); CswNbtMetaDataNodeTypeProp OrderNoNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.ExternalOrderNumber ); CswNbtMetaDataNodeTypeProp FulfillNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Fulfill ); CswNbtMetaDataNodeTypeProp RequestNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Request ); CswNbtMetaDataNodeTypeProp IGroupNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.InventoryGroup ); CswNbtMetaDataNodeTypeProp TotalDispNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.TotalDispensed ); NumberNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 1, DisplayColumn: 1 ); MaterialNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 1, DisplayColumn: 2 ); RequestNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 2, DisplayColumn: 1 ); OrderNoNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 2, DisplayColumn: 2 ); IGroupNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 3, DisplayColumn: 1 ); StatusNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 4, DisplayColumn: 1 ); TotalDispNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 4, DisplayColumn: 2 ); FulfillNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 5, DisplayColumn: 1 ); CswNbtMetaDataNodeTypeProp RequestByNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.RequestBy ); CswNbtMetaDataNodeTypeProp SizeNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Size ); CswNbtMetaDataNodeTypeProp CountNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Count ); CswNbtMetaDataNodeTypeProp QuantityNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Quantity ); RequestByNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true, DisplayRow: 1, DisplayColumn: 1 ); CountNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true, DisplayRow: 2, DisplayColumn: 1 ); SizeNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true, DisplayRow: 2, DisplayColumn: 2 ); QuantityNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true, DisplayRow: 3, DisplayColumn: 1 ); } CswNbtMetaDataObjectClass RoleOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RoleClass ); CswNbtMetaDataObjectClass UserOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.UserClass ); CswNbtMetaDataNodeType RoleNt = RoleOc.getLatestVersionNodeTypes().FirstOrDefault(); if( null != RoleNt ) { CswNbtObjClassRole NodeAsRole = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( RoleNt.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode ); if( null != NodeAsRole ) { NodeAsRole.Name.Text = "CISPro_Dispenser"; NodeAsRole.postChanges( true ); CswNbtMetaDataObjectClass MaterialOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass ); foreach( CswNbtMetaDataNodeType MaterialNt in MaterialOc.getLatestVersionNodeTypes() ) { _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.View, MaterialNt, NodeAsRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Create, MaterialNt, NodeAsRole, true ); } CswNbtMetaDataObjectClass ContainerOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.ContainerClass ); foreach( CswNbtMetaDataNodeType ContainerNt in ContainerOc.getLatestVersionNodeTypes() ) { _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.View, ContainerNt, NodeAsRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Create, ContainerNt, NodeAsRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Edit, ContainerNt, NodeAsRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Delete, ContainerNt, NodeAsRole, true ); } _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Receiving, NodeAsRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DispenseContainer, NodeAsRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DisposeContainer, NodeAsRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Submit_Request, NodeAsRole, true ); CswNbtMetaDataNodeType UserNt = UserOc.getLatestVersionNodeTypes().FirstOrDefault(); if( null != UserNt ) { CswNbtObjClassUser NodeAsUser = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( UserNt.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode ); if( null != NodeAsUser ) { NodeAsUser.Role.RelatedNodeId = NodeAsRole.NodeId; NodeAsUser.UsernameProperty.Text = "dispenser"; NodeAsUser.postChanges( true ); } } } } }//Update()
public override void update() { CswTableUpdate jctUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "29311_jctddntp_update", "jct_dd_ntp" ); DataTable jctTable = jctUpdate.getEmptyTable(); // Set up Sequence Nodetype CswNbtMetaDataObjectClass SequenceOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.DesignSequenceClass ); CswNbtMetaDataNodeType SequenceNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeTypeNew( new CswNbtWcfMetaDataModel.NodeType( SequenceOC ) { NodeTypeName = "Design Sequence", Category = "Design", IconFileName = "wrench.png" } ); //SequenceNT.addNameTemplateText( CswNbtObjClassDesignSequence.PropertyName.Name ); SequenceNT._DataRow["nametemplate"] = CswNbtMetaData.TemplateTextToTemplateValue( SequenceNT.getNodeTypeProps(), CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassDesignSequence.PropertyName.Name ) ); Int32 TabId = SequenceNT.getFirstNodeTypeTab().TabId; CswNbtMetaDataNodeTypeProp SeqNameNTP = SequenceNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDesignSequence.PropertyName.Name ); CswNbtMetaDataNodeTypeProp SeqNextValueNTP = SequenceNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDesignSequence.PropertyName.NextValue ); CswNbtMetaDataNodeTypeProp SeqPadNTP = SequenceNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDesignSequence.PropertyName.Pad ); CswNbtMetaDataNodeTypeProp SeqPostNTP = SequenceNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDesignSequence.PropertyName.Post ); CswNbtMetaDataNodeTypeProp SeqPreNTP = SequenceNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDesignSequence.PropertyName.Pre ); // Edit Layout SeqNameNTP.updateLayout( CswEnumNbtLayoutType.Edit, true, TabId, DisplayRow: 1, DisplayColumn: 1 ); SeqPreNTP.updateLayout( CswEnumNbtLayoutType.Edit, true, TabId, DisplayRow: 2, DisplayColumn: 1 ); SeqPostNTP.updateLayout( CswEnumNbtLayoutType.Edit, true, TabId, DisplayRow: 3, DisplayColumn: 1 ); SeqPadNTP.updateLayout( CswEnumNbtLayoutType.Edit, true, TabId, DisplayRow: 4, DisplayColumn: 1 ); SeqNextValueNTP.updateLayout( CswEnumNbtLayoutType.Edit, true, TabId, DisplayRow: 5, DisplayColumn: 1 ); // Add Layout SeqNameNTP.updateLayout( CswEnumNbtLayoutType.Add, false, Int32.MinValue, DisplayRow: 1, DisplayColumn: 1 ); SeqPreNTP.updateLayout( CswEnumNbtLayoutType.Add, false, Int32.MinValue, DisplayRow: 2, DisplayColumn: 1 ); SeqPostNTP.updateLayout( CswEnumNbtLayoutType.Add, false, Int32.MinValue, DisplayRow: 3, DisplayColumn: 1 ); SeqPadNTP.updateLayout( CswEnumNbtLayoutType.Add, false, Int32.MinValue, DisplayRow: 4, DisplayColumn: 1 ); SeqNextValueNTP.removeFromLayout( CswEnumNbtLayoutType.Add ); // Populate nodes // Very important that this happens BEFORE we map to the nodetypes table, or else we'll end up duplicating rows! Dictionary<Int32, CswNbtObjClassDesignSequence> SequenceNodeMap = new Dictionary<int, CswNbtObjClassDesignSequence>(); CswTableSelect SequencesTableSelect = _CswNbtSchemaModTrnsctn.makeCswTableSelect( "29311_sequencetable_select", "sequences" ); DataTable SequencesTable = SequencesTableSelect.getTable(); foreach( DataRow SeqRow in SequencesTable.Rows ) { CswNbtObjClassDesignSequence node = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( SequenceNT.NodeTypeId, OverrideUniqueValidation: true, OnAfterMakeNode: delegate( CswNbtNode NewNode ) { CswNbtObjClassDesignSequence NewSeqNode = NewNode; NewSeqNode.Name.Text = SeqRow["sequencename"].ToString(); NewSeqNode.Pad.Value = CswConvert.ToInt32( SeqRow["pad"] ); NewSeqNode.Post.Text = SeqRow["post"].ToString(); NewSeqNode.Pre.Text = SeqRow["prep"].ToString(); } ); node.RelationalId = new CswPrimaryKey( "sequences", CswConvert.ToInt32( SeqRow["sequenceid"] ) ); node.postChanges( false ); SequenceNodeMap.Add( node.RelationalId.PrimaryKey, node ); } // Here's where the extra special super-secret magic comes in //SequenceNT.TableName = "sequences"; SequenceNT._DataRow["tablename"] = "sequences"; _addJctRow( jctTable, SeqNameNTP, SequenceNT.TableName, "sequencename" ); _addJctRow( jctTable, SeqPadNTP, SequenceNT.TableName, "pad" ); _addJctRow( jctTable, SeqPostNTP, SequenceNT.TableName, "post" ); _addJctRow( jctTable, SeqPreNTP, SequenceNT.TableName, "prep" ); jctUpdate.update( jctTable ); // Set up existing relationships to sequences Dictionary<Int32, CswNbtObjClassDesignSequence> SequenceValueMap = new Dictionary<Int32, CswNbtObjClassDesignSequence>(); string Sql = @"select n.nodeid, r.sequenceid from nodetype_props p join nodetypes t on p.nodetypeid = t.nodetypeid join nodes n on t.nodetypeid = n.nodetypeid join nodetype_props r on n.relationalid = r.nodetypepropid where p.propname = 'Sequence' and t.nodetypename like 'Design%'"; CswArbitrarySelect ExistingSequenceIdSelect = _CswNbtSchemaModTrnsctn.makeCswArbitrarySelect( "getExistingSequenceIds", Sql ); DataTable ExistingSequenceIdTable = ExistingSequenceIdSelect.getTable(); foreach( DataRow row in ExistingSequenceIdTable.Rows ) { Int32 thisSeqId = CswConvert.ToInt32( row["sequenceid"] ); if( Int32.MinValue != thisSeqId && SequenceNodeMap.ContainsKey( thisSeqId ) ) { SequenceValueMap.Add( CswConvert.ToInt32( row["nodeid"] ), SequenceNodeMap[thisSeqId] ); } } foreach( CswEnumNbtFieldType ft in new CswEnumNbtFieldType[] { CswEnumNbtFieldType.Barcode, CswEnumNbtFieldType.Sequence } ) { CswNbtMetaDataNodeType PropNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( CswNbtObjClassDesignNodeTypeProp.getNodeTypeName( ft ) ); //CswNbtFieldTypeRuleSequence Rule = (CswNbtFieldTypeRuleSequence) _CswNbtSchemaModTrnsctn.MetaData.getFieldTypeRule( ft ); //CswNbtFieldTypeAttribute SequenceAttribute = Rule.getAttributes().FirstOrDefault( a => a.Name == CswEnumNbtPropertyAttributeName.Sequence ); CswNbtMetaDataNodeTypeProp SequenceNTP = PropNT.getNodeTypeProp( CswEnumNbtPropertyAttributeName.Sequence ); SequenceNTP.SetFKDeprecated( CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), SequenceOC.ObjectClassId ); CswNbtViewId ViewId = SequenceNTP.DesignNode.AttributeProperty[CswNbtFieldTypeRuleRelationship.AttributeName.View].AsViewReference.ViewId; CswNbtView View = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( ViewId ); CswNbtFieldTypeRuleDefaultImpl.setDefaultView( _CswNbtSchemaModTrnsctn.MetaData, SequenceNTP.DesignNode, View, CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), SequenceOC.ObjectClassId, false ); foreach( CswNbtObjClassDesignNodeTypeProp PropNode in PropNT.getNodes( false, true ) ) { if( SequenceValueMap.ContainsKey( PropNode.NodeId.PrimaryKey ) ) { CswNbtObjClassDesignSequence SeqNode = SequenceValueMap[PropNode.NodeId.PrimaryKey]; if( null != SeqNode ) { PropNode.Node.Properties[SequenceNTP].AsRelationship.RelatedNodeId = SeqNode.NodeId; PropNode.postChanges( false ); } } } } // foreach( CswEnumNbtFieldType ft in new CswEnumNbtFieldType[] {CswEnumNbtFieldType.Barcode, CswEnumNbtFieldType.Sequence} ) } // update()
private Collection <CswNbtViewRelationship> getObjectClassRelated(Int32 ObjectClassId, CswNbtView View, Int32 Level) { Collection <CswNbtViewRelationship> Relationships = new Collection <CswNbtViewRelationship>(); // If we're doing a grid, we can only pick things in which the provided nodetype has a relationship to, // rather than things that are related to the provided nodetype. // If this is a property grid, then the above rule does not apply to the first level. bool Restrict = (View.ViewMode == CswEnumNbtViewRenderingMode.Grid || View.ViewMode == CswEnumNbtViewRenderingMode.Table) && (View.Visibility != CswEnumNbtViewVisibility.Property || Level >= 2); CswNbtMetaDataObjectClass ObjectClass = _CswNbtResources.MetaData.getObjectClass(ObjectClassId); CswNbtMetaDataPropertySet PropertySet = ObjectClass.getPropertySet(); CswStaticSelect RelationshipPropsSelect = _CswNbtResources.makeCswStaticSelect("getRelationsForObjectClassId_select", "getRelationsForObjectClassId"); RelationshipPropsSelect.S4Parameters.Add("getobjectclassid", new CswStaticParam("getobjectclassid", ObjectClassId)); DataTable RelationshipPropsTable = RelationshipPropsSelect.getTable(); foreach (DataRow PropRow in RelationshipPropsTable.Rows) { // Ignore relationships that don't have a target if (PropRow["fktype"].ToString() != String.Empty && PropRow["fkvalue"].ToString() != String.Empty) { if ((PropRow["proptype"].ToString() == CswEnumNbtViewPropIdType.ObjectClassPropId.ToString() && PropRow["typeid"].ToString() == ObjectClassId.ToString()) && (PropRow["fktype"].ToString() == CswEnumNbtViewRelatedIdType.ObjectClassId.ToString() && PropRow["fkvalue"].ToString() == ObjectClassId.ToString())) { CswNbtMetaDataObjectClassProp ThisProp = _CswNbtResources.MetaData.getObjectClassProp(CswConvert.ToInt32(PropRow["propid"])); // Special case -- relationship to my own class // We need to create two relationships from this CswNbtViewRelationship R1 = View.AddViewRelationship(null, CswEnumNbtViewPropOwnerType.First, ThisProp, false); R1.overrideFirst(ObjectClass); R1.overrideSecond(ObjectClass); _InsertRelationship(Relationships, R1); if (!Restrict) { CswNbtViewRelationship R2 = View.AddViewRelationship(null, CswEnumNbtViewPropOwnerType.Second, ThisProp, false); R2.overrideFirst(ObjectClass); R2.overrideSecond(ObjectClass); _InsertRelationship(Relationships, R2); } } else { CswNbtViewRelationship R = null; if (PropRow["proptype"].ToString() == CswEnumNbtViewPropIdType.ObjectClassPropId.ToString() && PropRow["typeid"].ToString() == ObjectClassId.ToString()) { // my relation to something else CswNbtMetaDataObjectClassProp ThisProp = _CswNbtResources.MetaData.getObjectClassProp(CswConvert.ToInt32(PropRow["propid"])); R = View.AddViewRelationship(null, CswEnumNbtViewPropOwnerType.First, ThisProp, false); //if( PropRow["fktype"].ToString() == NbtViewRelatedIdType.PropertySetId.ToString() ) // R.overrideSecond( _CswNbtResources.MetaData.getPropertySet( CswConvert.ToInt32( PropRow["fkvalue"] ) ) ); //else if( PropRow["fktype"].ToString() == NbtViewRelatedIdType.ObjectClassId.ToString() ) // R.overrideSecond( _CswNbtResources.MetaData.getObjectClass( CswConvert.ToInt32( PropRow["fkvalue"] ) ) ); //else if( PropRow["fktype"].ToString() == NbtViewRelatedIdType.NodeTypeId.ToString() ) // R.overrideSecond( _CswNbtResources.MetaData.getNodeType( CswConvert.ToInt32( PropRow["fkvalue"] ) ) ); R.overrideSecond(PropRow["fktype"].ToString(), CswConvert.ToInt32(PropRow["fkvalue"])); R.overrideFirst(ObjectClass); _InsertRelationship(Relationships, R); } else if ((PropRow["fktype"].ToString() == CswEnumNbtViewRelatedIdType.ObjectClassId.ToString() && PropRow["fkvalue"].ToString() == ObjectClassId.ToString()) || (PropRow["fktype"].ToString() == CswEnumNbtViewRelatedIdType.PropertySetId.ToString() && PropertySet != null && PropRow["fkvalue"].ToString() == PropertySet.PropertySetId.ToString())) { if (!Restrict) { // something else's relation to me ICswNbtMetaDataProp ThisProp = null; if (PropRow["proptype"].ToString() == CswEnumNbtViewPropIdType.ObjectClassPropId.ToString()) { ThisProp = _CswNbtResources.MetaData.getObjectClassProp(CswConvert.ToInt32(PropRow["propid"])); } else { ThisProp = _CswNbtResources.MetaData.getNodeTypeProp(CswConvert.ToInt32(PropRow["propid"])); } R = View.AddViewRelationship(null, CswEnumNbtViewPropOwnerType.Second, ThisProp, false); if (PropRow["proptype"].ToString() == CswEnumNbtViewPropIdType.ObjectClassPropId.ToString()) { R.overrideSecond(_CswNbtResources.MetaData.getObjectClass(CswConvert.ToInt32(PropRow["typeid"]))); } else { R.overrideSecond(_CswNbtResources.MetaData.getNodeType(CswConvert.ToInt32(PropRow["typeid"]))); } R.overrideFirst(ObjectClass); _InsertRelationship(Relationships, R); } } else { throw new CswDniException(CswEnumErrorType.Error, "An unexpected data condition has occurred", "getObjectClassRelated() found a relationship which did not match the original objectclassid"); } } } } return(Relationships); }
}//ctor public override void update() { _CswTstCaseRsrc = new CswTestCaseRsrc(_CswNbtSchemaModTrnsctn); _CswTstCaseRsrc_010.CswNbtSchemaModTrnsctn = _CswNbtSchemaModTrnsctn; //Int32 MaterialsPk = Int32.MinValue; //SETUP: BEGIN ***************************************** //Step 1: Make the nodetype **************************** Int32 TestByteArraySize = 256; string BlobNodeTypeName = "TestForBlobNodeType"; string BlobPropName = "The Blob"; CswNbtMetaData CswNbtMetaData = _CswNbtSchemaModTrnsctn.MetaData; CswNbtMetaDataObjectClass GenericObjectClass = CswNbtMetaData.getObjectClass(CswEnumNbtObjectClass.GenericClass); CswNbtMetaDataNodeType BlobNodeTypeNodeType = CswNbtMetaData.makeNewNodeTypeNew(new CswNbtWcfMetaDataModel.NodeType(GenericObjectClass) { NodeTypeName = BlobNodeTypeName, Category = string.Empty }); CswNbtMetaDataNodeTypeProp BlobNodeTypeNodeTypeProp = CswNbtMetaData.makeNewPropNew( new CswNbtWcfMetaDataModel.NodeTypeProp(BlobNodeTypeNodeType, _CswNbtSchemaModTrnsctn.MetaData.getFieldType(CswEnumNbtFieldType.Image), BlobPropName)); _CswNbtSchemaModTrnsctn.MetaData.refreshAll(); if (null == _CswNbtSchemaModTrnsctn.MetaData.getNodeType(BlobNodeTypeName)) { throw (new CswDniException("Nodetype " + BlobNodeTypeName + " was not created; test cannot proceed")); } //Step 1: Make a node **************************** CswNbtNode BlobNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId(BlobNodeTypeNodeType.NodeTypeId); Int32 BlobJctNodePropId = BlobNode.Properties[BlobNodeTypeNodeTypeProp].JctNodePropId; CswTableUpdate JctUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate("CswScmUpdt_TstCse_DataTable_PreserveBlobColumns_1", "jct_nodes_props"); JctUpdate.AllowBlobColumns = true; DataTable JctTable = JctUpdate.getTable("jctnodepropid", BlobJctNodePropId); JctTable.Rows[0]["blobdata"] = new Byte[TestByteArraySize]; JctTable.Rows[0]["field1"] = "Dummy File Name"; JctTable.Rows[0]["field2"] = "Dummy File Type"; JctUpdate.update(JctTable); //SETUP: END ***************************************** //*** TEST PART 1: That we don't nuke the blob column when select columns are unspecified JctUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate("01G02_JctNodesProps_update", "jct_nodes_props"); JctTable = JctUpdate.getTable(); foreach (DataRow JctRow in JctTable.Rows) { JctRow["nodeidtablename"] = "nodes"; } JctUpdate.update(JctTable); CswTableSelect CswTableSelect = _CswNbtSchemaModTrnsctn.makeCswTableSelect("CswScmUpdt_TstCse_DataTable_PreserveBlobColumns_2", "jct_nodes_props"); DataTable DataTable = CswTableSelect.getTable(" where blobdata is not null "); if (0 == DataTable.Rows.Count) { throw (new CswDniException("A generic update of jct_nodes_props nuked the blob columns")); } //*** TEST PART 2: That we can retrieve and update the blob column when we use the AllowBlob flag //*** Note that in the setup sections we implciitly tested that we can retrieve and //*** update the blob column when set the AllowBlobFlag. JctUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate("01G02_JctNodesProps_update", "jct_nodes_props"); CswCommaDelimitedString SelectColumns = new CswCommaDelimitedString(); SelectColumns.Add("field1"); SelectColumns.Add("field2"); SelectColumns.Add("blobdata"); JctTable = JctUpdate.getTable(SelectColumns); if (false == JctTable.Columns.Contains("blobdata")) { throw (new CswDniException("Blob column was not retrieved when it was specified as a select column")); } Byte[] TestByteArray = new Byte[TestByteArraySize]; // update an arbitrary row for (int idx = 0; idx < TestByteArraySize; idx++) { TestByteArray[idx] = 1; } JctTable.Rows[0]["blobdata"] = TestByteArray; Int32 Arbitraryjctnodepropid = Convert.ToInt32(JctTable.Rows[0]["jctnodepropid"]); JctUpdate.update(JctTable); CswTableSelect = _CswNbtSchemaModTrnsctn.makeCswTableSelect("CswScmUpdt_TstCse_DataTable_PreserveBlobColumns_2", "jct_nodes_props"); DataTable = CswTableSelect.getTable(" where jctnodepropid= " + Arbitraryjctnodepropid.ToString() + "and blobdata is not null "); if (0 == DataTable.Rows.Count) { throw (new CswDniException("An update of a blob column with specified select columns failed")); } throw (new CswDniExceptionIgnoreDeliberately()); }
} // getPercentDone() /// <summary> /// Run the next iteration of this batch operation /// </summary> public void runBatchOp(CswNbtObjClassBatchOp BatchNode) { try { if (BatchNode != null && BatchNode.OpNameValue == CswEnumNbtBatchOpName.MobileMultiOpUpdates) { BatchNode.start(); MobileMultiOpUpdatesBatchData BatchData = new MobileMultiOpUpdatesBatchData(BatchNode.BatchData.Text); CswNbtObjClassUser UserNode = _CswNbtResources.Nodes.makeUserNodeFromUsername(BatchData.Username); _User = UserNode; if (BatchData.Operations.Count > 0) { if (null != UserNode) { CswNbtObjClassRole RoleNode = _CswNbtResources.Nodes.makeRoleNodeFromRoleName(UserNode.Rolename); CswNbtMetaDataObjectClass ContainerOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass); CswNbtMetaDataNodeType ContainerNT = ContainerOC.getNodeTypes().FirstOrDefault(); int NodesProcessedPerIteration = CswConvert.ToInt32(_CswNbtResources.ConfigVbls.getConfigVariableValue(CswEnumConfigurationVariableNames.NodesProcessedPerCycle)); for (int i = 0; i < NodesProcessedPerIteration && BatchData.Operations.Count > 0; i++) { string operation = string.Empty; operation = BatchData.Operations[0]["op"].ToString(); operation = operation.ToLower(); operation = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(operation); JObject update = (JObject)BatchData.Operations[0]["update"]; string barcode = BatchData.Operations[0]["barcode"].ToString(); if (_CswNbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Edit, ContainerNT, RoleNode)) { switch (operation) { case "Dispose": _dispose(operation, barcode, BatchNode); break; case "Move": _move(operation, barcode, update, BatchNode); break; case "Owner": _updateOwner(operation, barcode, update, BatchNode); break; case "Transfer": _transfer(operation, barcode, update, BatchNode); break; case "Dispense": _dispense(operation, barcode, update, BatchNode); break; case "Reconcile": _reconcile(operation, barcode, update, BatchNode); break; default: string msg = "The operation " + operation + "doesn't exist."; _storeError(BatchNode, msg); break; } //switch (operation) } else { string msg = "The user " + BatchData.Username + " does not have permission to edit a Container."; _storeError(BatchNode, msg); } BatchData.Operations.RemoveAt(0); } //forloop } //if(null != Usernode) else { _storeError(BatchNode, "The user " + BatchData.Username + " does not exist."); } } else { // Send errors via an email if (false == BatchNode.Log.Empty) { _emailErrors(BatchNode); } BatchNode.finish(); } BatchNode.PercentDone.Value = getPercentDone(BatchNode); BatchNode.BatchData.Text = BatchData.ToString(); BatchNode.postChanges(false); } } catch (Exception ex) { BatchNode.error(ex); } } // runBatchOp()
public override void update() { CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.ChemicalClass); CswNbtMetaDataObjectClassProp DisposalOCP = ChemicalOC.getObjectClassProp(CswNbtObjClassChemical.PropertyName.DisposalInstructions) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(ChemicalOC) { PropName = CswNbtObjClassChemical.PropertyName.DisposalInstructions, FieldType = CswEnumNbtFieldType.Memo }); CswNbtMetaDataObjectClassProp HazardsOCP = ChemicalOC.getObjectClassProp(CswNbtObjClassChemical.PropertyName.HazardInfo) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(ChemicalOC) { PropName = CswNbtObjClassChemical.PropertyName.HazardInfo, FieldType = CswEnumNbtFieldType.Memo }); CswNbtMetaDataObjectClassProp CompressedGasOCP = ChemicalOC.getObjectClassProp(CswNbtObjClassChemical.PropertyName.CompressedGas) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(ChemicalOC) { PropName = CswNbtObjClassChemical.PropertyName.CompressedGas, FieldType = CswEnumNbtFieldType.Logical }); CswNbtMetaDataObjectClassProp SMILESOCP = ChemicalOC.getObjectClassProp(CswNbtObjClassChemical.PropertyName.SMILES) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(ChemicalOC) { PropName = CswNbtObjClassChemical.PropertyName.SMILES, FieldType = CswEnumNbtFieldType.Text }); CswNbtMetaDataNodeType TimeUoM_OC = _CswNbtSchemaModTrnsctn.MetaData.getNodeType("Unit (Time)"); CswNbtMetaDataObjectClassProp OpenExpireIntervalOCP = ChemicalOC.getObjectClassProp(CswNbtObjClassChemical.PropertyName.OpenExpireInterval) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(ChemicalOC) { PropName = CswNbtObjClassChemical.PropertyName.OpenExpireInterval, FieldType = CswEnumNbtFieldType.Quantity, IsFk = true, FkType = "NodeTypeId", FkValue = TimeUoM_OC.NodeTypeId }); CswNbtMetaDataObjectClassProp EINECSOCP = ChemicalOC.getObjectClassProp(CswNbtObjClassChemical.PropertyName.EINECS) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(ChemicalOC) { PropName = CswNbtObjClassChemical.PropertyName.EINECS, FieldType = CswEnumNbtFieldType.Text }); CswNbtMetaDataObjectClassProp DOTCode = ChemicalOC.getObjectClassProp(CswNbtObjClassChemical.PropertyName.DOTCode) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(ChemicalOC) { PropName = CswNbtObjClassChemical.PropertyName.DOTCode, FieldType = CswEnumNbtFieldType.Number }); CswNbtMetaDataObjectClassProp SubclassName = ChemicalOC.getObjectClassProp(CswNbtObjClassChemical.PropertyName.SubclassName) ?? _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(ChemicalOC) { PropName = CswNbtObjClassChemical.PropertyName.SubclassName, FieldType = CswEnumNbtFieldType.Text, ServerManaged = true }); }
public override void update() { CswNbtMetaDataObjectClass GhsOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.GHSClass ); CswNbtMetaDataObjectClassProp GhsMaterialOCP = GhsOC.getObjectClassProp( CswNbtObjClassGHS.PropertyName.Material ); CswNbtMetaDataNodeType GhsNT = GhsOC.getNodeTypes().First(); if( null != GhsNT ) { CswNbtMetaDataNodeTypeTab GhsGhsTab = GhsNT.getNodeTypeTab( "GHS" ) ?? _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( GhsNT, "GHS", 1 ); // Fix nodetype name template GhsNT.setNameTemplateText( // "GHS for " + // CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassGHS.PropertyName.Material ) + // ": " + CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassGHS.PropertyName.Jurisdiction ) ); // Classification is now a list const string ClassificationPropName = "Classification"; const string ClassificationTabGroup = "Classification"; CswNbtMetaDataNodeTypeProp GhsClassificationNTP = GhsNT.getNodeTypeProp( ClassificationPropName ); _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( GhsClassificationNTP ); GhsClassificationNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GhsNT, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.List ), ClassificationPropName ) ); GhsClassificationNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, DisplayRow: 6, DisplayColumn: 1, TabGroup: ClassificationTabGroup ); GhsClassificationNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, GhsGhsTab.TabId, 6, 1, ClassificationTabGroup ); // Classification list options CswCommaDelimitedString ClassificationOptions = new CswCommaDelimitedString { "Category 1", "Category 2", "Category 3", "Category 4", "Category 1 A/1 B/1 C", "Category 2 (skin)/2A (eye)", "Category 2A", "Category 2B", "Category 1/ 1A / 1B", "Category 1A or Category 1B", "Type A", "Type B", "Type C&D", "Type E&F", "Compressed Gas", "Liquidfied Gas", "Dissolved Gas", "Refridgerated Liquidified Gas" }; GhsClassificationNTP.ListOptions = ClassificationOptions.ToString(); // Chemical GHS tab CswNbtMetaDataNodeType ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" ); if( null != ChemicalNT ) { CswNbtMetaDataNodeTypeTab ChemicalGhsTab = ChemicalNT.getNodeTypeTab( "GHS" ) ?? _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( ChemicalNT, "GHS", 3 ); // Delete the GHS grid, if present CswNbtMetaDataNodeTypeProp ChemicalGhsGridNTP = ChemicalNT.getNodeTypeProp( "GHS" ); if( null != ChemicalGhsGridNTP ) { _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( ChemicalGhsGridNTP ); } // Add Child Contents property to Chemical GHS tab CswNbtMetaDataNodeTypeProp JurisdictionNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.ChildContents ), "Jurisdiction" ) ); JurisdictionNTP.SetFK( NbtViewPropIdType.ObjectClassPropId.ToString(), GhsMaterialOCP.ObjectClassPropId ); JurisdictionNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add ); JurisdictionNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, ChemicalGhsTab.TabId, 1, 1 ); } // if(null != ChemicalNT) } // if (null != GhsNT) } //update()
private void _upgradeProblemNTPs() { CswNbtMetaDataObjectClass ProblemOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.ProblemClass); CswNbtMetaDataObjectClass DepartmentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.DepartmentClass); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.Department, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = DepartmentOC.ObjectClassId }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.LaborCost, FieldType = CswEnumNbtFieldType.Text }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.OtherCost, FieldType = CswEnumNbtFieldType.Text }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.OtherCostName, FieldType = CswEnumNbtFieldType.Text }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.PartsCost, FieldType = CswEnumNbtFieldType.Text }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.Problem, FieldType = CswEnumNbtFieldType.Memo }); CswNbtMetaDataObjectClass UserOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.UserClass); CswNbtMetaDataObjectClassProp UserPhoneOCP = UserOC.getObjectClassProp(CswNbtObjClassUser.PropertyName.Phone); CswNbtMetaDataObjectClassProp ReportedByOCP = ProblemOC.getObjectClassProp(CswNbtObjClassProblem.PropertyName.ReportedBy); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.ReporterPhone, FieldType = CswEnumNbtFieldType.PropertyReference, IsFk = true, FkType = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString(), FkValue = ReportedByOCP.PropId, ValuePropId = UserPhoneOCP.PropId, ValuePropType = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString() }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.Resolution, FieldType = CswEnumNbtFieldType.Memo }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.StartDate, FieldType = CswEnumNbtFieldType.DateTime }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.Summary, FieldType = CswEnumNbtFieldType.Text }); CswNbtMetaDataObjectClassProp TechnicianOCP = _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.Technician, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = UserOC.ObjectClassId }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.TechnicianPhone, FieldType = CswEnumNbtFieldType.PropertyReference, IsFk = true, FkType = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString(), FkValue = TechnicianOCP.PropId, ValuePropId = UserPhoneOCP.PropId, ValuePropType = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString() }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.TravelCost, FieldType = CswEnumNbtFieldType.Text }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.UnderWarranty, FieldType = CswEnumNbtFieldType.Logical }); _addOCP(ProblemOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassProblem.PropertyName.WorkOrderPrinted, FieldType = CswEnumNbtFieldType.Logical }); }
private void _addRelationship() { if (Request.Relationship.PropOwner == CswEnumNbtViewPropOwnerType.First && Int32.MinValue != Request.Relationship.FirstId) { CswNbtViewRelationship parentToAddTo = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(Request.Relationship.ParentArbitraryId); ICswNbtMetaDataProp prop = null; if (Request.Relationship.PropType == CswEnumNbtViewPropIdType.NodeTypePropId) { prop = _CswNbtResources.MetaData.getNodeTypeProp(Request.Relationship.PropId); } else { prop = _CswNbtResources.MetaData.getObjectClassProp(Request.Relationship.PropId); } if (null != prop) { CurrentView.AddViewRelationship(parentToAddTo, Request.Relationship.PropOwner, prop, true); } } else { if (Request.Relationship.SecondType == CswEnumNbtViewRelatedIdType.NodeTypeId) { CswNbtMetaDataNodeType nt = _CswNbtResources.MetaData.getNodeType(Request.Relationship.SecondId); CswNbtViewRelationship parent = null; if (CurrentView.Visibility == CswEnumNbtViewVisibility.Property) { parent = _addPropViewRelationshiop(CurrentView, Request.Relationship); } else { parent = CurrentView.AddViewRelationship(nt, true); } _addNameTemplateProps(CurrentView, parent, nt); } else if (Request.Relationship.SecondType == CswEnumNbtViewRelatedIdType.ObjectClassId) { CswNbtMetaDataObjectClass oc = _CswNbtResources.MetaData.getObjectClass(Request.Relationship.SecondId); CswNbtViewRelationship parent = null; if (CurrentView.Visibility == CswEnumNbtViewVisibility.Property) { parent = _addPropViewRelationshiop(CurrentView, Request.Relationship); } else { parent = CurrentView.AddViewRelationship(oc, true); } foreach (CswNbtMetaDataNodeType NodeType in oc.getNodeTypes()) { _addNameTemplateProps(CurrentView, parent, NodeType); } } else { CswNbtMetaDataPropertySet ps = _CswNbtResources.MetaData.getPropertySet(Request.Relationship.SecondId); CswNbtViewRelationship parent = null; if (CurrentView.Visibility == CswEnumNbtViewVisibility.Property) { parent = _addPropViewRelationshiop(CurrentView, Request.Relationship); } else { parent = CurrentView.AddViewRelationship(ps, true); } foreach (CswNbtMetaDataObjectClass oc in ps.getObjectClasses()) { foreach (CswNbtMetaDataNodeType NodeType in oc.getNodeTypes()) { _addNameTemplateProps(CurrentView, parent, NodeType); } } } } }
private void _upgradePrinterNTP() { CswNbtMetaDataObjectClass PrinterOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.PrinterClass); _createGridOCPFromNTP(PrinterOC, CswNbtObjClassPrinter.PropertyName.Jobs); }
private void _addProp(ICswNbtMetaDataProp prop) { CswNbtViewRoot.forEachRelationship eachRelationship = relationship => { //we have to iterate a temp view, but use the relationships on the "real" view relationship = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(relationship.ArbitraryId); //For property views, we ignore the top lvl relationship if ((false == (relationship.Parent is CswNbtViewRoot) && CurrentView.Visibility == CswEnumNbtViewVisibility.Property) || CurrentView.Visibility != CswEnumNbtViewVisibility.Property) { int Id = relationship.SecondId; CswEnumNbtViewRelatedIdType type = relationship.SecondType; if (relationship.PropOwner.Equals(CswEnumNbtViewPropOwnerType.First) && Int32.MinValue != relationship.FirstId && CurrentView.Visibility == CswEnumNbtViewVisibility.Property) { Id = relationship.FirstId; type = relationship.FirstType; } CswNbtViewProperty existingViewProp = relationship.findPropertyByName(prop.PropName); if (null != existingViewProp) { existingViewProp.ShowInGrid = true; } else { if (null != Request.Relationship) { int ownerTargetId = Request.Relationship.SecondId; Collection <CswNbtViewRelationship> relations = getViewChildRelationshipOptions(CurrentView, relationship.ArbitraryId); foreach (CswNbtViewRelationship related in relations) { ICswNbtMetaDataProp relProp = related.getProp(); int relatedTargetId = related.SecondId; if (ownerTargetId == relatedTargetId && Request.Relationship.getRelatedType() == related.getRelatedType()) { if (related.getRelatedType() == CswEnumNbtViewRelatedIdType.NodeTypeId) { CswNbtMetaDataNodeType ownerNT = _CswNbtResources.MetaData.getNodeType(relatedTargetId); foreach (CswNbtMetaDataNodeTypeProp ntp in ownerNT.getNodeTypeProps().Where(ntp => ntp.PropName == prop.PropName)) { CswNbtViewRelationship parentRel = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(related.ParentArbitraryId); CswNbtViewRelationship relToAddPropTo = relationship.findChildRelationshipByNodeTypeId(relatedTargetId); if (null == relToAddPropTo) { relToAddPropTo = CurrentView.AddViewRelationship(parentRel, related.PropOwner, relProp, false); } CurrentView.AddViewProperty(relToAddPropTo, ntp); } } else if (related.getRelatedType() == CswEnumNbtViewRelatedIdType.ObjectClassId) { CswNbtMetaDataObjectClass ownerOC = _CswNbtResources.MetaData.getObjectClass(relatedTargetId); foreach (CswNbtMetaDataObjectClassProp ocp in ownerOC.getObjectClassProps().Where(ocp => ocp.PropName == prop.PropName)) { CswNbtViewRelationship parentRel = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(related.ParentArbitraryId); CswNbtViewRelationship relToAddPropTo = relationship.findChildRelationshipByObjClassId(relatedTargetId); if (null == relToAddPropTo) { relToAddPropTo = CurrentView.AddViewRelationship(parentRel, related.PropOwner, relProp, false); } CurrentView.AddViewProperty(relToAddPropTo, ocp); } } else { CswNbtMetaDataPropertySet ownerPS = _CswNbtResources.MetaData.getPropertySet(relatedTargetId); foreach (CswNbtMetaDataObjectClass oc in ownerPS.getObjectClasses()) { foreach (CswNbtMetaDataNodeType nt in oc.getNodeTypes()) { foreach (CswNbtMetaDataNodeTypeProp ntp in nt.getNodeTypeProps()) { if (ntp.PropName == prop.PropName) { CswNbtViewRelationship parentRel = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(related.ParentArbitraryId); CswNbtViewRelationship relToAddPropTo = relationship.findChildRelationshipByPropSetId(relatedTargetId); if (null == relToAddPropTo) { relToAddPropTo = CurrentView.AddViewRelationship(parentRel, related.PropOwner, relProp, false); } CurrentView.AddViewProperty(relToAddPropTo, ntp); } } } } } } } } else { CswNbtViewRelationship realRelationship = (CswNbtViewRelationship)CurrentView.FindViewNodeByArbitraryId(relationship.ArbitraryId); if (type.Equals(CswEnumNbtViewRelatedIdType.NodeTypeId)) { CswNbtMetaDataNodeType nt = _CswNbtResources.MetaData.getNodeType(Id); CswNbtMetaDataNodeTypeProp ntp = nt.getNodeTypeProp(prop.PropName); if (null != ntp) { CurrentView.AddViewProperty(realRelationship, ntp); } } else if (type.Equals(CswEnumNbtViewRelatedIdType.ObjectClassId)) { CswNbtMetaDataObjectClass oc = _CswNbtResources.MetaData.getObjectClass(Id); CswNbtMetaDataObjectClassProp ocp = oc.getObjectClassProp(prop.PropName); if (null != ocp) { CurrentView.AddViewProperty(realRelationship, prop); } else { foreach (CswNbtMetaDataNodeType nt in oc.getNodeTypes()) { CswNbtMetaDataNodeTypeProp ntp = nt.getNodeTypeProp(prop.PropName); if (null != ntp) { CurrentView.AddViewProperty(realRelationship, prop); } } } } else { CswNbtMetaDataPropertySet ps = _CswNbtResources.MetaData.getPropertySet(Id); CswNbtMetaDataObjectClassProp ocp = ps.getPropertySetProps().FirstOrDefault(PropSetProp => PropSetProp.PropName == prop.PropName); if (null != ocp) { CurrentView.AddViewProperty(realRelationship, prop); } else { foreach (CswNbtMetaDataObjectClass oc in ps.getObjectClasses()) { foreach (CswNbtMetaDataNodeType nt in oc.getNodeTypes()) { CswNbtMetaDataNodeTypeProp ntp = nt.getNodeTypeProp(prop.PropName); if (null != ntp) { CurrentView.AddViewProperty(realRelationship, prop); } } } } } } } } }; CswNbtView tempView = _CswNbtResources.ViewSelect.restoreView(CurrentView.ToString()); tempView.Root.eachRelationship(eachRelationship, null); }
private void _upgradeEquipmentNTPs() { CswNbtMetaDataObjectClass EquipmentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.EquipmentClass); CswCommaDelimitedString ConditionOptions = new CswCommaDelimitedString { "New", "Refurbished", "Used" }; _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Condition, FieldType = CswEnumNbtFieldType.List, ListOptions = ConditionOptions.ToString() }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.ContractNo, FieldType = CswEnumNbtFieldType.Text }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Description, FieldType = CswEnumNbtFieldType.Memo }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.HasServiceContract, FieldType = CswEnumNbtFieldType.Logical }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.MTBF, FieldType = CswEnumNbtFieldType.MTBF }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.ManualStoredAt, FieldType = CswEnumNbtFieldType.Text }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Manufacturer, FieldType = CswEnumNbtFieldType.Text }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Model, FieldType = CswEnumNbtFieldType.Text }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Notes, FieldType = CswEnumNbtFieldType.Memo }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.OutOn, FieldType = CswEnumNbtFieldType.DateTime }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Picture, FieldType = CswEnumNbtFieldType.Image }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.PropertyNo, FieldType = CswEnumNbtFieldType.Text }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Purchased, FieldType = CswEnumNbtFieldType.DateTime }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Received, FieldType = CswEnumNbtFieldType.DateTime }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.SerialNo, FieldType = CswEnumNbtFieldType.Text }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.ServiceCost, FieldType = CswEnumNbtFieldType.Text }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.ServiceEndsOn, FieldType = CswEnumNbtFieldType.DateTime }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.ServicePhone, FieldType = CswEnumNbtFieldType.Text }); CswNbtMetaDataObjectClass VendorOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.VendorClass); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.ServiceVendor, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = VendorOC.ObjectClassId }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.StartingCost, FieldType = CswEnumNbtFieldType.Text }); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Vendor, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = VendorOC.ObjectClassId }); CswNbtMetaDataObjectClass DepartmentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.DepartmentClass); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Department, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = DepartmentOC.ObjectClassId }); _createGridOCPFromNTP(EquipmentOC, CswNbtObjClassEquipment.PropertyName.Documents); _createGridOCPFromNTP(EquipmentOC, CswNbtObjClassEquipment.PropertyName.Problem); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.Responsible, FieldType = CswEnumNbtFieldType.Text }); _createGridOCPFromNTP(EquipmentOC, CswNbtObjClassEquipment.PropertyName.Schedule); _createGridOCPFromNTP(EquipmentOC, CswNbtObjClassEquipment.PropertyName.Task); CswNbtMetaDataObjectClass UserOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.UserClass); CswNbtMetaDataObjectClassProp UserOCP = _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.User, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = UserOC.ObjectClassId }); CswNbtMetaDataObjectClassProp PhoneOCP = UserOC.getObjectClassProp(CswNbtObjClassUser.PropertyName.Phone); _addOCP(EquipmentOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassEquipment.PropertyName.UserPhone, FieldType = CswEnumNbtFieldType.PropertyReference, IsFk = true, FkType = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString(), FkValue = UserOCP.PropId, ValuePropId = PhoneOCP.PropId, ValuePropType = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString() }); }
protected void CswViewTree_DataBinding(object sender, EventArgs e) { try { CswTimer DataBindTimer = new CswTimer(); _CswNbtResources.logTimerResult("CswViewListTree.DataBind() started", DataBindTimer.ElapsedDurationInSecondsAsString); EnsureChildControls(); // don't bother databinding on postback -- this prevents losing the currently selected node if (TreeView.SelectedNode == null) { // BZ 8686 if (Page.Session[SessionCachedXmlName] != null && Page.Session[SessionCachedXmlName].ToString() != string.Empty) { TreeView.LoadXml(Page.Session[SessionCachedXmlName].ToString()); } else { XmlDocument XmlDoc = new XmlDocument(); XmlNode DocRoot = XmlDoc.CreateElement("Tree"); XmlDoc.AppendChild(DocRoot); // Views Dictionary <CswNbtViewId, CswNbtView> Views = _CswNbtResources.ViewSelect.getVisibleViews("lower(NVL(v.category, v.viewname)), lower(v.viewname)", false); foreach (CswNbtView View in Views.Values) { // BZ 10121 // This is a performance hit, but since this view list is cached, it's ok CswNbtView CurrentView = new CswNbtView(_CswNbtResources); CurrentView.LoadXml(View.ToXml()); CurrentView.ViewId = View.ViewId; // if( CurrentView.IsFullyEnabled() ) -- Case 20452: getVisibleViews() does this already XmlNode CategoryNode = _getCategoryNode(DocRoot, View.Category); bool ThisSearchable = View.ToXml().ToString().Contains("<Filter"); CategoryNode.AppendChild(_makeTreeViewXmlNode(XmlDoc, CurrentView.ViewId.ToString(), ViewType.View, CurrentView.ViewName, CurrentView.IconFileName, true, ThisSearchable)); } // Actions foreach (CswNbtAction Action in _CswNbtResources.Actions) { if (Action.ShowInList && (_CswNbtResources.ConfigVbls.getConfigVariableValue("loc_use_images") != "0") && _CswNbtResources.Permit.can(Action.Name)) { XmlNode CategoryNode = _getCategoryNode(DocRoot, Action.Category); CategoryNode.AppendChild(_makeTreeViewXmlNode(XmlDoc, Action.ActionId.ToString(), ViewType.Action, Action.Name.ToString().Replace('_', ' '), CswNbtMetaDataObjectClass.IconPrefix16 + "wizard.png", true, false)); } } // Reports CswNbtView ReportView = new CswNbtView(_CswNbtResources); ReportView.ViewName = "CswViewTree.DataBinding.ReportView"; CswNbtMetaDataObjectClass ReportMetaDataObjectClass = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ReportClass); CswNbtViewRelationship ReportRelationship = ReportView.AddViewRelationship(ReportMetaDataObjectClass, true); ICswNbtTree ReportTree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, ReportView, true, false, false); for (int i = 0; i < ReportTree.getChildNodeCount(); i++) { ReportTree.goToNthChild(i); CswNbtObjClassReport ReportNode = (CswNbtObjClassReport)ReportTree.getNodeForCurrentPosition(); XmlNode CategoryNode = _getCategoryNode(DocRoot, ReportNode.Category.Text); CategoryNode.AppendChild(_makeTreeViewXmlNode(XmlDoc, ReportNode.NodeId.PrimaryKey.ToString(), ViewType.Report, ReportNode.ReportName.Text, "Images/view/report.gif", true, false)); ReportTree.goToParentNode(); } TreeView.LoadXml(XmlDoc.InnerXml); Page.Session.Add(SessionCachedXmlName, XmlDoc.InnerXml); } // if-else( Page.Session[SessionCachedXmlName] != null && Page.Session[SessionCachedXmlName].ToString() != string.Empty ) } // if(TreeView.SelectedNode == null) _CswNbtResources.logTimerResult("CswViewListTree.DataBind() finished", DataBindTimer.ElapsedDurationInSecondsAsString); } catch (Exception ex) { HandleError(ex); } }
private void setupGridColumns(DataSet DS, CswNbtView View) { _Grid.Columns.Clear(); // Edit column GridBoundColumn EditColumn = new GridBoundColumn(); EditColumn.UniqueName = "EditColumn"; EditColumn.HeaderText = "Edit"; EditColumn.DataField = "Edit"; EditColumn.Display = ShowActionColumns; _Grid.Columns.Add(EditColumn); // Node column GridBoundColumn NodeNameColumn = new GridBoundColumn(); NodeNameColumn.UniqueName = "NodeName"; NodeNameColumn.HeaderText = "Node Name"; NodeNameColumn.DataField = "NodeName"; // BZ 6704 NodeNameColumn.Visible = false; NodeNameColumn.Display = false; _Grid.Columns.Add(NodeNameColumn); // NodeKey column GridBoundColumn NodeKeyColumn = new GridBoundColumn(); NodeKeyColumn.UniqueName = "NodeKey"; NodeKeyColumn.HeaderText = "NodeKey"; NodeKeyColumn.DataField = "NodeKey"; NodeKeyColumn.Display = false; _Grid.Columns.Add(NodeKeyColumn); foreach (DataTable Table in DS.Tables) { foreach (DataColumn Column in Table.Columns) { string ColumnName = Column.ColumnName; if (ColumnName.Length > PropColumnPrefix.Length && ColumnName.Substring(0, PropColumnPrefix.Length) == PropColumnPrefix) { string NoPrefixColumnName = ColumnName.Substring(PropColumnPrefix.Length); //Int32 CurrentNodeTypePropId = CswConvert.ToInt32( NoPrefixColumnName.Substring( 0, NoPrefixColumnName.IndexOf( '_' ) ) ); string RealColumnName = CswTools.XmlRealAttributeName(NoPrefixColumnName); //.Substring( NoPrefixColumnName.IndexOf( '_' ) + 1 ) ); //CswNbtMetaDataNodeTypeProp CurrentNodeTypeProp = _CswNbtResources.MetaData.getNodeTypeProp( CurrentNodeTypePropId ); //CswNbtViewProperty CurrentViewProp = View.FindPropertyById( CswNbtPropType.NodeTypePropId, CurrentNodeTypePropId ); CswNbtViewProperty CurrentViewProp = View.findPropertyByName(RealColumnName); //if( CurrentViewProp == null ) // CurrentViewProp = View.FindPropertyByName( CurrentNodeTypeProp.PropName ); CswEnumNbtFieldType ColFieldType = CswNbtResources.UnknownEnum; if (CurrentViewProp != null) { if (((CswNbtViewRelationship)CurrentViewProp.Parent).SecondType == CswEnumNbtViewRelatedIdType.NodeTypeId) { CswNbtMetaDataNodeType CurrentNT = _CswNbtResources.MetaData.getNodeType(((CswNbtViewRelationship)CurrentViewProp.Parent).SecondId); CswNbtMetaDataNodeTypeProp CurrentNTP = CurrentNT.getNodeTypeProp(RealColumnName); if (CurrentNTP != null) { ColFieldType = CurrentNTP.getFieldTypeValue(); } } else if (((CswNbtViewRelationship)CurrentViewProp.Parent).SecondType == CswEnumNbtViewRelatedIdType.ObjectClassId) { CswNbtMetaDataObjectClass CurrentOC = _CswNbtResources.MetaData.getObjectClass(((CswNbtViewRelationship)CurrentViewProp.Parent).SecondId); foreach (CswNbtMetaDataNodeType CurrentNT in CurrentOC.getNodeTypes()) { CswNbtMetaDataNodeTypeProp CurrentNTP = CurrentNT.getNodeTypeProp(RealColumnName); if (CurrentNTP != null) { ColFieldType = CurrentNTP.getFieldTypeValue(); } } } } GridBoundColumn thisColumn = null; //switch( CurrentNodeTypeProp.FieldType.FieldType ) switch (ColFieldType) { case CswEnumNbtFieldType.DateTime: thisColumn = new GridDateTimeColumn(); thisColumn.DataFormatString = "{0:M/d/yyyy}"; thisColumn.DataType = typeof(DateTime); break; //case CswEnumNbtFieldType.Time: // thisColumn = new GridDateTimeColumn(); // thisColumn.DataFormatString = "{0:H:mm:ss}"; // thisColumn.DataType = typeof( DateTime ); // break; default: thisColumn = new GridBoundColumn(); break; } thisColumn.UniqueName = ColumnName; thisColumn.HeaderText = RealColumnName; thisColumn.DataField = ColumnName; if (CurrentViewProp != null && CurrentViewProp.Width != Int32.MinValue) { thisColumn.HeaderStyle.Width = Unit.Parse((CswConvert.ToInt32(CurrentViewProp.Width * 7)).ToString() + "px"); // average pixel width per character } //thisColumn.OrderIndex = CurrentViewProp.Order; //Telerik.Web.UI.GridTableView GTV = new GridTableView( _Grid ); if (CurrentViewProp != null && CurrentViewProp.Order > 0 && _Grid.Columns.Count >= CurrentViewProp.Order) { _Grid.Columns.AddAt(CurrentViewProp.Order, thisColumn); } else { _Grid.Columns.Add(thisColumn); } } } } // Delete column GridBoundColumn DeleteColumn = new GridBoundColumn(); DeleteColumn.UniqueName = "DeleteColumn"; DeleteColumn.HeaderText = "Delete"; DeleteColumn.DataField = "Delete"; DeleteColumn.Display = ShowActionColumns; _Grid.Columns.Add(DeleteColumn); } // setupGridColumns()
public override void update() { Dictionary<CswEnumNbtPropertySetName, Int32> PropSetDict = new Dictionary<CswEnumNbtPropertySetName, Int32>(); { // Populate property_set CswTableUpdate PropSetUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "28160_ps_update", "property_set" ); DataTable PropSetTable = PropSetUpdate.getEmptyTable(); foreach( CswEnumNbtPropertySetName PropSetName in CswEnumNbtPropertySetName.All ) { if( PropSetName != CswEnumNbtPropertySetName.MaterialSet ) { DataRow Row = PropSetTable.NewRow(); Row["name"] = PropSetName; switch( PropSetName ) { case CswEnumNbtPropertySetName.GeneratorTargetSet: Row["iconfilename"] = "clipboardcheck.png"; break; case CswEnumNbtPropertySetName.InspectionParentSet: Row["iconfilename"] = "target.png"; break; case CswEnumNbtPropertySetName.RequestItemSet: Row["iconfilename"] = "cart.png"; break; case CswEnumNbtPropertySetName.SchedulerSet: Row["iconfilename"] = "calendar.png"; break; } PropSetTable.Rows.Add( Row ); PropSetDict[PropSetName] = CswConvert.ToInt32( Row["propertysetid"] ); } } PropSetUpdate.update( PropSetTable ); } Dictionary<CswEnumNbtObjectClass, CswEnumNbtPropertySetName> Dict = new Dictionary<CswEnumNbtObjectClass, CswEnumNbtPropertySetName>(); Dict.Add( CswEnumNbtObjectClass.InspectionDesignClass, CswEnumNbtPropertySetName.GeneratorTargetSet ); Dict.Add( CswEnumNbtObjectClass.TaskClass, CswEnumNbtPropertySetName.GeneratorTargetSet ); Dict.Add( CswEnumNbtObjectClass.InspectionTargetClass, CswEnumNbtPropertySetName.InspectionParentSet ); Dict.Add( CswEnumNbtObjectClass.RequestContainerDispenseClass, CswEnumNbtPropertySetName.RequestItemSet ); Dict.Add( CswEnumNbtObjectClass.RequestContainerUpdateClass, CswEnumNbtPropertySetName.RequestItemSet ); Dict.Add( CswEnumNbtObjectClass.RequestMaterialCreateClass, CswEnumNbtPropertySetName.RequestItemSet ); Dict.Add( CswEnumNbtObjectClass.RequestMaterialDispenseClass, CswEnumNbtPropertySetName.RequestItemSet ); Dict.Add( CswEnumNbtObjectClass.GeneratorClass, CswEnumNbtPropertySetName.SchedulerSet ); Dict.Add( CswEnumNbtObjectClass.MailReportClass, CswEnumNbtPropertySetName.SchedulerSet ); { // Populate jct_propertyset_objectclass CswTableUpdate JctUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "28160_jct_update", "jct_propertyset_objectclass" ); DataTable JctTable = JctUpdate.getEmptyTable(); foreach( CswEnumNbtObjectClass oc in Dict.Keys ) { DataRow NewRow = JctTable.NewRow(); NewRow["objectclassid"] = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassId( oc ); NewRow["propertysetid"] = CswConvert.ToDbVal( PropSetDict[Dict[oc]] ); JctTable.Rows.Add( NewRow ); } JctUpdate.update( JctTable ); } { // Populate jct_propertyset_objectclassprop CswTableUpdate JctUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "28160_jct2_update", "jct_propertyset_ocprop" ); DataTable JctTable = JctUpdate.getEmptyTable(); foreach( CswEnumNbtObjectClass oc in Dict.Keys ) { CswNbtMetaDataObjectClass ObjectClass = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( oc ); foreach( CswNbtMetaDataObjectClassProp ObjectClassProp in ObjectClass.getObjectClassProps() ) { bool doInsert = false; switch( Dict[oc] ) { case CswEnumNbtPropertySetName.GeneratorTargetSet: doInsert = ( ObjectClassProp.PropName == CswNbtPropertySetGeneratorTarget.PropertyName.CreatedDate || ObjectClassProp.PropName == CswNbtPropertySetGeneratorTarget.PropertyName.DueDate || ObjectClassProp.PropName == CswNbtPropertySetGeneratorTarget.PropertyName.Generator || ObjectClassProp.PropName == CswNbtPropertySetGeneratorTarget.PropertyName.IsFuture ); break; case CswEnumNbtPropertySetName.RequestItemSet: doInsert = ( ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.AssignedTo || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Comments || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Description || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.ExternalOrderNumber || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Fulfill || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.InventoryGroup || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Location || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Material || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Name || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.NeededBy || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Number || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Priority || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Request || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.RequestedFor || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Requestor || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Status || ObjectClassProp.PropName == CswNbtPropertySetRequestItem.PropertyName.Type ); break; case CswEnumNbtPropertySetName.InspectionParentSet: doInsert = ( ObjectClassProp.PropName == "Status" ); break; case CswEnumNbtPropertySetName.SchedulerSet: doInsert = ( ObjectClassProp.PropName == "Status" || ObjectClassProp.PropName == "Final Due Date" || ObjectClassProp.PropName == "Next Due Date" || ObjectClassProp.PropName == "Run Status" || ObjectClassProp.PropName == "Warning Days" || ObjectClassProp.PropName == "Due Date Interval" || ObjectClassProp.PropName == "Run Time" || ObjectClassProp.PropName == "Enabled" ); break; } if( doInsert ) { DataRow NewRow = JctTable.NewRow(); NewRow["objectclasspropid"] = ObjectClassProp.PropId; NewRow["propertysetid"] = CswConvert.ToDbVal( PropSetDict[Dict[oc]] ); JctTable.Rows.Add( NewRow ); } } // foreach( CswNbtMetaDataObjectClassProp ObjectClassProp in ObjectClass.getObjectClassProps() ) } // foreach( NbtObjectClass oc in OcPsDict.Keys ) JctUpdate.update( JctTable ); } } // update()
public override void update() { if (_CswNbtSchemaModTrnsctn.isMaster()) { CswNbtMetaDataObjectClass ContainerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass); foreach (CswNbtMetaDataNodeType ContainerNT in ContainerOC.getNodeTypes()) { CswNbtMetaDataNodeTypeTab firstTab = ContainerNT.getFirstNodeTypeTab(); CswNbtMetaDataNodeTypeTab identityTab = ContainerNT.getIdentityTab(); //update the edit layout CswNbtMetaDataNodeTypeProp BarcodeNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.Barcode); BarcodeNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, identityTab.TabId, 1, 1); CswNbtMetaDataNodeTypeProp MaterialNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.Material); MaterialNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, identityTab.TabId, 2, 1); CswNbtMetaDataNodeTypeProp QuantityNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.Quantity); QuantityNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, identityTab.TabId, 3, 1); CswNbtMetaDataNodeTypeProp OwnerNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.Owner); OwnerNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 1, 1); OwnerNTP.updateLayout(CswEnumNbtLayoutType.Add, true, firstTab.TabId, 1, 1); CswNbtMetaDataNodeTypeProp LocationNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.Location); LocationNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 2, 1); LocationNTP.updateLayout(CswEnumNbtLayoutType.Add, true, firstTab.TabId, 2, 1); CswNbtMetaDataNodeTypeProp OpenButtonNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.Open); OpenButtonNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 4, 1); CswNbtMetaDataNodeTypeProp OpenedDateNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.OpenedDate); OpenedDateNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 5, 1); CswNbtMetaDataNodeTypeProp DateCreatedNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.DateCreated); DateCreatedNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 6, 1); CswNbtMetaDataNodeTypeProp LabelFormatNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.LabelFormat); LabelFormatNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 7, 1); LabelFormatNTP.updateLayout(CswEnumNbtLayoutType.Add, true, firstTab.TabId, 5, 1); CswNbtMetaDataNodeTypeProp ExpDateNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.ExpirationDate); ExpDateNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 3, 1); ExpDateNTP.updateLayout(CswEnumNbtLayoutType.Add, true, firstTab.TabId, 3, 1); CswNbtMetaDataNodeTypeProp MissingNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.Missing); MissingNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 2, 2); CswNbtMetaDataNodeTypeProp StatusNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.Status); StatusNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 3, 2); CswNbtMetaDataNodeTypeProp RecieptLotNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.ReceiptLot); RecieptLotNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 4, 2); CswNbtMetaDataNodeTypeProp ContainerGroupNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.ContainerGroup); ContainerGroupNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 5, 2); CswNbtMetaDataNodeTypeProp ContainerFamilyNTP = ContainerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.ContainerFamily); ContainerFamilyNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 6, 2); CswNbtMetaDataNodeTypeProp UndisposeContainerNTP = ContainerNT.getNodeTypePropByObjectClassProp (CswNbtObjClassContainer.PropertyName.Undispose); UndisposeContainerNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 7, 2); CswNbtMetaDataNodeTypeProp DisposeContainerNTP = ContainerNT.getNodeTypePropByObjectClassProp (CswNbtObjClassContainer.PropertyName.Dispose); DisposeContainerNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, firstTab.TabId, 8, 2); //update the preview layout BarcodeNTP.updateLayout(CswEnumNbtLayoutType.Preview, true, identityTab.TabId, 1, 1); MaterialNTP.updateLayout(CswEnumNbtLayoutType.Preview, true, identityTab.TabId, 2, 1); QuantityNTP.updateLayout(CswEnumNbtLayoutType.Preview, true, identityTab.TabId, 3, 1); } } }
public override void update() { CswNbtMetaDataObjectClass MailReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MailReportClass ); CswNbtMetaDataNodeType MailReportNT = MailReportOC.FirstNodeType; if( null != MailReportNT ) { CswNbtMetaDataNodeTypeProp DueDateIntervalNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.DueDateInterval ); CswNbtMetaDataNodeTypeProp EnabledNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Enabled ); CswNbtMetaDataNodeTypeProp EventNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Event ); CswNbtMetaDataNodeTypeProp FinalDueDateNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.FinalDueDate ); CswNbtMetaDataNodeTypeProp LastProcessedNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.LastProcessed ); CswNbtMetaDataNodeTypeProp MessageNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Message ); CswNbtMetaDataNodeTypeProp NameNTP = MailReportNT.getNodeTypeProp( "Name" ); CswNbtMetaDataNodeTypeProp NextDueDateNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.NextDueDate ); CswNbtMetaDataNodeTypeProp NodesToReportNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.NodesToReport ); CswNbtMetaDataNodeTypeProp OutputFormatNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.OutputFormat ); CswNbtMetaDataNodeTypeProp RecipientsNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Recipients ); CswNbtMetaDataNodeTypeProp ReportNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Report ); CswNbtMetaDataNodeTypeProp ReportViewNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.ReportView ); CswNbtMetaDataNodeTypeProp RunNowNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.RunNow ); CswNbtMetaDataNodeTypeProp RunStatusNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.RunStatus ); CswNbtMetaDataNodeTypeProp RunTimeNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.RunTime ); CswNbtMetaDataNodeTypeProp TargetTypeNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.TargetType ); CswNbtMetaDataNodeTypeProp TypeNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Type ); CswNbtMetaDataNodeTypeProp NTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.WarningDays ); CswNbtMetaDataNodeTypeLayoutMgr.LayoutType LayoutEdit = CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit; CswNbtMetaDataNodeTypeTab Tab1 = MailReportNT.getFirstNodeTypeTab(); CswNbtMetaDataNodeTypeTab Tab2 = MailReportNT.getSecondNodeTypeTab(); // Fix default mail report layout if( Tab2 == null ) { Tab2 = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( MailReportNT, "Schedule", 2 ); } else { Tab2.TabName = "Schedule"; // formerly "Settings" } // clear the old layout _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.clearLayout( LayoutEdit, MailReportNT.NodeTypeId ); // setup the new layout if( null != NameNTP ) { NameNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 1, 1 ); } TypeNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 2, 1 ); ReportNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 3, 1 ); EventNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 4, 1 ); ReportViewNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 5, 1 ); TargetTypeNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 6, 1 ); OutputFormatNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 7, 1 ); MessageNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 8, 1 ); RecipientsNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 9, 1 ); EnabledNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 10, 1 ); RunNowNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 11, 1 ); DueDateIntervalNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 1, 1 ); NextDueDateNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 2, 1 ); FinalDueDateNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 3, 1 ); RunTimeNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 4, 1 ); LastProcessedNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 5, 1 ); RunStatusNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 6, 1 ); // Remove Output Format from add layout OutputFormatNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add ); } }//Update()
public override void update() { // cispro grid views: category=Containers , scope=global // name=Expiring Containers (expiration<=today+30) mode=grid, struct=container>size>material CswNbtMetaDataObjectClass contOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.ContainerClass ); CswNbtMetaDataObjectClassProp contSizeProp = contOC.getObjectClassProp( CswNbtObjClassContainer.SizePropertyName ); CswNbtMetaDataObjectClassProp contBarcodeProp = contOC.getObjectClassProp( CswNbtObjClassContainer.BarcodePropertyName ); CswNbtMetaDataObjectClassProp contQuantityProp = contOC.getObjectClassProp( CswNbtObjClassContainer.QuantityPropertyName ); CswNbtMetaDataObjectClassProp contLocationProp = contOC.getObjectClassProp( CswNbtObjClassContainer.LocationPropertyName ); CswNbtMetaDataObjectClassProp contExpiresProp = contOC.getObjectClassProp( CswNbtObjClassContainer.ExpirationDatePropertyName ); CswNbtMetaDataObjectClassProp contMissingProp = contOC.getObjectClassProp( CswNbtObjClassContainer.MissingPropertyName ); CswNbtMetaDataObjectClass sizeOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.SizeClass ); CswNbtMetaDataObjectClassProp sizeMatProp = sizeOC.getObjectClassProp( CswNbtObjClassSize.MaterialPropertyName ); CswNbtMetaDataObjectClass matOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass ); CswNbtMetaDataObjectClassProp matTradenameProp = matOC.getObjectClassProp( CswNbtObjClassMaterial.TradenamePropertyName ); CswNbtMetaDataObjectClassProp matSupplierProp = matOC.getObjectClassProp( CswNbtObjClassMaterial.SupplierPropertyName ); CswNbtMetaDataObjectClassProp matPartNumberProp = matOC.getObjectClassProp( CswNbtObjClassMaterial.PartNumberPropertyName ); CswNbtView expView = _CswNbtSchemaModTrnsctn.makeView(); expView.makeNew( "Expiring Containers", NbtViewVisibility.Global ); expView.ViewMode = NbtViewRenderingMode.Grid; CswNbtViewRelationship contRelationship = expView.AddViewRelationship( contOC, true ); //add size CswNbtViewRelationship sizeRelationship = expView.AddViewRelationship( contRelationship, NbtViewPropOwnerType.First, contSizeProp, true ); //add material CswNbtViewRelationship matRelationship = expView.AddViewRelationship( sizeRelationship, NbtViewPropOwnerType.First, sizeMatProp, true ); //add props CswNbtViewProperty bcViewProp = expView.AddViewProperty( contRelationship, contBarcodeProp ); bcViewProp.Order = 1; CswNbtViewProperty expViewProp = expView.AddViewProperty( contRelationship, contExpiresProp ); expViewProp.Order = 2; CswNbtViewProperty tnameViewProp = expView.AddViewProperty( matRelationship, matTradenameProp ); tnameViewProp.Order = 3; CswNbtViewProperty suppViewProp = expView.AddViewProperty( matRelationship, matSupplierProp ); suppViewProp.Order = 4; CswNbtViewProperty partViewProp = expView.AddViewProperty( matRelationship, matPartNumberProp ); partViewProp.Order = 5; CswNbtViewProperty qtyViewProp = expView.AddViewProperty( contRelationship, contQuantityProp ); qtyViewProp.Order = 6; CswNbtViewProperty locViewProp = expView.AddViewProperty( contRelationship, contLocationProp ); locViewProp.Order = 7; expView.save(); // Missing Containers (missing==true) CswNbtView missingView = _CswNbtSchemaModTrnsctn.makeView(); missingView.makeNew( "Missing Containers", NbtViewVisibility.Global, null, null, expView ); missingView.save(); //add filters expView.AddViewPropertyFilter( expViewProp, CswNbtSubField.SubFieldName.Value, CswNbtPropFilterSql.PropertyFilterMode.LessThanOrEquals, "today+30", false ); expView.save(); CswNbtViewProperty missingViewProp = expView.AddViewProperty( contRelationship, contMissingProp ); missingViewProp.Order = 8; missingViewProp.ShowInGrid = false; missingView.AddViewPropertyFilter( missingViewProp, CswNbtSubField.SubFieldName.Value, CswNbtPropFilterSql.PropertyFilterMode.Equals, true.ToString(), false ); missingView.save(); }//Update()
protected void _populatePropsCollection(CswNbtViewRelationship relationship, CswNbtView TempView, Collection <CswNbtViewProperty> Props, HashSet <string> seenProps, bool UseMetaName = false, bool overrideFirst = false, bool DoCheck = true) { CswEnumNbtViewRelatedIdType type; Int32 Id; if (relationship.PropOwner == CswEnumNbtViewPropOwnerType.First && Int32.MinValue != relationship.FirstId && false == overrideFirst) { type = relationship.FirstType; Id = relationship.FirstId; } else { type = relationship.SecondType; Id = relationship.SecondId; } if (type.Equals(CswEnumNbtViewRelatedIdType.NodeTypeId)) { CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType(Id); if (null != NodeType) { Collection <CswNbtViewProperty> props = _getProps(NodeType, TempView, seenProps, relationship, DoCheck); foreach (CswNbtViewProperty vp in props) { if (UseMetaName) { vp.TextLabel = NodeType.NodeTypeName + "'s " + vp.MetaDataProp.PropName; } if (false == DoCheck && false == seenProps.Contains(vp.TextLabel) || DoCheck) { seenProps.Add(vp.TextLabel); Props.Add(vp); } } } } else if (type.Equals(CswEnumNbtViewRelatedIdType.ObjectClassId)) { CswNbtMetaDataObjectClass ObjClass = _CswNbtResources.MetaData.getObjectClass(Id); if (null != ObjClass) { Collection <CswNbtViewProperty> props = _getProps(ObjClass, TempView, seenProps, relationship, DoCheck); foreach (CswNbtViewProperty vp in props) { if (UseMetaName) { vp.TextLabel = ObjClass.ObjectClass.Value + "'s " + vp.MetaDataProp.PropName; } Props.Add(vp); } } } else if (type.Equals(CswEnumNbtViewRelatedIdType.PropertySetId)) { CswNbtMetaDataPropertySet PropSet = _CswNbtResources.MetaData.getPropertySet(Id); if (null != PropSet) { foreach (CswNbtMetaDataObjectClass ObjClass in PropSet.getObjectClasses()) { Collection <CswNbtViewProperty> props = _getProps(ObjClass, TempView, seenProps, relationship, DoCheck); foreach (CswNbtViewProperty vp in props) { if (UseMetaName) { vp.TextLabel = ObjClass.ObjectClass.Value + "'s " + vp.MetaDataProp.PropName; } Props.Add(vp); } } } } }