-
Notifications
You must be signed in to change notification settings - Fork 0
/
Experience.cs
176 lines (162 loc) · 6.49 KB
/
Experience.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
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 Assignment_2
{
public partial class Experience : Form
{
private InputForm form_got;
public Education eduForm;
private int count_of_experience = 2;
private int MoveFactor = 1;
public List<string> Experiencecontent;
public Experience(InputForm form_got_i)
{
InitializeComponent();
this.form_got = form_got_i;
eduForm = new Education(form_got_i);
Experiencecontent=new List<string>();
}
private void button_Experienceadd_Click(object sender, EventArgs e)
{
TextBox textbox_company = new TextBox();
textbox_company.Text = "Enter Organization Name";
textbox_company.Name = "textbox_CompanyName " + count_of_experience;
TextBox textbox_startd = new TextBox();
textbox_startd.Text = "Enter Staring Date in (mm-yy) format";
textbox_startd.Name = "textboxExpstartDate " + count_of_experience;
TextBox textbox_endd = new TextBox();
textbox_endd.Text = "Enter Ending Date in (mm-yy) format";
textbox_endd.Name = "textboxExpendDate " + count_of_experience;
RichTextBox description = new RichTextBox();
description.Text = "Enter Experience Description (Max 65 words)";
description.Name = "rtb_JobDescription " + count_of_experience;
CopyTextBoxProperties(textBox_Organizationname, textbox_company);
CopyTextBoxProperties(textBox_startdate, textbox_startd);
CopyTextBoxProperties(textBox_enddate, textbox_endd);
CopyRichTextBoxProperties(richTextBox_description, description);
flp_experience.Controls.Add(textbox_company);
flp_experience.Controls.Add(textbox_startd);
flp_experience.Controls.Add(textbox_endd);
flp_experience.Controls.Add(description);
while (flp_experience.Bounds.IntersectsWith(button_back.Bounds))
{
System.Drawing.Point point_of_back_btn = new System.Drawing.Point(button_back.Location.X, button_back.Location.Y + MoveFactor);
System.Drawing.Point point_of_save_btn = new System.Drawing.Point(button_next.Location.X, button_next.Location.Y + MoveFactor);
button_back.Location = point_of_back_btn;
button_next.Location = point_of_save_btn;
}
count_of_experience++;
}
private void CopyTextBoxProperties(TextBox source, TextBox target)
{
target.Font = source.Font;
target.ForeColor = source.ForeColor;
target.BackColor = source.BackColor;
target.Size = source.Size;
target.Location = source.Location;
target.Padding = source.Padding;
target.Margin = source.Margin;
target.ReadOnly = source.ReadOnly;
target.ScrollBars = source.ScrollBars;
target.BorderStyle = source.BorderStyle;
target.TextAlign = source.TextAlign;
}
private void CopyRichTextBoxProperties(RichTextBox source, RichTextBox target)
{
target.Font = source.Font;
target.ForeColor = source.ForeColor;
target.BackColor = source.BackColor;
target.Size = source.Size;
target.Location = source.Location;
target.Padding = source.Padding;
target.Margin = source.Margin;
target.ReadOnly = source.ReadOnly;
target.ScrollBars = source.ScrollBars;
target.BorderStyle = source.BorderStyle;
}
private void button_back_Click(object sender, EventArgs e)
{
this.Hide();
this.Owner.Show();
}
private void Experience_FormClosed(object sender, FormClosedEventArgs e)
{
eduForm.Close();
this.Owner.Show();
}
private void button_next_Click(object sender, EventArgs e)
{
Experiencecontent.Clear();
foreach (var experience_flp in flp_experience.Controls)
{
if (experience_flp is TextBox textbox_exp)
{
if (!String.IsNullOrEmpty(textbox_exp.Text))
{
Experiencecontent.Add(textbox_exp.Text);
}
else
{
MessageBox.Show("Experience Fields can't be Null");
return;
}
}
else
{
if (experience_flp is RichTextBox rtbtextbox_exp)
{
if (!String.IsNullOrEmpty(rtbtextbox_exp.Text))
{
Experiencecontent.Add(rtbtextbox_exp.Text);
}
else
{
MessageBox.Show("Experience Fields can't be Null");
return;
}
}
}
}
form_got.Experienceandcommunityservice = Experiencecontent;
eduForm.Show(this);
this.Hide();
}
private void Form_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
if (MessageBox.Show("Are you sure you want to close!!!", "All data will be lost!!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
{
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
}
private void textBox_Organizationname_Click(object sender, EventArgs e)
{
textBox_Organizationname.Text = null;
}
private void textBox_startdate_Click(object sender, EventArgs e)
{
textBox_startdate.Text = null;
}
private void textBox_enddate_Click(object sender, EventArgs e)
{
textBox_enddate.Text = null;
}
private void richTextBox_description_Click(object sender, EventArgs e)
{
richTextBox_description.Text = null;
}
}
}