예제 #1
0
    protected DataSet getRoleID(string tem, string SParentCode)
    {
        if (tem != "")
        {
            string[] tems     = tem.Split(',');
            string   strWhere = " RoleID in (";  //拼接查询条件
            for (int i = 0; i < tems.Length; i++)
            {
                if (i < tems.Length - 1)
                {
                    strWhere = strWhere + tems[i] + ",";
                }
                else
                {
                    strWhere = strWhere + tems[i];
                }
            }
            strWhere += ")";
            Tz888.BLL.Sys.SysPermissionTab sysPerm = new Tz888.BLL.Sys.SysPermissionTab();
            DataSet ds     = sysPerm.GetList(strWhere);
            string  spCode = "";   //获取所有的菜单码
            if (ds.Tables[0] != null)
            {
                for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                {
                    spCode = spCode + ds.Tables[0].Rows[j]["SPCode"].ToString();
                }
            }
            //拼接菜单码查询条件
            string   strspCode  = " scode in (";
            string[] strspCodes = spCode.Split(',');
            for (int f = 0; f < strspCodes.Length; f++)
            {
                if (strspCode.IndexOf(strspCodes[f].Trim()) < 0)
                {
                    strspCode = strspCode + "'" + strspCodes[f] + "',";
                }
            }
            strspCode = strspCode.Substring(0, strspCode.Length - 1) + ") and sparentcode = '" + SParentCode + "'";
            Tz888.BLL.Sys.SysMenuTab sysMenu = new Tz888.BLL.Sys.SysMenuTab();

            return(sysMenu.GetList(strspCode));
        }
        else
        {
            return(null);
        }
    }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.UrlReferrer != null)
         {
             ViewState["url"] = Request.UrlReferrer.ToString();
         }
         else
         {
             ViewState["url"] = "MenuList1.aspx";
         }
         //删除一三级菜单
         if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "")
         {
             int sid = int.Parse(Request.QueryString["sid"].ToString());
             Tz888.BLL.Sys.SysMenuTab bll = new Tz888.BLL.Sys.SysMenuTab();
             if (bll.Delete(sid))
             {
                 Response.Redirect(ViewState["url"].ToString());
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "Msg", "<script>alert('删除失败!');location.href='" + ViewState["url"].ToString() + "';</script>", false);
                 //Response.Write("<script>alert('删除失败');location.href='" + ViewState["url"].ToString() + "';</script>");
             }
         }
         //删除二级菜单
         if (Request.QueryString["sid2"] != null && Request.QueryString["sid2"] != "")
         {
             int sid = int.Parse(Request.QueryString["sid2"].ToString());
             Tz888.BLL.Sys.SysMenuTab bll = new Tz888.BLL.Sys.SysMenuTab();
             if (bll.Delete1(sid))
             {
                 Response.Redirect(ViewState["url"].ToString());
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "Msg", "<script>alert('删除失败!');location.href='" + ViewState["url"].ToString() + "';</script>", false);
             }
         }
     }
 }