Fixed HomeOwner to ServiceProvider
This commit is contained in:
parent
91476b3ddc
commit
7db152a0a8
1 changed files with 18 additions and 1 deletions
|
@ -238,7 +238,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
values.put(COLUMN_FIRSTNAME, userType.getFirstname());
|
values.put(COLUMN_FIRSTNAME, userType.getFirstname());
|
||||||
values.put(COLUMN_LASTNAME, userType.getLastname());
|
values.put(COLUMN_LASTNAME, userType.getLastname());
|
||||||
values.put(COLUMN_USERTYPE, userType.getClass().getSimpleName());
|
values.put(COLUMN_USERTYPE, userType.getClass().getSimpleName());
|
||||||
if (userType.getClass().getSimpleName().equals("Homeowner")){
|
if (userType instanceof ServiceProvider){
|
||||||
ServiceProvider serviceProvider = (ServiceProvider)userType;
|
ServiceProvider serviceProvider = (ServiceProvider)userType;
|
||||||
|
|
||||||
String address = serviceProvider.getAddress();
|
String address = serviceProvider.getAddress();
|
||||||
|
@ -678,6 +678,23 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
return serviceProvider.getAvailabilities();
|
return serviceProvider.getAvailabilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[][] getAvailabilities(String serviceProviderName){
|
||||||
|
int[][] availabilities = new int[7][4];
|
||||||
|
if (serviceProviderName==null) return availabilities;
|
||||||
|
|
||||||
|
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_AVAILABILITY
|
||||||
|
+ " WHERE " + COLUMN_AVAILABILITYNAME + " = ?",
|
||||||
|
new String[]{serviceProviderName});
|
||||||
|
if (cursor.moveToFirst()){
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
int start = cursor.getInt(i*2+1);
|
||||||
|
int end = cursor.getInt(i*2+2);
|
||||||
|
availabilities[i] = new int[]{start/60, start%60, end/60, end%60};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return availabilities;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints all entries of table. One row is printed per line. Columns are
|
* Prints all entries of table. One row is printed per line. Columns are
|
||||||
* separated by spaces.
|
* separated by spaces.
|
||||||
|
|
Loading…
Reference in a new issue