Esempio n. 1
0
 /// <summary>
 /// Checks whether fields are valid and if not displays appropriate message
 /// </summary>
 /// <returns><c>true</c> if fields are valid, <c>false</c> otherwise</returns>
 private bool IsFormValid()
 {
     try
     {
         if (!new EmailAddressAttribute().IsValid(_email))
         {
             MessageBox.Show(String.Format(Resources.SignUp_EmailIsNotValid, _email));
             return(false);
         }
         using (var restClient = new UserApiService())
         {
             if (restClient.UserExists(Login))
             {
                 MessageBox.Show(String.Format(Resources.SignUp_UserLoginAlreadyExists, _login));
                 return(false);
             }
             if (restClient.UserExists(Email))
             {
                 MessageBox.Show(String.Format(Resources.SignUp_UserEmailAlreadyExists, _email));
                 return(false);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(String.Format(Resources.SignUp_FailedToValidateData, Environment.NewLine,
                                       ex.Message));
         return(false);
     }
     return(true);
 }