-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmEditAccount.cs
104 lines (94 loc) · 2.93 KB
/
frmEditAccount.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
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;
using System.Text.RegularExpressions;
namespace Bank_Cashier
{
public partial class frmEditAccount : Form
{
public frmEditAccount()
{
InitializeComponent();
}
private void btnEditAcount_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtName.Text))
{
lblError.Text = "Name is Required";
return;
}
if (string.IsNullOrEmpty(txtEmail.Text))
{
lblError.Text = "Email is Required";
return;
}
Regex rgxEmail = new Regex(@"^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)$");
if (!rgxEmail.IsMatch(txtEmail.Text))
{
lblError.Text = "Please Write a valid Email";
return;
}
if (string.IsNullOrEmpty(txtBalance.Text))
{
lblError.Text = "Balance is Required";
return;
}
Regex rgxBalane = new Regex(@"^[\d]+[\.]?[\d]?$");
if (!rgxBalane.IsMatch(txtBalance.Text))
{
lblError.Text = "Please write a valid balance ";
return;
}
if (!rbtnChecking.Checked && !rbtnSaving.Checked)
{
lblError.Text = "Please choose the account type";
return;
}
if (lblFees.Visible && txtFees.Visible)
{
if (string.IsNullOrEmpty(txtFees.Text))
{
lblError.Text = "Fees is Required";
return;
}
else if (!rgxBalane.IsMatch(txtFees.Text))
{
lblError.Text = "Please write a vaild Fees";
return;
}
else lblError.Text = String.Empty;
}
lblError.Text = String.Empty;
DialogResult = DialogResult.OK;
}
private void btnClose_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
this.Close();
}
private void frmEditAccount_Load(object sender, EventArgs e)
{
lblError.Text = String.Empty;
}
private void Type_Checked(object sender, EventArgs e)
{
var radio = (RadioButton)sender;
if (radio.Name.Equals("rbtnSaving"))
{
lblFees.Visible = false;
txtFees.Visible = false;
}
else if (radio.Name.Equals("rbtnChecking"))
{
lblFees.Visible = true;
txtFees.Visible = true;
}
}
}
}