Пример #1
0
        public static void initializeImpersonate(ICswResources CswResources, CswNbtMainMenuReturn Return, object Object)
        {
            CswNbtResources CswNbtResources = (CswNbtResources)CswResources;

            if (CswNbtResources.CurrentNbtUser.IsAdministrator())
            {
                // get the impersonate view
                DataTable DataTable = CswNbtResources.ViewSelect.getView("Impersonation NodeSelect View", CswEnumNbtViewVisibility.Hidden, null, null);
                if (DataTable.Rows.Count > 0)
                {
                    Int32        ViewId    = CswConvert.ToInt32(DataTable.Rows[0]["nodeviewid"].ToString());
                    CswNbtViewId NbtViewId = new CswNbtViewId(ViewId);
                    Return.Data.ImpersonateViewId = NbtViewId.ToString();
                }

                // We always want to exclude the current user
                Return.Data.ExcludeNodeIds.Add(CswNbtResources.CurrentNbtUser.UserId.ToString());
                // and exclude any users of chemsw_admin_role
                CswNbtObjClassUser ChemSWAdminUser = CswNbtResources.Nodes.makeUserNodeFromUsername("chemsw_admin");
                Return.Data.ExcludeNodeIds.Add(ChemSWAdminUser.UserId.ToString());
                //todo: make this encompass _all_ users of chemsw_admin_role
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Warning,
                                          "You do not have permission to use this feature.",
                                          "User " + CswNbtResources.CurrentNbtUser.Username + " attempted to run initalizeImpersonate().");
            }
        } //initializeImpersonate()
Пример #2
0
        } // Run()

        public JObject getView(string ViewId, ICswNbtUser CurrentUser)
        {
            JObject RetJson = new JObject();

            // Get the full XML for the entire view
            CswNbtViewId NbtViewId = new CswNbtViewId(ViewId);

            if (NbtViewId.isSet())
            {
                CswNbtView View = _CswNbtResources.ViewSelect.restoreView(NbtViewId);

                // case 20083
                if (_ForMobile)
                {
                    RetJson.Add(_getSearchNodes(View));
                }

                ICswNbtTree Tree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, View, true, false, false);

                if (Tree.getChildNodeCount() > 0)
                {
                    JObject NodesObj = new JObject();
                    RetJson["nodes"] = NodesObj;
                    _runTreeNodesRecursive(Tree, NodesObj);
                }
                else
                {
                    RetJson["nodes"] = new JObject();
                    RetJson["nodes"][NodeIdPrefix + Int32.MinValue] = "No Results";
                }
            }

            return(RetJson);
        } // Run()
Пример #3
0
        }//_createNodeType()

        private CswNbtViewId _createMaterialPropertyView(CswNbtMetaDataNodeTypeProp materialprop, string nodetype)
        {
            CswNbtViewId ViewId = null;
            CswNbtView   View   = _CswNbtSchemaModTrnsctn.makeSafeView("CertDefMaterialProp_" + nodetype, CswEnumNbtViewVisibility.Property);

            if (nodetype == "CertDef EP")
            {
                CswNbtMetaDataObjectClass EPOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.EnterprisePartClass);
                View.AddViewRelationship(EPOC, true);
                materialprop.DesignNode.AttributeProperty[CswEnumNbtPropertyAttributeName.Target].AsMetaDataList.setValue(CswEnumNbtViewRelatedIdType.ObjectClassId, EPOC.ObjectClassId);
            }
            else
            {
                CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet("MaterialSet");
                View.AddViewRelationship(MaterialPS, true);
                materialprop.DesignNode.AttributeProperty[CswEnumNbtPropertyAttributeName.Target].AsMetaDataList.setValue(CswEnumNbtViewRelatedIdType.PropertySetId, MaterialPS.PropertySetId);
            }

            View.save();
            ViewId = View.ViewId;



            return(ViewId);
        }
        public void onSetFk(CswNbtObjClassDesignNodeTypeProp DesignNTPNode)
        {
            Collection <CswNbtFieldTypeAttribute> Attributes = getAttributes();
            CswNbtFieldTypeAttribute FkTypeAttr = Attributes.FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Fktype);

            if (DesignNTPNode.AttributeProperty.ContainsKey(FkTypeAttr.Name))
            {
                CswNbtNodePropWrapper FkTypeProp = DesignNTPNode.AttributeProperty[FkTypeAttr.Name];
                if (null != FkTypeProp && FkTypeProp.wasAnySubFieldModified(false))
                {
                    CswNbtNodePropMetaDataList FkProp = FkTypeProp.AsMetaDataList;
                    CswNbtViewId ViewId = DesignNTPNode.AttributeProperty[AttributeName.UnitView].AsViewReference.ViewId;
                    CswNbtView   View   = _CswNbtFieldResources.CswNbtResources.ViewSelect.restoreView(ViewId);
                    if (CswEnumNbtViewRelatedIdType.Unknown != FkProp.Type && Int32.MinValue != FkProp.Id)
                    {
                        //We have valid values that are different that what is currently set
                        CswNbtFieldTypeRuleDefaultImpl.setDefaultView(_CswNbtFieldResources.CswNbtResources.MetaData, DesignNTPNode, View, FkProp.Type, FkProp.Id, false);
                    }
                    else
                    {
                        //Make sure a default view is set
                        CswEnumNbtViewRelatedIdType TargetType = DesignNTPNode.AttributeProperty[AttributeName.UnitTarget].AsMetaDataList.Type;
                        Int32 TargetId = DesignNTPNode.AttributeProperty[AttributeName.UnitTarget].AsMetaDataList.Id;
                        if (CswEnumNbtViewRelatedIdType.Unknown != TargetType && Int32.MinValue != TargetId)
                        {
                            CswNbtFieldTypeRuleDefaultImpl.setDefaultView(_CswNbtFieldResources.CswNbtResources.MetaData, DesignNTPNode, View, TargetType, TargetId, true);
                        }
                    }
                }
            } // if( DesignNTPNode.AttributeProperty.ContainsKey( FkTypeAttr.Name ) )
        }     // onSetFk()
Пример #5
0
        } // getAttributes()

        public static CswNbtView setDefaultView(CswNbtMetaData MetaData, CswNbtObjClassDesignNodeTypeProp DesignNTPNode, CswNbtView View, CswEnumNbtViewRelatedIdType RelatedIdType, Int32 inFKValue, bool OnlyCreateIfNull)
        {
            if (RelatedIdType != CswEnumNbtViewRelatedIdType.Unknown &&
                (null == View ||
                 View.Root.ChildRelationships.Count == 0 ||
                 false == OnlyCreateIfNull))
            {
                if (null != View)
                {
                    View.Root.ChildRelationships.Clear();
                }

                ICswNbtMetaDataDefinitionObject targetObj = MetaData.getDefinitionObject(RelatedIdType, inFKValue);
                if (null != targetObj)
                {
                    CswNbtViewId OldViewId = View.ViewId;
                    View        = targetObj.CreateDefaultView();
                    View.ViewId = OldViewId;
                }
                else
                {
                    throw new CswDniException(CswEnumErrorType.Error, "Cannot create a relationship without a valid target.", "setDefaultView() got an invalid RelatedIdType: " + RelatedIdType + " or value: " + inFKValue);
                }

                View.Visibility = CswEnumNbtViewVisibility.Property;
                View.ViewMode   = CswEnumNbtViewRenderingMode.Tree;
                View.ViewName   = DesignNTPNode.PropName.Text;
                View.save();
            }
            return(View);
        }
        public override void update()
        {
            CswNbtMetaDataObjectClass UnitOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.UnitOfMeasureClass );
            IEnumerable<CswNbtMetaDataObjectClassProp> OCPropsToUpdate = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProps( CswNbtMetaDataFieldType.NbtFieldType.Quantity );

            foreach( CswNbtMetaDataObjectClassProp QuantityProp in OCPropsToUpdate )
            {
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuantityProp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isfk, true );
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuantityProp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.fktype, NbtViewRelatedIdType.ObjectClassId.ToString() );
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuantityProp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.fkvalue, UnitOC.ObjectClassId );
            }

            IEnumerable<CswNbtMetaDataNodeTypeProp> NTPropsToUpdate = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProps( CswNbtMetaDataFieldType.NbtFieldType.Quantity );

            foreach( CswNbtMetaDataNodeTypeProp NodeTypeProp in NTPropsToUpdate )
            {
                CswNbtViewId NewViewId = NodeTypeProp.ViewId;
                CswNbtView UnitView = _CswNbtSchemaModTrnsctn.restoreView( NewViewId );
                UnitView.Root.ChildRelationships.Clear();
                UnitView.ViewName = "CswNbtNodeTypePropQuantity_" + NodeTypeProp.NodeTypeId.ToString();
                UnitView.AddViewRelationship( UnitOC, true );
                UnitView.save();

                NodeTypeProp.ViewId = UnitView.ViewId;
                NodeTypeProp.SetFK( NbtViewRelatedIdType.ObjectClassId.ToString(), UnitOC.ObjectClassId );
            }

        }//Update()
Пример #7
0
        public override void setDBValuesFromExistingLandingPageItem(string RoleId, LandingPageData.LandingPageItem Item)
        {
            CswEnumNbtViewType ViewType = (CswEnumNbtViewType)Item.Type;

            if (ViewType == CswEnumNbtViewType.View)
            {
                _ItemRow["to_nodeviewid"] = new CswNbtViewId(Item.ViewId).get();
            }
            else if (ViewType == CswEnumNbtViewType.Action)
            {
                _ItemRow["to_actionid"] = Item.ActionId;
            }
            else if (ViewType == CswEnumNbtViewType.Report)
            {
                _ItemRow["to_reportid"] = Item.ReportId;
            }
            else if (ViewType == CswEnumNbtViewType.Search)
            {
                ;
                _ItemRow["to_searchid"] = Item.ReportId;
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Warning, "You must select a view", "No view was selected for new Link LandingPage Item");
            }
            _setCommonDBValuesFromExistingLandingPageItem(RoleId, Item);
        }
Пример #8
0
        public CswNbtNodePropViewReference(CswNbtResources CswNbtResources, CswNbtNodePropData CswNbtNodePropData, CswNbtMetaDataNodeTypeProp CswNbtMetaDataNodeTypeProp, CswNbtNode Node)
            : base(CswNbtResources, CswNbtNodePropData, CswNbtMetaDataNodeTypeProp, Node)
        {
            _ViewIdSubField         = ((CswNbtFieldTypeRuleViewReference)_FieldTypeRule).ViewIdSubField;
            _CachedViewNameSubField = ((CswNbtFieldTypeRuleViewReference)_FieldTypeRule).CachedViewNameSubField;


            // Associate subfields with methods on this object, for SetSubFieldValue()
            _SubFieldMethods.Add(_ViewIdSubField.Name, new Tuple <Func <dynamic>, Action <dynamic> >(() => ViewId,
                                                                                                     x =>
            {
                if (CswTools.IsInteger(x))
                {
                    ViewId = new CswNbtViewId(CswConvert.ToInt32(x));
                }
                else if (x is CswNbtViewId)
                {
                    ViewId = x;
                }
                else if (string.IsNullOrEmpty(x))
                {
                    ViewId = null;
                }
                else
                {
                    throw new CswDniException(CswEnumErrorType.Error, "Invalid parameter", "CswNbtNodePropViewReference got an invalid parameter for setting ViewId: " + x.ToString());
                }
            }));
            _SubFieldMethods.Add(_CachedViewNameSubField.Name, new Tuple <Func <dynamic>, Action <dynamic> >(() => CachedViewName, x => CachedViewName = CswConvert.ToString(x)));
        }
 private static CswNbtView _getView( CswNbtResources NbtResources, CswNbtViewId ViewId )
 {
     CswNbtView Ret = null;
     if( ViewId.isSet() )
     {
         Ret = NbtResources.ViewSelect.restoreView( ViewId );
     }
     return Ret;
 }
Пример #10
0
 public void setViewId(CswNbtViewId ViewId, bool ForceReload)
 {
     if (Session["ViewId"] == null || ViewId.ToString() != Session["ViewId"].ToString() || ForceReload)
     {
         clearView();
         Session.Add("ViewId", ViewId.ToString());
         initSelectedView(true);
     }
 }
        public override void update()
        {

            CswNbtMetaDataNodeType InventoryGroupNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Inventory Group" );
            if( null != InventoryGroupNT ) 
            {
                CswNbtMetaDataNodeTypeProp LocationsNTP = InventoryGroupNT.getNodeTypeProp( "Locations" );
                if( null != LocationsNTP )
                {
                    CswNbtViewId LocationsViewId = LocationsNTP.ViewId;
                    CswNbtView IvgLocationsView = _CswNbtSchemaModTrnsctn.restoreView( LocationsViewId );
                    if( ( null != IvgLocationsView ) && ( null != IvgLocationsView.Root.ChildRelationships[0] ) && ( null != IvgLocationsView.Root.ChildRelationships[0].ChildRelationships[0] ) )
                    {
                        IvgLocationsView.Root.ChildRelationships[0].ChildRelationships[0].AddChildren = CswEnumNbtViewAddChildrenSetting.None;
                        IvgLocationsView.save();
                    }

                }//if we have the locations nt

                CswNbtMetaDataNodeTypeProp AssignLocationsNTP = InventoryGroupNT.getNodeTypeProp( CswNbtObjClassInventoryGroup.PropertyName.AssignLocation );
                CswNbtMetaDataNodeTypeProp LocationsGridNTP = InventoryGroupNT.getNodeTypeProp( "Locations" );
                if( ( null != AssignLocationsNTP ) && ( null != LocationsGridNTP )  )
                {
                    CswNbtMetaDataNodeTypeTab LocationsTab = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeTab( InventoryGroupNT.NodeTypeId, "Locations" );
                    if( null != LocationsTab )
                    {
                        
                        //AssignLocationsNTP
                        //_CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.
                        _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout(
                            CswEnumNbtLayoutType.Edit,
                            InventoryGroupNT.NodeTypeId,
                            AssignLocationsNTP,
                            true,
                            LocationsTab.TabId,
                            1
                            );

                        _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout(
                            CswEnumNbtLayoutType.Edit,
                            InventoryGroupNT.NodeTypeId,
                            LocationsGridNTP,
                            true,
                            LocationsTab.TabId,
                            2
                            );
                        //AssignLocationsNTP.
                    }//if we have a locatioins tab

                }//if we have an assign locations button. 

            }//if we have the inventory group nt
            
        } // update()
Пример #12
0
        }//afterPopulateProps()

        protected override bool onButtonClick( NbtButtonData ButtonData )
        {
            if( null != ButtonData && null != ButtonData.NodeTypeProp )
            {
                string OCPPropName = ButtonData.NodeTypeProp.getObjectClassPropName();
                //Remember: Save is an OCP too
                if( PropertyName.LoadUserContext == OCPPropName )
                {
                    ButtonData.Data["action"] = OCPPropName;

                    ButtonData.Data["type"] = "view"; //assume it's a view unless it's an action
                    CswEnumNbtActionName ActionName = CswNbtAction.ActionNameStringToEnum( Action.Text );
                    if( CswResources.UnknownEnum != ActionName )
                    {
                        if( null != _CswNbtResources.Actions[ActionName] )
                        {
                            CswNbtAction action = _CswNbtResources.Actions[ActionName];
                            ButtonData.Data["type"] = "action";
                            ButtonData.Data["actionname"] = action.Name.ToString();
                            ButtonData.Data["actionid"] = action.ActionId.ToString();
                            ButtonData.Data["actionurl"] = action.Url.ToString();
                        }
                    }
                    else
                    {
                        ButtonData.Data["selectedNodeId"] = SelectedNodeId.Text;
                        if( null != CurrentViewMode )
                        {
                            ButtonData.Data["viewmode"] = CurrentViewMode.Text;
                        }
                        //CswNbtViewId delimitedViewId = new CswNbtViewId( CswConvert.ToInt32( View.SelectedViewIds.ToString() ) );
                        CswNbtViewId delimitedViewId = View.ViewId;
                        if( null != delimitedViewId )
                        {
                            ButtonData.Data["viewid"] = delimitedViewId.ToString();
                        }
                        if( null != Author.RelatedNodeId )
                        {
                            if( _CswNbtResources.CurrentNbtUser.UserId != Author.RelatedNodeId )
                            {
                                ButtonData.Data["userid"] = Author.RelatedNodeId.ToString();
                                CswNbtObjClassUser userNode = _CswNbtResources.Nodes[Author.RelatedNodeId];
                                if( null != userNode )
                                {
                                    ButtonData.Data["username"] = userNode.Username;
                                }
                            }
                        }
                    }
                    ButtonData.Action = CswEnumNbtButtonAction.loadView;
                }
            }
            return true;
        }
        public override void update()
        {
            CswNbtObjClassRole AdminRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "Administrator" );

            CswNbtViewId MyBatchOperationsViewId = null;
            CswNbtView MyBatchOperationsView = null;
            DataTable Views = _CswNbtSchemaModTrnsctn.ViewSelect.getView( "My Batch Operations", CswEnumNbtViewVisibility.Global, null, null );
            if( Views.Rows.Count > 0 )
            {
                MyBatchOperationsViewId = new CswNbtViewId( CswConvert.ToInt32( Views.Rows[0]["nodeviewid"] ) );
                MyBatchOperationsView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( MyBatchOperationsViewId );
            }

            if( null == MyBatchOperationsView )
            {
                throw new CswDniException( CswEnumErrorType.Error, "My Batch Operations View does not exist", "The My Batch Operations View is needed to configure a landing page for the Receiving Wizard" );
            }
            if( null == AdminRole )
            {
                throw new CswDniException( CswEnumErrorType.Error, "Administrator Role does not exist", "The Administrator Role is needed to configure a landing page for the Receiving Wizard" );
            }

            /*
             * Case 31560 -- this button is now a link on the left hand side so that it only appears conditionally
             * 
            _CswNbtSchemaModTrnsctn.LandingPage.addLandingPageItem( CswEnumNbtLandingPageItemType.Link, new LandingPageData.Request()
                {
                    ActionId = _CswNbtSchemaModTrnsctn.Actions[CswEnumNbtActionName.Receiving].ActionId.ToString(),
                    NodeViewId = MyBatchOperationsViewId.ToString(),   //I think we have to set PkValue and not NodeViewId...but idk why
                    PkValue = MyBatchOperationsViewId.ToString(),
                    ViewType = CswEnumNbtViewType.View.ToString(),
                    RoleId = AdminRole.NodeId.ToString(),
                    Text = "My Batch Operations",
                    NewColumn = 1,
                    NewRow = 1
                } );
            */


            CswNbtMetaDataObjectClass ChemicalClass = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            CswNbtMetaDataObjectClassProp ReceiveOCP = ChemicalClass.getObjectClassProp( CswNbtObjClassChemical.PropertyName.Receive );
            _CswNbtSchemaModTrnsctn.LandingPage.addLandingPageItem( CswEnumNbtLandingPageItemType.Button, new LandingPageData.Request()
                {
                    ActionId = _CswNbtSchemaModTrnsctn.Actions[CswEnumNbtActionName.Receiving].ActionId.ToString(),
                    PkValue = ReceiveOCP.PropId.ToString(),
                    RoleId = AdminRole.NodeId.ToString(),
                    Text = "Receive more of this Material",
                    NewColumn = 2,
                    NewRow = 1
                } );


        } // update()
Пример #14
0
        public override void update()
        {
            #region part 1 - move the global Locations view to the System category
            List<CswNbtView> views = _CswNbtSchemaModTrnsctn.ViewSelect.restoreViews( "Locations" );
            foreach( CswNbtView view in views )
            {
                if( string.IsNullOrEmpty( view.Category ) && view.Visibility.Equals( NbtViewVisibility.Global ) && view.ViewMode.Equals( NbtViewRenderingMode.Tree ) )
                {
                    view.Category = "System";
                    view.save();
                }
            }
            #endregion

            #region part 2 - Move Deficient Inspections and Lab 1 Deficiencies Report nodes into Lab Safety (demo) category

            CswTableSelect nodesTS = _CswNbtSchemaModTrnsctn.makeCswTableSelect( "fixReportNodes_28117", "nodes" );
            DataTable nodesDT = nodesTS.getTable( "where nodename = 'Deficient Inspections' or nodename = 'Lab 1 Deficiencies'" );

            foreach( DataRow row in nodesDT.Rows )
            {
                int pkAsInt = CswConvert.ToInt32( row["nodeid"] );
                CswPrimaryKey pk = new CswPrimaryKey( "nodes", pkAsInt );
                CswNbtObjClassReport reportNode = _CswNbtSchemaModTrnsctn.Nodes.GetNode( pk );
                if( null != reportNode )
                {
                    reportNode.Category.Text = "Lab Safety (demo)";
                    reportNode.postChanges( false );
                }
            }

            #endregion

            #region part 3 - moving more views around

            //views that belong in the Containers category (Expiring Containers, Missing Containers, Above Maximum Inventory, Below Minimum Inventory)
            CswTableSelect containersTS = _CswNbtSchemaModTrnsctn.makeCswTableSelect( "conainerViews_28117", "node_views" );
            DataTable containersDT = containersTS.getTable( "where viewname = 'Expiring Containers' or viewname = 'Missing Containers' or viewname = 'Above Maximum Inventory' or viewname = 'Below Minimum Inventory' or viewname = 'Containers'" );

            foreach( DataRow row in containersDT.Rows )
            {
                CswNbtViewId viewId = new CswNbtViewId( CswConvert.ToInt32( row["nodeviewid"] ) );
                CswNbtView containerView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( viewId );
                containerView.Category = "Containers";
                containerView.save();
            }

            #endregion
        }
Пример #15
0
        public override void update()
        {
            CswNbtMetaDataNodeType ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
            if( null != ChemicalNT )
            {
                CswNbtMetaDataNodeTypeProp ContainersNTP = ChemicalNT.getNodeTypeProp( "Chemical Containers" );
                if( null != ContainersNTP )
                {
                    CswNbtViewId ChemContainersViewId = ContainersNTP.ViewId;
                    CswNbtView ChemContainersView = _CswNbtSchemaModTrnsctn.restoreView( ChemContainersViewId );
                    CswNbtViewProperty DisposedViewProp = ChemContainersView.findPropertyByName( "Disposed" );
                    foreach( CswNbtViewPropertyFilter CurrentFilter in DisposedViewProp.Filters )
                    {
                        CurrentFilter.ShowAtRuntime = true;
                    }

                    ChemContainersView.save();

                }//if we ahve a containers NTP

            }//if we have a chemical NT


            CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.LocationClass );
            foreach( CswNbtMetaDataNodeType CurrentLocationNT in LocationOC.getNodeTypes() )
            {
                    CswNbtMetaDataNodeTypeProp ContainersNTP = CurrentLocationNT.getNodeTypeProp( "Containers" );
                    if( null != ContainersNTP )
                    {
                        CswNbtViewId ChemContainersViewId = ContainersNTP.ViewId;
                        CswNbtView ChemContainersView = _CswNbtSchemaModTrnsctn.restoreView( ChemContainersViewId );
                        CswNbtViewProperty DisposedViewProp = ChemContainersView.findPropertyByName( "Disposed" );
                        foreach( CswNbtViewPropertyFilter CurrentFilter in DisposedViewProp.Filters )
                        {
                            CurrentFilter.ShowAtRuntime = true;
                        }

                        ChemContainersView.save();

                    }//if we ahve a containers NTP

            }//iterate location node types





        } // update()
