示例#1
0
 private void Button_Send_Click(object sender, RoutedEventArgs e)
 {
     if (ValidateBlankSpaces(textBox_UserName.Text, passwordBox_Password.Password, passwordBox_PasswordConfirmed.Password, textBox_Email.Text, textBox_EmailConfirmed.Text))
     {
         label_Message.Content = Properties.Resources.message_CompleteFields;
     }
     else
     {
         bool playerFound = playerClient.FindPlayer(textBox_UserName.Text, textBox_Email.Text);
         if (playerFound == true)
         {
             if (passwordBox_Password.Password == passwordBox_PasswordConfirmed.Password)
             {
                 if (textBox_Email.Text == textBox_EmailConfirmed.Text)
                 {
                     if (ValidateEmail(textBox_Email.Text) == true)
                     {
                         if (CountCharacters(passwordBox_Password.Password) > 7)
                         {
                             int    number       = SendEmail();
                             String randomNumber = number.ToString();
                             label_MessageCode.Content = Properties.Resources.message_SendEmailCode;
                             label_Email.Content       = textBox_Email.Text;
                             SendCode(randomNumber);
                             SetVisibleForm();
                         }
                         else
                         {
                             label_Message.Content = Properties.Resources.message_LittlePassword;
                         }
                     }
                     else
                     {
                         label_Message.Content = Properties.Resources.message_IntroduceValidEmail;
                     }
                 }
                 else
                 {
                     label_Message.Content = Properties.Resources.meesage_MatchPasswordEmail;
                 }
             }
             else
             {
                 label_Message.Content = Properties.Resources.meesage_MatchPasswordEmail;
             }
         }
         else
         {
             label_Message.Content = Properties.Resources.message_UserNameOrEmailBusy;
         }
     }
 }
 private void Button_Send_Click(object sender, RoutedEventArgs e)
 {
     using (ServiceReference.PlayerManagerClient client = new ServiceReference.PlayerManagerClient()) {
         if (ValidateBlankSpaces(textBox_UserName.Text, passwordBox_Password.Password, passwordBox_PasswordConfirmed.Password,
                                 textBox_Email.Text, textBox_EmailConfirmed.Text))
         {
             label_Message.Content = "*Debe completar todos campos";
         }
         else
         {
             bool playerFinded = client.FindPlayer(textBox_UserName.Text, textBox_Email.Text);
             if (playerFinded == true)
             {
                 if (passwordBox_Password.Password == passwordBox_PasswordConfirmed.Password)
                 {
                     if (textBox_Email.Text == textBox_EmailConfirmed.Text)
                     {
                         if (ValidateEmail(textBox_Email.Text) == true)
                         {
                             MainWindow mainWindow = new MainWindow();
                             SendPlayer();
                             this.Close();
                             mainWindow.Show();
                         }
                         else
                         {
                             label_Message.Content = "*Introduzca un correo electrónico válido";
                         }
                     }
                     else
                     {
                         label_Message.Content = "*El correo electrónico y/o contraseña deben coincidir";
                     }
                 }
                 else
                 {
                     label_Message.Content = "*El correo electrónico y/o contraseña deben coincidir";
                 }
             }
             else
             {
                 label_Message.Content = "*Nombre de usuario y/o Correo electrónico ocupado";
             }
         }
     }
 }