public override void update() { CswNbtMetaDataObjectClass SizeOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.SizeClass ); CswNbtMetaDataObjectClassProp QeOcp = SizeOc.getObjectClassProp( CswNbtObjClassSize.QuantityEditablePropertyName ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( QeOcp, QeOcp.getFieldTypeRule().SubFields.Default.Name, Tristate.True ); }//Update()
public Collection<string> getCASNumbers() { Collection<string> ret = new Collection<string>(); CswNbtMetaDataObjectClass RegListCasNoOC = _CswNbtResources.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListCasNoClass ); CswNbtMetaDataObjectClassProp RegListCasNoCasNoOCP = RegListCasNoOC.getObjectClassProp( CswNbtObjClassRegulatoryListCasNo.PropertyName.CASNo ); CswNbtMetaDataObjectClassProp RegListCasNoRegListOCP = RegListCasNoOC.getObjectClassProp( CswNbtObjClassRegulatoryListCasNo.PropertyName.RegulatoryList ); CswNbtView View = new CswNbtView( _CswNbtResources ); View.ViewName = "Reglist_getCASNumbers"; CswNbtViewRelationship casnoRel = View.AddViewRelationship( RegListCasNoOC, false ); View.AddViewProperty( casnoRel, RegListCasNoCasNoOCP ); View.AddViewPropertyAndFilter( casnoRel, RegListCasNoRegListOCP, SubFieldName: CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID, FilterMode: CswEnumNbtFilterMode.Equals, Value: this.NodeId.PrimaryKey.ToString() ); ICswNbtTree Tree = _CswNbtResources.Trees.getTreeFromView( View, RequireViewPermissions: false, IncludeSystemNodes: true, IncludeHiddenNodes: true ); for( Int32 i = 0; i < Tree.getChildNodeCount(); i++ ) { Tree.goToNthChild( i ); CswNbtTreeNodeProp casnoTreeProp = Tree.getChildNodePropsOfNode().FirstOrDefault( p => p.ObjectClassPropName == RegListCasNoCasNoOCP.PropName ); if( null != casnoTreeProp ) { ret.Add( casnoTreeProp[( (CswNbtFieldTypeRuleCASNo) RegListCasNoCasNoOCP.getFieldTypeRule() ).TextSubField.Column] ); } Tree.goToParentNode(); } return ret; } // getCASNumbers()
public static void CheckContainerBarcodes(ICswResources CswResources, CswNbtContainerBarcodeCheckReturn ErrorMsg, Collection <CswNbtAmountsGridQuantity> Quantities) { CswNbtResources NbtResources = (CswNbtResources)CswResources; CswNbtMetaDataObjectClass ContainerOC = NbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass); CswNbtMetaDataObjectClassProp BarcodeOCP = (CswNbtMetaDataObjectClassProp)ContainerOC.getBarcodeProperty(); CswCommaDelimitedString barcodeNTPs = new CswCommaDelimitedString(); foreach (CswNbtMetaDataNodeTypeProp barcodeNTP in BarcodeOCP.getNodeTypeProps()) { barcodeNTPs.Add(barcodeNTP.PropId.ToString()); } CswNbtFieldTypeRuleBarCode BarcodeFTR = (CswNbtFieldTypeRuleBarCode)BarcodeOCP.getFieldTypeRule(); CswCommaDelimitedString AllProposedBarcodes = new CswCommaDelimitedString(); HashSet <string> DuplicateBarcodes = new HashSet <string>(); HashSet <string> BarcodeLookup = new HashSet <string>(); foreach (CswNbtAmountsGridQuantity quantity in Quantities) { CswCommaDelimitedString barcodes = quantity.getBarcodes(); foreach (string barcode in barcodes) { AllProposedBarcodes.Add("'" + barcode.ToLower() + "'"); if (BarcodeLookup.Contains(barcode)) { DuplicateBarcodes.Add(barcode); } else { BarcodeLookup.Add(barcode); } } } if (AllProposedBarcodes.Count > 0) { if (DuplicateBarcodes.Count > 0) { CswCommaDelimitedString dupeCDS = HashSetToCDS(DuplicateBarcodes); ErrorMsg.Data = "There are following barcodes appear more than once: " + dupeCDS; } else { string barcodeSQL = @"select nodeid, field1 from jct_nodes_props where nodetypepropid in (" + barcodeNTPs + ") and lower(" + BarcodeFTR.BarcodeSubField.Column + ") in (" + AllProposedBarcodes + ")"; DataTable barcodesTbl = NbtResources.execArbitraryPlatformNeutralSqlSelect("WebServiceReceiving.CheckContainerBarcodes", barcodeSQL); if (barcodesTbl.Rows.Count > 0) { foreach (DataRow row in barcodesTbl.Rows) { DuplicateBarcodes.Add(row[BarcodeFTR.BarcodeSubField.Column.ToString()].ToString()); } CswCommaDelimitedString dupeCDS = HashSetToCDS(DuplicateBarcodes); ErrorMsg.Data = "There are following barcodes have already been assigned: " + dupeCDS; } } } }
public override void update() { CswNbtMetaDataObjectClass SizeOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswNbtMetaDataObjectClass.NbtObjectClass.SizeClass); CswNbtMetaDataObjectClassProp QeOcp = SizeOc.getObjectClassProp( CswNbtObjClassSize.QuantityEditablePropertyName ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(QeOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isrequired, true); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(QeOcp, QeOcp.getFieldTypeRule().SubFields.Default.Name, Tristate.False ); CswNbtMetaDataObjectClassProp DspOcp = SizeOc.getObjectClassProp( CswNbtObjClassSize.DispensablePropertyName ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DspOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isrequired, true ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( DspOcp, DspOcp.getFieldTypeRule().SubFields.Default.Name, Tristate.True ); }//Update()
} // _addRegListListModeProp() private void _addPropFiltertoAddCASNosProp() { CswNbtMetaDataObjectClass RegulatoryListOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.RegulatoryListClass); if (null != RegulatoryListOC) { CswNbtMetaDataObjectClassProp ListModeOCP = RegulatoryListOC.getObjectClassProp(CswNbtObjClassRegulatoryList.PropertyName.ListMode); CswNbtMetaDataObjectClassProp AddCASNumbersOCP = RegulatoryListOC.getObjectClassProp(CswNbtObjClassRegulatoryList.PropertyName.AddCASNumbers); AddCASNumbersOCP.setFilter(FilterProp: ListModeOCP, SubField: ListModeOCP.getFieldTypeRule().SubFields.Default, FilterMode: CswEnumNbtFilterMode.Equals, FilterValue: CswNbtObjClassRegulatoryList.CswEnumRegulatoryListListModes.ManuallyManaged); } } //_addPropFiltertoAddCASNosProp()
private void _addDefaultInspectionDesignViewPropsAndFilters(CswNbtView View, CswNbtViewRelationship InspectionDesignVr, CswNbtMetaDataObjectClass InspectionDesignOc) { CswNbtViewProperty DueDateVp = View.AddViewPropertyByName(InspectionDesignVr, InspectionDesignOc, CswNbtObjClassInspectionDesign.PropertyName.DueDate); DueDateVp.SortBy = true; CswNbtViewProperty LocationVp = View.AddViewPropertyByName(InspectionDesignVr, InspectionDesignOc, CswNbtObjClassInspectionDesign.PropertyName.Location); LocationVp.SortBy = true; View.AddViewPropertyByName(InspectionDesignVr, InspectionDesignOc, "Barcode"); CswNbtMetaDataObjectClassProp StatusOcp = InspectionDesignOc.getObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.Status); CswNbtViewProperty StatusVp = View.AddViewProperty(InspectionDesignVr, StatusOcp); string Completed = CswEnumNbtInspectionStatus.Completed; string Cancelled = CswEnumNbtInspectionStatus.Cancelled; string CompletedLate = CswEnumNbtInspectionStatus.CompletedLate; string Missed = CswEnumNbtInspectionStatus.Missed; View.AddViewPropertyFilter(StatusVp, StatusOcp.getFieldTypeRule().SubFields.Default.Name, CswEnumNbtFilterMode.NotEquals, Completed, false); View.AddViewPropertyFilter(StatusVp, StatusOcp.getFieldTypeRule().SubFields.Default.Name, CswEnumNbtFilterMode.NotEquals, Cancelled, false); View.AddViewPropertyFilter(StatusVp, StatusOcp.getFieldTypeRule().SubFields.Default.Name, CswEnumNbtFilterMode.NotEquals, CompletedLate, false); View.AddViewPropertyFilter(StatusVp, StatusOcp.getFieldTypeRule().SubFields.Default.Name, CswEnumNbtFilterMode.NotEquals, Missed, false); }
} //_makeNodeSql() private CswNbtSubField _getDefaultSubFieldForProperty(CswEnumNbtViewPropIdType Type, Int32 Id) { CswNbtSubField ret = null; if (Type == CswEnumNbtViewPropIdType.NodeTypePropId) { CswNbtMetaDataNodeTypeProp NodeTypeProp = _CswNbtResources.MetaData.getNodeTypeProp(Id); ret = NodeTypeProp.getFieldTypeRule().SubFields.Default; } else if (Type == CswEnumNbtViewPropIdType.ObjectClassPropId) { CswNbtMetaDataObjectClassProp ObjectClassProp = _CswNbtResources.MetaData.getObjectClassProp(Id); ret = ObjectClassProp.getFieldTypeRule().SubFields.Default; } return(ret); }
private void _createInvGrpPermApplyToAllOCPs() { CswNbtMetaDataObjectClass InvGrpPermOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.InventoryGroupPermissionClass); CswNbtMetaDataObjectClassProp ApplyToAllWorkUnitsOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(InvGrpPermOC) { PropName = CswNbtPropertySetPermission.PropertyName.ApplyToAllWorkUnits, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true, SetValOnAdd = true }); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(ApplyToAllWorkUnitsOCP, CswEnumTristate.False); CswNbtMetaDataObjectClassProp ApplyToAllRolesOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(InvGrpPermOC) { PropName = CswNbtPropertySetPermission.PropertyName.ApplyToAllRoles, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true, SetValOnAdd = true }); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(ApplyToAllRolesOCP, CswEnumTristate.False); CswNbtMetaDataObjectClassProp WorkUnitOCP = InvGrpPermOC.getObjectClassProp(CswNbtObjClassInventoryGroupPermission.PropertyName.WorkUnit); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(WorkUnitOCP, CswEnumNbtObjectClassPropAttributes.isrequired, false); WorkUnitOCP.setFilter(ApplyToAllWorkUnitsOCP, ApplyToAllWorkUnitsOCP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswEnumTristate.False); CswNbtMetaDataObjectClassProp RoleOCP = InvGrpPermOC.getObjectClassProp(CswNbtObjClassInventoryGroupPermission.PropertyName.Role); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(RoleOCP, CswEnumNbtObjectClassPropAttributes.isrequired, false); RoleOCP.setFilter(ApplyToAllRolesOCP, ApplyToAllRolesOCP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswEnumTristate.False); CswNbtMetaDataObjectClassProp PermissionGroupOCP = InvGrpPermOC.getObjectClassProp("Inventory Group"); if (null != PermissionGroupOCP) { CswTableUpdate OCPUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate("ChangeInvGrpPermName", "object_class_props"); DataTable OCPropTable = OCPUpdate.getTable("where objectclasspropid = " + PermissionGroupOCP.PropId); if (OCPropTable.Rows.Count > 0) { OCPropTable.Rows[0]["propname"] = CswNbtPropertySetPermission.PropertyName.PermissionGroup; OCPUpdate.update(OCPropTable); } } }
} //ctor Ntp public CswViewBuilderProp(CswNbtMetaDataObjectClassProp ObjectClassProp) { CswNbtMetaDataObjectClass oc = ObjectClassProp.getObjectClass(); if (null != oc) { OwnerName = oc.ObjectClass.Value; } FieldType = ObjectClassProp.getFieldTypeValue(); setObjectClassPropListOptions(ObjectClassProp); RelatedIdType = CswEnumNbtViewRelatedIdType.NodeTypeId; MetaDataPropNameWithQuestionNo = ObjectClassProp.PropNameWithQuestionNo; MetaDataPropId = ObjectClassProp.ObjectClassPropId; MetaDataPropName = ObjectClassProp.PropName; MetaDataTypeName = ObjectClassProp.getObjectClass().ObjectClass.ToString(); FieldTypeRule = ObjectClassProp.getFieldTypeRule(); Type = CswEnumNbtViewPropType.ObjectClassPropId; PropName = MetaDataPropName; AssociatedPropIds.Add(MetaDataPropId.ToString()); } //ctor Ntp
public override void update() { CswNbtMetaDataObjectClass RegListOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListClass ); CswNbtMetaDataObjectClassProp RegionsOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( RegListOC, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassRegulatoryList.PropertyName.Regions, FieldType = CswEnumNbtFieldType.MultiList } ); // Update ListModeOCP options CswNbtMetaDataObjectClassProp ListModeOCP = RegListOC.getObjectClassProp( CswNbtObjClassRegulatoryList.PropertyName.ListMode ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ListModeOCP, CswEnumNbtObjectClassPropAttributes.listoptions, CswNbtObjClassRegulatoryList.CswEnumRegulatoryListListModes.Options.ToString() ); // Set conditional filter RegionsOCP.setFilterDeprecated( FilterProp: ListModeOCP, SubField: ListModeOCP.getFieldTypeRule().SubFields.Default, FilterMode: CswEnumNbtFilterMode.Equals, FilterValue: CswNbtObjClassRegulatoryList.CswEnumRegulatoryListListModes.ArielManaged ); } // update()
/// <summary> /// Update logic /// </summary> public override void update() { CswNbtMetaDataObjectClass vendorOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.VendorClass ); /* Create the new properties Corporate Entity and Vendor Type */ CswNbtMetaDataObjectClassProp corporateEntityOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( vendorOC ) { PropName = "Corporate Entity", FieldType = CswNbtMetaDataFieldType.NbtFieldType.Text } ); CswNbtMetaDataObjectClassProp vendorTypeOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( vendorOC ) { PropName = "Vendor Type", FieldType = CswNbtMetaDataFieldType.NbtFieldType.List, ListOptions = "Sales,Corporate,Technical,Manufacturing" } ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( vendorTypeOCP, vendorTypeOCP.getFieldTypeRule().SubFields.Default.Name, "Sales" ); }//Update()
public override void update() { // Set MailReport.OutputFormat to be conditional on Type = Report CswNbtMetaDataObjectClass MailReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MailReportClass ); CswNbtMetaDataObjectClassProp TypeOCP = MailReportOC.getObjectClassProp( CswNbtObjClassMailReport.PropertyName.Type ); CswNbtMetaDataObjectClassProp OutputFormatOCP = MailReportOC.getObjectClassProp( CswNbtObjClassMailReport.PropertyName.OutputFormat ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( OutputFormatOCP, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.filterpropid, TypeOCP.PropId.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( OutputFormatOCP, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.filter, CswNbtMetaDataObjectClassProp.makeFilter( TypeOCP.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassMailReport.TypeOptionReport ) ); // because of case 27922, need to apply this to nodetypes manually foreach( CswNbtMetaDataNodeType MailReportNT in MailReportOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp TypeNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Type ); CswNbtMetaDataNodeTypeProp OutputFormatNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.OutputFormat ); OutputFormatNTP.setFilter( TypeNTP, TypeNTP.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassMailReport.TypeOptionReport ); // revert readonly foreach( CswNbtObjClassMailReport MailReportNode in MailReportNT.getNodes( false, true ) ) { MailReportNode.OutputFormat.setReadOnly( value: false, SaveToDb: true ); MailReportNode.postChanges( false ); } } // foreach( CswNbtMetaDataNodeType MailReportNT in MailReportOC.getNodeTypes() ) }//Update()
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()
private void _createPermissionClass(PermissionSetAttributes PermSet) { CswNbtMetaDataObjectClass PermissionOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(PermSet.PermissionClassName); if (null == PermissionOC) { PermissionOC = _CswNbtSchemaModTrnsctn.createObjectClass(PermSet.PermissionClassName, "doc.png", false); CswNbtMetaDataObjectClass GroupOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(PermSet.GroupClassName); _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionOC) { PropName = CswNbtPropertySetPermission.PropertyName.PermissionGroup, FieldType = CswEnumNbtFieldType.Relationship, IsRequired = true, SetValOnAdd = true, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = GroupOC.ObjectClassId }); CswNbtMetaDataObjectClass WorkUnitOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.WorkUnitClass); CswNbtMetaDataObjectClassProp WorkUnitOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionOC) { PropName = CswNbtPropertySetPermission.PropertyName.WorkUnit, FieldType = CswEnumNbtFieldType.Relationship, SetValOnAdd = true, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = WorkUnitOC.ObjectClassId }); CswNbtMetaDataObjectClassProp ApplyToAllWorkUnitsOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionOC) { PropName = CswNbtPropertySetPermission.PropertyName.ApplyToAllWorkUnits, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true, SetValOnAdd = true }); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(ApplyToAllWorkUnitsOCP, CswEnumTristate.False); WorkUnitOCP.setFilter(ApplyToAllWorkUnitsOCP, ApplyToAllWorkUnitsOCP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswEnumTristate.False); CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.RoleClass); CswNbtMetaDataObjectClassProp RoleOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionOC) { PropName = CswNbtPropertySetPermission.PropertyName.Role, FieldType = CswEnumNbtFieldType.Relationship, SetValOnAdd = true, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = RoleOC.ObjectClassId }); CswNbtMetaDataObjectClassProp ApplyToAllRolesOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionOC) { PropName = CswNbtPropertySetPermission.PropertyName.ApplyToAllRoles, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true, SetValOnAdd = true }); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(ApplyToAllRolesOCP, CswEnumTristate.False); RoleOCP.setFilter(ApplyToAllRolesOCP, ApplyToAllRolesOCP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswEnumTristate.False); CswNbtMetaDataObjectClassProp ViewOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionOC) { PropName = CswNbtPropertySetPermission.PropertyName.View, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true, SetValOnAdd = true }); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(ViewOCP, CswEnumTristate.False); CswNbtMetaDataObjectClassProp EditOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionOC) { PropName = CswNbtPropertySetPermission.PropertyName.Edit, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true, SetValOnAdd = true }); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(EditOCP, CswEnumTristate.False); } }
} // getCASNumbers() /// <summary> /// Returns a collection of matching Regulatory List primary keys, based on the provided cas numbers /// </summary> public static Collection<CswPrimaryKey> findMatches( CswNbtResources CswNbtResources, Collection<string> CasNos ) { Collection<CswPrimaryKey> ret = new Collection<CswPrimaryKey>(); if( CswNbtResources.Modules.IsModuleEnabled( CswEnumNbtModuleName.RegulatoryLists ) ) { CswNbtMetaDataObjectClass RegulatoryListOC = CswNbtResources.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListClass ); CswNbtMetaDataObjectClass RegListCasNoOC = CswNbtResources.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListCasNoClass ); if( null != RegulatoryListOC && null != RegListCasNoOC ) { CswNbtMetaDataObjectClassProp RegListExclusiveOCP = RegulatoryListOC.getObjectClassProp( CswNbtObjClassRegulatoryList.PropertyName.Exclusive ); CswNbtMetaDataObjectClassProp RegListCasNoCasNoOCP = RegListCasNoOC.getObjectClassProp( CswNbtObjClassRegulatoryListCasNo.PropertyName.CASNo ); Collection<CswPrimaryKey> ExclusiveMatches = new Collection<CswPrimaryKey>(); // find matches if( CasNos.Count > 0 ) { #region Manually Managed Reg Lists CswNbtView View = new CswNbtView( CswNbtResources ); View.ViewName = "Reglist_findMatches"; CswNbtViewRelationship casnoRel = View.AddViewRelationship( RegListCasNoOC, false ); CswNbtViewProperty casnoVP = View.AddViewProperty( casnoRel, RegListCasNoCasNoOCP ); foreach( string cas in CasNos ) { View.AddViewPropertyFilter( casnoVP, Conjunction: CswEnumNbtFilterConjunction.Or, FilterMode: CswEnumNbtFilterMode.Equals, Value: cas ); } CswNbtViewRelationship regListRel = View.AddViewRelationship( casnoRel, CswEnumNbtViewPropOwnerType.First, RegListCasNoOC.getObjectClassProp( CswNbtObjClassRegulatoryListCasNo.PropertyName.RegulatoryList ), false ); View.AddViewProperty( regListRel, RegListExclusiveOCP ); ICswNbtTree Tree = CswNbtResources.Trees.getTreeFromView( View, RequireViewPermissions: false, IncludeSystemNodes: true, IncludeHiddenNodes: true ); for( Int32 i = 0; i < Tree.getChildNodeCount(); i++ ) // RegListCasNo { Tree.goToNthChild( i ); for( Int32 j = 0; j < Tree.getChildNodeCount(); j++ ) // RegList { Tree.goToNthChild( j ); CswPrimaryKey thisRegListId = Tree.getNodeIdForCurrentPosition(); CswNbtTreeNodeProp exclusiveTreeProp = Tree.getChildNodePropsOfNode().FirstOrDefault( p => p.ObjectClassPropName == RegListExclusiveOCP.PropName ); if( null != exclusiveTreeProp ) { CswEnumTristate thisExclusive = CswConvert.ToTristate( exclusiveTreeProp[( (CswNbtFieldTypeRuleLogical) RegListExclusiveOCP.getFieldTypeRule() ).CheckedSubField.Column] ); if( CswEnumTristate.True == thisExclusive ) { ExclusiveMatches.Add( thisRegListId ); } else { ret.Add( thisRegListId ); } } Tree.goToParentNode(); } // for( Int32 j = 0; j < Tree.getChildNodeCount(); j++ ) // RegList Tree.goToParentNode(); } // for( Int32 i = 0; i < Tree.getChildNodeCount(); i++ ) // RegListCasNo #endregion Manually Managed Reg Lists #region Regulation Database Managed Reg Lists string SyncModule = string.Empty; if( CswNbtResources.Modules.IsModuleEnabled( CswEnumNbtModuleName.LOLISync ) ) { SyncModule = CswEnumRegulatoryListListModes.LOLIManaged; } else if( CswNbtResources.Modules.IsModuleEnabled( CswEnumNbtModuleName.ArielSync ) ) { SyncModule = CswEnumRegulatoryListListModes.ArielManaged; } if( false == string.IsNullOrEmpty( SyncModule ) ) //at least one of LOLISync or ArielSync is enabled { CswNbtMetaDataObjectClass RegListListCodeOC = CswNbtResources.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListListCodeClass ); if( null != RegListListCodeOC ) { CswNbtMetaDataObjectClassProp RegListListCodeListCodeOCP = RegListListCodeOC.getObjectClassProp( CswNbtObjClassRegulatoryListListCode.PropertyName.ListCode ); CswNbtMetaDataObjectClassProp RegListListCodeRegulatoryListOCP = RegListListCodeOC.getObjectClassProp( CswNbtObjClassRegulatoryListListCode.PropertyName.RegulatoryList ); CswNbtMetaDataObjectClassProp RegListListModeOCP = RegulatoryListOC.getObjectClassProp( PropertyName.ListMode ); // Get all regulation db managed regulatory lists CswNbtView View1 = new CswNbtView( CswNbtResources ); View1.ViewName = "RegLists_RegDbManaged"; CswNbtViewRelationship ParentRelationship = View1.AddViewRelationship( RegulatoryListOC, false ); View1.AddViewPropertyAndFilter( ParentViewRelationship: ParentRelationship, MetaDataProp: RegListListModeOCP, Value: SyncModule, //sync module that is enabled SubFieldName: CswNbtFieldTypeRuleList.SubFieldName.Value, FilterMode: CswEnumNbtFilterMode.Equals ); CswNbtViewRelationship SecondaryRelationship = View1.AddViewRelationship( ParentRelationship, CswEnumNbtViewPropOwnerType.Second, RegListListCodeRegulatoryListOCP, false ); View1.AddViewProperty( SecondaryRelationship, RegListListCodeListCodeOCP ); // Dictionary that stores the Regions and List Codes for each Regulatory List Dictionary<CswPrimaryKey, Tuple<string, List<string>>> RegListListCodes = new Dictionary<CswPrimaryKey, Tuple<string, List<string>>>(); // Get and iterate the Tree ICswNbtTree Tree1 = CswNbtResources.Trees.getTreeFromView( View1, false, true, true ); for( Int32 i = 0; i < Tree1.getChildNodeCount(); i++ ) // Regulatory List Nodes { Tree1.goToNthChild( i ); List<string> CurrentListCodes = new List<string>(); CswNbtObjClassRegulatoryList CurrentRegListNode = Tree1.getCurrentNode(); CswPrimaryKey CurrentRegListPk = CurrentRegListNode.NodeId; string CurrentRegListRegions = ""; if( string.IsNullOrEmpty( CswConvert.ToString( CurrentRegListNode.Regions.Value ) ) ) { if( SyncModule.Equals( CswEnumRegulatoryListListModes.ArielManaged ) ) { CurrentRegListRegions = CswNbtResources.ConfigVbls.getConfigVariableValue( CswConvert.ToString( CswEnumNbtConfigurationVariables.arielmodules ) ); } } else { CurrentRegListRegions = CswConvert.ToString( CurrentRegListNode.Regions.Value ); } for( int j = 0; j < Tree1.getChildNodeCount(); j++ ) // Regulatory List List Code Nodes { Tree1.goToNthChild( j ); CswNbtTreeNodeProp ListCodeTreeProp = null; foreach( CswNbtTreeNodeProp currentTnp in Tree1.getChildNodePropsOfNode() ) { if( currentTnp.ObjectClassPropName == RegListListCodeListCodeOCP.PropName ) { ListCodeTreeProp = currentTnp; break; } } if( null != ListCodeTreeProp ) { CurrentListCodes.Add( CswConvert.ToString( ListCodeTreeProp.Field1 ) ); } Tree1.goToParentNode(); } // Add to the dictionary RegListListCodes.Add( CurrentRegListPk, new Tuple<string, List<string>>( CurrentRegListRegions, CurrentListCodes ) ); Tree1.goToParentNode(); } // Search the regulation database foreach( string CurrentCasNo in CasNos ) { foreach( KeyValuePair<CswPrimaryKey, Tuple<string, List<string>>> Pair in RegListListCodes ) { CswC3SearchParams CswC3SearchParams = new CswC3SearchParams(); CswNbtC3ClientManager CswNbtC3ClientManager = new CswNbtC3ClientManager( CswNbtResources, CswC3SearchParams ); SearchClient C3SearchClient = CswNbtC3ClientManager.initializeC3Client(); if( null != C3SearchClient ) { string ListCodes = string.Join( ",", Pair.Value.Item2.ToArray() ); string Regions = Pair.Value.Item1; CswC3SearchParams.Query = CurrentCasNo; // Query takes the Cas Number CswC3SearchParams.ListCodes = ListCodes; // ListCodes should be a comma delimited string of all list codes CswC3SearchParams.Regions = Regions; // String list of all regions (for Ariel) CswC3SearchParams.RegulationDatabase = CswNbtC3ClientManager.RegulationDatabase; // Which Regulation Database to search CswRetObjSearchResults SearchResults = C3SearchClient.getListCodesByCasNo( CswC3SearchParams ); if( null != SearchResults.RegulationDbDataResults ) { if( SearchResults.RegulationDbDataResults.Length > 0 ) { // If at least one list code was returned, add this regulatory list id to the list of matching reg lists ret.Add( Pair.Key ); } } } } //foreach( KeyValuePair<CswPrimaryKey, List<string>> Pair in RegListListCodes ) } //foreach( string CurrentCasNo in CasNos ) }//if (null != RegListListCodeOC) }//if (CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.LOLISync)) #endregion Regulation Database Managed Reg Lists } // if( CasNos.Count > 0 ) // find exclusive lists that didn't match { CswNbtView exclusiveView = new CswNbtView( CswNbtResources ); CswNbtViewRelationship regListRel = exclusiveView.AddViewRelationship( RegulatoryListOC, false ); regListRel.NodeIdsToFilterOut = ExclusiveMatches; exclusiveView.AddViewPropertyAndFilter( regListRel, RegListExclusiveOCP, Value: CswEnumTristate.True.ToString() ); ICswNbtTree Tree = CswNbtResources.Trees.getTreeFromView( exclusiveView, RequireViewPermissions: false, IncludeSystemNodes: true, IncludeHiddenNodes: true ); for( Int32 i = 0; i < Tree.getChildNodeCount(); i++ ) { Tree.goToNthChild( i ); ret.Add( Tree.getNodeIdForCurrentPosition() ); Tree.goToParentNode(); } } // exclusive } // if( null != RegulatoryListOC && null != RegListCasNoOC ) } // if( CswNbtResources.Modules.IsModuleEnabled( CswEnumNbtModuleName.RegulatoryLists ) ) return ret; } // findMatches()
}//afterPopulateProps() public override void addDefaultViewFilters(CswNbtViewRelationship ParentRelationship) { // BZ 10454 // Filter out Retired Equipment by default CswNbtMetaDataObjectClassProp StatusOCP = this.ObjectClass.getObjectClassProp(PropertyName.Status); CswNbtViewProperty StatusViewProp = ParentRelationship.View.AddViewProperty(ParentRelationship, StatusOCP); CswNbtViewPropertyFilter StatusViewPropFilter = ParentRelationship.View.AddViewPropertyFilter(StatusViewProp, StatusOCP.getFieldTypeRule().SubFields.Default.Name, CswEnumNbtFilterMode.NotEquals, "Retired", //StatusOptionToDisplayString( StatusOption.Retired ), false); }
/// <summary> /// Update /// </summary> public override void update() { CswNbtMetaDataObjectClass PrintLabelOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswNbtMetaDataObjectClass.NbtObjectClass.PrintLabelClass); CswNbtMetaDataObjectClassProp ControlTypeOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PrintLabelOc) { PropName = CswNbtObjClassPrintLabel.PropertyName.ControlType, FieldType = CswNbtMetaDataFieldType.NbtFieldType.List, ListOptions = CswNbtObjClassPrintLabel.ControlTypes.Options.ToString(), IsRequired = true }); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(ControlTypeOcp, ControlTypeOcp.getFieldTypeRule().SubFields.Default.Name, CswNbtObjClassPrintLabel.ControlTypes.jZebra); foreach (CswNbtObjClassPrintLabel PrintLabel in PrintLabelOc.getNodes(forceReInit: true, includeSystemNodes: false)) { if (null != PrintLabel) { PrintLabel.ControlType.Value = CswNbtObjClassPrintLabel.ControlTypes.jZebra; PrintLabel.postChanges(ForceUpdate: false); } } _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(ControlTypeOcp, ControlTypeOcp.getFieldTypeRule().SubFields.Default.Name, CswNbtObjClassPrintLabel.ControlTypes.jZebra); _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PrintLabelOc) { PropName = CswNbtObjClassPrintLabel.PropertyName.LabelName, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Text, SetValOnAdd = true }); foreach (CswNbtObjClassPrintLabel PrintLabel in PrintLabelOc.getNodes(forceReInit: true, includeSystemNodes: false)) { if (null != PrintLabel) { PrintLabel.ControlType.Value = CswNbtObjClassPrintLabel.ControlTypes.jZebra; } } CswNbtMetaDataNodeType PrintLabelNt = PrintLabelOc.getLatestVersionNodeTypes().FirstOrDefault(); if (null != PrintLabelNt) { CswNbtObjClassPrintLabel PrintLabel = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId(PrintLabelNt.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode, OverrideUniqueValidation: false); if (null != PrintLabel) { PrintLabel.ControlType.Value = CswNbtObjClassPrintLabel.ControlTypes.jZebra; //Whitespace is treated literally PrintLabel.EplText.Text = @"I8,1,001 q664 S2 OD JF WN D7 ZB Q300,37 N B41,85,0,3,3,8,50,N,""{Barcode}"" A41,140,0,3,1,1,N,""{Barcode}"" P1"; try { PrintLabel.LabelName.Text = "Default Barcode Label"; } catch (Exception Ex) { CswNbtMetaDataNodeTypeProp LabelNameNtp = PrintLabelNt.getNodeTypeProp("Label Name"); if (null != LabelNameNtp) { PrintLabel.Node.Properties[LabelNameNtp].AsText.Text = "Default Barcode Label"; } } CswNbtMetaDataObjectClass ContainerOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswNbtMetaDataObjectClass.NbtObjectClass.ContainerClass); foreach (Int32 ContainerId in ContainerOc.getNodeTypeIds()) { PrintLabel.NodeTypes.SelectedNodeTypeIds.Add(ContainerId.ToString()); } PrintLabel.postChanges(ForceUpdate: false); } } } //Update()
public override void update() { CswNbtMetaDataObjectClass InventoryLevelOc = _CswNbtSchemaModTrnsctn.createObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.InventoryLevelClass, "docs.gif", true, false ); CswNbtMetaDataObjectClass MaterialOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass ); CswNbtMetaDataObjectClassProp IlMaterialOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassInventoryLevel.PropertyName.Material, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Relationship, IsFk = true, FkType = NbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = MaterialOc.ObjectClassId, IsRequired = true, IsCompoundUnique = true } ); CswNbtMetaDataObjectClassProp IlLocationOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassInventoryLevel.PropertyName.Location, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Location, IsRequired = true, IsCompoundUnique = true } ); CswNbtMetaDataObjectClassProp IlTypeOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassInventoryLevel.PropertyName.Type, FieldType = CswNbtMetaDataFieldType.NbtFieldType.List, ListOptions = CswNbtObjClassInventoryLevel.Types.Options.ToString(), IsRequired = true, IsCompoundUnique = true } ); CswNbtMetaDataObjectClassProp IlLevelOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassInventoryLevel.PropertyName.Level, FieldType = CswNbtMetaDataFieldType.NbtFieldType.Quantity, IsRequired = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassInventoryLevel.PropertyName.Subscribe, FieldType = CswNbtMetaDataFieldType.NbtFieldType.UserSelect, SetValOnAdd = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassInventoryLevel.PropertyName.LastNotified, FieldType = CswNbtMetaDataFieldType.NbtFieldType.DateTime, ServerManaged = true } ); CswNbtMetaDataObjectClassProp IlStatusOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp { PropName = CswNbtObjClassInventoryLevel.PropertyName.Status, FieldType = CswNbtMetaDataFieldType.NbtFieldType.List, ListOptions = CswNbtObjClassInventoryLevel.Statuses.Options.ToString(), ServerManaged = true } ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( IlStatusOcp, IlStatusOcp.getFieldTypeRule().SubFields.Default.Name, CswNbtObjClassInventoryLevel.Statuses.Ok ); _CswNbtSchemaModTrnsctn.createModuleObjectClassJunction( CswNbtResources.CswNbtModule.CISPro, InventoryLevelOc.ObjectClassId ); CswNbtMetaDataNodeType InventoryLevelNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Inventory Level" ); if( null != InventoryLevelNt && InventoryLevelNt.ObjectClassId != InventoryLevelOc.ObjectClassId ) { InventoryLevelNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "CISPro Inventory Level" ); } if( null != InventoryLevelNt && InventoryLevelNt.ObjectClassId != InventoryLevelOc.ObjectClassId ) { CswStatusMessage Msg = new CswStatusMessage { AppType = AppType.SchemUpdt, ContentType = ContentType.Error }; Msg.Attributes.Add( ChemSW.Log.LegalAttribute.exoteric_message, "Nodetypes 'Inventory Level' and 'CISPro Inventory Level' already exist and are not of the InventoryLevel Object Class." ); _CswNbtSchemaModTrnsctn.CswLogger.send( Msg ); } if( null == InventoryLevelNt ) { InventoryLevelNt = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( InventoryLevelOc ) { NodeTypeName = "Inventory Level", Category = "Materials", } ); CswNbtMetaDataNodeTypeProp Material = InventoryLevelNt.getNodeTypePropByObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Material ); CswNbtMetaDataNodeTypeProp Level = InventoryLevelNt.getNodeTypePropByObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Level ); CswNbtMetaDataNodeTypeProp Type = InventoryLevelNt.getNodeTypePropByObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Type ); InventoryLevelNt.addNameTemplateText( Material.PropName ); InventoryLevelNt.addNameTemplateText( Type.PropName ); InventoryLevelNt.addNameTemplateText( Level.PropName ); } foreach( CswNbtMetaDataNodeType MaterialNt in MaterialOc.getLatestVersionNodeTypes() ) { CswNbtMetaDataNodeTypeTab PhysicalTab = MaterialNt.getNodeTypeTab( "Physical Tab" ); if( null != PhysicalTab ) { PhysicalTab.TabName = "Physical"; } else { PhysicalTab = MaterialNt.getNodeTypeTab( "Physical" ); if( null == PhysicalTab ) { PhysicalTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( MaterialNt, "Physical", MaterialNt.getNodeTypeTabIds().Count ); } } CswNbtMetaDataNodeTypeProp LevelsNtp = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( MaterialNt, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Grid ), "Inventory Levels" ) { TabId = PhysicalTab.TabId } ); LevelsNtp.Extended = CswNbtNodePropGrid.GridPropMode.Link.ToString(); CswNbtView LevelsView = _CswNbtSchemaModTrnsctn.restoreView( LevelsNtp.ViewId ); if( null == LevelsView ) { LevelsView = _CswNbtSchemaModTrnsctn.makeView(); LevelsNtp.ViewId = LevelsView.ViewId; } LevelsView.Root.ChildRelationships.Clear(); LevelsView.ViewMode = NbtViewRenderingMode.Grid; LevelsView.Visibility = NbtViewVisibility.Property; CswNbtViewRelationship RootRel = LevelsView.AddViewRelationship( MaterialNt, true ); CswNbtViewRelationship LevelRel = LevelsView.AddViewRelationship( RootRel, NbtViewPropOwnerType.Second, IlMaterialOcp, true ); LevelsView.AddViewProperty( LevelRel, IlTypeOcp ); LevelsView.AddViewProperty( LevelRel, IlLevelOcp ); LevelsView.AddViewProperty( LevelRel, IlLocationOcp ); LevelsView.AddViewProperty( LevelRel, IlStatusOcp ); LevelsView.save(); } }//Update()
public override void update() { /* * I realize that most of the time you do not want to go directly to the table, but in this specific case I was %100 guarenteed that there were * no material nodes running wild and that I would be able to change the field type directly in the table without fear of having nodes with * data filled in the Scientific property. If there were, that would mean this would result in nodes having Scientific prop type data in a * Number prop type field...that's bad and would have dire consequences. * * tldr; DON'T USE THIS AS A TEMPLATE TO SOLVE SIMILIAR PROBLEMS! */ CswNbtMetaDataObjectClass materialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass ); CswNbtMetaDataObjectClassProp specificGravityOCP = materialOC.getObjectClassProp( CswNbtObjClassMaterial.SpecificGravityPropertyName ); CswNbtMetaDataFieldType numberFieldType = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Number ); if( null != numberFieldType ) { CswTableUpdate tableOCPUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "OCP_SpecGravity_26835", "object_class_props" ); DataTable ocpTable = tableOCPUpdate.getTable( "objectclasspropid", specificGravityOCP.ObjectClassPropId ); foreach( DataRow row in ocpTable.Rows ) { row["fieldtypeid"] = numberFieldType.FieldTypeId; } tableOCPUpdate.update( ocpTable ); CswTableUpdate tableNTPUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "NTP_SpecGravity_26835", "nodetype_props" ); DataTable ntpTable = tableNTPUpdate.getTable( "objectclasspropid", specificGravityOCP.ObjectClassPropId ); foreach( DataRow row in ntpTable.Rows ) { row["fieldtypeid"] = numberFieldType.FieldTypeId; } tableNTPUpdate.update( ntpTable ); } _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( specificGravityOCP, specificGravityOCP.getFieldTypeRule().SubFields.Default.Name, 1 ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( specificGravityOCP, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isrequired, true ); }//Update()
/// <summary> /// Do the update /// </summary> public override void update() { CswNbtMetaDataObjectClass DocumentOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.DocumentClass ); CswNbtMetaDataObjectClassProp ArchivedDateOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( DocumentOc ) { PropName = CswNbtObjClassDocument.PropertyName.ArchiveDate, FieldType = CswNbtMetaDataFieldType.NbtFieldType.DateTime } ); CswNbtMetaDataObjectClassProp DocumentClassOcp = DocumentOc.getObjectClassProp( CswNbtObjClassDocument.PropertyName.DocumentClass ); CswNbtMetaDataObjectClassProp LanguageOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( DocumentOc ) { PropName = CswNbtObjClassDocument.PropertyName.Language, FieldType = CswNbtMetaDataFieldType.NbtFieldType.List, ListOptions = "en,fr,es,de", SetValOnAdd = false //This worked for Size on Request Item but does not seem to work when making the prop conditional on another prop of the same Object Class //IsFk = true, //FkType = NbtViewPropIdType.ObjectClassPropId.ToString(), //FkValue = DocumentClassOcp.PropId, //FilterPropId = DocumentClassOcp.PropId, //Filter = CswNbtMetaDataObjectClassProp.makeFilter( DocumentClassOcp.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassDocument.DocumentClasses.MSDS ) } ); CswNbtMetaDataObjectClassProp FormatOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( DocumentOc ) { PropName = CswNbtObjClassDocument.PropertyName.Format, FieldType = CswNbtMetaDataFieldType.NbtFieldType.List, ListOptions = CswNbtObjClassDocument.Formats.Options.ToString(), SetValOnAdd = false //IsFk = true, //FkType = NbtViewPropIdType.ObjectClassPropId.ToString(), //FkValue = DocumentClassOcp.PropId, //FilterPropId = DocumentClassOcp.PropId, //Filter = CswNbtMetaDataObjectClassProp.makeFilter( DocumentClassOcp.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassDocument.DocumentClasses.MSDS ) } ); foreach( CswNbtMetaDataNodeType DocumentNt in DocumentOc.getLatestVersionNodeTypes() ) { CswNbtMetaDataNodeTypeProp FormatNtp = DocumentNt.getNodeTypePropByObjectClassProp( FormatOcp.PropId ); CswNbtMetaDataNodeTypeProp LanguageNtp = DocumentNt.getNodeTypePropByObjectClassProp( LanguageOcp.PropId ); if( false == DocumentNt.NodeTypeName.Contains( "material" ) && false == DocumentNt.NodeTypeName.Contains( "Material" ) ) { FormatNtp.removeFromAllLayouts(); LanguageNtp.removeFromAllLayouts(); } CswNbtMetaDataNodeTypeProp DocumentClassNtp = DocumentNt.getNodeTypePropByObjectClassProp( DocumentClassOcp.PropId ); FormatNtp.setFilter( DocumentClassNtp, DocumentClassNtp.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassDocument.DocumentClasses.MSDS ); LanguageNtp.setFilter( DocumentClassNtp, DocumentClassNtp.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassDocument.DocumentClasses.MSDS ); } CswNbtMetaDataObjectClassProp LinkOcp = DocumentOc.getObjectClassProp( CswNbtObjClassDocument.PropertyName.Link ); CswNbtMetaDataObjectClassProp FileOcp = DocumentOc.getObjectClassProp( CswNbtObjClassDocument.PropertyName.File ); CswNbtMetaDataObjectClassProp FileTypeOcp = DocumentOc.getObjectClassProp( CswNbtObjClassDocument.PropertyName.FileType ); CswNbtMetaDataObjectClassProp ArchivedOcp = DocumentOc.getObjectClassProp( CswNbtObjClassDocument.PropertyName.Archived ); CswNbtMetaDataObjectClassProp AcquiredDateOcp = DocumentOc.getObjectClassProp( CswNbtObjClassDocument.PropertyName.AcquiredDate ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( LinkOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.setvalonadd, true ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( FileOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.setvalonadd, true ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( FileTypeOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isrequired, true ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( AcquiredDateOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.servermanaged, true ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( FileTypeOcp, FileTypeOcp.getFieldTypeRule().SubFields.Default.Name, CswNbtObjClassDocument.FileTypes.File ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ArchivedOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isrequired, true ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( ArchivedOcp, ArchivedOcp.getFieldTypeRule().SubFields.Default.Name, Tristate.False ); }//Update()