コード例 #1
0
        /// <summary>
        /// Get a landing page for a Material
        /// </summary>
        public static JObject getLandingPageData(CswNbtResources NbtResources, CswNbtNode MaterialNode, CswNbtView MaterialNodeView = null)
        {
            JObject Ret = new JObject();

            if (null != MaterialNode)
            {
                MaterialNodeView = MaterialNodeView ?? CswNbtPropertySetMaterial.getMaterialNodeView(NbtResources, MaterialNode);
                MaterialNodeView.SaveToCache(IncludeInQuickLaunch: false);

                Ret["ActionId"] = NbtResources.Actions[CswEnumNbtActionName.Create_Material].ActionId.ToString();
                //Used for Tab and Button items
                Ret["NodeId"]     = MaterialNode.NodeId.ToString();
                Ret["NodeViewId"] = MaterialNodeView.SessionViewId.ToString();
                //Used for node-specific Add items
                Ret["RelatedNodeId"]   = MaterialNode.NodeId.ToString();
                Ret["RelatedNodeName"] = MaterialNode.NodeName;
                //If (and when) action landing pages are slated to be roleId-specific, remove this line
                Ret["isConfigurable"] = NbtResources.CurrentNbtUser.IsAdministrator();
                //Used for viewing new material
                Ret["ActionLinks"] = new JObject();
                string ActionLinkName = MaterialNode.NodeId.ToString();
                Ret["ActionLinks"][ActionLinkName]           = new JObject();
                Ret["ActionLinks"][ActionLinkName]["Text"]   = MaterialNode.NodeName;
                Ret["ActionLinks"][ActionLinkName]["ViewId"] = MaterialNodeView.SessionViewId.ToString();
            }
            return(Ret);
        }
コード例 #2
0
        /// <summary>
        /// Get a landing page for a Material
        /// </summary>
        public static JObject getLandingPageData(CswNbtResources NbtResources, CswNbtNode MaterialNode, bool UseBatchOp, Collection <CswPrimaryKey> ContainerIds, CswNbtView MaterialNodeView = null)
        {
            JObject Ret = new JObject();

            if (null != MaterialNode)
            {
                MaterialNodeView = MaterialNodeView ?? CswNbtPropertySetMaterial.getMaterialNodeView(NbtResources, MaterialNode, "Received: ");
                MaterialNodeView.SaveToCache(IncludeInQuickLaunch: false);

                Ret["ActionId"] = NbtResources.Actions[CswEnumNbtActionName.Receiving].ActionId.ToString();

                //Used for Tab and Button items
                Ret["NodeId"]     = MaterialNode.NodeId.ToString();
                Ret["NodeViewId"] = MaterialNodeView.SessionViewId.ToString();

                //Used for node-specific Add items
                Ret["RelatedNodeId"]   = MaterialNode.NodeId.ToString();
                Ret["RelatedNodeName"] = MaterialNode.NodeName;

                //If (and when) action landing pages are slated to be roleId-specific, remove this line
                Ret["isConfigurable"] = NbtResources.CurrentNbtUser.IsAdministrator();

                //Used for viewing new material
                Ret["ActionLinks"] = new JObject();
                string ActionLinkName = MaterialNode.NodeId.ToString();
                Ret["ActionLinks"][ActionLinkName]           = new JObject();
                Ret["ActionLinks"][ActionLinkName]["Text"]   = MaterialNode.NodeName;
                Ret["ActionLinks"][ActionLinkName]["ViewId"] = MaterialNodeView.SessionViewId.ToString();

                if (UseBatchOp)
                {
                    Ret["Title"] = "The containers for this material have been scheduled for creation, but may not be available immediately. Click 'View Batch Operations' to check their progress.";
                    Ret["ActionLinks"]["BatchOps"] = new JObject();
                    Ret["ActionLinks"]["BatchOps"]["ActionName"] = "These containers will be created in a batch operation and may not be immediately available. You can check the progress of their creation below:";
                    Ret["ActionLinks"]["BatchOps"]["Text"]       = "View Batch Operations";
                    Ret["ActionLinks"]["BatchOps"]["ViewId"]     = NbtResources.ViewSelect.getViewIdByName("My Batch Operations", CswEnumNbtViewVisibility.Global, null, null).ToString();
                }
                else
                {
                    CswNbtMetaDataNodeType ContainerNT = NbtResources.MetaData.getNodeType("Container");
                    if (null != ContainerNT)
                    {
                        CswNbtView NewContainersView = new CswNbtView(NbtResources);
                        NewContainersView.ViewName = "New Containers";
                        CswNbtViewRelationship ContainerVr = NewContainersView.AddViewRelationship(ContainerNT, true);
                        ContainerVr.NodeIdsToFilterIn = ContainerIds;
                        NewContainersView.SaveToCache(false);

                        Ret["ActionLinks"]["NewContainers"]           = new JObject();
                        Ret["ActionLinks"]["NewContainers"]["Text"]   = "View Received Containers";
                        Ret["ActionLinks"]["NewContainers"]["ViewId"] = NewContainersView.SessionViewId.ToString();;
                    }
                }
            }
            return(Ret);
        }