public async Task <ActionResult> ConfirmRegistration(UsuariosDTO userToValidate) { Result <Object> result = new Result <Object>(); try { AuthenticateServices service = new AuthenticateServices(); WrapperSimpleTypesDTO emailExist = await service.VerificarSiEmailYaExiste(userToValidate); if (emailExist == null || emailExist.Existe) { result.Success = false; result.Message = "NOTI_EMAIL_REGISTERED"; return(Json(result, JsonRequestBehavior.AllowGet)); } WrapperSimpleTypesDTO userExist = await service.VerificarSiUsuarioYaExiste(userToValidate); if (userExist == null || userExist.Existe) { result.Success = false; result.Message = "NOTI_USER_REGISTERED"; return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { result.Success = false; result.Message = ex.Message; return(Json(result, JsonRequestBehavior.AllowGet)); } }
async Task <bool> ValidarDatosPersona() { bool esValido = true; if (string.IsNullOrWhiteSpace(Persona.Nombres) || string.IsNullOrWhiteSpace(Persona.Telefono) || string.IsNullOrWhiteSpace(Persona.CiudadResidencia) || Persona.CodigoIdioma <= 0 || Persona.CodigoPais <= 0 || string.IsNullOrWhiteSpace(Persona.Usuarios.Email)) { await CoreMethods.DisplayAlert(SportsGoResources.Error, SportsGoResources.FaltaDatosPersona, "OK"); esValido = false; } else if (_tipoPerfil != TipoPerfil.Grupo && string.IsNullOrWhiteSpace(Persona.Apellidos)) { await CoreMethods.DisplayAlert(SportsGoResources.Error, SportsGoResources.FaltaDatosPersona, "OK"); esValido = false; } else if (!Regex.IsMatch(Persona.Usuarios.Email.Trim(), AppConstants.RegexEmail)) { await CoreMethods.DisplayAlert(SportsGoResources.Error, SportsGoResources.EmailFormatoInvalido, "OK"); esValido = false; } else if (EsPrimerRegistro || (_viejoCorreo.Trim() != Persona.Usuarios.Email.Trim())) { UsuariosDTO usuarioEmail = new UsuariosDTO { Email = Persona.Usuarios.Email }; if (IsNotConnected) { return(false); } WrapperSimpleTypesDTO wrapperEmail = await _authenticateServices.VerificarSiEmailYaExiste(usuarioEmail); if (wrapperEmail == null) { await CoreMethods.DisplayAlert(SportsGoResources.Error, SportsGoResources.ErrorValidarEmail, "OK"); esValido = false; } else if (wrapperEmail.Existe) { await CoreMethods.DisplayAlert(SportsGoResources.Error, SportsGoResources.EmailYaExiste, "OK"); esValido = false; } } return(esValido); }
public async Task <ActionResult> ValidateIfEmailExist(UsuariosDTO emailToValidate) { Result <WrapperSimpleTypesDTO> result = new Result <WrapperSimpleTypesDTO>(); try { AuthenticateServices service = new AuthenticateServices(); result.obj = await service.VerificarSiEmailYaExiste(emailToValidate); if (result.obj == null || result.obj.Existe) { return(Json(Helper.returnErrorObj(UserLoggedIn().PersonaDelUsuario.CodigoIdioma), JsonRequestBehavior.AllowGet)); } return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(Helper.returnErrorObj(UserLoggedIn().PersonaDelUsuario.CodigoIdioma), JsonRequestBehavior.AllowGet)); } }