主界面
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;
}
}
}
}
首页
国尚信-Beehooe云冷链
TOP
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 主要下拉菜单
<%= MenuContent%>
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+="";
//子菜单
MenuContent += GetMenuBody(drvMenu["code"].ToString(), arrRoleNo);
}
else
{
MenuContent += "" + strMenuName + "
";
//子菜单
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 = " ";
}
return strResult;
}
}
}
";
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 += "