-
Notifications
You must be signed in to change notification settings - Fork 1
/
CustomerInformation.cs
69 lines (61 loc) · 1.87 KB
/
CustomerInformation.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using testProj.Models;
namespace testProj
{
public partial class CustomerInformation : MetroFramework.Forms.MetroForm
{
LoginUser loggedUser;
public CustomerInformation(LoginUser _loggedUser)
{
InitializeComponent();
loggedUser = _loggedUser;
}
private void CustomerInformation_Load(object sender, EventArgs e)
{
}
private void metroButton1_Click(object sender, EventArgs e)
{
lblValidName.Visible = false;
lblValidEmail.Visible = false;
lblValidPhone.Visible = false;
if (PhoneChecked() && EmailChecked() && txtName.Text != "")
{
Reservation reservForm = new Reservation(loggedUser, txtName.Text);
this.Hide();
reservForm.ShowDialog();
this.Close();
}
else if (txtName.Text == "")
{
lblValidName.Visible = true;
}
else if (!PhoneChecked())
{
lblValidPhone.Visible = true;
}
else if (!EmailChecked())
{
lblValidEmail.Visible = true;
}
}
private bool PhoneChecked()
{
Regex regexPhone = new Regex("^01[0|1|2|5][0-9]{8}$");
return regexPhone.IsMatch(txtPhone.Text);
}
private bool EmailChecked()
{
Regex regexMail = new Regex(@"^([a-z|A-Z|0-9]+)\@[a-z|A-Z]{3,}\.([a-z|A-Z]){3,}\.*([a-z|A-Z])*$");
return regexMail.IsMatch(txtEmail.Text);
}
}
}