-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewEmployersJobPositions.aspx.cs
78 lines (63 loc) · 2.44 KB
/
ViewEmployersJobPositions.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
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 ViewEmployersJobPositions : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
LoginModule myLoginModule = new LoginModule();
myLoginModule.checkLoginStatus();
myLoginModule.checkPermission(1);
WelcomeLabel.Text = myLoginModule.getFirstName((String)Session["userID"]);
setTable();
}
protected void setTable()
{
DataTable myDataTable = new DataTable();
JobsModule myJobsModule = new JobsModule();
myJobsModule.setUserId((String)Session["userId"]);
myDataTable = myJobsModule.getEmployersJobPositions().Copy();
myDataTable.Columns.Add("Delete", typeof(String)).SetOrdinal(0);
myDataTable.Columns.Add("List of Applied Applicants", typeof(String)).SetOrdinal(4);
JobPositionsGridView.DataSource = myDataTable;
JobPositionsGridView.DataBind();
foreach (GridViewRow row in JobPositionsGridView.Rows)
{
LinkButton lb = new LinkButton();
lb.Text = "Delete";
lb.Click += new EventHandler(LinkButtonClicked);
row.Cells[0].Controls.Add(lb);
HyperLink hp = new HyperLink();
hp.Text = row.Cells[2].Text;
hp.NavigateUrl = "~/ShowJobPositionsManager.aspx?pId=" + row.Cells[1].Text;
row.Cells[2].Controls.Add(hp);
HyperLink hp2 = new HyperLink();
hp2.Text = "Show Applied Applicants";
hp2.NavigateUrl = "~/ListOfAppliedApplicants.aspx?pId=" + row.Cells[1].Text;
row.Cells[4].Controls.Add(hp2);
}
}
void LinkButtonClicked(object sender, EventArgs e)
{
LinkButton src = (LinkButton)sender;
JobsModule myJobsModule = new JobsModule();
myJobsModule.setUserId((String)Session["userId"]);
GridViewRow row = (GridViewRow)src.NamingContainer;
myJobsModule.deleteJobPosition(row.Cells[1].Text);
Response.Redirect(Request.RawUrl);
}
protected void GridViewRowCreated(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[1].Visible = false;
}
protected void Logout(object sender, EventArgs e)
{
Session["userID"] = null;
Session["prevPage"] = null;
Response.Redirect("~/WhereIsMyJob.aspx");
}
}