-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegistrationAsReceptionist.cs
70 lines (62 loc) · 1.97 KB
/
RegistrationAsReceptionist.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Bus_Reservation_System
{
public partial class RegistrationAsReceptionist : Form
{
Database db = Database.GetInstance();
public RegistrationAsReceptionist()
{
InitializeComponent();
}
private void btn_Register_Click(object sender, EventArgs e)
{
DateOnly date = DateOnly.Parse(calender_Dob.SelectionRange.Start.ToShortDateString(), CultureInfo.InvariantCulture);
if (txt_ConfPass.Text != txt_pass.Text)
{
MessageBox.Show("Password mismatch!");
txt_name.Clear();
txt_Contact.Clear();
txt_pass.Clear();
txt_ConfPass.Clear();
}
else
{
try
{
//create a receptionist object
Receptionist receptionist = new Receptionist(txt_name.Text, txt_Contact.Text, date, Encryption.EncryptPassword(txt_pass.Text));
if (db.newReceptionist(receptionist))
{
this.Hide();
new Form1().Show();
}
else
{
txt_name.Clear();
txt_Contact.Clear();
txt_pass.Clear();
txt_ConfPass.Clear();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Hide();
new Form1().Show();
}
}
}