private CswNbtView _getSiInspectionUserView(bool ReInit) { CswNbtView Ret = _getSystemView(CswEnumNbtSystemViewName.SIInspectionsbyUser); if (null == Ret) { CswNbtNode ChemSwAdminRoleNode = _CswNbtResources.Nodes.makeRoleNodeFromRoleName(CswNbtObjClassRole.ChemSWAdminRoleName); Ret = new CswNbtView(_CswNbtResources); Ret.saveNew(CswEnumNbtSystemViewName.SIInspectionsbyUser.ToString(), CswEnumNbtViewVisibility.Role, ChemSwAdminRoleNode.NodeId); Ret.Category = SiViewCategory; Ret.ViewMode = CswEnumNbtViewRenderingMode.List; ReInit = true; } if (ReInit) { Ret.Root.ChildRelationships.Clear(); CswNbtMetaDataObjectClass InspectionDesignOc = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.InspectionDesignClass); CswNbtViewRelationship InspectionDesignVr = Ret.AddViewRelationship(InspectionDesignOc, true); _addDefaultInspectionDesignViewPropsAndFilters(Ret, InspectionDesignVr, InspectionDesignOc); CswNbtMetaDataObjectClassProp InspectorOcp = InspectionDesignOc.getObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.Inspector); Ret.AddViewPropertyAndFilter(InspectionDesignVr, InspectorOcp, "me"); Ret.save(); } return(Ret); }
private CswNbtView _siLocationsListView(bool ReInit) { CswNbtView Ret = _getSystemView(CswEnumNbtSystemViewName.SILocationsList); if (null == Ret) { CswNbtNode ChemSwAdminRoleNode = _CswNbtResources.Nodes.makeRoleNodeFromRoleName(CswNbtObjClassRole.ChemSWAdminRoleName); Ret = new CswNbtView(_CswNbtResources); Ret.saveNew(CswEnumNbtSystemViewName.SILocationsList.ToString(), CswEnumNbtViewVisibility.Role, ChemSwAdminRoleNode.NodeId); Ret.Category = SiViewCategory; Ret.ViewMode = CswEnumNbtViewRenderingMode.List; ReInit = true; } if (ReInit) { Ret.Root.ChildRelationships.Clear(); CswNbtMetaDataObjectClass LocationOc = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.LocationClass); CswNbtViewRelationship LocationVr = Ret.AddViewRelationship(LocationOc, true); CswNbtMetaDataObjectClassProp LocationLocationOcp = LocationOc.getObjectClassProp(CswNbtObjClassLocation.PropertyName.Location); CswNbtViewProperty LocationLocationVp = Ret.AddViewProperty(LocationVr, LocationLocationOcp); LocationLocationVp.SortBy = true; Ret.save(); } return(Ret); }
public override void update() { // New 'Locations' view CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.LocationClass ); CswNbtMetaDataObjectClassProp LocationLocationOCP = LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.Location ); Int32 maxDepth = CswConvert.ToInt32( _CswNbtSchemaModTrnsctn.getConfigVariableValue( CswNbtResources.ConfigurationVariables.loc_max_depth.ToString() ) ); if( maxDepth == Int32.MinValue ) { maxDepth = 5; } string LocationsViewName = "Locations"; CswNbtView LocationsView = _CswNbtSchemaModTrnsctn.restoreView( LocationsViewName, NbtViewVisibility.Global ); if( null == LocationsView ) { LocationsView = _CswNbtSchemaModTrnsctn.makeView(); LocationsView.saveNew( LocationsViewName, NbtViewVisibility.Global ); LocationsView.ViewMode = NbtViewRenderingMode.Tree; } LocationsView.Root.ChildRelationships.Clear(); CswNbtViewRelationship LocRel1 = LocationsView.AddViewRelationship( LocationOC, true ); LocationsView.AddViewPropertyAndFilter( LocRel1, LocationLocationOCP, Conjunction: CswNbtPropFilterSql.PropertyFilterConjunction.And, SubFieldName: CswNbtSubField.SubFieldName.NodeID, FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Null ); CswNbtViewRelationship LocReln = LocRel1; for( Int32 i = 2; i <= maxDepth; i++ ) { LocReln = LocationsView.AddViewRelationship( LocReln, NbtViewPropOwnerType.Second, LocationLocationOCP, true ); } LocationsView.save(); } //Update()
public override void update() { Dictionary <string, CswNbtViewId> AdminViews = new Dictionary <string, CswNbtViewId>(); Dictionary <string, CswNbtViewId> ChemSWAdminViews = new Dictionary <string, CswNbtViewId>(); DataTable ViewsTable = _CswNbtSchemaModTrnsctn.getAllViews(); foreach (DataRow Row in ViewsTable.Rows) { if (CswConvert.ToString(Row["visibility"]) == CswEnumNbtViewVisibility.Role.ToString()) { Int32 RoleId = CswConvert.ToInt32(Row["roleid"]); if (Int32.MinValue != RoleId) { CswNbtObjClassRole Role = _CswNbtSchemaModTrnsctn.Nodes["nodes_" + RoleId]; if (null != Role && Role.Administrator.Checked == CswEnumTristate.True) { string ViewName = CswConvert.ToString(Row["viewname"]); CswNbtViewId ViewId = new CswNbtViewId(CswConvert.ToInt32(Row["nodeviewid"])); if (Role.Name.Text == CswNbtObjClassRole.ChemSWAdminRoleName) { ChemSWAdminViews.Add(ViewName, ViewId); } else if (false == AdminViews.ContainsKey(ViewName)) { AdminViews.Add(ViewName, ViewId); } } } } } CswNbtObjClassRole ChemSwAdmin = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName(CswNbtObjClassRole.ChemSWAdminRoleName); foreach (KeyValuePair <string, CswNbtViewId> KeyValuePair in AdminViews) { string ViewName = KeyValuePair.Key; if (false == ChemSWAdminViews.ContainsKey(ViewName)) { CswNbtViewId ViewId = KeyValuePair.Value; CswNbtView NewCswAdminView = _CswNbtSchemaModTrnsctn.makeView(); NewCswAdminView.saveNew(ViewName, CswEnumNbtViewVisibility.Role, ChemSwAdmin.NodeId, CopyViewId: ViewId.get()); NewCswAdminView.save(); } } }
/// <summary> /// Build a Unit View for a Quantity property using a Material NodeId /// </summary> public CswNbtView getQuantityUnitOfMeasureView(CswNbtNode MaterialNode, bool ExcludeEach = false, CswNbtView View = null) { CswNbtView Ret = View; if (null != MaterialNode) { string PhysicalState = getPhysicalState(MaterialNode); if (null == Ret) { Ret = new CswNbtView(_CswNbtResources); Ret.saveNew(MaterialNode.NodeName + " Units Of Measure View", CswEnumNbtViewVisibility.Property); } else { Ret.Root.ChildRelationships.Clear(); } _populateUnitViewRelationships(Ret, PhysicalState, ExcludeEach); } return(Ret); }
/// <summary> /// Handles when the property value is copied to another node /// </summary> public void CopyGeneric(CswNbtNodePropData Source) { // Default, just copy the data values CswEnumNbtFieldType FieldType = Source.getFieldTypeValue(); ICswNbtFieldTypeRule FieldTypeRule = _CswNbtResources.MetaData.getFieldTypeRule(FieldType); foreach (CswNbtSubField SubField in FieldTypeRule.SubFields) { if (SubField.Column == CswEnumNbtPropColumn.Field1_FK) { //Implementing FieldType specific behavior here. Blame Steve. if (FieldType == CswEnumNbtFieldType.ViewReference) { //we want to copy views to the new node by value, so changes to the view on either node don't affect the other CswNbtView View = _CswNbtResources.ViewSelect.restoreView(new CswNbtViewId(Source.Field1_Fk)); CswNbtView ViewCopy = new CswNbtView(_CswNbtResources); ViewCopy.saveNew(View.ViewName, View.Visibility, View.VisibilityRoleId, View.VisibilityUserId, View); SetSubFieldValue(CswEnumNbtSubFieldName.ViewID, ViewCopy.ViewId); } else { SetSubFieldValue(SubField.Name, Source.Field1_Fk); } } // if( SubField.Column == CswEnumNbtPropColumn.Field1_FK ) else { SetSubFieldValue(SubField.Name, Source.GetPropRowValue(SubField)); } } // foreach( CswNbtSubField SubField in NodeTypeProp.getFieldTypeRule().SubFields ) // Also copy Gestalt, which usually isn't listed as a subfield SetSubFieldValue(CswEnumNbtSubFieldName.Gestalt, Source.Gestalt); SetSubFieldValue(CswEnumNbtSubFieldName.GestaltSearch, Source.GestaltSearch); //Case 31362 - also copy Blob_Data if necessary if (Source.getFieldTypeValue() == CswEnumNbtFieldType.MOL || Source.getFieldTypeValue() == CswEnumNbtFieldType.Image || Source.getFieldTypeValue() == CswEnumNbtFieldType.File) { CswNbtSdBlobData.CopyBlobData(_CswNbtResources, Source.JctNodePropId, JctNodePropId); } }
public override void update() { // Set up label printing nodetypes CswNbtMetaDataObjectClass PrinterOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.PrinterClass ); CswNbtMetaDataObjectClass JobOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.PrintJobClass ); CswNbtMetaDataObjectClassProp JobCreatedDateOCP = JobOC.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.CreatedDate ); CswNbtMetaDataObjectClassProp JobJobNoOCP = JobOC.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.JobNo ); CswNbtMetaDataObjectClassProp JobJobStateOCP = JobOC.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.JobState ); CswNbtMetaDataObjectClassProp JobPrinterOCP = JobOC.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.Printer ); CswNbtMetaDataObjectClassProp JobRequestedByOCP = JobOC.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.RequestedBy ); CswNbtMetaDataObjectClassProp JobErrorOCP = JobOC.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.ErrorInfo ); CswNbtMetaDataObjectClassProp JobLabelOCP = JobOC.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.Label ); CswNbtMetaDataObjectClassProp JobEndedDateOCP = JobOC.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.EndedDate ); // Printer NodeType { CswNbtMetaDataNodeType PrinterNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( PrinterOC ) { NodeTypeName = "Printer", Category = "System" } ); PrinterNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassPrinter.PropertyName.Name ) ); // Add a job grid CswNbtMetaDataNodeTypeTab JobGridTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( PrinterNT, "Jobs", 2 ); CswNbtMetaDataNodeTypeProp JobGridNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( PrinterNT, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Grid ), "Jobs" ) ); JobGridNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, JobGridTab.TabId ); CswNbtView JobGridView = _CswNbtSchemaModTrnsctn.restoreView( JobGridNTP.ViewId ); JobGridView.Root.ChildRelationships.Clear(); CswNbtViewRelationship PrinterRel = JobGridView.AddViewRelationship( PrinterOC, true ); CswNbtViewRelationship JobRel = JobGridView.AddViewRelationship( PrinterRel, NbtViewPropOwnerType.Second, JobPrinterOCP, true ); CswNbtViewProperty JobNoVP = JobGridView.AddViewProperty( JobRel, JobJobNoOCP ); CswNbtViewProperty RequestedByVP = JobGridView.AddViewProperty( JobRel, JobRequestedByOCP ); CswNbtViewProperty CreatedDateVP = JobGridView.AddViewProperty( JobRel, JobCreatedDateOCP ); CswNbtViewProperty JobStateVP = JobGridView.AddViewProperty( JobRel, JobJobStateOCP ); CswNbtViewProperty JobLabelVP = JobGridView.AddViewProperty( JobRel, JobLabelOCP ); JobNoVP.Order = 1; RequestedByVP.Order = 2; CreatedDateVP.Order = 3; JobStateVP.Order = 4; JobLabelVP.Order = 5; JobGridView.save(); } // Print Job NodeType { CswNbtMetaDataNodeType JobNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( JobOC ) { NodeTypeName = "Print Job", Category = "System" } ); JobNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassPrintJob.PropertyName.JobNo ) ); CswNbtMetaDataNodeTypeProp JobJobNoNTP = JobNT.getNodeTypePropByObjectClassProp( CswNbtObjClassPrintJob.PropertyName.JobNo ); Int32 SequenceId = _CswNbtSchemaModTrnsctn.makeSequence( new CswSequenceName( "printjob" ), "PJ", "", 4, 1 ); JobJobNoNTP.setSequence( SequenceId ); JobJobNoNTP.ReadOnly = true; // Notification: My print job failed { CswNbtMetaDataObjectClass MailReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MailReportClass ); CswNbtMetaDataNodeType MailReportNT = MailReportOC.FirstNodeType; if( null != MailReportNT ) { CswNbtMetaDataNodeTypeProp NameNTP = MailReportNT.getNodeTypeProp( "Name" ); CswNbtObjClassMailReport PrintJobNotif = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( MailReportNT.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode ); if( null != NameNTP ) { PrintJobNotif.Node.Properties[NameNTP].AsText.Text = "My Print Job Failures"; } PrintJobNotif.Type.Value = CswNbtObjClassMailReport.TypeOptionView; PrintJobNotif.Enabled.Checked = Tristate.True; PrintJobNotif.Event.Value = CswNbtObjClassMailReport.EventOption.Edit.ToString(); PrintJobNotif.Message.Text = "One of your print jobs has failed."; PrintJobNotif.OutputFormat.Value = MailRptFormatOptions.Link.ToString(); PrintJobNotif.TargetType.SelectedNodeTypeIds.Add( JobNT.NodeTypeId.ToString() ); CswRateInterval Rate = _CswNbtSchemaModTrnsctn.makeRateInterval(); Rate.setHourly( 1, DateTime.Now ); PrintJobNotif.DueDateInterval.RateInterval = Rate; PrintJobNotif.postChanges( false ); CswNbtView NotifView = _CswNbtSchemaModTrnsctn.restoreView( PrintJobNotif.ReportView.ViewId ); // Print jobs... CswNbtViewRelationship JobRel = NotifView.AddViewRelationship( JobOC, false ); // ...where the state is error... NotifView.AddViewPropertyAndFilter( JobRel, JobJobStateOCP, Value: CswNbtObjClassPrintJob.StateOption.Error, FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals ); // ...and the requestor was me... NotifView.AddViewPropertyAndFilter( JobRel, JobRequestedByOCP, Value: "me", FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals ); NotifView.save(); } } } // Printers View { CswNbtView PrintersView = _CswNbtSchemaModTrnsctn.makeView(); PrintersView.saveNew( "Printers", NbtViewVisibility.Global ); PrintersView.Category = "System"; PrintersView.ViewMode = NbtViewRenderingMode.Tree; PrintersView.AddViewRelationship( PrinterOC, true ); PrintersView.save(); } // Print Job Errors View { CswNbtView ErrorsView = _CswNbtSchemaModTrnsctn.makeView(); ErrorsView.saveNew( "Print Job Errors", NbtViewVisibility.Global ); ErrorsView.Category = "System"; ErrorsView.ViewMode = NbtViewRenderingMode.Grid; CswNbtViewRelationship JobRel = ErrorsView.AddViewRelationship( JobOC, true ); CswNbtViewProperty JobNoVP = ErrorsView.AddViewProperty( JobRel, JobJobNoOCP ); CswNbtViewProperty RequestedByVP = ErrorsView.AddViewProperty( JobRel, JobRequestedByOCP ); //CswNbtViewProperty CreatedDateVP = ErrorsView.AddViewProperty( JobRel, JobCreatedDateOCP ); CswNbtViewProperty JobStateVP = ErrorsView.AddViewProperty( JobRel, JobJobStateOCP ); CswNbtViewProperty JobLabelVP = ErrorsView.AddViewProperty( JobRel, JobLabelOCP ); CswNbtViewProperty ErrorVP = ErrorsView.AddViewProperty( JobRel, JobErrorOCP ); CswNbtViewProperty EndedDateVP = ErrorsView.AddViewProperty( JobRel, JobEndedDateOCP ); JobNoVP.Order = 1; RequestedByVP.Order = 2; //CreatedDateVP.Order = 3; EndedDateVP.Order = 4; JobStateVP.Order = 5; JobLabelVP.Order = 6; ErrorVP.Order = 7; ErrorsView.AddViewPropertyFilter( JobStateVP, Value: CswNbtObjClassPrintJob.StateOption.Error, FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals ); ErrorsView.AddViewPropertyFilter( EndedDateVP, Value: "today-7", FilterMode: CswNbtPropFilterSql.PropertyFilterMode.GreaterThanOrEquals ); ErrorsView.save(); } } //Update()
} // OnEnable() protected override void OnDisable() { //Turn on off views in the MLM (demo) category _CswNbtResources.Modules.ToggleViewsInCategory(true, "MLM (demo)", CswEnumNbtViewVisibility.Global); //Case 27866 on disable hide Container props... // Lot Controlled // Requisitionable // Reserved For CswNbtMetaDataObjectClass containerOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass); foreach (CswNbtMetaDataNodeType containerNT in containerOC.getNodeTypes()) { _CswNbtResources.Modules.HideProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.LotControlled); _CswNbtResources.Modules.HideProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.Requisitionable); _CswNbtResources.Modules.HideProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.ReservedFor); //if( null != cmgTab ) //{ // cmgTab.DesignNode.Node.delete( false, true ); //} } //Case 31546 - If requesting is disabled, we don't need to hide anything on the Request Item OC because it is not available if (_CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.Requesting)) { CswNbtObjClassRequestItem.ToggleMLMProps(_CswNbtResources, true); } //Case 28339 // Hide Vendor.VendorType and CorporateEntity // Remove filter on Material.Supplier CswNbtMetaDataObjectClass vendorOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.VendorClass); foreach (CswNbtMetaDataNodeType vendorNT in vendorOC.getNodeTypes()) { _CswNbtResources.Modules.HideProp(vendorNT.NodeTypeId, CswNbtObjClassVendor.PropertyName.VendorTypeName); _CswNbtResources.Modules.HideProp(vendorNT.NodeTypeId, CswNbtObjClassVendor.PropertyName.CorporateEntityName); } CswNbtView newSupplierPropView = new CswNbtView(_CswNbtResources); newSupplierPropView.saveNew("Supplier", CswEnumNbtViewVisibility.Property); newSupplierPropView.AddViewRelationship(vendorOC, true); newSupplierPropView.save(); _toggleMaterialSupplierView(true); _toggleReceiptLotManufacturerView(true); //Case CIS-52280 on disable hide Material props... // Manufacturing Sites Grid // Requires Cleaning Event CswNbtMetaDataPropertySet materialPS = _CswNbtResources.MetaData.getPropertySet(CswEnumNbtPropertySetName.MaterialSet); foreach (CswNbtMetaDataObjectClass materialOC in materialPS.getObjectClasses()) { foreach (CswNbtMetaDataNodeType materialNT in materialOC.getNodeTypes()) { _CswNbtResources.Modules.HideProp(materialNT.NodeTypeId, CswNbtPropertySetMaterial.PropertyName.ManufacturingSites); _CswNbtResources.Modules.HideProp(materialNT.NodeTypeId, CswNbtPropertySetMaterial.PropertyName.RequiresCleaningEvent); } } setReceiptLotPermissions(_CswNbtResources, false); } // OnDisable()
protected override void OnEnable() { #if DEBUG if (_CswNbtResources.ConfigVbls.doesConfigVarExist(CswEnumConfigurationVariableNames.Logging_Level)) { _CswNbtResources.ConfigVbls.setConfigVariableValue(CswEnumConfigurationVariableNames.Logging_Level.ToString(), "Info"); } _CswNbtResources.SetupVbls.writeSetting(CswEnumSetupVariableNames.ShowFullExceptions, "true"); CswNbtMetaDataNodeType FieldTypeNt = _CswNbtResources.MetaData.getNodeType("Csw Dev FieldType Test"); if (null == FieldTypeNt) { FieldTypeNt = _CswNbtResources.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType(_CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.GenericClass)) { NodeTypeName = "Csw Dev FieldType Test", Category = "Csw Dev" }); CswNbtMetaDataNodeTypeTab SimpleTab = FieldTypeNt.getNodeTypeTab("Csw Dev FieldType Test"); if (null != SimpleTab) { //SimpleTab.TabName = "Simple"; SimpleTab.DesignNode.TabName.Text = "Simple"; SimpleTab.DesignNode.postChanges(false); } else { SimpleTab = _CswNbtResources.MetaData.makeNewTab(FieldTypeNt, "Simple", 1); } CswNbtMetaDataNodeTypeTab LessSimpleTab = _CswNbtResources.MetaData.makeNewTab(FieldTypeNt, "Less Simple", 2); CswNbtMetaDataNodeTypeTab ComplexTab = _CswNbtResources.MetaData.makeNewTab(FieldTypeNt, "Complex", 3); foreach (CswNbtMetaDataFieldType FieldType in _CswNbtResources.MetaData.getFieldTypes()) { switch (FieldType.FieldType) { case CswEnumNbtFieldType.Barcode: case CswEnumNbtFieldType.DateTime: case CswEnumNbtFieldType.Image: case CswEnumNbtFieldType.List: case CswEnumNbtFieldType.Logical: case CswEnumNbtFieldType.Memo: case CswEnumNbtFieldType.Number: case CswEnumNbtFieldType.PropertyReference: case CswEnumNbtFieldType.Sequence: case CswEnumNbtFieldType.Static: case CswEnumNbtFieldType.Text: _CswNbtResources.MetaData.makeNewProp(new CswNbtWcfMetaDataModel.NodeTypeProp(FieldTypeNt, FieldType, FieldType.FieldType.ToString()) { TabId = SimpleTab.TabId }); break; case CswEnumNbtFieldType.Comments: case CswEnumNbtFieldType.Composite: case CswEnumNbtFieldType.File: case CswEnumNbtFieldType.ImageList: case CswEnumNbtFieldType.Link: case CswEnumNbtFieldType.MOL: case CswEnumNbtFieldType.MTBF: case CswEnumNbtFieldType.Password: case CswEnumNbtFieldType.Quantity: case CswEnumNbtFieldType.Scientific: case CswEnumNbtFieldType.ViewReference: _CswNbtResources.MetaData.makeNewProp(new CswNbtWcfMetaDataModel.NodeTypeProp(FieldTypeNt, FieldType, FieldType.FieldType.ToString()) { TabId = LessSimpleTab.TabId }); break; case CswEnumNbtFieldType.Grid: case CswEnumNbtFieldType.Location: case CswEnumNbtFieldType.LogicalSet: case CswEnumNbtFieldType.MultiList: case CswEnumNbtFieldType.Question: case CswEnumNbtFieldType.NFPA: case CswEnumNbtFieldType.NodeTypeSelect: case CswEnumNbtFieldType.Relationship: case CswEnumNbtFieldType.TimeInterval: case CswEnumNbtFieldType.ViewPickList: case CswEnumNbtFieldType.UserSelect: _CswNbtResources.MetaData.makeNewProp(new CswNbtWcfMetaDataModel.NodeTypeProp(FieldTypeNt, FieldType, FieldType.FieldType.ToString()) { TabId = ComplexTab.TabId }); break; } } CswNbtView FieldTypeView = new CswNbtView(_CswNbtResources); FieldTypeView.saveNew("Field Types", CswEnumNbtViewVisibility.User, null, _CswNbtResources.Nodes.makeUserNodeFromUsername(CswNbtObjClassUser.ChemSWAdminUsername).NodeId); FieldTypeView.AddViewRelationship(FieldTypeNt, false); FieldTypeView.Category = "Csw Dev"; FieldTypeView.save(); CswNbtNode Node1 = _CswNbtResources.Nodes.makeNodeFromNodeTypeId(FieldTypeNt.NodeTypeId); CswNbtNode Node2 = _CswNbtResources.Nodes.makeNodeFromNodeTypeId(FieldTypeNt.NodeTypeId); Node1.IsDemo = true; Node1.postChanges(ForceUpdate: false); Node2.IsDemo = true; Node2.postChanges(ForceUpdate: false); } _CswNbtResources.Modules.EnableModule(CswEnumNbtModuleName.NBTManager); CswNbtMetaDataNodeType CustomerNt = _CswNbtResources.MetaData.getNodeType("Csw Dev Customers"); if (null == CustomerNt) { CustomerNt = _CswNbtResources.MetaData.makeNewNodeType(new CswNbtWcfMetaDataModel.NodeType(_CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.CustomerClass)) { NodeTypeName = "Csw Dev Customers" }); CswNbtView CustomersView = new CswNbtView(_CswNbtResources); CustomersView.saveNew("Csw Dev Customers", CswEnumNbtViewVisibility.Global); CustomersView.Category = "Csw Dev"; CustomersView.AddViewRelationship(CustomerNt, IncludeDefaultFilters: true); CustomersView.save(); foreach (string AccessId in _CswNbtResources.CswDbCfgInfo.AccessIds) { _CswNbtResources.Nodes.makeNodeFromNodeTypeId(CustomerNt.NodeTypeId, delegate(CswNbtNode NewNode) { ((CswNbtObjClassCustomer)NewNode).CompanyID.Text = AccessId; }); } } #endif }
public override void update() { CswNbtMetaDataObjectClass MailReportGroupOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.MailReportGroupClass); CswNbtObjClassMailReportGroup DemoMailReports = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId(MailReportGroupOC.FirstNodeType.NodeTypeId, delegate(CswNbtNode NewNode) { CswNbtObjClassMailReportGroup DemoMailReportNode = NewNode; DemoMailReportNode.IsDemo = true; DemoMailReportNode.Name.Text = "Demo Mail Reports"; }); CswNbtMetaDataObjectClass MailReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.MailReportClass); foreach (CswNbtObjClassMailReport MailReportNode in MailReportOC.getNodes(false, false, false, true)) { if (MailReportNode.IsDemo) { MailReportNode.MailReportGroup.RelatedNodeId = DemoMailReports.NodeId; MailReportNode.postChanges(false); } } CswNbtMetaDataObjectClass MailReportGroupPermissionOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.MailReportGroupPermissionClass); CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.RoleClass); foreach (CswNbtObjClassRole RoleNode in RoleOC.getNodes(false, false, false, true)) { if (RoleNode.Administrator.Checked == CswEnumTristate.True) { CswNbtObjClassMailReportGroupPermission DemoMailReportGroupPerm = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId(MailReportGroupPermissionOC.FirstNodeType.NodeTypeId, delegate(CswNbtNode NewNode) { CswNbtObjClassMailReportGroupPermission DemoMailReportPermNode = NewNode; DemoMailReportPermNode.Role.RelatedNodeId = RoleNode.NodeId; DemoMailReportPermNode.ApplyToAllWorkUnits.Checked = CswEnumTristate.True; DemoMailReportPermNode.PermissionGroup.RelatedNodeId = DemoMailReports.NodeId; DemoMailReportPermNode.View.Checked = CswEnumTristate.True; DemoMailReportPermNode.Edit.Checked = CswEnumTristate.True; }); } } CswNbtObjClassMailReportGroup DefaultMailReportGroup = null; foreach (CswNbtObjClassMailReportGroup MailReportGroupNode in MailReportGroupOC.getNodes(false, false, false, true)) { if (MailReportGroupNode.Name.Text == "Default Mail Report Group") { DefaultMailReportGroup = MailReportGroupNode; } } CswNbtView MyExpiringContainersView = _CswNbtSchemaModTrnsctn.restoreView("My Expiring Containers"); if (null != MyExpiringContainersView && null != DefaultMailReportGroup) { CswNbtObjClassMailReport MyExpiringContainersReport = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId(MailReportOC.FirstNodeType.NodeTypeId, delegate(CswNbtNode NewNode) { CswNbtObjClassMailReport MyExpiringContainersReportNode = NewNode; MyExpiringContainersReportNode.Name.Text = "My Expiring Containers"; MyExpiringContainersReportNode.Type.Value = CswNbtObjClassMailReport.TypeOptionView; MyExpiringContainersReportNode.Event.Value = "Edit"; MyExpiringContainersReportNode.MailReportGroup.RelatedNodeId = DefaultMailReportGroup.NodeId; MyExpiringContainersReportNode.Message.Text = "The following containers will be expiring soon: "; MyExpiringContainersReportNode.Enabled.Checked = CswEnumTristate.False; CswNbtView MyExpContMRView = _CswNbtSchemaModTrnsctn.makeView(); MyExpContMRView.saveNew("My Expiring Containers", CswEnumNbtViewVisibility.Hidden, CopyViewId: MyExpiringContainersView.ViewId.get()); MyExpiringContainersReportNode.ReportView.ViewId = MyExpContMRView.ViewId; CswRateInterval DailyRate = _CswNbtSchemaModTrnsctn.makeRateInterval(); DailyRate.setHourly(24, DateTime.Today); MyExpiringContainersReportNode.DueDateInterval.RateInterval = DailyRate; }); } }