Example #1
0
        public override void update()
        {

            CswNbtMetaDataObjectClass MailReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MailReportClass );
            foreach( CswNbtMetaDataNodeType MailReportNT in MailReportOC.getNodeTypes() )
            {
                // remove 'Nodes to Report' from all layouts
                CswNbtMetaDataNodeTypeProp NodesToReportNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.NodesToReport );
                _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.removePropFromAllLayouts( NodesToReportNTP );

                // remove Run Status from Add layout
                CswNbtMetaDataNodeTypeProp RunStatusNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.RunStatus );
                RunStatusNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );

                // set Target Type and Event to be conditional on Type = View
                CswNbtMetaDataNodeTypeProp TypeNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Type );
                CswNbtMetaDataNodeTypeProp TargetTypeNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.TargetType );
                CswNbtMetaDataNodeTypeProp EventNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Event );
                TargetTypeNTP.setFilter( TypeNTP, TypeNTP.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassMailReport.TypeOptionView );
                EventNTP.setFilter( TypeNTP, TypeNTP.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassMailReport.TypeOptionView );

                // add help text to Report View
                CswNbtMetaDataNodeTypeProp ReportViewNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.ReportView );
                ReportViewNTP.HelpText = "For 'Exists' events, a report is generated if the view returns any results that match the Target Type.  For 'Edit' events, a report is only generated if one of the properties in the view was modified.";

                // set target type and event for existing mail reports
                foreach( CswNbtObjClassMailReport MailReportNode in MailReportNT.getNodes( false, true ) )
                {
                    if( CswNbtObjClassMailReport.TypeOptionView == MailReportNode.Type.Value &&
                        0 == MailReportNode.TargetType.SelectedNodeTypeIds.Count )
                    {
                        CswNbtView View = _CswNbtSchemaModTrnsctn.restoreView( MailReportNode.ReportView.ViewId );
                        if( View.Root.ChildRelationships.Count > 0 )
                        {
                            CswNbtViewRelationship RootRel = View.Root.ChildRelationships[0];
                            if( RootRel.SecondType == NbtViewRelatedIdType.NodeTypeId )
                            {
                                MailReportNode.TargetType.SelectedNodeTypeIds.Add( RootRel.SecondId.ToString() );
                            }
                            else
                            {
                                CswNbtMetaDataObjectClass RootOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( RootRel.SecondId.ToString() );
                                if( null != RootOC.FirstNodeType )
                                {
                                    MailReportNode.TargetType.SelectedNodeTypeIds.Add( RootOC.FirstNodeType.NodeTypeId.ToString() );
                                }
                            }
                        }
                    }

                    if( MailReportNode.Event.Empty )
                    {
                        MailReportNode.Event.Value = CswNbtObjClassMailReport.EventOption.Exists.ToString();
                    }
                    MailReportNode.postChanges( false );

                } // foreach( CswNbtObjClassMailReport MailReportNode in MailReportNT.getNodes( false, true ) )
            } // foreach( CswNbtMetaDataNodeType MailReportNT in MailReportOC.getNodeTypes() )

        }//Update()
        public override void update()
        {
            CswNbtMetaDataObjectClass MailReportOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MailReportClass );

            foreach( CswNbtMetaDataNodeType MailReportNt in MailReportOc.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp WarningDaysNtp = MailReportNt.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.WarningDays );
                WarningDaysNtp.removeFromAllLayouts();
                WarningDaysNtp.DefaultValue.AsNumber.Value = 0;
            }
            foreach( CswNbtObjClassMailReport MailReportNode in MailReportOc.getNodes( false, false ) )
            {
                if( null != MailReportNode.WarningDays )
                {
                    MailReportNode.WarningDays.Value = 0;
                    MailReportNode.postChanges( false );
                }
            }
        }//Update()
Example #3
0
        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()
