Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PlaysRUs
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
sam.pople
PlaysRUs
Commits
8919500f
Commit
8919500f
authored
Jun 19, 2023
by
sam.pople
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tryagain
parent
879ccd6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
19 deletions
+18
-19
Database.java
...RUs2/app/src/main/java/com/example/playsrus/Database.java
+18
-13
seating.java
...sRUs2/app/src/main/java/com/example/playsrus/seating.java
+0
-6
No files found.
PlaysRUs2/app/src/main/java/com/example/playsrus/Database.java
View file @
8919500f
...
@@ -11,9 +11,9 @@ import java.util.ArrayList;
...
@@ -11,9 +11,9 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
public
class
Database
extends
SQLiteOpenHelper
{
public
class
Database
extends
SQLiteOpenHelper
{
public
static
final
String
databasename
=
"
playsrusdata3
.db"
;
public
static
final
String
databasename
=
"
totestthedatabase2
.db"
;
public
Database
(
@Nullable
Context
cont
)
{
public
Database
(
@Nullable
Context
cont
)
{
super
(
cont
,
"
playsrusdata3
.db"
,
null
,
1
);
super
(
cont
,
"
totestthedatabase2
.db"
,
null
,
1
);
}
}
@Override
@Override
public
void
onCreate
(
SQLiteDatabase
data
)
{
public
void
onCreate
(
SQLiteDatabase
data
)
{
...
@@ -35,7 +35,8 @@ public class Database extends SQLiteOpenHelper {
...
@@ -35,7 +35,8 @@ public class Database extends SQLiteOpenHelper {
cv
.
put
(
"username"
,
username
);
cv
.
put
(
"username"
,
username
);
cv
.
put
(
"password"
,
password
);
cv
.
put
(
"password"
,
password
);
long
conclusion
=
MyDatabase
.
insert
(
"user"
,
null
,
cv
);
long
conclusion
=
MyDatabase
.
insert
(
"user"
,
null
,
cv
);
if
(
conclusion
==
-
1
)
{
if
(
conclusion
==
-
1
)
{
return
false
;
return
false
;
}
else
}
else
{
{
...
@@ -45,7 +46,8 @@ public class Database extends SQLiteOpenHelper {
...
@@ -45,7 +46,8 @@ public class Database extends SQLiteOpenHelper {
public
Boolean
usercheck
(
String
username
){
public
Boolean
usercheck
(
String
username
){
SQLiteDatabase
MyDatabase
=
this
.
getWritableDatabase
();
SQLiteDatabase
MyDatabase
=
this
.
getWritableDatabase
();
Cursor
record
=
MyDatabase
.
rawQuery
(
"SELECT * FROM user WHERE username = ?"
,
new
String
[]{
username
});
Cursor
record
=
MyDatabase
.
rawQuery
(
"SELECT * FROM user WHERE username = ?"
,
new
String
[]{
username
});
if
(
record
.
getCount
()
>
0
)
{
if
(
record
.
getCount
()
>
0
)
{
return
true
;
return
true
;
}
else
}
else
{
{
...
@@ -55,7 +57,8 @@ public class Database extends SQLiteOpenHelper {
...
@@ -55,7 +57,8 @@ public class Database extends SQLiteOpenHelper {
public
Boolean
userpass
(
String
username
,
String
password
){
public
Boolean
userpass
(
String
username
,
String
password
){
SQLiteDatabase
MyDatabase
=
this
.
getWritableDatabase
();
SQLiteDatabase
MyDatabase
=
this
.
getWritableDatabase
();
Cursor
record
=
MyDatabase
.
rawQuery
(
"SELECT * FROM user WHERE username = ? AND password = ?"
,
new
String
[]{
username
,
password
});
Cursor
record
=
MyDatabase
.
rawQuery
(
"SELECT * FROM user WHERE username = ? AND password = ?"
,
new
String
[]{
username
,
password
});
if
(
record
.
getCount
()
>
0
)
{
if
(
record
.
getCount
()
>
0
)
{
return
true
;
return
true
;
}
else
}
else
{
{
...
@@ -68,7 +71,8 @@ public class Database extends SQLiteOpenHelper {
...
@@ -68,7 +71,8 @@ public class Database extends SQLiteOpenHelper {
cv
.
put
(
"playName"
,
playName
);
cv
.
put
(
"playName"
,
playName
);
cv
.
put
(
"noticket"
,
noticket
);
cv
.
put
(
"noticket"
,
noticket
);
long
conclusion
=
MyDatabase
.
insert
(
"booking"
,
null
,
cv
);
long
conclusion
=
MyDatabase
.
insert
(
"booking"
,
null
,
cv
);
if
(
conclusion
==
-
1
)
{
if
(
conclusion
==
-
1
)
{
return
false
;
return
false
;
}
else
}
else
{
{
...
@@ -83,13 +87,7 @@ public class Database extends SQLiteOpenHelper {
...
@@ -83,13 +87,7 @@ public class Database extends SQLiteOpenHelper {
long
conclusion
=
data
.
insert
(
"play"
,
null
,
cv
);
long
conclusion
=
data
.
insert
(
"play"
,
null
,
cv
);
return
conclusion
!=
-
1
;
return
conclusion
!=
-
1
;
}
}
public
boolean
ticketsupdate
(
String
playName
,
int
newtickets
){
SQLiteDatabase
data
=
this
.
getWritableDatabase
();
ContentValues
cv
=
new
ContentValues
();
cv
.
put
(
"tickets"
,
newtickets
);
int
rows
=
data
.
update
(
"play"
,
cv
,
"playName=?"
,
new
String
[]{
playName
});
return
rows
>
0
;
}
public
List
<
String
>
currentbookings
()
{
public
List
<
String
>
currentbookings
()
{
List
<
String
>
findbookings
=
new
ArrayList
<>();
List
<
String
>
findbookings
=
new
ArrayList
<>();
SQLiteDatabase
data
=
this
.
getReadableDatabase
();
SQLiteDatabase
data
=
this
.
getReadableDatabase
();
...
@@ -114,6 +112,13 @@ public class Database extends SQLiteOpenHelper {
...
@@ -114,6 +112,13 @@ public class Database extends SQLiteOpenHelper {
record
.
close
();
record
.
close
();
return
0
;
return
0
;
}
}
public
boolean
ticketsupdate
(
String
playName
,
int
newtickets
){
SQLiteDatabase
data
=
this
.
getWritableDatabase
();
ContentValues
cv
=
new
ContentValues
();
cv
.
put
(
"tickets"
,
newtickets
);
int
rows
=
data
.
update
(
"play"
,
cv
,
"playName=?"
,
new
String
[]{
playName
});
return
rows
>
0
;
}
}
}
...
...
PlaysRUs2/app/src/main/java/com/example/playsrus/seating.java
View file @
8919500f
...
@@ -109,12 +109,6 @@ public class seating extends AppCompatActivity implements AdapterView.OnItemSele
...
@@ -109,12 +109,6 @@ public class seating extends AppCompatActivity implements AdapterView.OnItemSele
}
}
private
boolean
bookingdone
(
String
playName
,
int
noticket
)
{
boolean
storebooking
=
database
.
bookinginput
(
playName
,
Integer
.
parseInt
(
String
.
valueOf
(
noticket
)));
return
storebooking
;
}
@Override
@Override
public
void
onItemSelected
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
public
void
onItemSelected
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
...
...
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