public void JumpPage()
        {
            int moduleid = 0;
            int.TryParse(Request.QueryString["Module"], out moduleid);
            if (moduleid == 0) Response.Redirect("desktop.aspx");

            Right_Module Module = new Right_Module_BLL(moduleid, true).Model;

            Session["ActiveModule"] = Module.ID;

            switch (Module.ID)
            {
                default:
                    if (!string.IsNullOrEmpty(Module.Remark))
                    {
                        if (Module.Remark.ToLower().StartsWith("http:"))
                            Response.Write("<script laguage='javascript'>window.open('" + Module.Remark + "');history.back(-1);</script>");
                        else if (Module.Remark.StartsWith("~"))
                        {
                            Response.Redirect(Module.Remark);
                        }
                        else
                        {
                            Session["ReportPath"] = Module.Remark;
                            Response.Redirect("../ReportViewer/PubReportViewer.aspx");
                        }
                    }
                    break;
            }
            Response.Redirect("desktop.aspx");
        }
Exemple #2
0
    void tr_TreeNodePopulate(object sender, TreeNodeEventArgs e)
    {
        DataTable dtMenu = Right_Module_BLL.GetBrowseMoudleByUser(Session["UserName"].ToString());

        string[] values = e.Node.Value.Split(new char[] { '|' });
        int      rootmenuindex = 0, menuid = 0;

        int.TryParse(values[0], out rootmenuindex);
        int.TryParse(values[1], out menuid);

        GenareateSubMenu(dtMenu, rootmenuindex, e.Node.ChildNodes, menuid);
    }
Exemple #3
0
    private void BindModuleTree(TreeNodeCollection TNC, int SuperID)
    {
        IList <Right_Assign> assignlist = (IList <Right_Assign>)ViewState["RightAssign"];

        IList <Right_Module> _moduleList = Right_Module_BLL.GetModelList("SuperID=" + SuperID.ToString() + " AND EnableFlag='Y'");

        foreach (Right_Module _module in _moduleList)
        {
            TreeNode tn = new TreeNode();
            tn.Text  = _module.Name + "(M:" + _module.ID.ToString() + ")";
            tn.Value = "M" + _module.ID.ToString();

            //判断有没有对该功能的浏览权限
            if (assignlist.FirstOrDefault(assign => assign.Module == _module.ID && assign.Action == 1) != null)
            {
                tn.Checked = true;
            }

            TNC.Add(tn);

            BindModuleTree(tn.ChildNodes, _module.ID);
        }

        IList <Right_Action> _actionlist = Right_ActionBLL.GetModelList("Module=" + SuperID.ToString());

        foreach (Right_Action _action in _actionlist)
        {
            TreeNode tn = new TreeNode();

            tn.Text  = _action.Name + "(A:" + _action.ID.ToString() + ")";
            tn.Value = "A" + _action.ID.ToString();

            //判断有没有对该功能的浏览权限
            if (assignlist.FirstOrDefault(assign => assign.Module == SuperID && assign.Action == _action.ID) != null)
            {
                tn.Checked = true;
            }

            TNC.Add(tn);
        }
    }
Exemple #4
0
    void tr_SelectedNodeChanged(object sender, EventArgs e)
    {
        TreeView tr = (TreeView)sender;

        string[] values = tr.SelectedValue.Split(new char[] { '|' });
        if (values.Length != 3)
        {
            if (values.Length > 1)
            {
                //记下当前结点所属的主模块
                Session["ActiveRootNode"] = int.Parse(values[0]);
                Ac_MainMenu.SelectedIndex = (int)Session["ActiveRootNode"];
            }

            if (tr.SelectedNode.ChildNodes.Count == 0)
            {
                //如果没有生成子节点,则自动生成下级子节点
                int rootmenuindex = 0, menuid = 0;

                int.TryParse(values[0], out rootmenuindex);
                int.TryParse(values[1], out menuid);

                DataTable dtMenu = Right_Module_BLL.GetBrowseMoudleByUser(Session["UserName"].ToString());
                GenareateSubMenu(dtMenu, rootmenuindex, tr.SelectedNode.ChildNodes, menuid);
            }
            //tr.SelectedNode.ImageUrl = "~/Images/icon/TreeCollapse.gif";
            tr.SelectedNode.Expand();
        }
        //else
        //{
        //    //有设置最终跳转页面的树节点,记录当前主菜单ID及树节点ID,并跳转至相应页面
        //    Session["AcMenu_SelectIndex"] = int.Parse(values[0]);
        //    Session["ActiveModule"] = int.Parse(values[1]);
        //    if (values[2] != "")
        //    {
        //        Response.Redirect("~/SubModule/switch.aspx?Module=" + values[1]);
        //    }
        //}
    }
Exemple #5
0
        public void JumpPage()
        {
            int moduleid = 0;

            int.TryParse(Request.QueryString["Module"], out moduleid);
            if (moduleid == 0)
            {
                Response.Redirect("desktop.aspx");
            }

            Right_Module Module = new Right_Module_BLL(moduleid, true).Model;

            Session["ActiveModule"] = Module.ID;

            switch (Module.ID)
            {
            default:
                if (!string.IsNullOrEmpty(Module.Remark))
                {
                    if (Module.Remark.ToLower().StartsWith("http:"))
                    {
                        Response.Write("<script laguage='javascript'>window.open('" + Module.Remark + "');history.back(-1);</script>");
                    }
                    else if (Module.Remark.StartsWith("~"))
                    {
                        Response.Redirect(Module.Remark);
                    }
                    else
                    {
                        Session["ReportPath"] = Module.Remark;
                        Response.Redirect("../ReportViewer/PubReportViewer.aspx");
                    }
                }
                break;
            }
            Response.Redirect("desktop.aspx");
        }
Exemple #6
0
    protected void GenarateMainMenu()
    {
        #region 生成主菜单datatable
        DataTable dt       = Right_Module_BLL.GetBrowseMoudleByUser(Session["UserName"].ToString());
        DataRow[] RootRows = dt.Select("SuperID=1");
        if (dt != null && RootRows.Length > 0)
        {
            for (int i = 0; i < RootRows.Length; i++)
            {
                DataRow dr      = RootRows[i];
                int     superid = (int)dr["SuperID"];
                int     menuid  = (int)dr["ID"];

                if (superid == 1)
                {
                    AjaxControlToolkit.AccordionPane p = new AjaxControlToolkit.AccordionPane();
                    p.ID = "AccordionPane" + menuid.ToString();
                    HyperLink hy = new HyperLink();
                    hy.Text = (string)dr["Name"];
                    p.HeaderContainer.Controls.Add(hy);

                    TreeView tr = new TreeView();
                    tr.ImageSet           = TreeViewImageSet.Custom;
                    tr.ShowExpandCollapse = true;
                    tr.ExpandImageUrl     = "~/Images/icon/TreeExpand.gif";
                    tr.NoExpandImageUrl   = "~/Images/icon/TreeNode.gif";
                    tr.CollapseImageUrl   = "~/Images/icon/TreeCollapse.gif";

                    tr.SelectedNodeStyle.Font.Bold = true;
                    tr.SelectedNodeStyle.ForeColor = System.Drawing.Color.Red;
                    tr.SelectedNodeStyle.BackColor = System.Drawing.Color.Yellow;
                    tr.EnableViewState             = true;

                    GenareateSubMenu(dt, i, tr.Nodes, menuid);
                    tr.SelectedNodeChanged += tr_SelectedNodeChanged;
                    tr.TreeNodePopulate    += tr_TreeNodePopulate;

                    p.ContentContainer.Controls.Add(tr);

                    Ac_MainMenu.Panes.Add(p);

                    #region 只有当前已选择的树节点及至所有父节点才展开,其余折叠
                    if (Session["ActiveRootNode"] != null && (int)Session["ActiveRootNode"] == i && ViewState["CurrentRootNode"] != null)
                    {
                        string nodepath = (string)ViewState["CurrentRootNode"];

                        TreeNode node = tr.FindNode(nodepath);
                        if (node != null)
                        {
                            //node.ImageUrl = "~/Images/icon/TreeCollapse.gif";
                            node.ExpandAll();
                        }
                    }
                    #endregion
                }
            }

            if (Session["ActiveRootNode"] != null)
            {
                Ac_MainMenu.SelectedIndex = (int)Session["ActiveRootNode"];
            }
            //wc.DataSource = dt;
        }
        else
        {
            Response.Write("对不起,当前用户没有分配任何浏览权限!");
        }
        #endregion
    }