日期:2014-05-17 浏览次数:20403 次
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
bool isAdmin = false;
e.Authenticated = UserManager.Authenticate(Login1.UserName, Login1.Password, out isAdmin);
bool result = LicenseManager.checkExpire();
if (!result)
{
e.Authenticated = false;
}
if (e.Authenticated)
{
if (!isAdmin)
{
UserManager.ReportLogin(Login1.UserName, DateTime.Now);
}
}
if (isAdmin)
{
Login1.DestinationPageUrl = "~/Admin/Default.aspx";
}
}
}
public class UserManager
{
public static bool Authenticate(string userID, string password, out bool isAdmin)
{
MOREntities enity = new MOREntities();
var v = from s in enity.Users where s.UserID == userID && s.Password == password select s;
if (v.Count() > 0)
{
isAdmin = v.First<DataLayer.User>().IsAdmin;