Web/Main.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Maticsoft.Web
{
    public partial class Main : System.Web.UI.Page
    {
        
        public string treeStr = null;
        public string userName = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["UserName"] == null) // 从客户端读取cookie值  
            {
                Response.Redirect("~/Default.aspx");
                
            }
            userName = Request.Cookies["UserName"].Value;
            if (userName == string.Empty || userName == null) // 从客户端读取cookie值  
            {
                Response.Redirect("Default.aspx");
            }
            if (!IsPostBack)
            {
                BLL.Users bll_U = new BLL.Users();
                Label1.Text = bll_U.GetUserName(userName);
                GetTreeList(0);                
            }
        }


        int treeNo = 0;
        /// <summary>
        /// 加载导航
        /// </summary>
        /// <param name="id">根节点ID,0</param>
        public void GetTreeList(int id)
        {
            Maticsoft.BLL.Menus bll_menus = new Maticsoft.BLL.Menus();
            Maticsoft.BLL.Users bll_U = new BLL.Users();
            //treeNo++;
            string sqlWhere = "rootId="+id;
            List<Maticsoft.Model.Menus> mlist = bll_menus.GetModelList(sqlWhere);
            //IList<Menus> mlist = MenusBLL.GetMenuByRootID(id);

            for (int i = 0; i < mlist.Count; i++)
            {
                if ((Request.Cookies["UserName"].Value) == "admin")
                {
                    if (mlist[i].rootId == 0)
                    {
                        treeStr += "<li> <a href='" + mlist[i].mUrl + "' class='nav-top-item' target='frameBord'> ";
                        treeStr += mlist[i].mName + "</a><ul>";

                        GetTreeList(mlist[i].ID);

后面还有 44 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。