Commit 4815c6d4 authored by chris.crook's avatar chris.crook

> basic checkout screen functionality

parent 19c926ce
......@@ -153,8 +153,8 @@ public class BookingDetails extends AppCompatActivity {
// time slot 1
String tempwrite = ((EditText) findViewById(R.id.YEET2)).getText().toString();
tempwrite += "&1";
String [] temploadarray = tempwrite.split("&"); // id,museum_name,city,country,price,name,password,adminflag,currency,language,id
String filename6 = "Booking_" + temploadarray[5] + temploadarray [10]; // file will be named: Booking_NameID
String [] temploadarray = tempwrite.split("&"); // id,museum_name,city,country,price,name,password,adminflag,currency,language,id,slot
String filename6 = "Booking";// + temploadarray[5] + temploadarray [10]; // file will be named: Booking_NameID
File file6;
file6 = new File(getApplicationContext().getFilesDir(), filename6 + ".txt");
String temp = "";
......@@ -169,7 +169,7 @@ public class BookingDetails extends AppCompatActivity {
//
}
else{
tempwrite = "%" + tempwrite;
tempwrite = "&" + tempwrite;
}
try{
FileWriter stream = new FileWriter(file6, true);
......
......@@ -58,7 +58,7 @@ public class CheckoutScreen extends AppCompatActivity {
//
}
String [] passed = temp.split("&"); // id,name,city,country,price
String filename6 = "Booking_" + passed[1] + passed[0];
String filename6 = "Booking";// + passed[1] + passed[0];
File file6;
file6 = new File(getApplicationContext().getFilesDir(), filename6 + ".txt");
String read = "";
......@@ -68,7 +68,45 @@ public class CheckoutScreen extends AppCompatActivity {
read = read + reader.nextLine();
}
} catch (Exception e) { }
((EditText)findViewById(R.id.outputcheckout)).setText(read);
// id,museum_name,city,country,price,name,password,adminflag,currency,language,id,slot
String [] loadbooking = read.split("&");
String bookingoutput = "Bookings made:";
for (int i = 0; i < loadbooking.length; i++){
if (i%12 == 2){
//museum name
bookingoutput += loadbooking [i];
bookingoutput += ", ";
}
if (i%12 == 3){
//city
bookingoutput += "(";
bookingoutput += loadbooking [i];
bookingoutput += "), ";
}
if (i%12 == 9){
//currency mode to select
}
if (i%12 == 5){
//price
bookingoutput += " ";
String pricetest = loadbooking [i+4];
int price = 0;
bookingoutput += loadbooking [i];
bookingoutput += ", ";
}
if (i%12 == 10){
//
bookingoutput += loadbooking [i];
bookingoutput += ", ";
}
if (i%12 == 0){
//end of each booking entry
bookingoutput += loadbooking [i];
bookingoutput += "\n";
bookingoutput += "> ";
}
}
((EditText)findViewById(R.id.outputcheckout)).setText(bookingoutput);
}
public void gobackfromtheshop (View view){
......
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