use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class CreateConstraintsWizard method saveZonesLocal.
private long saveZonesLocal(ArrayList<String> zone_list) {
long newRowId = -1;
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(getContext());
SQLiteDatabase db = dbAlpha.getWritableDatabase();
ContentValues values = new ContentValues();
idPlace = getIdPlace(CreatePlaceWizard.getNamePlace());
for (i = 0; i < zone_list.size(); i++) {
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ZONE_NAME, zone_list.get(i));
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ZONE_ID_PLACE, idPlace);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_ZONE_LOAD, load);
newRowId = db.insert(AlphaTourContract.AlphaTourEntry.NAME_TABLE_ZONE, AlphaTourContract.AlphaTourEntry.COLUMN_NAME_NULLABLE, values);
}
return newRowId;
}
use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class CreateConstraintsWizard method getIdPlace.
private String getIdPlace(String s) {
String idPl = "";
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(getContext());
SQLiteDatabase db = dbAlpha.getReadableDatabase();
Cursor cursor = db.rawQuery(CommandDbAlphaTour.Command.SELECT_ID_PLACE, new String[] { s });
if (cursor.moveToFirst()) {
idPl = cursor.getString(cursor.getColumnIndexOrThrow(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PLACE_ID));
}
return idPl;
}
use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class CreateConstraintsWizard method saveConstraintsLocal.
private long saveConstraintsLocal() {
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(getContext());
SQLiteDatabase db = dbAlpha.getWritableDatabase();
ContentValues values = new ContentValues();
long newRowId = -1;
for (j = 0; j < listConstranints.size(); j++) {
Constraint constraint = listConstranints.get(j);
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_CONSTRAINTS_FROM_ZONE, constraint.getFromZone());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_CONSTRAINTS_IN_ZONE, constraint.getInZone());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_CONSTRAINTS_LOAD, load);
newRowId = db.insert(AlphaTourContract.AlphaTourEntry.NAME_TABLE_CONSTRAINTS, AlphaTourContract.AlphaTourEntry.COLUMN_NAME_NULLABLE, values);
}
return newRowId;
}
use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class CreateConstraintsWizard method savePlaceLocal.
private long savePlaceLocal() {
long newRowId;
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(getContext());
SQLiteDatabase db = dbAlpha.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PLACE_NAME, CreatePlaceWizard.getNamePlace());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PLACE_CITY, CreatePlaceWizard.getCity());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PLACE_TYPOLOGY, CreatePlaceWizard.getCity());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PLACE_LOAD, load);
newRowId = db.insert(AlphaTourContract.AlphaTourEntry.NAME_TABLE_PLACE, AlphaTourContract.AlphaTourEntry.COLUMN_NAME_NULLABLE, values);
return newRowId;
}
use of com.example.alphatour.dblite.AlphaTourDbHelper in project AlphaTour by Frank99DG.
the class Step4 method savePathLocal.
public long savePathLocal(Path path) {
long newRowId = -1;
AlphaTourDbHelper dbAlpha = new AlphaTourDbHelper(getContext());
SQLiteDatabase db = dbAlpha.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PATH_NAME, path.getName());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PATH_DESCRIPTION, path.getDescription());
values.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PATH_LOAD, "false");
newRowId = db.insert(AlphaTourContract.AlphaTourEntry.NAME_TABLE_PATH, AlphaTourContract.AlphaTourEntry.COLUMN_NAME_NULLABLE, values);
SQLiteDatabase db1 = dbAlpha.getWritableDatabase();
ContentValues values1 = new ContentValues();
for (i = 0; i < path.getZonePath().size(); i++) {
ZoneChoosed zoneChoosed = path.getZonePath().get(i);
for (int j = 0; j < zoneChoosed.getObjectChoosed().size(); j++) {
values1.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PATH_CONTAINS_ID_PATH, getIdPath(path.getName()));
values1.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PATH_CONTAINS_ZONE, zoneChoosed.getName());
values1.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PATH_CONTAINS_OBJECT, zoneChoosed.getObjectChoosed().get(j));
values1.put(AlphaTourContract.AlphaTourEntry.NAME_COLUMN_PATH_CONTAINS_LOAD, "false");
newRowId = db1.insert(AlphaTourContract.AlphaTourEntry.NAME_TABLE_PATH_CONTAINS, AlphaTourContract.AlphaTourEntry.COLUMN_NAME_NULLABLE, values1);
}
}
return newRowId;
}
Aggregations