use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class CreateConstraintsWizard method getIdZone.
private String getIdZone(Element elm) {
String idZone = "";
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(getContext());
SQLiteDatabase db = dbAlpha.getReadableDatabase();
Cursor cursor = db.rawQuery(CommandDbAlphaTour.Command.SELECT_ID_ZONE, new String[] { elm.getZoneRif() });
if (cursor.moveToFirst()) {
idZone = cursor.getString(cursor.getColumnIndexOrThrow(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ZONE_ID));
}
return idZone;
}
use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class UpdateProfileActivity method updateUserOnDbLocal.
public int updateUserOnDbLocal(String Name, String Surname, String DateOfBirth, String Username, String Email, String EmailLocal) {
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(this);
// recupero idUtente
SQLiteDatabase db = dbAlpha.getReadableDatabase();
Cursor cursor = db.rawQuery(CommandDbAlphaTour.Command.SELECT_USER_PROFILE, new String[] { emailLocal });
if (cursor.moveToFirst()) {
idUtenteLocal = cursor.getString(cursor.getColumnIndexOrThrow(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_ID));
}
// aggiornamento dati utente
db = dbAlpha.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_NAME, Name);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_SURNAME, Surname);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_DATE_BIRTH, DateOfBirth);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_USERNAME, Username);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_EMAIL, Email);
return db.update(AlphaTourContract.AlphaTourEntry.NAME_TABLE_USER, values, AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_ID + CommandDbAlphaTour.Command.EQUAL + CommandDbAlphaTour.Command.VALUE, new String[] { idUtenteLocal });
}
use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class ProfileActivity method saveImageProfileOnDbLocal.
// salva l'uri dell'immagine di profilo
private int saveImageProfileOnDbLocal(Uri uri) {
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(this);
// recupero idUtente
SQLiteDatabase db = dbAlpha.getReadableDatabase();
Cursor cursor = db.rawQuery(CommandDbAlphaTour.Command.SELECT_USER_PROFILE, new String[] { email });
if (cursor.moveToFirst()) {
idUtenteLocal = cursor.getString(cursor.getColumnIndexOrThrow(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_ID));
}
db = dbAlpha.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_IMAGE, uri.toString());
return db.update(AlphaTourContract.AlphaTourEntry.NAME_TABLE_USER, values, AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_ID + CommandDbAlphaTour.Command.EQUAL + CommandDbAlphaTour.Command.VALUE, new String[] { idUtenteLocal });
}
use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class RegisterActivity method saveUserOnDbLocal.
public long saveUserOnDbLocal(String Name, String Surname, String DateBirth, String Username, String Email) {
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(this);
SQLiteDatabase db = dbAlpha.getWritableDatabase();
ContentValues values = new ContentValues();
long newRowId;
// valori.put(AlphaTourContract.AlphaTourEntry.NOME_COLONNA_UTENTE_ID,2);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_NAME, Name);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_SURNAME, Surname);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_DATE_BIRTH, DateBirth);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_USERNAME, Username);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_EMAIL, Email);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_USER_IMAGE, "null");
newRowId = db.insert(AlphaTourContract.AlphaTourEntry.NAME_TABLE_USER, AlphaTourContract.AlphaTourEntry.COLUMN_NAME_NULLABLE, values);
return newRowId;
}
use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class CreateConstraintsWizard method saveObjectsLocal.
private long saveObjectsLocal(List<Element> elementList) {
long newRowId = -1;
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(getContext());
SQLiteDatabase db = dbAlpha.getWritableDatabase();
ContentValues values = new ContentValues();
for (int i = 0; i < elementList.size(); i++) {
Element elm = elementList.get(i);
String idZone = getIdZone(elm);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ELEMENT_ID_ZONE, idZone);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ELEMENT_NAME, elm.getTitle());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ELEMENT_DESCRIPTION, elm.getDescription());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ELEMENT_PHOTO, elm.getPhoto().toString());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ELEMENT_QR_CODE, elm.getQrData());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ELEMENT_LOAD, load);
newRowId = db.insert(AlphaTourContract.AlphaTourEntry.NAME_TABLE_ELEMENT, AlphaTourContract.AlphaTourEntry.COLUMN_NAME_NULLABLE, values);
}
return newRowId;
}
Aggregations