Beispiel #1
0
        private void LogInButton_Click(object sender, RoutedEventArgs e)
        {
            LogInWindow logInWindow = new LogInWindow();

            logInWindow.Show();
            this.Close();
        }
Beispiel #2
0
 private void DeleteAccount(string password)
 {
     if (password.Length != 0)
     {
         if (this.Participant.Password == password)
         {
             MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure?", "Delete confirmation", MessageBoxButton.YesNo);
             if (messageBoxResult == MessageBoxResult.Yes)
             {
                 try
                 {
                     DbAdapter.DeleteAccount(this.Participant.Name);
                     MessageBox.Show($"Account {this.Participant.Name} has been deleted");
                     LogInWindow logInWindow = new LogInWindow();
                     logInWindow.Show();
                     CloseWindows();
                 }
                 catch (Exception exception)
                 {
                     MessageBox.Show(exception.Message);
                 }
             }
         }
         else
         {
             MessageBox.Show("Bad password");
         }
     }
     else
     {
         MessageBox.Show("Password field must be filled");
     }
 }
Beispiel #3
0
 private void SignUp(string login, string password, string passwordRetype)
 {
     if (login.Length != 0 && password.Length != 0 && passwordRetype.Length != 0)
     {
         if (password == passwordRetype)
         {
             try
             {
                 DbAdapter.ParticipantAdd(login, password);
                 MessageBox.Show($"Account {login} has been created");
                 LogInWindow logInWindow = new LogInWindow();
                 logInWindow.LogIn(login, password);
                 this.Close();
             }
             catch (SqlException sqlException) when(sqlException.Number == 2627)
             {
                 MessageBox.Show($"Account {login} already exists");
                 LoginTextBox.Clear();
             }
             catch (Exception exception)
             {
                 MessageBox.Show(exception.Message);
             }
         }
         else
         {
             MessageBox.Show("Given passwords are non-identical");
         }
     }
     else
     {
         MessageBox.Show("All fields must be filled");
     }
 }
Beispiel #4
0
        private void LogOutButton_Click(object sender, RoutedEventArgs e)
        {
            LogInWindow logInWindow = new LogInWindow();

            logInWindow.Show();
            CloseWindows();
        }