Ejemplo n.º 1
0
        public CswNbtView setupPhraseView(CswNbtView View, CswCommaDelimitedString SelectedPhraseIds)
        {
            CswNbtMetaDataObjectClass GhsPhraseOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.GHSPhraseClass);
            CswNbtMetaDataNodeType    GhsPhraseNT = GhsPhraseOC.FirstNodeType;

            View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null);
            View.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            View.Root.ChildRelationships.Clear();
            if (SelectedPhraseIds.Count > 0)
            {
                CswNbtViewRelationship PhraseVR = View.AddViewRelationship(GhsPhraseOC, false);
                foreach (string PhraseId in SelectedPhraseIds)
                {
                    CswPrimaryKey PhrasePk = new CswPrimaryKey();
                    PhrasePk.FromString(PhraseId);
                    PhraseVR.NodeIdsToFilterIn.Add(PhrasePk);
                }

                View.AddViewProperty(PhraseVR, GhsPhraseOC.getObjectClassProp(CswNbtObjClassGHSPhrase.PropertyName.Code));
                if (null != GhsPhraseNT)
                {
                    CswNbtMetaDataNodeTypeProp LanguageProp = GhsPhraseNT.getNodeTypePropByObjectClassProp(_getLanguageForTranslation());
                    CswNbtViewProperty         LanguageVP   = View.AddViewProperty(PhraseVR, LanguageProp);
                    LanguageVP.Width = 100;
                }
            } // if( SelectedPhraseIds.Count > 0 )

            return(View);
        } // setupPhraseView()
Ejemplo n.º 2
0
        } // setupPhraseView()

        private void _setupClassificationView(CswNbtView View, CswCommaDelimitedString SelectedClassIds)
        {
            CswNbtMetaDataObjectClass GhsClassOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.GHSClassificationClass);
            CswNbtMetaDataNodeType    GhsClassNT = GhsClassOC.FirstNodeType;

            View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null);
            View.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            View.Root.ChildRelationships.Clear();
            if (SelectedClassIds.Count > 0)
            {
                CswNbtViewRelationship ClassVR = View.AddViewRelationship(GhsClassOC, false);
                foreach (string ClassId in SelectedClassIds)
                {
                    CswPrimaryKey ClassPk = new CswPrimaryKey();
                    ClassPk.FromString(ClassId);
                    ClassVR.NodeIdsToFilterIn.Add(ClassPk);
                }

                View.AddViewProperty(ClassVR, GhsClassOC.getObjectClassProp(CswNbtObjClassGHSClassification.PropertyName.Category));
                if (null != GhsClassNT)
                {
                    CswNbtMetaDataNodeTypeProp LanguageProp = GhsClassNT.getNodeTypePropByObjectClassProp(_getLanguageForTranslation());
                    CswNbtViewProperty         LanguageVP   = View.AddViewProperty(ClassVR, LanguageProp);
                    LanguageVP.Width = 100;
                }
            } // if( SelectedClassIds.Count > 0 )
            View.SaveToCache(IncludeInQuickLaunch: false, UpdateCache: true, KeepInQuickLaunch: false);
        }     // _setupClassificationView()
Ejemplo n.º 3
0
        private void _updateAvailableWorkUnits()
        {
            //Case 30817 (Case 30843: moved to here from onBeforeCreate)
            if (CswTools.IsPrimaryKey(CurrentWorkUnitId) &&
                false == AvailableWorkUnits.CheckValue(CurrentWorkUnitId.ToString()))
            {
                AvailableWorkUnits.AddValue(CurrentWorkUnitId.ToString());
                CurrentWorkUnitProperty.RelatedNodeId = CurrentWorkUnitId;
                CurrentWorkUnitProperty.SyncGestalt();
            }

            CswNbtView View = _CswNbtResources.ViewSelect.restoreView(CurrentWorkUnitProperty.NodeTypeProp.ViewId);

            View.Clear();
            View.SetVisibility(CswEnumNbtViewVisibility.Property, null, null);

            CswNbtMetaDataObjectClass WorkUnitOC     = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.WorkUnitClass);
            CswNbtViewRelationship    WorkUnitParent = View.AddViewRelationship(WorkUnitOC, false);

            foreach (string WorkUnitNodeId in AvailableWorkUnits.Value)
            {
                CswPrimaryKey pk = CswConvert.ToPrimaryKey(WorkUnitNodeId);
                WorkUnitParent.NodeIdsToFilterIn.Add(pk);
            }

            CurrentWorkUnitProperty.OverrideView(View);
        }
