|
|
@ -1,77 +0,0 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Web; |
|
|
|
using System.Web.UI.WebControls; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// HuiyuanPage 会员中心通用判断是否登录
|
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
namespace Basic |
|
|
|
{ |
|
|
|
public class HuiyuanPage : System.Web.UI.Page |
|
|
|
{ |
|
|
|
public HuiyuanPage() |
|
|
|
{ |
|
|
|
this.Load += new EventHandler(HuiyuanPage_Load); |
|
|
|
} |
|
|
|
|
|
|
|
private void HuiyuanPage_Load(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
//判断管理员是否登录
|
|
|
|
if (!IsUserLogin()) |
|
|
|
{ |
|
|
|
string _weburl = Basic.Tools.WebInfo.weburl(); |
|
|
|
Response.Write("<script>parent.location.href='" + _weburl + "/member/login.htm'</script>"); |
|
|
|
Response.End(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 判断会员是否登录
|
|
|
|
/// </summary>
|
|
|
|
public bool IsUserLogin() |
|
|
|
{ |
|
|
|
//如果Session为Null
|
|
|
|
if (System.Web.HttpContext.Current.Session[Keys.SESSION_USER_INFO] != null) |
|
|
|
{ |
|
|
|
return true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//检查Cookies
|
|
|
|
string username = Basic.Tools.Utils.GetCookie("UserName", "str_key"); |
|
|
|
string userpwd = Basic.Tools.Utils.GetCookie("UserPwd", "str_key"); |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(userpwd)) |
|
|
|
{ |
|
|
|
DAL.user dal = new DAL.user(); |
|
|
|
Model.user model = dal.GetModel(username, userpwd); |
|
|
|
if (model != null) |
|
|
|
{ |
|
|
|
System.Web.HttpContext.Current.Session[Keys.SESSION_USER_INFO] = model; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 取得管理员信息
|
|
|
|
/// </summary>
|
|
|
|
public Model.user GetUserInfo() |
|
|
|
{ |
|
|
|
if (IsUserLogin()) |
|
|
|
{ |
|
|
|
Model.user model = Session[Keys.SESSION_USER_INFO] as Model.user; |
|
|
|
if (model != null) |
|
|
|
{ |
|
|
|
return model; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |