Пример #1
0
        private void Sumbit_Click(object sender, RoutedEventArgs e)
        {
            This_Guest.FirstName = FirstNameFill.Text.ToString();
            This_Guest.LastName  = LastNameFill.Text.ToString();
            This_Guest.Id        = IdFill.Text.ToString();
            This_Guest.Password  = PasswordFill.Text.ToString();
            bl.AddGuest(this.This_Guest);
            Close();

            Window_Password window = new Window_Password();

            window.Show();
        }
Пример #2
0
 private void CompleteGuestRegistration()
 {
     try
     {
         newUser.FinishedRegistration = true;
         Guest guest = GetGuest(newUser);
         bl.AddGuest(guest);
         GoToLogin();
     }
     catch (BlArgumentNullException)
     {
         MessageBox.Show("There was a problem. Please try again later.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     catch (BlMailAlreadyExistException)
     {
         MessageBox.Show("Mail address already exist in the system. Please try another address.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     catch (BlNickAlreadyExistException)
     {
         MessageBox.Show("Nickname already exist in the system. Please try another nickname.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     catch (BlUsernameInvalidException)
     {
         MessageBox.Show("Username invalid.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     catch (BlPasswordInvalidException)
     {
         MessageBox.Show("Password invalid.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     catch (BlInvalidEmailException)
     {
         MessageBox.Show("Mail address invalid.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     catch (BlFileErrorException)
     {
         MessageBox.Show("There was file error. Please try again later.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Пример #3
0
        private void RegisterButton_Click(object sender, RoutedEventArgs e)
        {
            if (UserPassword.Password == UserPasswordEnsure.Password)
            {
                user.Password = UserPassword.Password;
                if ((UserType)UserTypeComboBox.SelectedItem == BE.UserType.Host)
                {
                    try
                    {
                        if (myIBL.AddHostCanMoveOn(user))
                        {
                            Window NewHostRegWindow = new HostRegWindow(user);
                            NewHostRegWindow.Show();
                            this.Close();
                        }
                    }
                    catch (UserAlreadyExistsException)
                    {
                        UserName.Focus();
                        MessageBox.Show("The UserName you entered is alredy used.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    catch (NotValidEmailAddressException)
                    {
                        MailTextBox.Focus();
                        MessageBox.Show("The MailAddress you entered is invalid.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("There was a problem!!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else if ((UserType)UserTypeComboBox.SelectedItem == BE.UserType.Guest)
                {
                    try
                    {
                        myIBL.AddGuest(user);
                        Window loginWindow = new LoginWindow();
                        loginWindow.Show();
                        this.Close();
                    }
                    catch (UserAlreadyExistsException)
                    {
                        UserName.Focus();
                        MessageBox.Show("The UserName you entered is alredy used.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    catch (NotValidEmailAddressException)
                    {
                        MailTextBox.Focus();
                        MessageBox.Show("The MailAddress you entered is invalid.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("There was a problem!!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }

            else
            {
                UserPasswordEnsure.Focus();
                MessageBox.Show("Check Your Password again!!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }