-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplicantPersonalForm.aspx.cs
More file actions
331 lines (323 loc) · 15.5 KB
/
ApplicantPersonalForm.aspx.cs
File metadata and controls
331 lines (323 loc) · 15.5 KB
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CAPRES.ValueObjects;
using CAPRES.BusinessLogicObjects;
using System.Data;
namespace CAPRES
{
public partial class ApplicantPersonalForm : System.Web.UI.Page
{
#region ObjectInstantiation
private File1VO file1VO = new File1VO();
private File1BLO file1BLO = new File1BLO();
private NationalityVO nationalityVO = new NationalityVO();
private NationalityBLO nationalityBLO = new NationalityBLO();
private GenderVO genderVO = new GenderVO();
private GenderBLO genderBLO = new GenderBLO();
private CivilStatusVO civilStatusVO = new CivilStatusVO();
private CivilStatusBLO civilStatusBLO = new CivilStatusBLO();
private AffixVO affixVO = new AffixVO();
private AffixBLO affixBLO = new AffixBLO();
private ReligionVO religionVO = new ReligionVO();
private ReligionBLO religionBLO = new ReligionBLO();
private BloodTypeVO bloodTypeVO = new BloodTypeVO();
private BloodTypeBLO bloodTypeBLO = new BloodTypeBLO();
private CountryVO countryVO = new CountryVO();
private CountryBLO countryBLO = new CountryBLO();
#endregion
private int candidateId;
private string status;
protected void Page_PreInit(object sender, EventArgs e)
{
CheckApplicantLogin();
}
protected void Page_Load(object sender, EventArgs e)
{
if (candidateId > 0)
{
if (status.Equals("applicant") || status.Equals("pending"))
{
lblStep.Text = "Step 2 of 8 - Personal Information";
pnlFile1.Visible = false;
btnPrevious.Visible = true;
btnHome.Visible = false;
}
else if (status.Equals("preboarding"))
{
lblStep.Text = "Step 1 of 6 - Personal Information";
pnlFile1.Visible = true;
btnPrevious.Visible = false;
btnHome.Visible = true;
}
}
else
{
lblStep.Text = "Personal Information";
pnlFile1.Visible = true;
btnPrevious.Enabled = false;
btnHome.Enabled = false;
btnNext.Enabled = false;
}
if (!Page.IsPostBack)
{
DataBindItems();
FillControlsWithData();
}
}
private void CheckApplicantLogin()
{
List<string> list;
if (Session["Candidate"] != null || Request.Cookies["Candidate"] != null)
{
list = (List<string>)Session["Candidate"];
status = list == null
? Request.Cookies["Candidate"]["Status"] : list[1];
if (status.Equals("preboarding"))
{
candidateId = list == null
? int.Parse(Request.Cookies["Candidate"]["ID"].ToString())
: int.Parse(list[0].ToString());
Label lblHeader = this.Master.FindControl("lblHeader") as Label;
lblHeader.Text = "PRE-EMPLOYMENT REQUIREMENTS";
Label lblUser = this.Master.FindControl("lblUser") as Label;
lblUser.Text = "Hello Candidate #" + candidateId;
}
else if (status.Equals("hiring"))
{
Response.Redirect("HiringHome.aspx");
}
else if (status.Equals("applicant") || status.Equals("pending"))
{
candidateId = list == null
? int.Parse(Request.Cookies["Candidate"]["ID"].ToString())
: int.Parse(list[0].ToString());
Label lblHeader = this.Master.FindControl("lblHeader") as Label;
lblHeader.Text = "APPLICATION FOR EMPLOYMENT";
Label lblUser = this.Master.FindControl("lblUser") as Label;
lblUser.Text = "Hello Candidate #" + candidateId;
}
}
else if (Session["HR"] != null || Request.Cookies["HR"] != null)
{
list = (List<string>)Session["HR"];
string type = list == null
? Request.Cookies["HR"]["Type"] : list[1];
if (type.Equals("recruiter"))
{
Response.Redirect("RecruiterHome.aspx");
}
else if (type.Equals("preboarder"))
{
Response.Redirect("PreboarderHome.aspx");
}
else if (type.Equals("datamanager"))
{
Response.Redirect("DataManagerHome.aspx");
}
else if (type.Equals("admin"))
{
this.MasterPageFile = "SmartStartAdmin.master";
string hrEmail = list == null
? Request.Cookies["HR"]["Email"] : list[0];
Label lblHeader = this.Master.Master.FindControl("lblHeader") as Label;
lblHeader.Text = "APPLICATION FOR EMPLOYMENT";
Label lblUser = this.Master.Master.FindControl("lblUser") as Label;
lblUser.Text = hrEmail;
}
}
else
{
Response.Redirect("index.aspx");
}
}
private void DataBindItems()
{
ddlNationality.DataSource = nationalityBLO.SelectAllNationality();
ddlNationality.DataValueField = "nationality_code";
ddlNationality.DataTextField = "nationality";
ddlNationality.DataBind();
ddlGender.DataSource = genderBLO.SelectAllGender();
ddlGender.DataValueField = "gender_code";
ddlGender.DataTextField = "gender";
ddlGender.DataBind();
ddlCivilStatus.DataSource = civilStatusBLO.SelectAllCivilStatus();
ddlCivilStatus.DataValueField = "civil_status_code";
ddlCivilStatus.DataTextField = "civil_status";
ddlCivilStatus.DataBind();
ddlAffix.DataSource = affixBLO.SelectAllAffix();
ddlAffix.DataValueField = "affix_code";
ddlAffix.DataTextField = "affix";
ddlAffix.DataBind();
ddlReligion.DataSource = religionBLO.SelectAllReligion();
ddlReligion.DataValueField = "religion_code";
ddlReligion.DataTextField = "religion";
ddlReligion.DataBind();
ddlBloodType.DataSource = bloodTypeBLO.SelectAllBloodType();
ddlBloodType.DataValueField = "blood_type";
ddlBloodType.DataTextField = "blood_type";
ddlBloodType.DataBind();
ddlPresentCountry.DataSource = countryBLO.SelectAllCountry();
ddlPresentCountry.DataValueField = "country_code";
ddlPresentCountry.DataTextField = "country";
ddlPresentCountry.DataBind();
ddlPermanentCountry.DataSource = countryBLO.SelectAllCountry();
ddlPermanentCountry.DataValueField = "country_code";
ddlPermanentCountry.DataTextField = "country";
ddlPermanentCountry.DataBind();
ddlProvincialCountry.DataSource = countryBLO.SelectAllCountry();
ddlProvincialCountry.DataValueField = "country_code";
ddlProvincialCountry.DataTextField = "country";
ddlProvincialCountry.DataBind();
}
private void FillControlsWithData()
{
if (candidateId > 0)
{
file1VO = file1BLO.SelectFile1OfCandidate(candidateId);
if (file1VO != null)
{
hidFile1ID.Value = file1VO.File1Id.ToString();
txtFirstName.Text = file1VO.FirstName;
txtLastName.Text = file1VO.LastName;
txtNickName.Text = file1VO.NickName;
txtMiddleName.Text = file1VO.MiddleName;
txtDateOfBirth.Text = DateTime.Parse(file1VO.DateOfBirth).ToString("yyyy-MM-dd");
txtPlaceOfBirth.Text = file1VO.PlaceOfBirth;
ddlNationality.SelectedValue = file1VO.Nationality;
ddlGender.SelectedValue = file1VO.Gender;
ddlCivilStatus.SelectedValue = file1VO.CivilStatus;
if (!ddlCivilStatus.SelectedValue.Equals("0"))
{
pnlCivilStatusDate.Visible = true;
}
else
{
pnlCivilStatusDate.Visible = false;
}
if (file1VO.CivilStatusDate != "")
{
txtCivilStatusDate.Text =
DateTime.Parse(file1VO.CivilStatusDate).ToString("yyyy-MM-dd");
}
ddlAffix.SelectedValue = file1VO.Affix;
ddlReligion.SelectedValue = file1VO.Religion;
if (file1VO.Height != "")
{
txtHeightFeet.Text = file1VO.Height.Substring(0, 1);
txtHeightInches.Text = file1VO.Height.Substring(1);
}
txtWeight.Text = file1VO.Weight;
ddlBloodType.SelectedValue = file1VO.BloodType;
txtSSS.Text = file1VO.SSS;
txtTIN.Text = file1VO.TIN;
txtPresentAddress.Text = file1VO.PresentAddress;
txtPresentCity.Text = file1VO.PresentCity;
txtPresentDistrict.Text = file1VO.PresentDistrict;
ddlPresentCountry.SelectedValue = file1VO.PresentCountry;
txtPresentTelephoneHome.Text = file1VO.PresentTelephoneHome;
txtPresentTelephoneAdditional.Text = file1VO.PresentTelephoneAdditional;
txtPresentMobileNumber.Text = file1VO.PresentTelephoneMobile;
txtPresentFax.Text = file1VO.PresentFax;
txtPermanentAddress.Text = file1VO.PermanentAddress;
txtPermanentCity.Text = file1VO.PermanentCity;
txtPermanentDistrict.Text = file1VO.PermanentDistrict;
ddlPermanentCountry.SelectedValue = file1VO.PermanentCountry;
txtProvincialAddress.Text = file1VO.ProvincialAddress;
txtProvincialCity.Text = file1VO.ProvincialCity;
txtProvincialDistrict.Text = file1VO.ProvincialDistrict;
ddlProvincialCountry.SelectedValue = file1VO.ProvincialCountry;
txtProvincialTelephone.Text = file1VO.ProvincialTelephone;
}
}
}
protected void ddlCivilStatus_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlCivilStatus.SelectedValue != "0")
{
pnlCivilStatusDate.Visible = true;
}
else
{
pnlCivilStatusDate.Visible = false;
}
}
protected void btnPrevious_Click(object sender, EventArgs e)
{
Response.Redirect("ApplicantAFE.aspx");
}
protected void btnHome_Click(object sender, EventArgs e)
{
Response.Redirect("PreboardingHome.aspx");
}
protected void btnNext_Click(object sender, EventArgs e)
{
string firstName = txtFirstName.Text.Trim();
string lastName = txtLastName.Text.Trim();
string nickName = txtNickName.Text.Trim();
string middleName = txtMiddleName.Text.Trim();
string dateOfBirth = txtDateOfBirth.Text.Trim();
string placeOfBirth = txtPlaceOfBirth.Text.Trim();
string nationality = ddlNationality.SelectedValue;
string gender = ddlGender.SelectedValue;
string civilStatus = ddlCivilStatus.SelectedValue;
string civilStatusDate = txtCivilStatusDate.Text.Trim();
string affix = ddlAffix.SelectedValue;
string religion = ddlReligion.SelectedValue;
string height = txtHeightFeet.Text.Trim() + txtHeightInches.Text.Trim();
string weight = txtWeight.Text.Trim();
string bloodType = ddlBloodType.SelectedValue;
string sss = txtSSS.Text.Trim();
string tin = txtTIN.Text.Trim();
string presentAddress = txtPresentAddress.Text.Trim();
string presentCity = txtPresentCity.Text.Trim();
string presentDistrict = txtPresentDistrict.Text.Trim();
string presentCountry = ddlPresentCountry.SelectedValue;
string presentTelephoneHome = txtPresentTelephoneHome.Text.Trim();
string presentTelephoneAdditional = txtPresentTelephoneAdditional.Text.Trim();
string presentTelephoneMobile = txtPresentMobileNumber.Text.Trim();
string presentFax = txtPresentFax.Text.Trim();
string permanentAddress = txtPermanentAddress.Text.Trim();
string permanentCity = txtPermanentCity.Text.Trim();
string permanentDistrict = txtPermanentDistrict.Text.Trim();
string permanentCountry = ddlPermanentCountry.SelectedValue;
string provincialAddress = txtProvincialAddress.Text.Trim();
string provincialCity = txtProvincialCity.Text.Trim();
string provincialDistrict = txtProvincialDistrict.Text.Trim();
string provincialCountry = ddlProvincialCountry.SelectedValue;
string provincialTelephone = txtProvincialTelephone.Text.Trim();
if (hidFile1ID.Value == "")
{
file1BLO.InsertFile1(candidateId, status, firstName, lastName, nickName, middleName,
dateOfBirth, placeOfBirth, nationality, gender, civilStatus, civilStatusDate,
affix, religion, height, weight, bloodType, sss, tin, presentAddress, presentCity,
presentDistrict, presentCountry, presentTelephoneHome, presentTelephoneAdditional,
presentTelephoneMobile, presentFax, permanentAddress, permanentCity,
permanentDistrict, permanentCountry, provincialAddress, provincialCity,
provincialDistrict, provincialCountry, provincialTelephone);
}
else
{
file1BLO.UpdateFile1(int.Parse(hidFile1ID.Value), firstName,
lastName, nickName, middleName, dateOfBirth, placeOfBirth, nationality,
gender, civilStatus, civilStatusDate, affix, religion, height, weight,
bloodType, sss, tin, presentAddress, presentCity, presentDistrict, presentCountry,
presentTelephoneHome, presentTelephoneAdditional, presentTelephoneMobile, presentFax,
permanentAddress, permanentCity, permanentDistrict, permanentCountry,
provincialAddress, provincialCity, provincialDistrict, provincialCountry,
provincialTelephone);
}
if (status.Equals("preboarding"))
{
Response.Redirect("ApplicantEducationalForm.aspx");
}
else
{
Response.Redirect("ApplicantFamilyForm.aspx");
}
}
}
}