Пример #16
0
        /// <summary>
        /// Get all Nodes in this View which match the provided NodeType or ObjectClass
        /// </summary>
        public Collection <CswNbtNode.Node> getOptions(CswNbtViewId ViewId, Int32 TargetNodeTypeId, Int32 TargetObjectClassId)
        {
            CswNbtView View = _CswNbtResources.ViewSelect.restoreView(ViewId);
            Collection <CswNbtNode.Node> Options = new Collection <CswNbtNode.Node>();

            if (View != null)
            {
                ICswNbtTree CswNbtTree = _CswNbtResources.Trees.getTreeFromView(
                    View: View,
                    IncludeSystemNodes: false,
                    RequireViewPermissions: false,
                    IncludeHiddenNodes: false);
                _addOptionsRecurse(Options, CswNbtTree, TargetNodeTypeId, TargetObjectClassId, 0);
            }
            return(Options);
        }
        private void _makeNewStatisticsViewsRow(DataTable Table, Int32 StatisticsId, CswNbtViewId ViewId, Int32 HitCount, string Action)
        {
            DataRow Row = Table.NewRow();

            Row["statisticsid"] = CswConvert.ToDbVal(StatisticsId);
            Row["nodeviewid"]   = CswConvert.ToDbVal(ViewId.get());
            CswNbtView ThisView = _CswNbtResources.ViewSelect.restoreView(ViewId);

            if (ThisView != null)
            {
                Row["viewname"] = ThisView.ViewName;
            }
            Row["hitcount"] = CswConvert.ToDbVal(HitCount);
            Row["action"]   = Action;
            Table.Rows.Add(Row);
        }
        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();
                }
            }
        }
Пример #19
0
        public override void update()
        {

            //get all views and find the dispense requests view
            DataTable Views = _CswNbtSchemaModTrnsctn.ViewSelect.getAllViews();
            CswNbtViewId dispenseRequestsViewId = new CswNbtViewId();
            foreach( DataRow row in Views.Rows )
            {
                if( row["viewname"].Equals( "Dispense Requests: Open" ) )
                {
                    dispenseRequestsViewId.set( CswConvert.ToInt32( row["nodeviewid"] ) );
                }
            }

            /*
             * The dispense requests view is broken. It has THREE 'Status' properties, each with different filters
             */

            if( dispenseRequestsViewId.isSet() )
            {
                CswNbtView DispenseRequestsView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( dispenseRequestsViewId );
                LinkedList<CswNbtViewProperty> viewProps = DispenseRequestsView.getOrderedViewProps( false );
                CswNbtViewRelationship parent = null;
                foreach( CswNbtViewProperty viewProp in viewProps ) //delete the 3 duplicate 'Status' view props from this view
                {
                    if( viewProp.Name.Equals( "Status" ) )
                    {
                        DispenseRequestsView.removeViewProperty( viewProp.MetaDataProp );
                    }
                    else
                    {
                        parent = (CswNbtViewRelationship) viewProp.Parent; //get the view parent to add the Status prop later (in this specific case this get the root)
                    }
                }

                //add the property to the view ONCE
                CswNbtMetaDataObjectClass requestItemOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RequestItemClass );
                CswNbtViewProperty statusVP = DispenseRequestsView.AddViewProperty( parent, requestItemOC.getObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Status ) );

                //now add the filters
                DispenseRequestsView.AddViewPropertyFilter( statusVP, FilterMode: CswNbtPropFilterSql.PropertyFilterMode.NotEquals, Value: "Completed" );
                DispenseRequestsView.AddViewPropertyFilter( statusVP, FilterMode: CswNbtPropFilterSql.PropertyFilterMode.NotEquals, Value: "Cancelled" );

                DispenseRequestsView.save();
            }

        }//Update()
Пример #20
0
        } // _error()

        public static CswNbtView getView(CswNbtResources CswNbResources, string ViewId)
        {
            CswNbtView ReturnVal = null;

            if (CswNbtViewId.isViewIdString(ViewId))
            {
                CswNbtViewId realViewid = new CswNbtViewId(ViewId);
                ReturnVal = CswNbResources.ViewSelect.restoreView(realViewid);
            }
            else if (CswNbtSessionDataId.isSessionDataIdString(ViewId))
            {
                CswNbtSessionDataId SessionViewid = new CswNbtSessionDataId(ViewId);
                ReturnVal = CswNbResources.ViewSelect.getSessionView(SessionViewid);
            }

            return(ReturnVal);
        } // _getView()
Пример #21
0
        public override void update()
        {
            CswNbtMetaDataObjectClass materialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass );

            #region Create and set the material Id for all material NTs
            CswSequenceName materialIDSequenceName = new CswSequenceName( "Material Id nbt" );

            if( false == _CswNbtSchemaModTrnsctn.doesSequenceExist( materialIDSequenceName ) )
            {
                int seqId = _CswNbtSchemaModTrnsctn.makeSequence( materialIDSequenceName, "M", "", 6, 0 );

                foreach( CswNbtMetaDataNodeType matNT in materialOC.getNodeTypes() )
                {
                    CswNbtMetaDataNodeTypeProp materialIdNTP = matNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.MaterialId );
                    materialIdNTP.setSequence( seqId );
                }
            }
            #endregion

            #region set the NodeViewId for Manufacturing Sites on Material

            CswNbtViewId viewid = null;
            foreach( CswNbtView view in _CswNbtSchemaModTrnsctn.ViewSelect.restoreViews( "Manufacturing Sites" ) )
            {
                if( view.Visibility.Equals( NbtViewVisibility.Property ) )
                {
                    viewid = view.ViewId;
                }
            }

            if( null != viewid )
            {
                CswNbtMetaDataObjectClassProp manufacturingSitesOCP = materialOC.getObjectClassProp( CswNbtObjClassMaterial.PropertyName.ManufacturingSites );
                foreach( CswNbtMetaDataNodeTypeProp manufacturingSitesNTP in manufacturingSitesOCP.getNodeTypeProps() )
                {
                    manufacturingSitesNTP.ViewId = viewid;
                }
            }

            #endregion

        }
Пример #22
0
        public void RunTree(CswNbtAPITree Return, int ViewIdInt)
        {
            try
            {
                CswNbtViewId ViewId = new CswNbtViewId(ViewIdInt);
                CswNbtView   View   = _CswNbtResources.ViewSelect.restoreView(ViewId);
                if (null != View)
                {
                    ICswNbtTree results = _CswNbtResources.Trees.getTreeFromView(View, true, false, false);
                    for (int i = 0; i < results.getChildNodeCount(); i++)
                    {
                        results.goToNthChild(i);
                        CswNbtNodeKey             NodeKey     = results.getNodeKeyForCurrentPosition();
                        string                    Name        = results.getNodeNameForCurrentPosition();
                        CswNbtMetaDataNodeType    nt          = _CswNbtResources.MetaData.getNodeType(NodeKey.NodeTypeId);
                        CswNbtMetaDataObjectClass oc          = nt.getObjectClass();
                        CswNbtMetaDataPropertySet propSet     = oc.getPropertySet();
                        string                    PropSetName = string.Empty;
                        if (null != propSet)
                        {
                            PropSetName = propSet.Name;
                        }

                        CswNbtAPITree.CswNbtTreeResource Parent = Return.Add(Name, NodeKey.NodeId, nt.NodeTypeName, oc.ObjectClassName, PropSetName, BuildURI(nt.NodeTypeName, NodeKey.NodeId.PrimaryKey));
                        _recurseTree(results, Parent);
                        results.goToParentNode();
                    }

                    Return.Status = HttpStatusCode.OK;
                }
                else
                {
                    Return.Status = HttpStatusCode.NotFound;
                }
            }
            catch (Exception)
            {
                Return.Status = HttpStatusCode.InternalServerError;
            }
        }
        public override CswNbtViewEditorData GetStepData()
        {
            CswNbtViewEditorData Return = new CswNbtViewEditorData();

            if (null == CurrentView)
            {
                CswNbtViewId selectedViewId = new CswNbtViewId();
                if (CswNbtSessionDataId.isSessionDataIdString(Request.ViewId))
                {
                    CswNbtSessionDataId sessionDataId = new CswNbtSessionDataId(Request.ViewId);
                    if (sessionDataId.isSet())
                    {
                        selectedViewId = _CswNbtResources.ViewSelect.getSessionView(sessionDataId).ViewId;
                    }
                }

                if (false == selectedViewId.isSet())
                {
                    selectedViewId = new CswNbtViewId(Request.ViewId);
                }

                CurrentView = _CswNbtResources.ViewSelect.restoreView(selectedViewId);
            }

            if (null != CurrentView)
            {
                CswNbtView TempView = new CswNbtView(_CswNbtResources);
                if (CurrentView.Visibility.Equals(CswEnumNbtViewVisibility.Property))
                {
                    _getPropertyViewProps(TempView, Return);
                }
                else
                {
                    _getViewProps(TempView, Return);
                }
            }

            base.Finalize(Return);
            return(Return);
        }
Пример #24
0
        }     // initSelectedView()

        public void setViewId(CswNbtViewId ViewId)
        {
            setViewId(ViewId, false);
        }
Пример #25
0
        private void initSelectedView(bool ForceReload)
        {
            //bz # 5150 init from query param
            string ViewIdFromQueryParam = string.Empty;
            bool   ViewLoaded           = false;

            if (_CswNbtView == null || ForceReload)
            {
                if (Request.QueryString["viewid"] != null && Request.QueryString["viewid"] != string.Empty)
                {
                    ViewIdFromQueryParam = CswTools.QueryStringParamToUrl(Request.QueryString["viewid"].ToString());
                    CswNbtViewId TargetViewId = new CswNbtViewId(CswConvert.ToInt32(ViewIdFromQueryParam));
                    if (Session["ViewId"] != null && Session["ViewId"].ToString() != TargetViewId.ToString())   // BZ 10125
                    {
                        ViewLoaded = (null != (_CswNbtView = CswNbtResources.ViewSelect.restoreView(TargetViewId)));
                    }
                }

                if (false == ViewLoaded)
                {
                    if (Session["ActionId"] != null)
                    {
                        // Action
                        _ActionId = CswConvert.ToInt32(Session["ActionId"].ToString());
                        // BZ 9934 - No need for 'default view' anymore
                        //// this is for when we come back
                        //_CswNbtView = (CswNbtView) CswNbtViewFactory.restoreView( CswNbtResources, CswNbtResources.CurrentNbtUser.DefaultViewId );

                        if (ForceReload)
                        {
                            Master.HandleLoadAction(_ActionId);
                        }
                    }
                    else
                    {
                        // View
                        _CswNbtView = new CswNbtView(CswNbtResources);
                        if (Session["SessionViewId"] != null)
                        {
                            CswNbtSessionDataId SessionDataId = null;
                            Int32 SessionViewId = CswConvert.ToInt32(Session["SessionViewId"]);
                            if (Int32.MinValue != SessionViewId)
                            {
                                SessionDataId = new CswNbtSessionDataId(SessionViewId);
                            }
                            else
                            {
                                string SessionDataIdString = CswConvert.ToString(Session["SessionViewId"]);
                                if (false == string.IsNullOrEmpty(SessionDataIdString))
                                {
                                    SessionDataId = new CswNbtSessionDataId(SessionDataIdString);
                                }
                            }
                            if (null != SessionDataId && SessionDataId.isSet())
                            {
                                _CswNbtView = CswNbtResources.ViewSelect.getSessionView(SessionDataId);
                                ViewLoaded  = (null != _CswNbtView);
                            }
                        }

                        if (Session["ViewId"] != null)
                        {
                            CswNbtViewId NbtViewId = null;
                            Int32        ViewId    = CswConvert.ToInt32(Session["ViewId"]);
                            if (Int32.MinValue != ViewId)
                            {
                                NbtViewId = new CswNbtViewId(ViewId);
                            }
                            else
                            {
                                string ViewIdStr = CswConvert.ToString(Session["ViewId"]);
                                if (false == string.IsNullOrEmpty(ViewIdStr))
                                {
                                    NbtViewId = new CswNbtViewId(ViewIdStr);
                                }
                            }
                            if (null != NbtViewId && NbtViewId.isSet())
                            {
                                _CswNbtView = CswNbtResources.ViewSelect.restoreView(NbtViewId);
                                ViewLoaded  = (null != _CswNbtView);
                            }
                        }

                        if (false == ViewLoaded && Session["ViewXml"] != null)
                        {
                            string SessionViewXml = CswConvert.ToString(Session["ViewXml"]);
                            if (false == string.IsNullOrEmpty(SessionViewXml))
                            {
                                _CswNbtView = CswNbtResources.ViewSelect.restoreView(SessionViewXml);
                            }
                            ViewLoaded = (null != _CswNbtView);
                        }

                        // BZ 9934 - No need for 'default view' anymore
                        //if( !ViewLoaded && CswNbtResources.CurrentUser != null && CswNbtResources.CurrentNbtUser.DefaultViewId > 0 )
                        //    ViewLoaded = ( null != ( _CswNbtView = (CswNbtView) CswNbtViewFactory.restoreView( CswNbtResources, CswNbtResources.CurrentNbtUser.DefaultViewId ) ) );

                        if (ForceReload)
                        {
                            Master.HandleLoadView(_CswNbtView);
                        }
                    }
                }

                if (_CswNbtView == null)
                {
                    // BZ 8321 - If all else fails, use an empty view
                    _CswNbtView = new CswNbtView(CswNbtResources);
                }
            } // if( _CswNbtView == null || ForceReload )
        }     // initSelectedView()
        }//_makeEmailBody()

        private string _makeViewLink(CswNbtResources _CswNbtResources, CswNbtViewId ViewId, string ViewName)
        {
            return(_makeLink(_CswNbtResources, "Main.html?viewid=" + ViewId.ToString(), ViewName));
        }
        private void processMailReport(CswNbtResources _CswNbtResources, CswNbtObjClassMailReport CurrentMailReport)
        {
            string EmailReportStatusMessage = string.Empty;

            if (false == CurrentMailReport.Recipients.Empty)
            {
                Collection <Int32> RecipientIds = CurrentMailReport.Recipients.SelectedUserIds.ToIntCollection();
                for (Int32 u = 0; u < RecipientIds.Count; u++)
                {
                    Int32 UserId = CswConvert.ToInt32(RecipientIds[u].ToString());

                    if (Int32.MinValue != UserId)
                    {
                        CswNbtNode         UserNode            = _CswNbtResources.Nodes[new CswPrimaryKey("nodes", UserId)];
                        CswNbtObjClassUser UserNodeAsUser      = (CswNbtObjClassUser)UserNode;
                        string             CurrentEmailAddress = UserNodeAsUser.Email.Trim();
                        if (CurrentEmailAddress != string.Empty)
                        {
                            DataTable            ReportTable    = null;
                            CswNbtObjClassReport ReportObjClass = null;

                            string EmailMessageSubject = CurrentMailReport.NodeName;
                            string EmailMessageBody    = string.Empty;
                            bool   SendMail            = false;

                            if ("View" == CurrentMailReport.Type.Value)
                            {
                                CswNbtViewId ViewId = CurrentMailReport.ReportView.ViewId;
                                if (ViewId.isSet())
                                {
                                    CswNbtView  ReportView = _CswNbtResources.ViewSelect.restoreView(ViewId);
                                    ICswNbtTree ReportTree = _CswNbtResources.Trees.getTreeFromView(
                                        RunAsUser: UserNodeAsUser as ICswNbtUser,
                                        View: ReportView,
                                        RequireViewPermissions: true,
                                        IncludeSystemNodes: false,
                                        IncludeHiddenNodes: false);
                                    //ICswNbtTree ReportTree = _CswNbtResources.Trees.getTreeFromView( UserNodeAsUser as ICswNbtUser, ReportView, true, true, false, false );

                                    if (ReportTree.getChildNodeCount() > 0)
                                    {
                                        if (CswEnumNbtMailReportEventOption.Exists.ToString() != CurrentMailReport.Event.Value)
                                        {
                                            // case 27720 - check mail report events to find nodes that match the view results
                                            Dictionary <CswPrimaryKey, string> NodesToMail = new Dictionary <CswPrimaryKey, string>();
                                            foreach (Int32 NodeId in CurrentMailReport.GetNodesToReport().ToIntCollection())
                                            {
                                                CswPrimaryKey ThisNodeId = new CswPrimaryKey("nodes", NodeId);
                                                ReportTree.makeNodeCurrent(ThisNodeId);
                                                if (ReportTree.isCurrentNodeDefined())
                                                {
                                                    NodesToMail.Add(ThisNodeId, ReportTree.getNodeNameForCurrentPosition());
                                                }
                                            }
                                            if (NodesToMail.Count > 0)
                                            {
                                                EmailMessageBody = _makeEmailBody(_CswNbtResources, CurrentMailReport, string.Empty, NodesToMail);
                                                SendMail         = true;
                                            }
                                        }
                                        else
                                        {
                                            EmailMessageBody = _makeEmailBody(_CswNbtResources, CurrentMailReport, _makeViewLink(_CswNbtResources, ViewId, ReportView.ViewName));
                                            SendMail         = true;
                                        }
                                    } // if( ReportTree.getChildNodeCount() > 0 )
                                }     // if( ViewId.isSet() )
                                else
                                {
                                    EmailReportStatusMessage += "Unable to process email report " + CurrentMailReport.Node.NodeName + ": the associated view's ViewId is not set\r\n";
                                }
                            } // if( "View" == CurrentMailReport.Type.Value )

                            else if ("Report" == CurrentMailReport.Type.Value)
                            {
                                ReportObjClass = (CswNbtObjClassReport)_CswNbtResources.Nodes[CurrentMailReport.Report.RelatedNodeId];
                                if (null != ReportObjClass)
                                {
                                    string ReportSql = CswNbtObjClassReport.ReplaceReportParams(ReportObjClass.SQL.Text, ReportObjClass.ExtractReportParams(UserNode));

                                    CswArbitrarySelect ReportSelect = _CswNbtResources.makeCswArbitrarySelect("MailReport_" + ReportObjClass.NodeId.ToString() + "_Select", ReportSql);
                                    ReportTable = ReportSelect.getTable();

                                    if (ReportTable.Rows.Count > 0)
                                    {
                                        string ReportLink = string.Empty;
                                        CswEnumNbtMailReportFormatOptions MailRptFormat = CurrentMailReport.OutputFormat.Value;
                                        if (CswEnumNbtMailReportFormatOptions.Link == MailRptFormat)
                                        {
                                            ReportLink  = _makeReportLink(_CswNbtResources, ReportObjClass);
                                            ReportTable = null; //so we don't end up attaching the CSV
                                        }

                                        EmailMessageBody = _makeEmailBody(_CswNbtResources, CurrentMailReport, ReportLink);
                                        SendMail         = true;
                                    }
                                }
                                else
                                {
                                    EmailReportStatusMessage += "Unable to process email report " + CurrentMailReport.Node.NodeName + ": the associated report's NodeId is not set\r\n";
                                } //if-else report's node id is present
                            }     // else if( "Report" == CurrentMailReport.Type.Value )

                            else
                            {
                                EmailReportStatusMessage += "Unable to process email report " + CurrentMailReport.Node.NodeName + ": the report type " + CurrentMailReport.Type.Value + " is unknown\r\n";
                            }//if-else-if on report type


                            if (SendMail)
                            {
                                EmailReportStatusMessage += _sendMailMessage(_CswNbtResources, CurrentMailReport, EmailMessageBody, UserNodeAsUser.LastName, UserNodeAsUser.FirstName, UserNodeAsUser.Node.NodeName, EmailMessageSubject, CurrentEmailAddress, ReportTable) + "\r\n";
                            }
                        } //if( Email Address != string.Empty )
                    }     //if( Int32.MinValue != UserId )
                }         //for( Int32 u = 0; u < BatchData.RecipientIds.Count() && u < NodeLimit; u++ )

                // case 27720, 28006, 31205, 30959
                CurrentMailReport.ClearNodesToReport();
                CurrentMailReport.LastProcessed.DateTimeValue = DateTime.Now;

                CurrentMailReport.RunStatus.AddComment(EmailReportStatusMessage);
                CurrentMailReport.postChanges(false);
            } //if( !CurrentMailReport.Recipients.Empty )
        }     //processMailReport()
