美文网首页
2018-10-09实习日记1

2018-10-09实习日记1

作者: 1f658716b568 | 来源:发表于2018-10-09 11:02 被阅读0次

    主界面

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using BLL;
    using Entities;
    using BasicItem;
    using MenuUtility;
    using System.IO;
    
    namespace THMS
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!VerifySign())
                {
                    Response.Redirect("License.aspx");
                }
    
                if (Request.Cookies["THMS_UserName"] != null && Request.Cookies["THMS_Password"] != null)
                {
                    User_InfoBLL UserInfoBLL = new User_InfoBLL();
    
                    //读取出cookies中的值
                    string strUserName = Request.Cookies["THMS_UserName"].Value;
                    string strPassword = Request.Cookies["THMS_Password"].Value;
    
                    //获取用户信息
                    DataTable dt = UserInfoBLL.GetUserInfo(strUserName, strPassword);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        User_Info model = new User_Info();
                        model.User_ID = CommonHelper.GetLong(dt.Rows[0]["User_ID"].ToString(), 0);
                        model.User_No = dt.Rows[0]["User_No"].ToString();
                        model.User_Name = dt.Rows[0]["User_Name"].ToString();
                        model.Company_ID = CommonHelper.GetLong(dt.Rows[0]["Company_ID"].ToString(), 0);
                        model.User_Phone = dt.Rows[0]["User_Phone"].ToString();
                        model.User_Mail = dt.Rows[0]["User_Mail"].ToString();
                        model.User_Sex = dt.Rows[0]["User_Sex"].ToString();
    
                        LoginHandler.CurrentUser = model;
    
                        Log_InfoBLL.AddSysLog("用户" + model.User_No + "登陆成功", this.Title);
    
                        Response.Redirect("Page/MyDefault.aspx");
                    }
                    else
                    {
                        Response.Redirect("page/homeLogin.aspx"); 
                    }
    
                }
                else
                {
                    Response.Redirect("page/homeLogin.aspx");
                }
                
            }
    
    
            private bool VerifySign()
            {
                if (File.Exists(Server.MapPath("/code.lic")))
                {
                    //读取文件asp.net
                    StreamReader sr = new StreamReader(Server.MapPath(@"\code.lic"), System.Text.Encoding.Default);
                    try
                    {
                        string input = sr.ReadToEnd();
                        sr.Close();
                        
                        //解密时间
                        //string str=CommonHelper.DesEncrypt(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        string strDes = CommonHelper.DesDecrypt(input);
    
                        string[] ArDes = strDes.Split(',');
                        if (ArDes.Length > 1)
                        {
                            string strType = ArDes[1].ToUpper();
                            if (strType == "PERMANENT")
                            {
                                return true;
                            }
                            else if (strType == "LIMITED")
                            {
                                string strDateTime = ArDes[0];
                                if (strDateTime != "")
                                {
                                    //比较时间
                                    DateTime dtRead = DateTime.Parse(strDateTime);
                                    if (dtRead > DateTime.Now)
                                        return true;
                                    else
                                        return false;
                                }
                                return false;
                            }
                            else
                            {
                                return false;
                            }
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
        }
    }
    

    首页

    <head runat="server">
        <title>国尚信-Beehooe云冷链</title>
        
        <link href="../CommonNew/css/main.css" rel="stylesheet" type="text/css" />
    
    </head>    
     <frameset rows="80,*" cols="*" frameborder="no" border="0" framespacing="0">
      <frame src="Top.aspx" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" style="position:absolute; z-index:9999px" />
      <frameset cols="270,*" frameborder="no" border="0" framespacing="0">
        <frame src="LeftMenu.aspx" name="leftFrame" scrolling="auto" noresize="noresize" id="leftFrame" title="leftFrame" />
        <frame src="THDataCentre\SCMain.aspx" name="MainFrame" id="MainFrame" title="mainFrame" />
      </frameset>
    </frameset>
    <noframes><body>
    </body></noframes>
    
    TOP
     <link href="../CommonNew/css/main.css" rel="stylesheet" type="text/css" />
    
        <script type="text/javascript" language="javascript">
            function btn_close() {
    
                if (confirm("确定退出系统?")) {
                    parent.location.href = '../page/homeLogin.aspx?Action=exit'
                    __doPostBack('imgClose', '');
                }
    
            }
        </script>
    
    </head>
    <body>
        <div class="head">
            <div class="left">
            </div>
            
            <div class="right">
                <div class="menu">
                    <ul>
                        <li class="ic1"><a href="THDataCentre/SCMain.aspx" target="MainFrame" class="current">
                            首页</a></li>
                        <li class="ic2"><a href="SystemManage/AlertDataManage.aspx" target="MainFrame">报警</a></li>
                        <li class="ic3" style="display: none"><a href="#">用户中心</a></li>
                        <li class="ic4" style="display: none"><a href="#">帮助中心</a></li>
                        <li class="ic5" style="display: none"><a href="SystemManage/AlertDataManage.aspx"
                            target="MainFrame">超限处理</a></li>
                        <li class="ic7"><a href="THSupervisionCenter/Shadow.aspx" target="_blank" ">投影广播</a></li>
                        <li class="ic6"><a href="#" onclick="btn_close();">退出系统</a></li>
                        <li class="ic7"><%--<a href="#" onclick="ShowShadow()">投影广播</a>--%></li>
                    </ul>
                </div>
                <a href="PersonalInfo.aspx" target="MainFrame">
                    <div class="user">
                        <div id="top_daohang">
                            <li class="top_tab top_dropdown"><span class="img"><img src="../CommonNew/images/user_img.jpg" width="28" height="28"/>
            </span><span class="fclan"><asp:Label ID="labUserName" runat="server" class="name"></asp:Label></span>
                            </li>
                        </div>
                    </div>
                </a>
            </div>
        </div>
    
    namespace PFTHWeb.Page
    {
        public partial class Top : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (LoginHandler.CurrentUser != null)
                {
                    if (LoginHandler.CurrentUser.User_ID != 0)
                    {
                        string strUser_Name = LoginHandler.CurrentUser.User_Name.ToString();
    
                        User_InfoBLL UserInfoBLL = new User_InfoBLL();
                        string strRoleName = UserInfoBLL.GetUserRoleName(LoginHandler.CurrentUser.User_ID.ToString());
    
                        labUserName.Text = "【" + strUser_Name + "】:" + strRoleName;
                    }
                }
            }
    
            protected void LinkB_Logout_Click(object sender, EventArgs e)
            {
                //LoginHandler.CurrentUser = null;
                //HttpContext.Current.Session["userInfo"] = null;
    
                //LoginHandler.DisposeRoles();
            }
    
        }
    }
    
    style
    
    

    leftMenu 主要下拉菜单

    <head runat="server">
        <title></title>
        <link href="../CommonNew/css/main.css" rel="stylesheet" type="text/css" />
        <script src="../CommonNew/js/jquery.min.js" type="text/javascript"></script>
        
        
    <script type=text/javascript>
        $(document).ready(function() {
            $("#firstpane .menu_body:eq(0)").show();
            $("#firstpane p.menu_head1").click(function() {
                $(this).addClass("current1").next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
                $(this).siblings().removeClass("current1");
                $(this).siblings().removeClass("current2");
                $(this).siblings().removeClass("current3");
                $(this).siblings().removeClass("current4");
                $(this).siblings().removeClass("current5");
                $(this).siblings().removeClass("current6");
    
            });
    
    
            $("#firstpane p.menu_head2").click(function() {
                $(this).addClass("current2").next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
                $(this).siblings().removeClass("current1");
                $(this).siblings().removeClass("current2");
                $(this).siblings().removeClass("current3");
                $(this).siblings().removeClass("current4");
                $(this).siblings().removeClass("current5");
                $(this).siblings().removeClass("current6");
    
            });
    
            $("#firstpane p.menu_head3").click(function() {
                $(this).addClass("current3").next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
                $(this).siblings().removeClass("current1");
                $(this).siblings().removeClass("current2");
                $(this).siblings().removeClass("current3");
                $(this).siblings().removeClass("current4");
                $(this).siblings().removeClass("current5");
                $(this).siblings().removeClass("current6");
    
            });
    
            $("#firstpane p.menu_head4").click(function() {
                $(this).addClass("current4").next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
                $(this).siblings().removeClass("current1");
                $(this).siblings().removeClass("current2");
                $(this).siblings().removeClass("current3");
                $(this).siblings().removeClass("current4");
                $(this).siblings().removeClass("current5");
                $(this).siblings().removeClass("current6");
    
            });
    
            $("#firstpane p.menu_head5").click(function() {
                $(this).addClass("current5").next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
                $(this).siblings().removeClass("current1");
                $(this).siblings().removeClass("current2");
                $(this).siblings().removeClass("current3");
                $(this).siblings().removeClass("current4");
                $(this).siblings().removeClass("current5");
                $(this).siblings().removeClass("current6");
    
            });
    
            $("#firstpane p.menu_head6").click(function() {
                $(this).addClass("current6").next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
                $(this).siblings().removeClass("current1");
                $(this).siblings().removeClass("current2");
                $(this).siblings().removeClass("current3");
                $(this).siblings().removeClass("current4");
                $(this).siblings().removeClass("current5");
                $(this).siblings().removeClass("current6");
    
            });
    
    
        });
    
    
    </script>
    </head>
    <body class="leftbg" style="overflow-x:hidden">
        <%= MenuContent%>
    </body>
    
    引用关系
    c#中 怎么手动创建三层架构_百度经验 https://jingyan.baidu.com/article/86f4a73ea9de6037d65269d1.html
    namespace THMS.page
    {
        public partial class LeftMenu : System.Web.UI.Page
        {
            public string MenuContent = "";
    
            #region 
            string parentCode = "0";
            string target = "MainFrame";
            string menu_body_class = "menu_body";
            #endregion
    
            protected void Page_Load(object sender, EventArgs e)
            {
    
                MenuContent+="<div id=\"firstpane\" class=\"menu_list\"  style=\"overflow-x:hidden\">";
    
                if(!IsPostBack)
                    GetMenuContent();
    
                MenuContent += "</div>";
    
                string test = MenuContent;
            }
    
            public void GetMenuContent()
            {
                //获取登录用户角色
                string[] arrRoleNo = LoginHandler.RolesOfUser.Split(',');
                if (arrRoleNo.Length != 0 && CommonHelper.IsNotNull(arrRoleNo[0]))
                {
                    string strMenuName = "";
                    string strClassName = "";
                    string strMenuUrl = "";
                    string strVisible = "";
    
                    DataView dvMenu = MenuRoleHelper.GetLeftRoleMenu(parentCode, arrRoleNo);
                    foreach (DataRowView drvMenu in dvMenu)
                    {
    
                        strMenuName = drvMenu["name"].ToString().Trim();
                        strClassName = drvMenu["class-name"].ToString().Trim();
                        strMenuUrl = drvMenu["url"].ToString().Trim();
                        strVisible = drvMenu["visible"].ToString().Trim();
    
                        if (strVisible == "true")
                        {
                            if (drvMenu["url-type"].ToString() == Constants.URL_TYPE_SEPARATOR)
                            {
                                if (strMenuUrl != "")
                                {
                                    MenuContent += "<p class=\"" + strClassName + "\"><span><a href=\"" + strMenuUrl + "\" target=\"" + target + "\">" + strMenuName + "</a></span></p>";
                                    //子菜单
                                    MenuContent += GetMenuBody(drvMenu["code"].ToString(), arrRoleNo);
                                }
                                else
                                {
                                    MenuContent += "<p class=\"" + strClassName + "\"><span>" + strMenuName + "</span></p>";
                                    //子菜单
                                    MenuContent += GetMenuBody(drvMenu["code"].ToString(), arrRoleNo);
                                }
                            }
                        }
    
                    }
                }
            }
    
    
            private string GetMenuBody(string m_ParentCode, string[] m_ArrRoleNo)
            {
                string strResult = "";
    
                if (m_ArrRoleNo.Length != 0 && CommonHelper.IsNotNull(m_ArrRoleNo[0]))
                {
                    string strMenuName = "";
                    string strClassName = "";
                    string strMenuUrl = "";
                    string strVisible = "";
    
    
                    DataView dvMenu = MenuRoleHelper.GetLeftRoleMenu(m_ParentCode, m_ArrRoleNo);
    
                    strResult = "<div style=\"display:none\" class=\"" + menu_body_class + "\" >";
    
                    foreach (DataRowView drvMenu in dvMenu)
                    {
                        strMenuName = drvMenu["name"].ToString().Trim();
                        strClassName = drvMenu["class-name"].ToString().Trim();
                        strMenuUrl = drvMenu["url"].ToString().Trim();
                        strVisible = drvMenu["visible"].ToString().Trim();
    
                        if (strVisible == "true")
                        {
                            if (strMenuUrl == "")
                                strMenuUrl = "THDataCentre\\SCMain.aspx";
    
                            if (drvMenu["url-type"].ToString() == Constants.URL_TYPE_LINK)
                            {
                                if (strClassName != "")
                                {
                                    strResult += "<a href=\"" + strMenuUrl + "\" class=\"" + strClassName + "\" target=\"" + target + "\">" + strMenuName + "</a>";
                                }
                                else
                                {
                                    strResult += "<a href=\"" + strMenuUrl + "\" target=\"" + target + "\">" + strMenuName + "</a>";
                                }
                            }
                        }
                    }
    
                    strResult += "</div>";
    
                   
                }
    
                return strResult;
            }
        }
    }
    
    

    相关文章

      网友评论

          本文标题:2018-10-09实习日记1

          本文链接:https://www.haomeiwen.com/subject/mvqeaftx.html