-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrary.java
More file actions
110 lines (102 loc) · 3.97 KB
/
Library.java
File metadata and controls
110 lines (102 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import java.sql.SQLException;
import java.util.Scanner;
public class Library
{
static final Scanner scan=new Scanner(System.in);
static String userName;
static String userEmail;
static String userPass;
public static void main(String [] args) throws SQLException
{
enterLibrary();
}
public static void enterLibrary() throws SQLException
{
System.out.println("WELCOME TO OUR LIBRARY\n");
System.out.println("New User? Press 1 to Register");
System.out.println("Existing User? Press 2 to Login\n");
int option=Integer.parseInt(scan.nextLine());
switch(option)
{
case 1:
{
System.out.println("Enter your Name");
userName=scan.nextLine();
System.out.println("Enter your Email Address");
userEmail=scan.nextLine();
System.out.println("Enter your Password");
userPass=scan.nextLine();
if(Databasehandler.registerUser(userName, userEmail, userPass))
UserLogs.DashBoard(userName,userEmail); // Name for display; Email for book order
else
{
System.out.println("Registration UnSuccessful..!!!\n\n");
enterLibrary();
}
break;
}
case 2:
{
System.out.println("Press 1 for Admin Login");
System.out.println("Press 2 for User Login");
System.out.println("Press 3 to Go Back");
int opt=Integer.parseInt(scan.nextLine());
switch (opt)
{
case 1:
{
System.out.println("Enter your Email Address");
userEmail=scan.nextLine();
System.out.println("Enter your Password");
userPass=scan.nextLine();
if(Databasehandler.CheckAdmin(userEmail, userPass)) {
System.out.println("WELCOME ADMIN):\n");
AdminLogs.DashBoard(userName, userEmail);
}
else
{
System.out.println("Invalid AdminEmail or AdminPassword.\n\n\t Thank You");
enterLibrary();
}
break;
}
case 2:
{
System.out.println("Enter your Email Address");
userEmail=scan.nextLine();
System.out.println("Enter your Password");
userPass=scan.nextLine();
if(Databasehandler.CheckUser(userEmail, userPass)) {
System.out.println("WELCOME USER):\n");
UserLogs.DashBoard(userName, userEmail);
}
else
{
System.out.println("Invalid UserEmail or UserPassword.\n\n\t Thank You");
enterLibrary();
}
break;
}
case 3:
{
enterLibrary();
break;
}
default:
{
System.out.println("Please Enter the Correct Number\n\n");
enterLibrary();
break;
}
}
break;
}
default:
{
System.out.println("Please Enter the Correct Number\n\n");
enterLibrary();
break;
}
}
}
}