コード例 #1
0
        /// <summary>
        /// Method used to load menus based on the filter condition
        /// </summary>
        /// <param name="argTabID">Menu TabID</param>
        /// <param name="argUsedID">Iser ID</param>
        /// <param name="sesitivity">sesitivity</param>
        public void LoadMenu(int argTabID, int argUsedID, int sesitivity)
        {
            try
            {
                string  umbrellaURL  = Global.UmbrellaSiteURL + "/Umbrella/kernel/PCOWINIEX.aspx";
                DataSet dtParentMenu = objMenuGenerator.GetParentMenuItems(argTabID, argUsedID, sesitivity);

                if (dtParentMenu.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in dtParentMenu.Tables[0].Rows)
                    {
                        MenuItem tabItem = new MenuItem((string)row["Name"]);

                        tabItem.ToolTip = row["Name"].ToString();
                        tabItem.Target  = "bodyframe";

                        switch (row["ID"].ToString())
                        {
                        // case "5567": // Inventory Management tab
                        //    tabItem.NavigateUrl = Global.IntranetSiteURL + "InvReportDashboard/InvReportsDashBoard.aspx";
                        //    break;
                        case "5947":    //PFCPolicies
                            tabItem.NavigateUrl = Global.IntranetSiteURL + "SystemFrameSet/PFCVisionWOLogin.aspx";
                            break;

                        case "5615":     // Web Administration
                            tabItem.NavigateUrl = umbrellaURL;
                            tabItem.Target      = "_blank";
                            break;

                        //case "5549"://Financial Management
                        //case "5568"://Order Management
                        //case "5577"://Period Processing
                        //case "5578"://Procurement Management
                        case "5579":    //Quality Assurance Management
                        case "5608":    //Reports and Queries
                        case "5609":    //HardWare Under knowledgeBase
                        case "5610":    //Newsparts Under knowledgeBase
                        case "5614":    //EDI
                            tabItem.NavigateUrl = Global.IntranetSiteURL + "SystemFrameSet/UnderConstruction.aspx";
                            break;

                        default:
                            tabItem.NavigateUrl = Global.IntranetSiteURL + "SystemFrameSet/BodyFrame.aspx?TabID=" + argTabID.ToString() + "&ParentID=" + row["ID"].ToString() + "&ParentMenuName=" + row["Name"].ToString();
                            break;
                        }
                        Menu1.Items.Add(tabItem);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #2
0
    /// <summary>
    /// Build TreeView using Recursive concept
    /// </summary>
    /// <CreatedBy>Shiva</CreatedBy>
    /// <alteredBy>mahesh For TreeView</alteredBy>
    /// <param name="menuItemID"></param>
    /// <param name="tabID"></param>
    private void BuildMenuTree(TreeView tvMenu, int tabID)
    {
        try
        {
            //
            // Menu Item
            //
            DataSet   dsParentMenuID = menuGenerator.GetParentMenuItems(tabID, userID, sensitivity);
            DataTable dtParentMenuID = dsParentMenuID.Tables[0];

            //
            // Check whether there exist any rows
            //
            if (dtParentMenuID.Rows.Count > 0)
            {
                //
                // Loop trough each row and add the menu item
                //
                foreach (DataRow parentRow in dtParentMenuID.Rows)
                {
                    //
                    // Add the menu item
                    //
                    TreeNode tvMenuItem = new TreeNode((string)parentRow["Name"]);
                    tvMenu.Nodes.Add(tvMenuItem);
                    tvMenuItem.SelectAction = TreeNodeSelectAction.Expand;
                    tvMenuItem.ToolTip      = ((string)parentRow["Name"]);
                    string parentName = (string)parentRow["Name"];

                    // ----------------------------------------------------------------------
                    // Check whether next level exist before binding the URL to the item (Level 2)
                    // ----------------------------------------------------------------------
                    int    parentTabID   = Convert.ToInt32(parentRow["TabID"].ToString());
                    int    parentID      = Convert.ToInt32(parentRow["ID"].ToString());
                    string mouseOutColor = parentRow["MouseOutColour"].ToString();

                    iLinkFlag = 0;
                    //
                    // Build the child TreeView menus
                    //
                    BuildSubMenus(tvMenuItem, parentID, parentTabID, mouseOutColor, parentName);
                }
            }
        }
        catch (Exception ex)
        {
            //ProcessMonitor.InsertProcessMonitor("MenuFrame.aspx", "1.0", "System", "Kernel", "BuildMenuTree()", "", ex.Message.ToString(), "Failed");
        }
    }