Commit 22239a1e authored by austin.blanke's avatar austin.blanke

Performance Display Working Minus Tickets

parent 310c2d60
......@@ -31,14 +31,23 @@ public class DatabaseConnector extends SQLiteOpenHelper {
private static final String COLUMN_WHEELCHAIR = "wheelchair";
private static final String COLUMN_STEPS = "steps";
private static final String COLUMN_TICSEAT = "ticSeat";
private static final String COLUMN_TICSEATCOST = "ticSeatCost";
private static final String COLUMN_TICSTAND = "ticStand";
private static final String COLUMN_TICSTANDCOST = "ticStandCost";
private static final String COLUMN_TICSTAGE = "ticStage";
private static final String COLUMN_TICSTAGECOST = "ticStageCost";
private static final String COLUMN_TICGRASS = "ticGrass";
private static final String COLUMN_TICGRASSCOST = "ticGrassCost";
private static final String COLUMN_TICBOATA = "ticBoatA";
private static final String COLUMN_TICBOATACOST = "ticBoatACost";
private static final String COLUMN_TICBOATB = "ticBoatB";
private static final String COLUMN_TICBOATBCOST = "ticBoatBCost";
private static final String COLUMN_TICRIVERBANK = "ticRiverBank";
private static final String COLUMN_TICRIVERBANKCOST = "ticRiverBankCost";
private static final String COLUMN_TICINNERCIRCLE = "ticInnerCircle";
private static final String COLUMN_TICINNERCIRCLECOST = "ticInnerCircleCost";
private static final String COLUMN_TICOUTTERCIRCLE = "ticOutterCircle";
private static final String COLUMN_TICOUTTERCIRCLECOST = "ticOutterCircleCost";
public DatabaseConnector(Context context, SQLiteDatabase.CursorFactory factory) {
......@@ -64,15 +73,24 @@ public class DatabaseConnector extends SQLiteOpenHelper {
COLUMN_FLASH + " TEXT, " +
COLUMN_WHEELCHAIR + " TEXT, " +
COLUMN_STEPS + " TEXT, " +
COLUMN_TICSEAT + " TEXT, " +
COLUMN_TICSTAND + " TEXT, " +
COLUMN_TICSTAGE + " TEXT, " +
COLUMN_TICGRASS + " TEXT, " +
COLUMN_TICBOATA + " TEXT, " +
COLUMN_TICBOATB + " TEXT, " +
COLUMN_TICRIVERBANK + " TEXT, " +
COLUMN_TICINNERCIRCLE + " TEXT, " +
COLUMN_TICOUTTERCIRCLE + " TEXT)";
COLUMN_TICSEAT + " Int, " +
COLUMN_TICSEATCOST + " Int, " +
COLUMN_TICSTAND + " INT, " +
COLUMN_TICSTANDCOST + " INT, " +
COLUMN_TICSTAGE + " INT, " +
COLUMN_TICSTAGECOST + " INT, " +
COLUMN_TICGRASS + " INT, " +
COLUMN_TICGRASSCOST + " INT, " +
COLUMN_TICBOATA + " INT, " +
COLUMN_TICBOATACOST + " INT, " +
COLUMN_TICBOATB + " INT, " +
COLUMN_TICBOATBCOST + " INT, " +
COLUMN_TICRIVERBANK + " INT, " +
COLUMN_TICRIVERBANKCOST + " INT, " +
COLUMN_TICINNERCIRCLE + " INT, " +
COLUMN_TICINNERCIRCLECOST + " INT, " +
COLUMN_TICOUTTERCIRCLE + " INT, " +
COLUMN_TICOUTTERCIRCLECOST + " INT)";
db.execSQL(CREATE_table2);
ContentValues play1 = new ContentValues();
......@@ -84,7 +102,8 @@ public class DatabaseConnector extends SQLiteOpenHelper {
play1.put(COLUMN_FLASH, "false");
play1.put(COLUMN_WHEELCHAIR, "true");
play1.put(COLUMN_STEPS, "false");
play1.put(COLUMN_TICSEAT, "17,8");
play1.put(COLUMN_TICSEAT, 17);
play1.put(COLUMN_TICSEATCOST, 8);
db.insert(TABLE_PERFORMANCES, null, play1);
ContentValues play2 = new ContentValues();
......@@ -96,7 +115,10 @@ public class DatabaseConnector extends SQLiteOpenHelper {
play2.put(COLUMN_FLASH, "true");
play2.put(COLUMN_WHEELCHAIR, "false");
play2.put(COLUMN_STEPS, "true");
play2.put(COLUMN_TICSEAT, "8,8");
play2.put(COLUMN_TICSEAT, 8);
play2.put(COLUMN_TICSEATCOST, 8);
play2.put(COLUMN_TICSTAND, 12);
play2.put(COLUMN_TICSTANDCOST, 7);
db.insert(TABLE_PERFORMANCES, null, play2);
ContentValues play3 = new ContentValues();
......@@ -108,8 +130,10 @@ public class DatabaseConnector extends SQLiteOpenHelper {
play3.put(COLUMN_FLASH, "true");
play3.put(COLUMN_WHEELCHAIR, "true");
play3.put(COLUMN_STEPS, "false");
play3.put(COLUMN_TICSTAGE, "11,4");
play3.put(COLUMN_TICGRASS, "29,4");
play3.put(COLUMN_TICSTAGE, 11);
play3.put(COLUMN_TICSTAGECOST, 4);
play3.put(COLUMN_TICGRASS, 29);
play3.put(COLUMN_TICGRASSCOST, 4);
db.insert(TABLE_PERFORMANCES, null, play3);
ContentValues play4 = new ContentValues();
......@@ -121,8 +145,10 @@ public class DatabaseConnector extends SQLiteOpenHelper {
play4.put(COLUMN_FLASH, "false");
play4.put(COLUMN_WHEELCHAIR, "true");
play4.put(COLUMN_STEPS, "false");
play4.put(COLUMN_TICSEAT, "5,9");
play4.put(COLUMN_TICSTAND, "12,7");
play4.put(COLUMN_TICSEAT, 5);
play4.put(COLUMN_TICSEATCOST, 9);
play4.put(COLUMN_TICSTAND, 12);
play4.put(COLUMN_TICSTANDCOST, 7);
db.insert(TABLE_PERFORMANCES, null, play4);
ContentValues play5 = new ContentValues();
......@@ -134,8 +160,10 @@ public class DatabaseConnector extends SQLiteOpenHelper {
play5.put(COLUMN_FLASH, "false");
play5.put(COLUMN_WHEELCHAIR, "true");
play5.put(COLUMN_STEPS, "false");
play5.put(COLUMN_TICBOATA, "6,9");
play5.put(COLUMN_TICRIVERBANK, "10,7");
play5.put(COLUMN_TICBOATA, 6);
play5.put(COLUMN_TICBOATACOST, 9);
play5.put(COLUMN_TICRIVERBANK, 10);
play5.put(COLUMN_TICRIVERBANKCOST, 7);
db.insert(TABLE_PERFORMANCES, null, play5);
ContentValues play6 = new ContentValues();
......@@ -147,9 +175,12 @@ public class DatabaseConnector extends SQLiteOpenHelper {
play6.put(COLUMN_FLASH, "false");
play6.put(COLUMN_WHEELCHAIR, "false");
play6.put(COLUMN_STEPS, "true");
play6.put(COLUMN_TICINNERCIRCLE, "5,16");
play6.put(COLUMN_TICOUTTERCIRCLE, "8,13");
play6.put(COLUMN_TICSTAND, "10,10");
play6.put(COLUMN_TICINNERCIRCLE, 5);
play6.put(COLUMN_TICINNERCIRCLECOST, 16);
play6.put(COLUMN_TICOUTTERCIRCLE, 8);
play6.put(COLUMN_TICOUTTERCIRCLECOST, 13);
play6.put(COLUMN_TICSTAND, 10);
play6.put(COLUMN_TICSTANDCOST, 10);
db.insert(TABLE_PERFORMANCES, null, play6);
}
......@@ -185,14 +216,56 @@ public class DatabaseConnector extends SQLiteOpenHelper {
return result;
}
public String getTicketCount(String PID, int t) {
int count = 0;
String result = null;
String query = "SELECT * FROM " + TABLE_PERFORMANCES + " WHERE " + COLUMN_PERFORMANCEID + " = \"" + PID + "\"";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
cursor.moveToFirst();
for(int i=8;i< cursor.getCount();i++){
if(cursor.getString(i) != null){
count = count + 1;
if(count==t){
result = (cursor.getString(i));
}
}
}
cursor.close();
db.close();
return result;
}
public void moreInfo(String username, String PID) {
public String getTicketPrice(String PID, int t) {
int count = 0;
String result = null;
String query = "SELECT * FROM " + TABLE_PERFORMANCES + " WHERE " + COLUMN_PERFORMANCEID + " = \"" + PID + "\"";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
cursor.moveToFirst();
for(int i=8;i< cursor.getCount();i++){
if(cursor.getString(i) != null){
count = count + 1;
if(count==t){
result = (cursor.getString(i+1));
}
}
}
cursor.close();
db.close();
return result;
}
public String getInfo(String PID, int column) {
String result;
String query = "SELECT * FROM " + TABLE_PERFORMANCES + " WHERE " + COLUMN_PERFORMANCEID + " = \"" + PID + "\"";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
cursor.moveToFirst();
result = cursor.getString(column).toString();
cursor.close();
db.close();
return result;
}
public boolean login(String username, String password) {
String query = "SELECT * FROM " + TABLE_USERS + " WHERE " + COLUMN_USERNAME + " = \"" + username + "\"";
......@@ -224,20 +297,20 @@ public class DatabaseConnector extends SQLiteOpenHelper {
for(int i=0;i< cursor.getCount();i++){
if (filter1) {
if (cursor.getString(5).equals("false")) {
performances.add(cursor.getString(1));
performances.add(cursor.getString(1) + " id: " +cursor.getString(0));
}
}
else if(filter2) {
if (cursor.getString(6).equals("true")) {
performances.add(cursor.getString(1));
performances.add(cursor.getString(1) + " id: " +cursor.getString(0));
}
}
else if(filter3) {
if (cursor.getString(7).equals("false")) {
performances.add(cursor.getString(1));
performances.add(cursor.getString(1) + " id: " +cursor.getString(0));
}
}
else{performances.add(cursor.getString(1));} //No filter present
else{performances.add(cursor.getString(1) + " id: " +cursor.getString(0));} //No filter present
cursor.moveToNext();
}
......
......@@ -18,26 +18,75 @@ public class MoreInfoActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.moreinfo_activity);
Bundle loginBundle = getIntent().getExtras();
PID = loginBundle.getString("PID");
String Performance = null;
String Title = null;
String Date = null;
String Time = null;
String Location = null;
Boolean Flash = false;
Boolean Wheelchair = false;
Boolean Stairs = false;
String Tickets = null;
String Flash = null;
String Wheelchair = null;
String Stairs = null;
String Flashdis = null;
String Wheelchairdis = null;
String Stairsdis = null;
String Tickets1 = null;
String Tickets2 = null;
String Tickets3 = null;
String Tickets1Price = null;
String Tickets2Price = null;
String Tickets3Price = null;
DatabaseConnector connector = new DatabaseConnector(this, null);
Title = connector.getInfo(PID, 1);
Date = connector.getInfo(PID, 2);
Time = connector.getInfo(PID, 3);
Location = connector.getInfo(PID, 4);
Flash = connector.getInfo(PID, 5);
Wheelchair = connector.getInfo(PID, 6);
Stairs = connector.getInfo(PID, 7);
if(Flash == "true"){Flashdis = "There are Flashing Lights";}
else{Flashdis = "There are no flashing lights";}
if(Wheelchair == "true"){Wheelchairdis = "There is wheelchair access";}
else{Wheelchairdis = "There is no wheelchair access";}
if(Stairs == "true"){Stairsdis = "There are less than 20 steps";}
else{Stairsdis = "There are more than 20 steps";}
Tickets1 = connector.getTicketCount(PID, 1);
Tickets2 = connector.getTicketCount(PID, 2);
Tickets3 = connector.getTicketCount(PID, 3);
Tickets1Price = connector.getTicketPrice(PID, 1);
Tickets2Price = connector.getTicketPrice(PID, 2);
Tickets3Price = connector.getTicketPrice(PID, 3);
Bundle loginBundle = getIntent().getExtras();
PID = loginBundle.getString("PID");
TextView title = (TextView) findViewById(R.id.PTitle);
title.setText(PID);
title.setText(Title);
TextView date = (TextView) findViewById(R.id.date);
date.setText(Date);
TextView time = (TextView) findViewById(R.id.time);
time.setText(Time);
TextView location = (TextView) findViewById(R.id.location);
location.setText(Location);
TextView flash = (TextView) findViewById(R.id.flash);
flash.setText(Flashdis);
TextView wheel = (TextView) findViewById(R.id.wheelchair);
wheel.setText(Wheelchairdis);
TextView stairs = (TextView) findViewById(R.id.stairs);
stairs.setText(Stairsdis);
TextView ticket1 = (TextView) findViewById(R.id.tickets1);
ticket1.setText(Tickets1 + ", £" + Tickets1Price);
TextView ticket2 = (TextView) findViewById(R.id.tickets2);
ticket2.setText(Tickets2 + ", £" + Tickets2Price);
TextView ticket3 = (TextView) findViewById(R.id.tickets3);
ticket3.setText(Tickets3 + ", £" + Tickets3Price);
}
......
......@@ -23,6 +23,7 @@
android:layout_width="290dp"
android:layout_height="92dp"
android:text="TextView"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
......@@ -30,81 +31,59 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.097" />
<TextView
android:id="@+id/date"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.197"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.257" />
<TextView
android:id="@+id/flash"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.799"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.368" />
<TextView
android:id="@+id/tickets"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.197"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.478"
tools:ignore="DuplicateIds" />
<TextView
android:id="@+id/date"
android:layout_width="190dp"
android:layout_height="55dp"
android:text="TextView"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.197"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.257" />
<TextView
android:id="@+id/stairs"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.799"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.515" />
<TextView
android:id="@+id/flash"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.799"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.359" />
<TextView
android:id="@+id/time"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.799"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.257" />
<TextView
android:id="@+id/tickets2"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.197"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.547"
tools:ignore="DuplicateIds" />
<TextView
android:id="@+id/PTitle"
android:layout_width="290dp"
android:layout_height="92dp"
android:id="@+id/tickets3"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintHorizontal_bias="0.197"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.097" />
app:layout_constraintVertical_bias="0.619"
tools:ignore="DuplicateIds" />
<TextView
android:id="@+id/date"
android:id="@+id/tickets1"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
......@@ -113,7 +92,21 @@
app:layout_constraintHorizontal_bias="0.197"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.257" />
app:layout_constraintVertical_bias="0.478"
tools:ignore="DuplicateIds" />
<TextView
android:id="@+id/stairs"
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.799"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.515" />
<TextView
android:id="@+id/wheelchair"
......@@ -129,8 +122,8 @@
<TextView
android:id="@+id/location"
android:layout_width="107dp"
android:layout_height="39dp"
android:layout_width="145dp"
android:layout_height="55dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......@@ -144,6 +137,7 @@
android:layout_width="107dp"
android:layout_height="39dp"
android:text="TextView"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.799"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment