|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Security;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.HtmlControls;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
using System.Web.UI.WebControls.WebParts;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb
|
|
|
|
|
{
|
|
|
|
|
public class PageBase : System.Web.UI.Page
|
|
|
|
|
{
|
|
|
|
|
public void VolidatePageBase()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (HttpContext.Current.Session["USERID"] == null)
|
|
|
|
|
{
|
|
|
|
|
if (Request.Cookies["DSUSERID"] != null)
|
|
|
|
|
{
|
|
|
|
|
string cookieUserID = Request.Cookies["DSUSERID"].Value;
|
|
|
|
|
UserLoginStatusDA userLoginStatusDA = new UserLoginStatusDA();
|
|
|
|
|
UserLoginStatusEntity userLoginStatusEntity = new UserLoginStatusEntity();
|
|
|
|
|
|
|
|
|
|
//查看是否当前登录用户是否是时效内重新登录的用户
|
|
|
|
|
userLoginStatusEntity = userLoginStatusDA.GetLoginStatusByUserID(cookieUserID);
|
|
|
|
|
|
|
|
|
|
if (userLoginStatusEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
DateTime signDateTime = userLoginStatusEntity.SignInTime;
|
|
|
|
|
DateTime serverDateTime = userLoginStatusEntity.ServerDateTime;
|
|
|
|
|
double expiresMinutes = double.Parse(userLoginStatusEntity.ExpiresMinutes.ToString());
|
|
|
|
|
if (signDateTime.AddMinutes(expiresMinutes).CompareTo(serverDateTime) >= 0)
|
|
|
|
|
{
|
|
|
|
|
userLoginStatusDA.DeleteUserLoginStatus(userLoginStatusEntity.GID);
|
|
|
|
|
Response.Redirect("login.aspx");
|
|
|
|
|
Response.End();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
userLoginStatusDA.UpdateLoginStatusForReSign(userLoginStatusEntity);
|
|
|
|
|
UserEntity userEntity = new UserDA().GetUserSignByID(cookieUserID);
|
|
|
|
|
|
|
|
|
|
Session["USERID"] = userEntity.Gid;
|
|
|
|
|
Session["CODENAME"] = userEntity.CodeName;
|
|
|
|
|
Session["SHOWNAME"] = userEntity.ShowName;
|
|
|
|
|
Session["PASSWORD"] = userEntity.PassWord;
|
|
|
|
|
|
|
|
|
|
CompanyEntity companyEntity = new CompanyEntity();
|
|
|
|
|
|
|
|
|
|
CompanyDA companyDA = new CompanyDA();
|
|
|
|
|
|
|
|
|
|
companyEntity = companyDA.GetCompanyByUserIDNoLogoImg(userEntity.Gid);
|
|
|
|
|
|
|
|
|
|
if (companyEntity != null)
|
|
|
|
|
{
|
|
|
|
|
if (companyEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
Session["COMPANYID"] = companyEntity.GID;
|
|
|
|
|
Session["COMPANYNAME"] = companyEntity.NAME;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
UserDA UserDA = new UserDA();
|
|
|
|
|
Session["DEPTNAME"] = UserDA.GetUserDepartmentName(userEntity.Gid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Response.Redirect("login.aspx");
|
|
|
|
|
Response.End();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|