-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.cs
98 lines (84 loc) · 2.83 KB
/
signup.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace VBB
{
public partial class signup : Form
{
VBBDBDataContext v;
public signup()
{
InitializeComponent();
}
private void btnsignin_Click(object sender, EventArgs e)
{
if (tbname.Text == "")
{
MessageBox.Show("Name must be filled");
}
else if (tbpassword.Text == "")
{
MessageBox.Show("Password must be filled");
}
else if (tbdateofbirth.Text == "")
{
MessageBox.Show("Date of birth must be filled");
}
else if (tbbloodgroup.Text == "")
{
MessageBox.Show("Blood group must be filled");
}
else if (tblastdonationdate.Text == "")
{
MessageBox.Show("Last donation date must be filled");
}
else if (tbmobilenumber.Text == "")
{
MessageBox.Show("Mobile number must be filled");
}
else if (tbaddress.Text == "")
{
MessageBox.Show("Adress must be filled");
}
else
{
v = new VBBDBDataContext();
User u = new User();
u.Name = tbname.Text;
u.Password = tbpassword.Text;
u.DateOfBirth = Convert.ToDateTime(tbdateofbirth.Text);//dob
u.BloodGroup = tbbloodgroup.Text;
/* try
{
u.LastDonationDate = Convert.ToDateTime(tblastdonationdate.Text);
}
catch (Exception)
{
MessageBox.Show("Enter date in right format(ex:mm/dd/yyyy)");*/
u.LastDonationDate = Convert.ToDateTime(tblastdonationdate.Text);// last donation d
u.MobileNumber = Convert.ToInt32(tbmobilenumber.Text);
u.Address = tbaddress.Text;
v.Users.InsertOnSubmit(u);
try
{
v.SubmitChanges();
MessageBox.Show("Successfully registered!");
Close();
}
catch (Exception)
{
MessageBox.Show("Something went wrong, Try again!");
}
this.Hide();
Signin si = new Signin();
si.Show();
}
}
}
}