public List <RespuestaModelo> ListarEncuestaCompleta(int id) { List <RespuestaModelo> lista = new List <RespuestaModelo>(); MySqlConnection conn = new MySqlConnection(this.CadenaConexion()); MySqlCommand command = conn.CreateCommand(); command.CommandText = "STP_ListarEncuestaKey"; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("id", id); try { conn.Open(); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { RespuestaModelo oRespuesta = new RespuestaModelo(); oRespuesta.idRespuesta = reader.GetInt32(5); oRespuesta.pregunta.idPregunta = reader.GetInt32(2); oRespuesta.pregunta.encuesta.IdEncuesta = reader.GetInt32(0); oRespuesta.pregunta.encuesta.NomEncuesta = reader.GetString(1); oRespuesta.pregunta.descPregunta = reader.GetString(3); oRespuesta.pregunta.tipoPregunta.idTipoPregunta = reader.GetInt32(4); oRespuesta.descRespuesta = reader.GetString(6); lista.Add(oRespuesta); } } catch (Exception e) { throw e; } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } } return(lista); }
public async Task <RespuestaModelo> verificaConexion() { RespuestaModelo respuesta = new RespuestaModelo(); respuesta.IsSuccess = true; respuesta.Mensaje = "OK"; if (!CrossConnectivity.Current.IsConnected) { respuesta.IsSuccess = false; respuesta.Mensaje = "Sin conexión WI-FI o Datos 3G"; } else { var hayConexionInternet = await CrossConnectivity.Current.IsRemoteReachable("google.com"); //if (!hayConexionInternet) //{ // respuesta.IsSuccess = false; // respuesta.Mensaje = "UPPS! Actualmente no hay conexión a internet"; //} } return(respuesta); }