protected void Page_Load(object sender, EventArgs e) { //if (!string.IsNullOrEmpty(Request["ScenicID"])) //{ // //带参数过来的! // divManage.Visible = false; // divAdmin.Visible = true; // aWelCome.HRef = "WelCome.aspx?ScenicID=" + Request["ScenicID"]; // aStatInfo.HRef = "StatInfo.aspx?ScenicID=" + Request["ScenicID"]; //} //else //{ UserCookieInfo uc = CookierManage.CookierAPI <UserCookieInfo> .GetCookierObject(UserCookieInfo.UserCookierName); if (uc.UnitID == 0) { divAdmin.Visible = false; } else { divManage.Visible = false; } //} }
protected void Page_Load(object sender, EventArgs e) { uc = new WebUserCookie(WebUserCookie.CookierUser).GetCookiesValues(); if (!IsPostBack) { BindDepart(); BindUserInfo(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserCookieInfo uc = CookierManage.CookierAPI <UserCookieInfo> .GetCookierObject(UserCookieInfo.UserCookierName); imgunitlogo.Src = uc.UnitLogo; spanusername.InnerText = uc.TrueName; devicecount.InnerText = "监控点" + uc.MonitorCount + "个"; divTopDate.InnerText = DateTime.Now.ToString("yyyy-MM-dd"); } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request["UnitID"])) { UserCookieInfo uc = CookierManage.CookierAPI <UserCookieInfo> .GetCookierObject(UserCookieInfo.UserCookierName); unitid = uc.UnitID.ToString(); aBack.Visible = false; } else { unitid = Request["UnitID"]; } if (!IsPostBack) { GetData(); } }
protected void btnLogin_Click(object sender, EventArgs e) { DataSet ds = MySQL.ExecProc("usp_Sys_UserInfo_Login", new string[] { tbusername.Value, tbpwd.Value }, out sqlexec, out sqlresult); DataTable dt = ds.Tables[0]; if (dt.Rows.Count == 0) { Session[WebHint.Web_Hint] = new WebHint("用户名或者密码错误", "#", HintFlag.错误); Response.Redirect("Hint.aspx"); } else { UserCookieInfo uc = new UserCookieInfo(dt.Rows[0]["UserName"].ToString(), dt.Rows[0]["TrueName"].ToString(), Convert.ToInt32(dt.Rows[0]["UnitID"]), Convert.ToInt32(dt.Rows[0]["UnitType"]), dt.Rows[0]["UnitName"].ToString()); uc.UnitLogo = string.IsNullOrEmpty(dt.Rows[0]["UnitLogo"].ToString()) ? "http://" + Request.Url.Host + "/Images/zllogobigimg.png" : dt.Rows[0]["UnitLogo"].ToString(); uc.MonitorCount = ds.Tables[1].Rows[0]["DeviceCount"].ToString(); CookierManage.CookierAPI <UserCookieInfo> .WriteCookierObject(uc); if (uc.UnitID == 0) { Response.Redirect("admin/SysUnitInfo.aspx"); } else { Response.Redirect("admin/WelCome.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { dateparam = string.IsNullOrEmpty(Request["d"]) ? DateTime.Now.ToString("yyyy-MM-dd") : Request["d"]; if (!string.IsNullOrEmpty(Request["unitid"])) { unitid = Request["unitid"]; } else { UserCookieInfo uc = CookierManage.CookierAPI <UserCookieInfo> .GetCookierObject(UserCookieInfo.UserCookierName); if (uc == null) { Response.Redirect("Default.aspx"); } else { unitid = CookierManage.CookierAPI <UserCookieInfo> .GetCookierObject(UserCookieInfo.UserCookierName).UnitID.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { username = Request["username"]; if (string.IsNullOrEmpty(Request["UnitID"])) { UserCookieInfo uc = CookierManage.CookierAPI <UserCookieInfo> .GetCookierObject(UserCookieInfo.UserCookierName); unitid = uc.UnitID.ToString(); aBack.HRef = "SysUser.aspx"; } else { unitid = Request["UnitID"]; aBack.HRef = "SysUser.aspx?UnitID=" + unitid; } if (!IsPostBack) { DataTable dt = MySQL.ExecProc("usp_Sys_UnitInfo_GetByUnitID", new string[] { unitid }, out sqlexec, out sqlresult).Tables[0]; lbUnitName.Text = dt.Rows[0]["UnitName"].ToString(); if (string.IsNullOrEmpty(username)) { btnDelete.Visible = false; btnRePwd.Visible = false; } else { dt = MySQL.ExecProc("usp_Sys_UserInfo_GetByUserName", new string[] { username }, out sqlexec, out sqlresult).Tables[0]; tbUserName.Text = dt.Rows[0]["UserName"].ToString(); tbTrueName.Text = dt.Rows[0]["TrueName"].ToString(); tbUserName.ReadOnly = true; } } }
protected void Page_Load(object sender, EventArgs e) { uc = new WebUserCookie(WebUserCookie.CookierUser).GetCookiesValues(); //权限处理 }
public void WriteCookies(UserCookieInfo values) { //创建cookies,写入初始数据 cookie = new HttpCookie(cookien); cookie.Values.Add("UserName", HttpUtility.UrlEncode(values.UserName)); cookie.Values.Add("TrueName", HttpUtility.UrlEncode(values.TrueName)); cookie.Values.Add("RoleSet", HttpUtility.UrlEncode(values.RoleSet.ToString())); cookie.Expires = DateTime.Now.AddDays(1); HttpContext.Current.Response.Cookies.Add(cookie); HttpContext.Current.Session[cookien] = values; }
public UserCookieInfo GetCookiesValues() { //尝试获取Cookies UserCookieInfo cookieValue = null; if (cookie != null) { cookieValue = new UserCookieInfo(); cookieValue.UserName = HttpUtility.UrlDecode(cookie.Values["UserName"]); cookieValue.TrueName = HttpUtility.UrlDecode(cookie.Values["TrueName"]); cookieValue.RoleSet = Convert.ToInt64(HttpUtility.UrlDecode(cookie.Values["RoleSet"])); } else { if (HttpContext.Current.Session[cookien] != null) { cookieValue = (UserCookieInfo)HttpContext.Current.Session[cookien]; } } return cookieValue; }
protected void Page_Load(object sender, EventArgs e) { uc = CookierManage.CookierAPI <UserCookieInfo> .GetCookierObject(UserCookieInfo.UserCookierName); }