Пример #28
0
        public override void setItemDataForUI(DataRow LandingPageRow, LandingPageData.Request Request)
        {
            bool   finishLoading = false; //this will be set to true if and only if there's a valid link to be made
            String DisplayText   = LandingPageRow["displaytext"].ToString();
            Int32  ViewId        = CswConvert.ToInt32(LandingPageRow["to_nodeviewid"]);

            if (ViewId != Int32.MinValue)
            {
                CswNbtViewId NodeViewId = new CswNbtViewId(ViewId);
                CswNbtView   ThisView   = _CswNbtResources.ViewSelect.restoreView(NodeViewId);
                if (null != ThisView && ThisView.IsFullyEnabled() && ThisView.IsVisible())
                {
                    finishLoading  = true;
                    _ItemData.Text = LandingPageRow["displaytext"].ToString() != string.Empty ? LandingPageRow["displaytext"].ToString() : ThisView.ViewName;

                    _ItemData.ViewId   = NodeViewId.ToString();
                    _ItemData.ViewMode = ThisView.ViewMode.ToString().ToLower();
                    if (ThisView.Root.ChildRelationships.Count > 0 && ThisView.Root.ChildRelationships[0] != null)
                    {
                        _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + ThisView.Root.ChildRelationships[0].SecondIconFileName;
                    }
                    _ItemData.Type = "view";
                }
            }
            Int32 ActionId = CswConvert.ToInt32(LandingPageRow["to_actionid"]);

            if (ActionId != Int32.MinValue)
            {
                CswNbtAction ThisAction = _CswNbtResources.Actions[ActionId];
                if (null != ThisAction)
                {
                    if (_CswNbtResources.Permit.can(ThisAction.Name))
                    {
                        finishLoading        = true;
                        _ItemData.Text       = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : CswNbtAction.ActionNameEnumToString(ThisAction.Name);
                        _ItemData.ActionId   = ActionId.ToString();
                        _ItemData.ActionName = ThisAction.Name.ToString();
                        _ItemData.ActionUrl  = ThisAction.Url;
                        _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + ThisAction.IconFileName;
                        _ItemData.Type       = "action";
                    }
                }
            }
            Int32 ReportId = CswConvert.ToInt32(LandingPageRow["to_reportid"]);

            if (ReportId != Int32.MinValue)
            {
                CswPrimaryKey ReportPk       = new CswPrimaryKey("nodes", ReportId);
                CswNbtNode    ThisReportNode = _CswNbtResources.Nodes[ReportPk];
                if (null != ThisReportNode)
                {
                    finishLoading        = true;
                    _ItemData.Text       = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : ThisReportNode.NodeName;
                    _ItemData.ReportId   = ReportPk.ToString();
                    _ItemData.Type       = "report";
                    _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + ThisReportNode.getNodeType().IconFileName;
                }
            }
            Int32 SearchId = CswConvert.ToInt32(LandingPageRow["to_searchid"]);

            if (SearchId != Int32.MinValue)
            {
                CswPrimaryKey SearchPk = new CswPrimaryKey("search", SearchId);
                CswNbtSearch  Search   = _CswNbtResources.SearchManager.restoreSearch(SearchPk);
                if (null != Search)
                {
                    finishLoading        = true;
                    _ItemData.Text       = Search.Name;
                    _ItemData.ReportId   = SearchPk.ToString();
                    _ItemData.Type       = "search";
                    _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + "magglass.png";
                }
            }

            //we only want to send the item back with a landingpageid if it contains a valid link
            if (finishLoading)
            {
                _setCommonItemDataForUI(LandingPageRow);
            }
        }
 /// <summary>
 /// Removes a ViewId from the SelectedViewIds
 /// </summary>
 public void RemoveViewId( CswNbtViewId ViewIdToRemove )
 {
     SelectedViewIds.Remove( ViewIdToRemove.get().ToString() );
 }
 /// <summary>
 /// True if the SelectedViewIds contains the given ViewId
 /// </summary>
 public bool ContainsViewId( CswNbtViewId ViewIdToFind )
 {
     return SelectedViewIds.Contains( ViewIdToFind.get().ToString() );
 }