Exemple #1
0
        private void Login(string username, string password)
        {
            var loginResult = _userBusinessComponent.Login(username, password);

            if (loginResult != null)
            {
                if (loginResult == UserRole.Operator || loginResult == UserRole.SecurityServiceEmployee)
                {
                    if (_userBusinessComponent.IsActive(username, password).Value)
                    {
                        this.SetPage(loginResult.Value, username);
                    }
                    else
                    {
                        MessageBox.Show("Your account has been disabled, please, contact your administrator.");
                    }
                }
                else
                {
                    this.SetPage(loginResult.Value, username);
                }
            }
            else
            {
#if RELEASE
                _failedLoginAttempts++;
                if (_failedLoginAttempts >= 5)
                {
                    //lock for 30 seconds
                    Thread.Sleep(30 * 1000);
                }
#endif
                MessageBox.Show(errorMessage);
            }
        }