-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchApplicants.aspx.cs
103 lines (92 loc) · 3.24 KB
/
SearchApplicants.aspx.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class SearchApplicants : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
LoginModule myLoginModule = new LoginModule();
myLoginModule.checkLoginStatus();
myLoginModule.checkPermission(0);
WelcomeLabel.Text = myLoginModule.getFirstName((String)Session["userID"]);
SearchByDropDownList.AutoPostBack = true;
JobTypeDropDownList.Visible = false;
JobTypeLabel.Visible = false;
if (SearchByDropDownList.SelectedValue.Equals("JobPosition"))
{
JobTypeDropDownList.Visible = true;
JobTypeLabel.Visible = true;
}
search();
}
protected void SearchButton_Click(object sender, EventArgs e)
{
search();
}
protected void GridViewRowCreated(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[0].Visible = false;
}
protected void search()
{
DataTable myDataTable = new DataTable();
String keyword = SearchByDropDownList.SelectedValue;
switch (keyword)
{
case "Name":
myDataTable = new SearchModule().searchApplicantsByName(KeywordBox.Text).Copy();
break;
case "ComputerLanguage":
myDataTable = new SearchModule().searchApplicantsByComputerLanguage(KeywordBox.Text).Copy();
break;
case "SoftSkill":
myDataTable = new SearchModule().searchApplicantsBySoftSkill(KeywordBox.Text).Copy();
break;
case "JobPosition":
if (!JobTypeDropDownList.SelectedValue.Equals("-1"))
{
myDataTable = new SearchModule().searchApplicantsByJob(KeywordBox.Text, JobTypeDropDownList.SelectedValue).Copy();
}
else
{
myDataTable = new SearchModule().searchApplicantsByJob(KeywordBox.Text).Copy();
}
break;
}
myDataTable.Columns.Add("Photo", typeof(String)).SetOrdinal(0);
ResultsGridView.DataSource = myDataTable;
ResultsGridView.DataBind();
if (myDataTable.Rows.Count <= 0)
{
MessageLabel.Text = "No results found.";
return;
}
else
{
MessageLabel.Text = "";
}
ResultsGridView.GridLines = GridLines.Horizontal;
foreach (GridViewRow row in ResultsGridView.Rows)
{
HyperLink hp = new HyperLink();
hp.Text = row.Cells[2].Text;
hp.NavigateUrl = "~/SearchCandidates.aspx?userId=" + row.Cells[1].Text;
row.Cells[2].Controls.Add(hp);
row.Cells[1].Controls.Clear();
Image img = new Image();
img.ImageUrl = "~/ShowPhoto.aspx?userId=" + row.Cells[1].Text;
img.Height = 60;
row.Cells[1].Controls.Add(img);
}
}
protected void Logout(object sender, EventArgs e)
{
Session["userID"] = null;
Session["prevPage"] = null;
Response.Redirect("~/WhereIsMyJob.aspx");
}
}