Commit 4afc5f2e authored by austin.blanke's avatar austin.blanke

Database Updated, Working on Add Booking Method

parent 67e195a8
......@@ -3,6 +3,7 @@ package com.example.bookingapp_austinblanke;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
......@@ -31,6 +32,9 @@ public class MoreInfoActivity extends AppCompatActivity {
String Flashdis = null;
String Wheelchairdis = null;
String Stairsdis = null;
String Tickets1Type = null;
String Tickets2Type = null;
String Tickets3Type = null;
String Tickets1 = null;
String Tickets2 = null;
String Tickets3 = null;
......@@ -57,12 +61,15 @@ public class MoreInfoActivity extends AppCompatActivity {
if(Stairs == "true"){Stairsdis = "There are less than 20 steps";}
else{Stairsdis = "There are more than 20 steps";}
Tickets1 = connector.getInfo(PID, 8);
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);
Tickets1Type = connector.getTicketType(PID, 1);
Tickets2Type = connector.getTicketType(PID, 2);
Tickets3Type = connector.getTicketType(PID, 3);
......@@ -81,13 +88,42 @@ public class MoreInfoActivity extends AppCompatActivity {
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);
if(Tickets1 != null){ticket1.setText(Tickets1Type + ": " + Tickets1 + " (£" + Tickets1Price + ")");}
else{ticket1.setText("");}
if(Tickets2 != null){ticket2.setText(Tickets2Type + ": " + Tickets2 + " (£" + Tickets2Price + ")");}
else{ticket2.setText("");}
if(Tickets3 != null){ticket3.setText(Tickets3Type + ": " + Tickets3 + " (£" + Tickets3Price + ")");}
else{ticket3.setText("");}
}
public void bookNow(View view){bookNow();}
public void bookNow(){
DatabaseConnector connector = new DatabaseConnector(this, null);
int TIC1 = 0;
int TIC2 = 0;
int TIC3 = 0;
EditText Tic1Cnt = findViewById(R.id.bookTicket1Cnt);
EditText Tic2Cnt = findViewById(R.id.bookTicket2Cnt);
EditText Tic3Cnt = findViewById(R.id.bookTicket3Cnt);
if (Tic1Cnt != null){TIC1 = Integer.parseInt(Tic1Cnt.getText().toString());}
if (Tic2Cnt != null){TIC2 = Integer.parseInt(Tic2Cnt.getText().toString());}
if (Tic3Cnt != null){TIC3 = Integer.parseInt(Tic3Cnt.getText().toString());}
connector.addBooking(PID, TIC1, TIC2, TIC3);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
}
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