Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Booking App COM5007
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
austin.blanke
Booking App COM5007
Commits
ce152119
Commit
ce152119
authored
May 29, 2023
by
austin.blanke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Almost Done3
parent
b1b58be6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
135 additions
and
3 deletions
+135
-3
DatabaseConnector.java
...om/example/bookingapp_austinblanke/DatabaseConnector.java
+42
-3
SingleBookingActivity.java
...xample/bookingapp_austinblanke/SingleBookingActivity.java
+81
-0
singlebooking.xml
app/src/main/res/layout/singlebooking.xml
+12
-0
No files found.
app/src/main/java/com/example/bookingapp_austinblanke/DatabaseConnector.java
View file @
ce152119
...
...
@@ -310,7 +310,17 @@ public class DatabaseConnector extends SQLiteOpenHelper {
}
public
String
getBookingInfo
(
String
BID
,
int
column
)
{
String
result
;
String
query
=
"SELECT * FROM "
+
TABLE_BOOKINGS
+
" WHERE "
+
COLUMN_BID
+
" = \""
+
BID
+
"\""
;
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
Cursor
cursor
=
db
.
rawQuery
(
query
,
null
);
cursor
.
moveToFirst
();
result
=
cursor
.
getString
(
column
).
toString
();
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
+
"\""
;
...
...
@@ -357,11 +367,40 @@ public class DatabaseConnector extends SQLiteOpenHelper {
}
public
void
deleteBooking
(
int
BID
){
String
query
=
"SELECT * FROM "
+
TABLE_BOOKINGS
;
String
PID
=
null
;
String
newTicketCount1
=
null
;
String
newTicketCount2
=
null
;
String
newTicketCount3
=
null
;
String
query
=
"SELECT * FROM "
+
TABLE_BOOKINGS
+
" WHERE "
+
COLUMN_BID
+
" = \""
+
BID
+
"\""
;
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
Cursor
cursor
=
db
.
rawQuery
(
query
,
null
);
db
.
delete
(
TABLE_BOOKINGS
,
COLUMN_BID
+
"="
+
BID
,
null
);
PID
=
cursor
.
getString
(
1
);
String
query2
=
"SELECT * FROM "
+
TABLE_PERFORMANCES
+
" WHERE "
+
COLUMN_PERFORMANCEID
+
" = \""
+
PID
+
"\""
;
Cursor
cursor2
=
db
.
rawQuery
(
query2
,
null
);
newTicketCount1
=
(
Integer
.
valueOf
(
cursor2
.
getString
(
10
))
+
Integer
.
valueOf
(
cursor
.
getString
(
2
)).
toString
());
newTicketCount2
=
(
Integer
.
valueOf
(
cursor2
.
getString
(
13
))
+
Integer
.
valueOf
(
cursor
.
getString
(
3
)).
toString
());
newTicketCount3
=
(
Integer
.
valueOf
(
cursor2
.
getString
(
16
))
+
Integer
.
valueOf
(
cursor
.
getString
(
4
)).
toString
());
cursor
.
close
();
cursor2
.
close
();
ContentValues
values2
=
new
ContentValues
();
values2
.
put
(
COLUMN_TICKET1CNT
,
newTicketCount1
);
values2
.
put
(
COLUMN_TICKET2CNT
,
newTicketCount2
);
values2
.
put
(
COLUMN_TICKET3CNT
,
newTicketCount3
);
String
whereClause
=
COLUMN_PERFORMANCEID
+
" = "
+
"\""
+
PID
+
"\""
;
db
.
update
(
TABLE_PERFORMANCES
,
values2
,
whereClause
,
null
);
String
queryDelete
=
"SELECT * FROM "
+
TABLE_BOOKINGS
;
Cursor
cursor3
=
db
.
rawQuery
(
queryDelete
,
null
);
db
.
delete
(
TABLE_BOOKINGS
,
COLUMN_BID
+
"="
+
BID
,
null
);
cursor3
.
close
();
db
.
close
();
}
public
ArrayList
bookings
(){
...
...
app/src/main/java/com/example/bookingapp_austinblanke/SingleBookingActivity.java
View file @
ce152119
...
...
@@ -3,6 +3,9 @@ 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
;
import
androidx.appcompat.app.AppCompatActivity
;
...
...
@@ -12,8 +15,86 @@ public class SingleBookingActivity extends AppCompatActivity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
singlebooking
);
Bundle
loginBundle
=
getIntent
().
getExtras
();
BID
=
loginBundle
.
getString
(
"BID"
);
String
PID
=
null
;
String
Title
=
null
;
String
Date
=
null
;
String
Time
=
null
;
String
Location
=
null
;
String
Flash
=
null
;
String
Wheelchair
=
null
;
String
Stairs
=
null
;
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
;
String
Tickets1Price
=
null
;
String
Tickets2Price
=
null
;
String
Tickets3Price
=
null
;
DatabaseConnector
connector
=
new
DatabaseConnector
(
this
,
null
);
PID
=
connector
.
getBookingInfo
(
BID
,
1
);
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"
;}
TextView
title
=
(
TextView
)
findViewById
(
R
.
id
.
BTitle
);
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
);
Tickets1
=
connector
.
getBookingInfo
(
BID
,
2
);
Tickets2
=
connector
.
getBookingInfo
(
BID
,
3
);
Tickets3
=
connector
.
getBookingInfo
(
BID
,
4
);
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
);
TextView
ticket1
=
(
TextView
)
findViewById
(
R
.
id
.
tickets1
);
TextView
ticket2
=
(
TextView
)
findViewById
(
R
.
id
.
tickets2
);
TextView
ticket3
=
(
TextView
)
findViewById
(
R
.
id
.
tickets3
);
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
myBookings
(
View
view
){
...
...
app/src/main/res/layout/singlebooking.xml
View file @
ce152119
...
...
@@ -146,5 +146,17 @@
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.699"
/>
<TextView
android:id=
"@+id/location"
android:layout_width=
"166dp"
android:layout_height=
"44dp"
android:text=
"TextView"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.124"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.476"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment