예제 #1
0
 public void OnActionExecuted(ActionExecutedContext filterContext)
 {
     if (HttpContext.Current.Request.IsAuthenticated)
     {
         var db = new VODEntities();
         SystemLog log = new SystemLog
         {
             AddDate = DateTime.Now,
             Description = String.Format("{0} 登录成功!",HttpContext.Current.User.Identity.Name)
         };
         db.SystemLogs.Add(log);
         db.SaveChanges();
     }
 }
예제 #2
0
 /// <summary>
 /// 验证登录
 /// </summary>
 /// <param name="model">登录的模型</param>
 /// <returns></returns>
 private bool LoginValidate(LogOnModel model)
 {
     if (MembershipService.ValidateUser(model.UserName, model.Password))
     {
         FormsService.SignIn(model.UserName, model.RememberMe);
         try
         {
             var db = new VODEntities();
             var logToAdd = new SystemLog
             {
                 Description = String.Format("用户{0} 登录成功!", model.UserName),
                 AddDate = DateTime.Now
             };
             db.SystemLogs.Add(logToAdd);
             db.SaveChanges();
         }
         catch { }
         return true;
     }
     return false;
 }