Ejemplo n.º 1
0
        public ActionResult Login(LoginViewModel input)
        {
            var notification = new Notification {Message = WebLocalizationKeys.INVALID_USERNAME_OR_PASSWORD.ToString()};

            try
            {
                if (input.HasCredentials())
                {
                    var redirectUrl = string.Empty;
                    var user = _securityDataService.AuthenticateForUserId(input.UserName, input.Password);
                    if (user != null)
                    {
                        redirectUrl = _authenticationContext.ThisUserHasBeenAuthenticated(user, input.RememberMe);
                        notification.Success = true;
                        notification.Message = string.Empty;
                        notification.Redirect = true;
                        notification.RedirectUrl = redirectUrl;
                    }
                }
            }
            catch (Exception ex)
            {
                notification = new Notification { Message = WebLocalizationKeys.ERROR_UNEXPECTED.ToString() };
                ex.Source = "CATCH RAISED";
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            }
            return Json(notification);
        }
Ejemplo n.º 2
0
 public Notification(Notification report)
 {
     Message = report.Message;
     Success = report.Success;
     Errors = report.Errors;
     //Target = continuation.Target;
 }
Ejemplo n.º 3
0
 public Notification Finish(string successMessage ="")
 {
     if (successMessage.IsEmpty()) successMessage = CoreLocalizationKeys.SUCCESSFUL_SAVE.ToString();
     var notification = new Notification { Success = true };
     GetCrudReports().Each(x =>
     {
         if (!x.Success)
         {
             notification.Success = false;
             if (notification.Errors == null)
                 notification.Errors = x.GetErrorInfos().ToList();
             else
                 x.GetErrorInfos().Each(notification.Errors.Add).ToList();
         }
     });
     if (notification.Success)
     {
         _repository.Commit();
         notification.Message = successMessage;
     }
     else
         _repository.Rollback();
     return notification;
 }