Beispiel #1
0
 /// <summary>
 /// Checks to see if a view is visible to a given user
 /// </summary>
 public bool isVisible(CswNbtView View, ICswNbtUser User, bool IncludeEmptyViews, bool SearchableOnly, bool ForEdit = false)
 {
     return(((View.Root.ChildRelationships.Count > 0 &&
              (
                  View.Root.ChildRelationships.Any(R => R.SecondType != CswEnumNbtViewRelatedIdType.NodeTypeId ||
                                                   _CswNbtResources.Permit.canAnyTab(
                                                       CswEnumNbtNodeTypePermission.View,
                                                       _CswNbtResources.MetaData.getNodeType(R.SecondId),
                                                       User)))
              ) || IncludeEmptyViews) &&
            View.IsFullyEnabled() &&
            (IncludeEmptyViews || View.ViewMode != CswEnumNbtViewRenderingMode.Grid || null != View.findFirstProperty()) &&
            (!SearchableOnly || View.IsSearchable()) &&
            (false == ForEdit || (_CswNbtResources.CurrentNbtUser.Username == CswNbtObjClassUser.ChemSWAdminUsername || false == CswConvert.ToBoolean(View.IsSystem))));
 }
Beispiel #2
0
        private XmlNode _makePreviousViewTreeViewXmlNode(XmlDocument XmlDoc, object PreviousViewObj)
        {
            XmlNode Ret = null;

            if (PreviousViewObj is CswNbtView)
            {
                CswNbtView PreviousView = PreviousViewObj as CswNbtView;
                Ret = _makeTreeViewXmlNode(XmlDoc, PreviousView.SessionViewId.ToString(), ViewType.RecentView, PreviousView.ViewName, PreviousView.IconFileName, true, PreviousView.IsSearchable());
            }
            else // Action
            {
                Int32 PreviousActionId = CswConvert.ToInt32(PreviousViewObj.ToString());
                if (PreviousActionId > 0)
                {
                    CswNbtAction Action = _CswNbtResources.Actions[PreviousActionId];
                    Ret = _makeTreeViewXmlNode(XmlDoc, Action.ActionId.ToString(), ViewType.Action, Action.Name.ToString().Replace('_', ' '),
                                               CswNbtMetaDataObjectClass.IconPrefix16 + "wizard.png", true, false);
                }
            }
            return(Ret);
        }