Exemplo n.º 1
0
    private int CreateChildNode111(TreeNode ParentNodee, int stIndexdd, string[] DirectoryList, string DocID, int NodeType)
    {
        TreeNode ParentNode = null;

        try
        {
            for (int stIndex = 0; stIndex < DirectoryList.Length; stIndex++)
            {
                // string nodeText = ParentNode.ValuePath + "/" + DirectoryList[stIndex];
                if (stIndex == 0)
                {
                    ParentNode = BrowseTreeView.FindNode(DirectoryList[stIndex]);
                }
                else
                {
                    ParentNode = BrowseTreeView.FindNode(DirectoryList[stIndex - 1]);
                }

                TreeNode ChildNode = BrowseTreeView.FindNode(DirectoryList[stIndex]);
                TreeNode NewNode   = new TreeNode();

                if (ChildNode == null)
                {
                    ParentNode.ChildNodes.Add(new TreeNode(DirectoryList[stIndex], DirectoryList[stIndex], getNodeImageURL(DirectoryList[stIndex]), "", DocID));
                }

                // string nodeText1 = ParentNode.ValuePath + "/" + DirectoryList[stIndex];
                NewNode = BrowseTreeView.FindNode(ParentNode.ValuePath + "/" + DirectoryList[stIndex]);
                if (NewNode != null)
                {
                    //if (NodeType == 0 && ChildNode == null)
                    if (DirectoryList[stIndex].ToString().IndexOf(".") > 0)
                    {
                        NewNode.NavigateUrl  = "FileLoader.aspx?DocID=" + DocID;
                        NewNode.Target       = "docPreview";
                        NewNode.SelectAction = TreeNodeSelectAction.Select;
                        NewNode.Expand();
                    }
                    else
                    {
                        string value = Convert.ToString(NewNode.ValuePath);
                        NewNode.NavigateUrl  = "AddNewFile.aspx?Path=" + value;
                        NewNode.Target       = "docPreview";
                        NewNode.SelectAction = TreeNodeSelectAction.SelectExpand;
                        NewNode.Collapse();
                    }
                }
                // stIndex++;
                //CreateChildNode(NewNode, stIndex, DirectoryList, DocID);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(0);
    }
Exemplo n.º 2
0
    /// <summary>
    /// this is method uses for the load & bind the treeview control from database.
    /// </summary>
    public void LoadtreeView()
    {
        dsTreeResult = objQMS.getFilpath();
        DataTable dtTree = dsTreeResult.Tables[0];

        BrowseTreeView.Nodes.Add(new TreeNode("DOCUMENT", "DOCUMENT"));
        foreach (DataRow dr in dtTree.Rows)
        {
            string[] DirectoryList = dr[0].ToString().Split('\\');
            int      stIndex       = 3;
            TreeNode ParentNode    = BrowseTreeView.FindNode("DOCUMENT");
            CreateChildNode(ParentNode, stIndex, DirectoryList);
        }
    }
    protected void CreateChildNode(string NodePath, string NodeName, int NodeType, string NodeValue, string ParentNodeValue, string DocFileExt, string VogId)
    {
        try
        {
            //string ParentNodePath = NodePath.Replace("/" + NodeName, "");
            string[] Temp = NodePath.Split('/');


            string ParentNodePath = "";
            for (int i = 0; i < Temp.Length - 1; i++)
            {
                if (ParentNodePath.Length > 0)
                {
                    ParentNodePath += "/";
                }
                ParentNodePath += Temp[i];
            }

            TreeNode ParentNode = BrowseTreeView.FindNode(ParentNodePath);

            if (ParentNode == null)
            {
                string[] sN = ParentNodePath.Split('/');

                CreateChildNode(ParentNodePath, sN[sN.Length - 1], 0, NodeValue, ParentNodeValue, DocFileExt, VogId);

                TreeNode ParentNode1 = BrowseTreeView.FindNode(ParentNodePath);
                if (ParentNode1 != null)
                {
                    CreateNode(ParentNode1, NodeName, NodeType, NodeValue, ParentNodeValue, DocFileExt, VogId);
                }
            }
            else
            {
                CreateNode(ParentNode, NodeName, NodeType, NodeValue, ParentNodeValue, DocFileExt, VogId);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// this is for the child node by passsing the ParentNode,starting index of the node & directory list.
 /// </summary>
 /// <param name="ParentNode"></param>
 /// <param name="stIndex"></param>
 /// <param name="DirectoryList"></param>
 /// <returns></returns>
 private int CreateChildNode(TreeNode ParentNode, int stIndex, string[] DirectoryList)
 {
     try
     {
         if (stIndex < DirectoryList.Length - 1)
         {
             TreeNode ChildNode = BrowseTreeView.FindNode(ParentNode.ValuePath + "/" + DirectoryList[stIndex + 1]);
             TreeNode NewNode   = new TreeNode();
             if (ChildNode == null)
             {
                 ParentNode.ChildNodes.Add(new TreeNode(DirectoryList[stIndex + 1], DirectoryList[stIndex + 1]));
             }
             NewNode = BrowseTreeView.FindNode(ParentNode.ValuePath + "/" + DirectoryList[stIndex + 1]);
             stIndex++;
             CreateChildNode(NewNode, stIndex, DirectoryList);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(0);
 }
Exemplo n.º 5
0
    /// <summary>
    /// this is for the child node by passsing the ParentNodePath,Node Name,node type & node ID.
    /// </summary>
    /// <param name="NodePath"></param>
    /// <param name="NodeName"></param>
    /// <param name="NodeType"></param>
    /// <param name="NodeID"></param>
    /// <returns></returns>
    ///
    private int CreateChildNode(string NodePath, string NodeName, int NodeType, int NodeID)
    {
        try
        {
            string   ParentNodePath = NodePath.Replace("/" + NodeName, "");
            TreeNode ParentNode     = BrowseTreeView.FindNode(ParentNodePath);

            if (ParentNode != null)
            {
                TreeNode NewNode = new TreeNode(NodeName, NodeName.ToString(), getNodeImageURL(NodeName));


                if (NodeType == 0)
                {
                    NewNode.NavigateUrl  = "FileLoader.aspx?DocID=" + NodeID;
                    NewNode.Target       = "docPreview";
                    NewNode.SelectAction = TreeNodeSelectAction.Select;
                    NewNode.Expand();
                }
                else
                {
                    NewNode.NavigateUrl  = "AddNewFile.aspx?Path=" + NodePath;
                    NewNode.Target       = "docPreview";
                    NewNode.SelectAction = TreeNodeSelectAction.SelectExpand;
                    NewNode.Collapse();
                }

                ParentNode.ChildNodes.Add(NewNode);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(0);
    }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     LoadtreeView();
     if (!IsPostBack)
     {
         string js = "<script language='javascript' type='text/javascript'>DocOpenOnIFrame('DocPublishPendingList.aspx');</script>";
         Page.ClientScript.RegisterStartupScript(GetType(), "script", js);
     }
     else
     {
         if (Session["NAV_URL"] != null)
         {
             if (Session["NAV_URL"].ToString() != "")
             {
                 NavigateNodeURL(Session["NAV_URL"].ToString());
                 TreeNode tNode = BrowseTreeView.FindNode(Session["NAV_URL"].ToString());
                 hidden_SelectedNodeURL.Value = Session["NAV_URL"].ToString();
                 //OpenfileInfo.Disabled = true;
                 Session["NAV_URL"] = "";
             }
         }
         Session["FolderPath"] = hidden_SelectedNodeURL.Value;
     }
 }
Exemplo n.º 7
0
    /// <summary>
    /// this is method uses for the load & bind the treeview control from database.
    /// </summary>
    public void LoadtreeView()
    {
        //string FilePath[]= "";
        dsTreeResult = objQMS.getFilpath();
        DataTable dtTree = dsTreeResult.Tables[0];

        //foreach (DataRow dr in dtTree.Rows)
        //{
        //    string[] DirectoryList = dr[0].ToString().Split('\\');
        //   // string DirectoryList = dr[0].ToString();
        //    TreeNode tr = new TreeNode();
        //    string sd = DirectoryList[4].ToUpper();
        //    int iTreeIndex = 0;
        //    //for (int i = 3; i < DirectoryList.Length; i++)
        //    //{
        //    //    if(DirectoryList[i].ToUpper() == "QMS")
        //    //    {
        //    //        iTreeIndex = i+1;
        //    //        startindex = i+2;
        //    //        tr = new TreeNode(DirectoryList[i+1].ToUpper());
        //    //        BrowseTreeView.Nodes.Add(tr);

        //    //    }
        //        CreateChildNode(DirectoryList[3].ToUpper(), DirectoryList[4].ToUpper(), iTreeIndex, DirectoryList);
        //   //}
        //}

        BrowseTreeView.Nodes.Add(new TreeNode("DOCUMENT", "DOCUMENT"));
        foreach (DataRow dr in dtTree.Rows)
        {
            string[] DirectoryList = dr[0].ToString().Split('\\');
            int      stIndex       = 3;
            TreeNode ParentNode    = BrowseTreeView.FindNode("DOCUMENT");
            CreateChildNode(ParentNode, stIndex, DirectoryList);
        }
    }