Ejemplo n.º 4
0
        public void OnReportViewChange(CswNbtNodeProp Prop, bool Creating)
        {
            // case 28844 - Change view visibility from 'Property' to 'Hidden', so grids will run correctly
            // This will only trigger when the viewid is first set.
            CswNbtView View = _CswNbtResources.ViewSelect.restoreView(ReportView.ViewId);

            View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null);
            View.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            View.save();
        } // OnReportViewChange()
Ejemplo n.º 5
0
        public override void update()
        {
            // Fix visibility on existing mail report views
            CswNbtMetaDataObjectClass MailReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MailReportClass );
            foreach( CswNbtObjClassMailReport MailReportNode in MailReportOC.getNodes( false, true ) )
            {
                if( MailReportNode.ReportView.ViewId.isSet() )
                {
                    CswNbtView ReportView = _CswNbtSchemaModTrnsctn.restoreView( MailReportNode.ReportView.ViewId );
                    if( null != ReportView )
                    {
                        ReportView.SetVisibility( NbtViewVisibility.Hidden, null, null );
                        ReportView.save();
                    
                    } // if( null != ReportView )
                } // if( MailReportNode.ReportView.ViewId.isSet() )
            } // foreach( CswNbtObjClassMailReport MailReportNode in MailReportOC.getNodes( false, true ) )

        } //Update()
Ejemplo n.º 6
0
        public override void update()
        {
            //Fetch the data we need
            CswNbtMetaDataObjectClass SDSDocOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.SDSDocumentClass );
            CswNbtMetaDataObjectClassProp fileTypeOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.FileType );
            CswNbtMetaDataObjectClassProp archivedOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Archived );
            CswNbtMetaDataObjectClassProp formatOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Format );
            CswNbtMetaDataObjectClassProp languageOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Language );
            CswNbtMetaDataObjectClassProp fileOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.File );
            CswNbtMetaDataObjectClassProp linkOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Link );
            CswNbtMetaDataObjectClassProp ownerOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Owner );
            CswNbtMetaDataObjectClassProp revisionDateOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.RevisionDate );

            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            CswNbtMetaDataObjectClassProp AssignedSDS_OCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.AssignedSDS );

            //Find the relationship to add the prop to
            CswNbtView AssignedSDSView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( AssignedSDS_OCP.ViewXml );
            AssignedSDSView.Clear();
            AssignedSDSView.SetVisibility( CswEnumNbtViewVisibility.Property, null, null );

            CswNbtViewRelationship chemLvl = AssignedSDSView.AddViewRelationship( ChemicalOC, false );
            CswNbtViewRelationship sdsLvl = AssignedSDSView.AddViewRelationship( chemLvl, CswEnumNbtViewPropOwnerType.Second, ownerOCP, true );

            AssignedSDSView.AddViewPropertyAndFilter( sdsLvl,
                                                        MetaDataProp : archivedOCP,
                                                        SubFieldName : CswEnumNbtSubFieldName.Checked,
                                                        Value : false.ToString(),
                                                        FilterMode : CswEnumNbtFilterMode.Equals,
                                                        ShowInGrid : false );

            AssignedSDSView.AddViewProperty( sdsLvl, revisionDateOCP, 1 );
            AssignedSDSView.AddViewProperty( sdsLvl, formatOCP, 5 );
            AssignedSDSView.AddViewProperty( sdsLvl, languageOCP, 4 );
            AssignedSDSView.AddViewProperty( sdsLvl, fileOCP, 2 );
            AssignedSDSView.AddViewProperty( sdsLvl, linkOCP, 3 );
            CswNbtViewProperty fileTypeVP = AssignedSDSView.AddViewProperty( sdsLvl, fileTypeOCP );
            fileTypeVP.ShowInGrid = false;

            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( AssignedSDS_OCP, CswEnumNbtObjectClassPropAttributes.viewxml, AssignedSDSView.ToString() );

        } // update()
