/
Registration.aspx.cs
73 lines (59 loc) · 1.83 KB
/
Registration.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Registration : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//hide the linkbutton
if (!IsPostBack)
LinkButton1.Visible = false;
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
//get the passcode
PasscodeGenerator pg = new PasscodeGenerator();
int passcode = pg.GetPasscode();
//initialize customer and vehicle
Customer c = new Customer();
Vehicle v = new Vehicle();
//initialize PasswordHash
PasswordHash ph = new PasswordHash();
//Assign the values from the textboxes
//to the classes
c.LastName = txtLastName.Text;
c.FirstName = txtFirstName.Text;
c.email = txtEmail.Text;
c.password = txtPassword.Text;
c.passcode = passcode;
//get the hashed password
c.PasswordHash = ph.Hashit(txtPassword.Text, passcode.ToString());
c.apartment = txtApt.Text;
c.state = txtState.Text;
c.street = txtStreet.Text;
c.zip = txtZip.Text;
c.city = txtCity.Text;
c.phone = txtPhone.Text;
// v.License = txtLicense.Text;
//v.Make = txtMake.Text;
// v.Year = txtYear.Text;
try
{
//try to write to the database
Registrations r = new Registrations(c);
lblResult.Text = "Thank you for registering";
LinkButton1.Visible = true;
}
catch (Exception ex)
{
//if it fails show the error
lblError.Text = ex.ToString();
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
}
}