Beispiel #1
0
        private void Register_Click(object sender, RoutedEventArgs e)
        {
            if (ConnectionHelper.CheckName(name.Text) && ConnectionHelper.CheckSurname(surname.Text) &&
                ConnectionHelper.CheckEmail(email.Text) && ConnectionHelper.CheckUsername(username.Text) &&
                ConnectionHelper.CheckPassword(password1.Password, password2.Password))
            {
                try
                {
                    FocusManager.SetFocusedElement(this, null);

                    if (ConnectionHelper.RegisterUser(name.Text, surname.Text, email.Text, username.Text, password1.Password, password2.Password))
                    {
                        if (EmailClientHelper.SMTP != null)
                        {
                            EmailClientHelper.SendEmail(email.Text, name.Text, surname.Text, username.Text, password1.Password);
                        }

                        MessageBox.Show("Congratulations!\nYou are successfully registered!", "Registration", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
                        //Close();
                    }
                }
                catch (SqlException exception)
                {
                    MessageBox.Show("Database insert error:\n" + exception.Message, "Registration", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                finally
                {
                    StatusBarString = Properties.Settings.Default.StatusReady;
                }
            }
        }
Beispiel #2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     EmailClientHelper.ReadConfigurations();
     Host.Text     = EmailClientHelper.Host;
     Port.Text     = EmailClientHelper.Port == 0 ? string.Empty : EmailClientHelper.Port.ToString();
     Address.Text  = EmailClientHelper.FromAddress == null ? string.Empty : EmailClientHelper.FromAddress.Address;
     Password.Text = EmailClientHelper.FromPassword;
 }
Beispiel #3
0
        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            if (!Host.DataChanged && !Port.DataChanged && !Address.DataChanged && !Password.DataChanged)
            {
                this.Close();
            }

            if (ConnectionHelper.CheckHost(Host.Text) &&
                ConnectionHelper.CheckPort(Port.Text) &&
                ConnectionHelper.CheckEmail(Address.Text) &&
                ConnectionHelper.CheckPassword(Password.Text))
            {
                EmailClientHelper.WriteConfigurations(Host.Text, Port.Text, Address.Text, Password.Text);
                this.Close();
            }
        }