Ejemplo n.º 7
0
        /// <summary>
        /// Convenience function for hiding views (null safe)
        /// </summary>
        /// <param name="hidden">True if the view should be hidden</param>
        /// <param name="viewName">The name of the view to hide/unhide</param>
        /// /// <param name="visibility">the original visibility of the view when not hidden</param>
        public void ToggleView(bool hidden, string viewName, CswEnumNbtViewVisibility Visibility)
        {
            CswEnumNbtViewVisibility FindVisibility = hidden ? Visibility : CswEnumNbtViewVisibility.Hidden;
            CswEnumNbtViewVisibility SetVisibility  = hidden ? CswEnumNbtViewVisibility.Hidden : Visibility;

            DataTable viewDT = _CswNbtResources.ViewSelect.getView(viewName, FindVisibility, null, null);

            if (viewDT.Rows.Count == 1)
            {
                CswNbtView view = _CswNbtResources.ViewSelect.restoreView(viewDT.Rows[0]["viewxml"].ToString());
                if (null != view)
                {
                    // case 30162 - check for redundant existing views of all visibility types (other than itself)
                    List <CswNbtView> MatchingViews = _CswNbtResources.ViewSelect.restoreViews(viewName);
                    if (MatchingViews.Count <= 1)
                    {
                        view.SetVisibility(SetVisibility, null, null);
                        view.save();
                    }
                }
            }
        }
        public override void update()
        {
            Int32 AdminRolePk = Int32.MinValue;
            CswCommaDelimitedString AdminRoles = new CswCommaDelimitedString();

            // Change the visibilily of the 'Roles and Users' view to global
            CswNbtView RolesAndUsersView = _CswNbtSchemaModTrnsctn.restoreView( "Roles and Users" );
            if( null != RolesAndUsersView )
            {
                RolesAndUsersView.SetVisibility( CswEnumNbtViewVisibility.Global, null, null );
                RolesAndUsersView.save();

                // For any roles that aren't Administrator roles, remove any role permissions
                CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RoleClass );
                foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true, false ) )
                {
                    if( CswEnumTristate.True != RoleNode.Administrator.Checked )
                    {
                        foreach( CswEnumNbtNodeTypePermission Permission in CswEnumNbtNodeTypePermission.Members )
                        {
                            RoleNode.NodeTypePermissions.RemoveValue( CswNbtObjClassRole.MakeNodeTypePermissionValue( RoleOC.FirstNodeType.NodeTypeId, Permission ) );
                        }
                        RoleNode.NodeTypePermissions.SyncGestalt();
                        RoleNode.postChanges( false );
                    }
                    else
                    {
                        AdminRoles.Add( CswConvert.ToString( RoleNode.NodeId.PrimaryKey ) );
                    }

                    // We need this because setting the landing page for this Role is a special case
                    if( RoleNode.Name.Text == "Administrator" )
                    {
                        AdminRolePk = RoleNode.NodeId.PrimaryKey;
                    }
                }

                // Redirect Welcome Landingpage items
                CswTableUpdate TableUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "updateLandingPageItems_Case28518", "landingpage" );
                DataTable LandingPageDt = TableUpdate.getTable( "where for_roleid in (" + AdminRoles.ToString() + ")" );
                foreach( DataRow CurrentRow in LandingPageDt.Rows )
                {
                    if( CswConvert.ToInt32( CurrentRow["for_roleid"] ) == AdminRolePk )
                    {
                        if( CswConvert.ToString( CurrentRow["to_nodeviewid"] ) == "19" )
                        {
                            CurrentRow["displaytext"] = RolesAndUsersView.ViewName;
                        }
                    }

                    if( CswConvert.ToString( CurrentRow["displaytext"] ) == "Roles and Users" )
                    {
                        CurrentRow["to_nodeviewid"] = RolesAndUsersView.ViewId.get();
                    }

                }

                TableUpdate.update( LandingPageDt );
            }//if( null != RolesAndUsersView )

        }// update()