-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInfo.cs
282 lines (262 loc) · 11.2 KB
/
Info.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
using Raven.DAO;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Raven
{
public partial class Info : Form
{
System.Windows.Forms.Form GetName = System.Windows.Forms.Application.OpenForms["SignUp"];
System.Windows.Forms.Form GetLackName = System.Windows.Forms.Application.OpenForms["SignIn"];
public Bunifu.Framework.UI.BunifuMaterialTextbox SetName { get { return this.name; } }
public Bunifu.Framework.UI.BunifuMaterialTextbox GetPhone { get { return this.phone; } }
#region Round Corner
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // width of ellipse
int nHeightEllipse // height of ellipse
);
public Info()
{
InitializeComponent();
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
/*tabControl1.DrawItem += new DrawItemEventHandler(tabControl1_DrawItem);
((Control)this.tabPage2).Enabled = false;*/
/*gender.Region = new Region(new Rectangle(3, 3, gender.Width - 3, gender.Height - 7));*/
pictureBox1.Hide();
pictureBox3.Hide();
gender.Properties.Items.Add("Male");
gender.Properties.Items.Add("Female");
gender.Properties.Items.Add("Other");
}
#endregion
#region Move Form
private bool dragging = false;
private Point dragCursorPoint;
private Point dragFormPoint;
private void Info_MouseUp(object sender, MouseEventArgs e)
{
dragging = false;
}
private void Info_MouseMove(object sender, MouseEventArgs e)
{
if (dragging)
{
Point dif = Point.Subtract(Cursor.Position, new Size(dragCursorPoint));
this.Location = Point.Add(dragFormPoint, new Size(dif));
}
}
private void Info_MouseDown(object sender, MouseEventArgs e)
{
dragging = true;
dragCursorPoint = Cursor.Position;
dragFormPoint = this.Location;
}
#endregion
private void pictureBox2_Click(object sender, EventArgs e) // Exit Form
{
var mss = MessageBox.Show("We're recognise that You have not completed filling out information yet \nIf you log out, you will need to enter your information for the first time\nDo you want exit", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (mss == DialogResult.Yes)
{
SignIn restore = new SignIn();
restore.Show();
this.Hide();
}
else
{
}
}
private void Info_Load(object sender, EventArgs e) // Load Form
{
// TODO: This line of code loads data into the 'onYourWeddingDayDataSet.Gender' table. You can move, or remove it, as needed.
}
private void bunifuMaterialTextbox5_OnValueChanged(object sender, EventArgs e) // Check Phone
{
int check;
if(phone.Text == string.Empty)
{
phone.LineIdleColor = Color.Gray;
phone.LineFocusedColor = Color.White;
}
else if (!int.TryParse(phone.Text, out check))
{
phone.LineFocusedColor = Color.Red;
phone.LineIdleColor = Color.Red;
}
else
{
phone.LineFocusedColor = Color.White;
phone.LineIdleColor = Color.Gray;
}
Regex reg = new Regex("^[0-9]+$");
if (string.IsNullOrEmpty(phone.Text))
{
pictureBox1.Hide();
}
else if (!reg.IsMatch(phone.Text))
{
pictureBox1.Show();
}
else
{
pictureBox1.Hide();
}
}
private void bunifuDatepicker1_onValueChanged(object sender, EventArgs e) // DateTimePick
{
}
private void bunifuMaterialTextbox4_OnValueChanged(object sender, EventArgs e) // Check ICM
{
Regex reg = new Regex("^[0-9]+$");
if (string.IsNullOrEmpty(ICM.Text))
{
pictureBox3.Hide();
}
else if (!reg.IsMatch(ICM.Text))
{
pictureBox3.Show();
}
else
{
pictureBox3.Hide();
}
}
#region Method
bool Update(string username , string Gender , string Phone , string address , string icm , DateTime DOB , string Des)
{
return AccountDAO.Instance.UpdateInfo(username , Gender , Phone , address , icm , DOB , Des );
}
#endregion
private void bunifuFlatButton1_Click(object sender, EventArgs e)
{
if (((SignUp)GetName) == null)
{
string username = ((SignIn)GetLackName).TextBox.Text;
string icm = ICM.Text;
string Gender = gender.Text;
string Phone = phone.Text;
string address = Address.Text;
DateTime DOB = birth.Value;
string Des = desc.Text;
if (string.IsNullOrEmpty(name.Text) || string.IsNullOrEmpty(ICM.Text) || string.IsNullOrEmpty(gender.Text) || string.IsNullOrEmpty(phone.Text) || string.IsNullOrEmpty(Address.Text) || string.IsNullOrEmpty(desc.Text) || birth.Value.Year >= 1998)
{
#region Check For missing
if (string.IsNullOrEmpty(name.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(ICM.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(gender.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(phone.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(Address.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(desc.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (birth.Value.Year > 1998)
{
MessageBox.Show("System Error Please recheck", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
#endregion
}
else
{
if (Update(username, Gender, Phone, address, icm, DOB, Des))
{
LastStep lastStep = new LastStep();
lastStep.Show();
this.Hide();
}
else
{
MessageBox.Show("Update failed. Something was wrong, please try again later");
}
}
}
else
{
string username = ((SignUp)GetName).SetMails.Text;
string icm = ICM.Text;
string Gender = gender.Text;
string Phone = phone.Text;
string address = Address.Text;
DateTime DOB = birth.Value;
string Des = desc.Text;
if (string.IsNullOrEmpty(name.Text) || string.IsNullOrEmpty(ICM.Text) || string.IsNullOrEmpty(gender.Text) || string.IsNullOrEmpty(phone.Text) || string.IsNullOrEmpty(Address.Text) || string.IsNullOrEmpty(desc.Text) || birth.Value.Year >= 1998)
{
#region Check For missing
if (string.IsNullOrEmpty(name.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(ICM.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(gender.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(phone.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(Address.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(desc.Text))
{
MessageBox.Show("Please fill in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (birth.Value.Year > 1998)
{
MessageBox.Show("System Error Please recheck", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
#endregion
}
else
{
if (Update(username, Gender, Phone, address, icm, DOB, Des))
{
LastStep lastStep = new LastStep();
lastStep.Show();
this.Hide();
}
else
{
MessageBox.Show("Update failed. Something was wrong, please try again later");
}
}
}
}
private void name_OnValueChanged(object sender, EventArgs e)
{
}
}
}