예제 #1
0
        private void LogInButton_Click(object sender, RoutedEventArgs e)
        {
            var loginWindow = new LogInWindow();

            loginWindow.Show();
            this.Close();
        }
예제 #2
0
        private void ButtonAdmin_Click(object sender, RoutedEventArgs e)
        {
            var logInWindow = new LogInWindow();

            logInWindow.DoNotHaveAnAccount.Visibility = Visibility.Hidden;
            logInWindow.Show();
            Close();
        }
예제 #3
0
        private void ButtonRegister_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBoxLogin.Text))
            {
                MessageBox.Show("Password cannot be empty", "Error");
                textBoxLogin.Focus();
                return;
            }

            else if (string.IsNullOrWhiteSpace(textBoxName.Text))
            {
                MessageBox.Show("Name cannot be empty", "Error");
                textBoxName.Focus();
                return;
            }

            else if (string.IsNullOrWhiteSpace(textBoxSurname.Text))
            {
                MessageBox.Show("Surname cannot be empty", "Error");
                textBoxSurname.Focus();
                return;
            }

            else if (string.IsNullOrWhiteSpace(textBoxPassword.Password))
            {
                MessageBox.Show("Password cannot be empty", "Error");
                textBoxPassword.Focus();
                return;
            }

            Guest guest;
            Hotel hotel;

            _repo.Authorize(textBoxLogin.Text, Hash.GetHash(textBoxPassword.Password), out guest, out hotel);
            if (guest != null)
            {
                MessageBox.Show("This user has been already created", "Error");
                return;
            }
            if (Guest == null)
            {
                Guest = new Guest
                {
                    Name     = textBoxName.Text,
                    Surname  = textBoxSurname.Text,
                    Email    = textBoxLogin.Text,
                    Password = textBoxPassword.Password,
                };
                _repo.RegisterGuest(Guest);
                LogInWindow logInWindow = new LogInWindow();
                logInWindow.Show();
                Close();
            }
        }
예제 #4
0
        private void ButtonLogIn_Click(object sender, RoutedEventArgs e)
        {
            var loginWindow = new LogInWindow();

            loginWindow.Show();
        }