private void skillUpdateBtn_Click(object sender, EventArgs e) { List <DbJob> jobs = new List <DbJob>(); jobs.Add(job); if (deletedSkills.Count > 0) { if (service.UpdateDeletedJobSkill(jobs, deletedSkills)) { BindingList <string> skills = new BindingList <string>(service.GetJobSkills(job.JobId).ToList()); mForm.editSkillListBox.DataSource = skills; mForm.fillMyJobsDataGrid(); this.Close(); } } if (newlyAddedSkills.Count > 0) { if (service.UpdateAddedJobSkill(jobs, newlyAddedSkills)) { BindingList <string> skills = new BindingList <string>(service.GetJobSkills(job.JobId).ToList()); mForm.editSkillListBox.DataSource = skills; mForm.tabControl1.Refresh(); this.Close(); } } else { editSkillErrorLbl.Text = "updating job skills failed."; editSkillErrorLbl.Visible = true; } }
protected void gvRecentJobs_SelectedIndexChanged(object sender, EventArgs e) { favJobs = service.GetListOfFavJobs(new DbJob(), Guid.Parse(Session["sessionid"].ToString())); GridViewRow row = gvFavJobs.SelectedRow; dt2 = ToDataTable <DbJob>(favJobs.ToList()); DataRow dRow = dt2.Rows[row.RowIndex]; Session["jobId"] = (int)dRow["JobId"]; pnlSelectJob.Visible = true; List <string> skills = new List <string>(); skills = service.GetJobSkills((int)dRow["JobId"]).ToList(); Session["Skills"] = skills; Session["AccMan"] = service.GetOneUser((int)dRow["UserId"]); int rowCount = gvFavJobs.SelectedIndex; lblStatus.Text = row.Cells[6].Text; lblStream.Text = row.Cells[5].Text; lblLocation.Text = row.Cells[4].Text; lblCompany.Text = row.Cells[3].Text; lblTitle.Text = row.Cells[2].Text; lblDescription.Text = dRow["Description"].ToString(); lblDateposted.Text = row.Cells[1].Text; lblDeadline.Text = row.Cells[7].Text; lblAccMan.Text = Session["AccMan"].ToString(); blSkills.DataSource = Session["Skills"]; blSkills.DataBind(); lblMsg.Visible = false; pnlSelectJob.Visible = true; lblMsg.Visible = false; jobId = int.Parse(Session["jobId"].ToString()); lbtnAddComment.Visible = true; BindCommentData(jobId); if (service.ViewComments(jobId).ToList().Count == 0) { lblSuccess.Text = "There are currently no comments for this post"; cmntTimer.Enabled = false; } cmntTimer.Enabled = true; }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { BindingList <string> skills = new BindingList <string>(); string jobTitle = myJobsGridView.Rows[e.RowIndex].Cells["Title"].Value.ToString(); //Checking if view is clicked if (e.ColumnIndex == 0) { //Hiding the editPanel and find the title of the job selected editPanel.Visible = false; hiddenLbl.Visible = false; //Finding all the information about the selected job and initialsing the correspondent txtBoxes for (int i = 0; i < myFullJobsList.Count; i++) { if (jobTitle == myFullJobsList[i].Title) { skills = new BindingList <string>(service.GetJobSkills(myFullJobsList[i].JobId).ToList()); listViewSkills.DataSource = skills; txtBoxStream.Text = myFullJobsList[i].Stream; txtBoxStatus.Text = myFullJobsList[i].Status; txtBoxLoc.Text = myFullJobsList[i].Location; txtBoxDeadline.Text = myFullJobsList[i].Deadline.ToString(); txtBoxDatePosted.Text = myFullJobsList[i].DatePosted.ToString(); txtBoxDesc.Text = myFullJobsList[i].Description; txtBoxCompany.Text = myFullJobsList[i].Company; txtBoxTitle.Text = jobTitle; jobId = myFullJobsList[i].JobId; } } //show the description of selected job panelDescription.Visible = true; //MessageBox.Show((e.RowIndex + 1) + " Row " + (e.ColumnIndex + 1) + " Column button clicked "); } //Otherwise Check if the selected column is edit column else if (e.ColumnIndex == 1) { panelDescription.Hide(); hiddenLbl.Visible = false; for (int i = 0; i < myFullJobsList.Count; i++) { if (jobTitle == myFullJobsList[i].Title) { skills = new BindingList <string>(service.GetJobSkills(myFullJobsList[i].JobId).ToList()); editSkillListBox.DataSource = skills; streamComBox.DataSource = service.GetStreams(); streamComBox.SelectedItem = myFullJobsList[i].Stream; statusComBox.DataSource = service.GetStatuses(); statusComBox.SelectedItem = myFullJobsList[i].Status; editLocTxtBox.Text = myFullJobsList[i].Location; editDPTxtBox.Text = myFullJobsList[i].Deadline.ToString(); txtBoxDatePosted.Text = myFullJobsList[i].DatePosted.ToString(); editDescTxtBox.Text = myFullJobsList[i].Description; editCompTxtBox.Text = myFullJobsList[i].Company; editTitleTxtBox.Text = jobTitle; deadLinePicker.Value = myFullJobsList[i].Deadline; editJob.JobId = myFullJobsList[i].JobId; hiddenLbl.Text = jobTitle; } } editPanel.Size = panelDescription.Size; editPanel.Location = panelDescription.Location; panelDescription.Visible = false; editPanel.Visible = true; } //Otherwise Check if the selected column is delete column else if (e.ColumnIndex == 2) { if (MessageBox.Show("Are you sure You want to delete this job?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { for (int i = 0; i < myFullJobsList.Count; i++) { if (jobTitle == myFullJobsList[i].Title) { DbJob job = new DbJob(); job.JobId = myFullJobsList[i].JobId; List <DbJob> jobs = new List <DbJob>(); jobs.Add(job); if (service.DeleteJob(jobs, 1)) { editPanel.Hide(); panelDescription.Hide(); fillMyJobsDataGrid(); hiddenLbl.ForeColor = Color.Green; hiddenLbl.Text = "Job successfully deleted. "; hiddenLbl.Visible = true; } else { hiddenLbl.Text = "Job delete unsuccessful. "; hiddenLbl.ForeColor = Color.Red; hiddenLbl.Visible = true; } } } } else { // user clicked no } } }