Beispiel #1
0
 public LoginContinions singInWithAttempts(string login, string password)
 {
     if (!login.Equals(LastLogin))
     {
         AttemptsToSingIn = maxAttempstToSingIn;
         LastLoginCard    = findCard(login);
         LastLogin        = login;
     }
     if (LastLoginCard.Blocked)
     {
         return(LoginContinions.BLOCKED);
     }
     if (AttemptsToSingIn == 0)
     {
         LastLoginCard.Blocked = true;
         DataBaseWorker.saveBlockedCard(LastLoginCard, DataBaseWorker.BlockedCardPath);
     }
     if (LastLoginCard.Blocked)
     {
         return(LoginContinions.BLOCKED);
     }
     if (LastLoginCard == null)
     {
         return(LoginContinions.DOESNTEXIST);
     }
     if (LastLoginCard.Password.Equals(password))
     {
         AttemptsToSingIn = maxAttempstToSingIn;
         CurrentCard      = LastLoginCard;
         LastLoginCard    = null;
         return(LoginContinions.SUCCESS);
     }
     else
     {
         AttemptsToSingIn--;
         return(LoginContinions.PASSWORDERROR);
     }
 }