protected void BindDropDowns() { PRMS controller = new PRMS(); PostingDropDown.DataSource = controller.GetAllJobPostings(); PostingDropDown.DataTextField = "Description"; PostingDropDown.DataValueField = "JobPostingID"; PostingDropDown.Items.Insert(0, new ListItem("Select Job Posting...", "0")); PostingDropDown.DataBind(); Profession.DataSource = controller.GetProfessions(); Profession.DataTextField = "Description"; Profession.DataValueField = "ProfessionID"; Profession.Items.Insert(0, new ListItem("Select Profession...", "0")); Profession.DataBind(); Skillset.DataSource = controller.GetSkillsets(); Skillset.DataTextField = "Description"; Skillset.DataValueField = "SkillsetID"; Skillset.Items.Insert(0, new ListItem("Select Skillset...", "0")); Skillset.DataBind(); Region.DataSource = controller.GetRegions(); Region.DataTextField = "Description"; Region.DataValueField = "RegionID"; Region.Items.Insert(0, new ListItem("Select Region...", "0")); Region.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { PRMS controller = new PRMS(); // Get all job postings List<JobPosting> jobPostingsList = new List<JobPosting>(); jobPostingsList = controller.GetAllJobPostings(); // Table Headings TableHeaderRow tableHRow = new TableHeaderRow(); List<String> headerList = new List<String>() { "Company Name", "Job Description" }; foreach (string header in headerList) { TableHeaderCell tableHCell = new TableHeaderCell(); tableHCell.Text = header; tableHRow.Cells.Add(tableHCell); } JobPostingsTable.Rows.Add(tableHRow); // Table Rows TableRow aNewRow; int index = 0; foreach (var item in jobPostingsList) { aNewRow = new TableRow(); TableCell aNewCell = new TableCell(); aNewCell.Text = item.CompanyName; aNewRow.Cells.Add(aNewCell); aNewCell = new TableCell(); aNewCell.Text = item.Description; aNewRow.Cells.Add(aNewCell); JobPostingsTable.Rows.Add(aNewRow); index++; } }
protected void Page_Load(object sender, EventArgs e) { try { PRMS controller = new PRMS(); // Get all job postings List <JobPosting> jobPostingsList = new List <JobPosting>(); jobPostingsList = controller.GetAllJobPostings(); // Table Headings TableHeaderRow tableHRow = new TableHeaderRow(); List <String> headerList = new List <String>() { "JobPostingID", "CompanyName", "Description", "Assigned Candidates", "Modify" }; foreach (string header in headerList) { TableHeaderCell tableHCell = new TableHeaderCell(); tableHCell.Text = header; tableHRow.Cells.Add(tableHCell); } JobPostingsTable.Rows.Add(tableHRow); // Table Rows TableRow aNewRow; int index = 0; foreach (var item in jobPostingsList) { aNewRow = new TableRow(); TableCell aNewCell = new TableCell(); aNewCell.Text = item.JobPostingID.ToString(); aNewRow.Cells.Add(aNewCell); aNewCell = new TableCell(); aNewCell.Text = item.CompanyName; aNewRow.Cells.Add(aNewCell); aNewCell = new TableCell(); aNewCell.Text = item.Description; aNewRow.Cells.Add(aNewCell); aNewCell = new TableCell(); Button viewButton = new Button(); viewButton.ID = "ViewButton" + index; viewButton.Text = "View"; viewButton.CssClass = "btn btn-dark"; viewButton.Click += new EventHandler((obj, eArgs) => ViewButton_Click(obj, eArgs, item.JobPostingID, item.CompanyName, item.Description)); aNewCell.Controls.Add(viewButton); aNewRow.Cells.Add(aNewCell); aNewCell = new TableCell(); Button UpdateButton = new Button(); UpdateButton.ID = "Update" + index; UpdateButton.Text = "Update"; UpdateButton.CssClass = "btn btn-dark"; UpdateButton.Click += new EventHandler((obj, eArgs) => UpdateButton_Click(obj, eArgs, item.JobPostingID)); aNewCell.Controls.Add(UpdateButton); aNewRow.Cells.Add(aNewCell); JobPostingsTable.Rows.Add(aNewRow); index++; } } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(‘Error occurred while viewing job posting. Please contact customer support for assistance if this issue persists.’)", true); } }