Example #4
0
        public override void update()
        {
            #region NodeTypes

            CswNbtMetaDataNodeType ReportGroupPermNT = _createPermissionNT( CswEnumNbtObjectClass.ReportGroupPermissionClass, "Report Group Permission" );
            CswNbtMetaDataNodeType MailReportGroupPermNT = _createPermissionNT( CswEnumNbtObjectClass.MailReportGroupPermissionClass, "Mail Report Group Permission" );
            CswNbtMetaDataNodeType ReportGroupNT = _createGroupNT( CswEnumNbtObjectClass.ReportGroupClass, "Report Group", CswNbtObjClassReportGroup.PropertyName.Reports );
            CswNbtMetaDataNodeType MailReportGroupNT = _createGroupNT( CswEnumNbtObjectClass.MailReportGroupClass, "Mail Report Group", CswNbtObjClassMailReportGroup.PropertyName.MailReports );
            CswNbtMetaDataObjectClass InvGrpPermOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.InventoryGroupPermissionClass );
            _CswNbtSchemaModTrnsctn.MetaData.makeMissingNodeTypeProps();//For some reason this is needed here or else the following code will throw an ORNI on a full master reset
            foreach( CswNbtMetaDataNodeType InvGrpPermNT in InvGrpPermOC.getNodeTypes() )
            {
                _setPermissionPropFilters( InvGrpPermNT );
            }

            #endregion NodeTypes

            #region Permission Group Nodes

            CswNbtObjClassReportGroup DefaultReportGroup = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( ReportGroupNT.NodeTypeId, CswEnumNbtMakeNodeOperation.MakeTemp );
            DefaultReportGroup.Name.Text = "Default Report Group";
            DefaultReportGroup.IsTemp = false;
            DefaultReportGroup.postChanges( false );

            CswNbtMetaDataObjectClass ReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ReportClass );
            foreach( CswNbtObjClassReport ReportNode in ReportOC.getNodes( false, false ) )
            {
                ReportNode.ReportGroup.RelatedNodeId = DefaultReportGroup.NodeId;
                ReportNode.postChanges( false );
            }

            CswNbtObjClassMailReportGroup DefaultMailReportGroup = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( MailReportGroupNT.NodeTypeId, CswEnumNbtMakeNodeOperation.MakeTemp );
            DefaultMailReportGroup.Name.Text = "Default Mail Report Group";
            DefaultMailReportGroup.IsTemp = false;
            DefaultMailReportGroup.postChanges( false );

            CswNbtMetaDataObjectClass MailReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.MailReportClass );
            foreach( CswNbtObjClassMailReport MailReportNode in MailReportOC.getNodes( false, false ) )
            {
                MailReportNode.MailReportGroup.RelatedNodeId = DefaultMailReportGroup.NodeId;
                MailReportNode.postChanges( false );
            }

            #endregion Permission Group Nodes

            #region Inventory Group Permission Nodes

            CswNbtMetaDataNodeType InventoryGroupNT = InvGrpPermOC.FirstNodeType;
            if( null != InventoryGroupNT )
            {
                CswNbtMetaDataNodeTypeProp PermissionGroupNTP = InventoryGroupNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetPermission.PropertyName.PermissionGroup );
                if( null != PermissionGroupNTP )
                {
                    PermissionGroupNTP.PropName = CswNbtPropertySetPermission.PropertyName.PermissionGroup;
                }
            }

            foreach( CswNbtObjClassInventoryGroupPermission InvGrpPermNode in InvGrpPermOC.getNodes( false, false ) )
            {
                InvGrpPermNode.ApplyToAllWorkUnits.Checked = CswEnumTristate.False;
                InvGrpPermNode.ApplyToAllRoles.Checked = CswEnumTristate.False;
                InvGrpPermNode.PermissionGroup.RefreshNodeName();
                InvGrpPermNode.postChanges( false );
            }

            CswNbtMetaDataObjectClass InvGrpOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.InventoryGroupClass );
            foreach( CswNbtObjClassInventoryGroup InvGrpNode in InvGrpOC.getNodes( false, false ) )
            {
                if( InvGrpNode.Name.Text == "Default Inventory Group" && null != InventoryGroupNT )
                {
                    CswNbtObjClassInventoryGroupPermission WildCardInventoryGroupPermission = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( InventoryGroupNT.NodeTypeId, CswEnumNbtMakeNodeOperation.DoNothing );
                    WildCardInventoryGroupPermission.ApplyToAllRoles.Checked = CswEnumTristate.True;
                    WildCardInventoryGroupPermission.ApplyToAllWorkUnits.Checked = CswEnumTristate.True;
                    WildCardInventoryGroupPermission.PermissionGroup.RelatedNodeId = InvGrpNode.NodeId;
                    WildCardInventoryGroupPermission.View.Checked = CswEnumTristate.True;
                    WildCardInventoryGroupPermission.Edit.Checked = CswEnumTristate.True;
                    WildCardInventoryGroupPermission.Dispense.Checked = CswEnumTristate.False;
                    WildCardInventoryGroupPermission.Dispose.Checked = CswEnumTristate.False;
                    WildCardInventoryGroupPermission.Request.Checked = CswEnumTristate.False;
                    WildCardInventoryGroupPermission.Undispose.Checked = CswEnumTristate.False;
                    WildCardInventoryGroupPermission.WorkUnit.RelatedNodeId = null;
                    WildCardInventoryGroupPermission.WorkUnit.RefreshNodeName();
                    WildCardInventoryGroupPermission.WorkUnit.SyncGestalt();
                    WildCardInventoryGroupPermission.postChanges( false );
                }
            }

            //This is now being handled as part of creating the Default Group nodes
            /*CswNbtObjClassReportGroupPermission WildCardReportGroupPermission = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( ReportGroupPermNT.NodeTypeId, CswEnumNbtMakeNodeOperation.DoNothing );
            WildCardReportGroupPermission.ApplyToAllRoles.Checked = CswEnumTristate.True;
            WildCardReportGroupPermission.ApplyToAllWorkUnits.Checked = CswEnumTristate.True;
            WildCardReportGroupPermission.PermissionGroup.RelatedNodeId = DefaultReportGroup.NodeId;
            WildCardReportGroupPermission.View.Checked = CswEnumTristate.True;
            WildCardReportGroupPermission.Edit.Checked = CswEnumTristate.True;
            WildCardReportGroupPermission.postChanges( false );

            CswNbtObjClassMailReportGroupPermission WildCardMailReportGroupPermission = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( MailReportGroupPermNT.NodeTypeId, CswEnumNbtMakeNodeOperation.DoNothing );
            WildCardMailReportGroupPermission.ApplyToAllRoles.Checked = CswEnumTristate.True;
            WildCardMailReportGroupPermission.ApplyToAllWorkUnits.Checked = CswEnumTristate.True;
            WildCardMailReportGroupPermission.PermissionGroup.RelatedNodeId = DefaultMailReportGroup.NodeId;
            WildCardMailReportGroupPermission.View.Checked = CswEnumTristate.True;
            WildCardMailReportGroupPermission.Edit.Checked = CswEnumTristate.True;
            WildCardMailReportGroupPermission.postChanges( false );*/

            #endregion Inventory Group Permission Nodes
        } // update()
Example #5
0
        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;
                });
            }
        }