-
Notifications
You must be signed in to change notification settings - Fork 0
/
createAccount.aspx.cs
182 lines (148 loc) · 6.01 KB
/
createAccount.aspx.cs
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
using System;
using HandicappedDriver.Bridge;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows;
namespace HandicappedDriver
{
public partial class createAccount : System.Web.UI.Page
{
protected DriverData driver;
protected int usrid_pg = 0;
protected void Page_Load(object sender, EventArgs e)
{
List<State> states = Facade.GetStates();
int len = states.Count;
//this.drpRegState.DataSource = states;
for(int i = 0; i < len; i++)
{
drpRegState.Items.Add(states[i].name.ToString());
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
//string fullName = txtName.Text;
string username = txtUserName.Text;
string phone = txtPhoneNumber.Text;
string stateID = drpRegState.SelectedValue;
string regNum = txtRegNumber.Text;
string pass = txtPass.Text;
//MessageBox.Show(stateID + " " + regNum);
bool isFound = username.Contains("@uco.edu");
if (!isFound)
{
username += "@uco.edu";
}
/*string info = "[{"+
"\"LicensePlateState_ID\":" + stateID + "," +
"\"EMail\":" + username + "," +
"\"Password\":" + pass + "," +
"\"MobileNum\":" + phone + "," +
"\"LicensePlate\":" + regNum + "," +
//"\"Name\":" + fullName +
"}]";*/
//Response.Write(info);
Bridge.DriverData dd = new DriverData();
dd.fullName = txtUserName.Text;
dd.mobileNumber = txtPhoneNumber.Text;
dd.password = txtPass.Text;
dd.licensePlateNum = regNum;
dd.licensePlateState = stateID;
//dd.licensePlateNum = "";
//dd.licensePlateState = "Oklahoma";
dd.eMailAddress = txtUserName.Text;
dd.Id = Facade.Login_GetID(dd.fullName, dd.password);
// returning boolean to check is update successful
bool r = Facade.UpdateDriverProfile(dd);
if (r)
{
Response.Redirect("loginPage.aspx");
}
else
{
string msg = "Something went wrong. Please try again.";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(msg);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
}
}
/*protected void btnLogin_Click(object sender, EventArgs e)
{
// Login
string usr = txtUserName.Text;
string pwd = txtPass.Text;
//Data validation goes here
int uid = Facade.Login_GetID(usr, pwd);
if (uid > 0)
{
driver = Facade.GetDriverFull(uid);
usrid_pg = (int)driver.Id;
// assuming userid_pg is the user id, go to home page
// write cookies
//HttpCookie user_ID_cookie = new HttpCookie("USER_ID");
//user_ID_cookie["USER_ID"] = usr;
//user_ID_cookie.Expires = DateTime.Now.AddHours(2);
//Response.Cookies.Add(user_ID_cookie);
Response.Redirect("homePage.aspx");
}
//Now do whatever
}*/
/*protected void btnForgotPass_Click(object sender, EventArgs e)
{
// Forgot password
string usr = txtUserName.Text;
//Data validation goes here
Facade.ForgotPassword(usr);
//Now do whatever
txtUserName.Text = usr;
txtUserName.ReadOnly = true;
btnSubmit_Click(sender, e);
}*/
/*protected void btnCreate_Click(object sender, EventArgs e)
{
//Data validation goes here
if (usrid_pg > 0)
{
//driver.fullName = txtName.Text;
driver.licensePlateNum = txtRegNumber.Text;
driver.password = txtPass.Text;
driver.mobileNumber = txtPhoneNumber.Text;
driver.licensePlateState = drpRegState.SelectedValue;
Facade.UpdateDriverProfile(driver);
string msg = "Your profile has been sucessfully created. Please start from login page.";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(msg);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
Response.Redirect("loginPage.aspx");
}
else
{
string msg = "You already have an existing profile. Please login with your credentials.";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(msg);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
Response.Redirect("loginPage.aspx");
}
//else - need to login first
//Now do whatever
}*/
}
}