예제 #1
0
 public bool newEjercicio(EjercicioModel _ejercicio)
 {
     try
     {
         DDBBGateway data = new DDBBGateway();
         data.prepareQuery(
             "insert into Ejercicios " +
             "values ('" + _ejercicio.nombre + "', '" + _ejercicio.tipo + "', '" + _ejercicio.urlEjemplo + "', '" + _ejercicio.tiempo +
             "', '" + _ejercicio.repeticiones + "', '" + _ejercicio.comentarios + "', '" + _ejercicio.intensidad +
             "', '" + _ejercicio.idPersona + "', '" + _ejercicio.idRutina + "')");
         if (data.sendStatement() == false)
         {
             return(false);
         }
         if (data.getAffectedRows() <= 0)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public bool updatePersonaByIdAndDNI(personaModel _persona, int _oldDNI, long _oldID)
 {
     try
     {
         DDBBGateway data = new DDBBGateway();
         data.prepareQuery("" +
                           "update Personas " +
                           "set nombre = '" + _persona.nombre + "', apellido = '" + _persona.apellido + "', dni = '" + _persona.dni + "'" +
                           ", fechaNacimiento = '" + _persona.fechaNacimiento + "' " +
                           "where dni = '" + _oldDNI + "' and id = '" + _oldID + "';");
         data.sendStatement();
         if (data.getAffectedRows() <= 0)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public bool newEntrenamiento(EntrenamientoModel _entrenamiento)
 {
     try
     {
         DDBBGateway data = new DDBBGateway();
         data.prepareQuery(
             "insert into Entrenamientos " +
             "values ('" + _entrenamiento.idPersona + "', '" + _entrenamiento.descripcion + "', '" + _entrenamiento.nombre + "')");
         data.sendStatement();
         if (data.getAffectedRows() <= 0)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public bool updateEntrenamiento(EntrenamientoModel _entrenamiento)
 {
     try
     {
         DDBBGateway data = new DDBBGateway();
         data.prepareQuery(
             "update Entrenamientos" +
             " set descripcion = '" + _entrenamiento.descripcion + "', nombre = '" + _entrenamiento.nombre + "' " +
             "where id = '" + _entrenamiento.id + "'");
         data.sendStatement();
         if (data.getAffectedRows() <= 0)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public bool updateUsuarioByID(usuarioModel _user)
 {
     try
     {
         DDBBGateway data = new DDBBGateway();
         data.prepareQuery(
             "update Usuarios " +
             "set mail = '" + _user.mail + "', password = '******', profile = '" + _user.profile + "' " +
             "where id = '" + _user.id + "'");
         data.sendStatement();
         if (data.getAffectedRows() <= 0)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }