Esempio n. 1
0
    /// <summary>
    /// Recursive routine which builds the child level menus
    /// </summary>
    /// <CreatedBy>Shiva</CreatedBy>
    /// <alteredBy>mahesh For TreeView</alteredBy>
    /// <param name="tvMenuItem"></param>
    /// <param name="tabID"></param>
    private void BuildSubMenus(TreeNode tvMenuItem, int parentID, int parentTabID, string mouseOutColor, string parentMenuName)
    {
        try
        {
            DataSet   dsSubMenu = menuGenerator.GetSubMenuCategory(parentID, parentTabID, sensitivity);
            DataTable dtSubMenu = dsSubMenu.Tables[0];

            if (dtSubMenu.Rows.Count > 0)
            {
                foreach (DataRow SubmenuRow in dtSubMenu.Rows)
                {
                    //
                    // condition to check where the module is pubished or released
                    //
                    if (SubmenuRow["Published"].ToString().ToLower() == "true" || SubmenuRow["ModuleID"].ToString() == "0")
                    {
                        //
                        // Add the menu item
                        //
                        TreeNode tvSubMenuitem = new TreeNode(SubmenuRow["Name"].ToString());
                        tvMenuItem.ChildNodes.Add(tvSubMenuitem);
                        tvSubMenuitem.SelectAction = TreeNodeSelectAction.Expand;
                        tvSubMenuitem.ToolTip      = SubmenuRow["Name"].ToString();
                        string parentName = SubmenuRow["Name"].ToString();

                        //
                        // Bind the URL and set the target frame
                        //
                        if (SubmenuRow["ModuleURL"].ToString() != string.Empty)
                        {
                            switch (SubmenuRow["ID"].ToString())
                            {
                            //case "5549"://Financial Management
                            case "5568":    //Order Management
                            case "5579":    //Quality Assurance Management
                            case "5608":    //Reports and Queries
                            case "5609":    //HardWare Under knowledgeBase
                            case "5610":    //Newsparts Under knowledgeBase
                            case "5614":    //EDI
                                tvSubMenuitem.NavigateUrl = Global.IntranetSiteURL + "SystemFrameSet/UnderConstruction.aspx";
                                break;

                            default:
                                tvSubMenuitem.NavigateUrl = Global.UmbrellaSiteURL + SubmenuRow["ModuleURL"].ToString();
                                break;
                            }
                        }

                        //
                        // Now check for child levels and call the function itself
                        //
                        int currentTabID    = Convert.ToInt32(SubmenuRow["TabID"].ToString());
                        int currentParentID = Convert.ToInt32(SubmenuRow["ID"].ToString());

                        DataSet dsTempSubMenu = menuGenerator.GetSubMenuCategory(currentParentID, currentTabID, sensitivity);
                        if (dsTempSubMenu.Tables[0].Rows.Count == 0)
                        {
                            iLinkFlag = 1;
                        }
                        else
                        {
                            iLinkFlag = 0;
                        }
                        //
                        // Call the function recursively for further sublevel items
                        //
                        BuildMenuItems(tvSubMenuitem, currentParentID, currentTabID, mouseOutColor, parentName);
                    }
                }
            }
            else
            {
                if (parentID == 5615)
                {
                    tvMenuItem.NavigateUrl = Global.UmbrellaSiteURL + "/Umbrella/kernel/PCOWINIEX.aspx";
                    tvMenuItem.Target      = "_blank";
                }
                else if (parentID == 5567) // Inventory Management tab
                {
                    tvMenuItem.NavigateUrl = Global.IntranetSiteURL + "InvReportDashboard/InvReportsDashBoard.aspx";
                }

                //
                // Add the menu item
                //
                if (iLinkFlag == 0)
                {
                    TreeNode tvSubMenuitem = new TreeNode("<i>No links found</i>");
                    tvMenuItem.ChildNodes.Add(tvSubMenuitem);
                    tvSubMenuitem.SelectAction = TreeNodeSelectAction.Expand;
                    tvSubMenuitem.ToolTip      = "No links found";
                    iLinkFlag = 0;
                }
            }
        }
        catch (Exception ex)
        {
        }
    }