private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { if (PageHelper.isEmployer) { jobSeeker_Details = (JobSeeker_Details)listView1.SelectedItems[0].Tag; } else { employerJob = (EmployerJob)listView1.SelectedItems[0].Tag; } listView1.SelectedItems.Clear(); } else { return; } if (!getIndexWorker1.IsBusy) { getIndexWorker1.RunWorkerAsync(); } else { getIndexWorker1.CancelAsync(); } }
static async Task <JobSeeker_Details> GetSingleJobSeekerAsync(string path) { response = await client.GetAsync(path); if (response.IsSuccessStatusCode) { var tempSeeker = await response.Content.ReadAsStringAsync(); jobSeeker_details = JsonConvert.DeserializeObject <JobSeeker_Details>(tempSeeker); } return(jobSeeker_details); }
private void getAllSeekersWorker1_DoWork(object sender, DoWorkEventArgs e) { try { if (listView1.InvokeRequired) { listView1.Invoke((MethodInvoker) delegate() { listView1.Items.Clear(); listView1.Columns.Clear(); }); } EmployerApi.StartAsync("GETALL_JobSeekers"); List <JobSeeker_Details> jobSeeker_Details = new List <JobSeeker_Details>(); jobSeeker_Details = EmployerApi.GetAllJobSeekerList().Cast <JobSeeker_Details>().ToList(); var counter = 0; foreach (var listing in jobSeeker_Details) { if (listView1.InvokeRequired) { listView1.Invoke((MethodInvoker) delegate() { ListViewItem item = new ListViewItem(); item.Text = listing.LastName + ", " + listing.FirstName; item.Tag = listing; listView1.View = View.Tile; listView1.Columns.Add("", 100); listView1.HeaderStyle = ColumnHeaderStyle.None; listView1.FullRowSelect = true; listView1.Items.Add(item); listView1.Items[counter].SubItems.Add(listing.SkillSet); listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); counter++; }); } } } catch (Exception ex) { MessageBox.Show("Err: " + ex); } }
private void getIndexWorker1_DoWork(object sender, DoWorkEventArgs e) { try { if (PageHelper.isEmployer) { JobSeeker_Details jobSeeker = null; PageHelper.id = jobSeeker_Details.id; EmployerApi.StartAsync("GET_JobSeeker_Profile_w_Resume", PageHelper.id); jobSeeker = (JobSeeker_Details)EmployerApi.GetSingleSeeker(); PageHelper.globalTitle = jobSeeker.FirstName + ", " + jobSeeker.LastName; PageHelper.globalDescription = jobSeeker.Description; PageHelper.globalSkills = jobSeeker.SkillSet; } else { EmployerJob empJob = null; PageHelper.id = employerJob.ID; EmployerApi.StartAsync("GET", PageHelper.id); //todo change to EmployerJob empJob = (EmployerJob)EmployerApi.GetSingle(); PageHelper.globalTitle = empJob.JobTitle; PageHelper.globalDescription = empJob.Description; PageHelper.globalSkills = empJob.SkillSet; } PageHelper.pageReferrer = this.Name; ViewDetailsPartial viewDetails = new ViewDetailsPartial(); viewDetails.Text = (PageHelper.isEmployer) ? "Candidate" : "Job Details"; viewDetails.ShowDialog(); } catch (Exception ex) { MessageBox.Show("Err: Could not connect to server" + "==> " + ex); } }
/*** * id param can either be the "id" or "subid" * */ static async Task RunAsync(string requestType, int id = 1) { try { if (client.BaseAddress == null) { client.BaseAddress = new Uri("http://localhost:51781/"); } client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); var path = ""; switch (requestType) { case "GETALL": //get all jobs for employers only path = "api/values/GET/"; employerJobs = await GetEmpJobsAsync(path); break; case "GETALL_JobSeekers": //get specific path = "api/values/GetJobSeekers"; jobSeekers = await GetAllJobSeekerAsync(path); break; case "GETALL_PER_USER": path = "api/values/GetJobs_User/" + id; //create param id employerJobs = await GetAllJob_User(path); break; case "GET": //get specific path = "api/values/GET/" + id; //create param id employerJob = await GetSingleEmpJobAsync(path); break; case "GET_JobSeeker_Profile_w_Resume": path = "api/values/GetSeekerProfileRes/" + id; jobSeeker_details = await GetSingleJobSeekerAsync(path); break; case "GET_JobSeeker_Resume": path = "api/values/GetSeekerResume/" + id; jobSeeker_Resume = await GetSingleResumeAsync(path); break; case "POST_JOB": path = "api/values/PostJob"; isSuccess = await PostSingleEmpJobAsync(path, CreateJobPage.globalEmployerJob); // add jobs break; case "POST_RESUME": path = "api/values/PostRes"; isSuccess = await PostSingleEmpJobAsync(path, CreateJobPage.globalEmployerJob); // add jobs break; case "PUT_JOB": path = "api/values/PutJob"; isSuccess = await UpdateSingleEmpJob(path, ViewDetailsPartial.globalEmployerJob); // add jobs break; case "PUT_RES": path = "api/values/PutRes"; isSuccess = await UpdateSingleResume(path, ViewDetailsPartial.globalResume); // add jobs break; case "DELETE_JOB": path = "api/values/DeleteJob/" + id; // isSuccess = await DeleteSingleEmpJobAsync(path, PageHelper.id); // add jobs break; case "DELETE_RESUME": path = "api/values/DeleteRes/" + id; // isSuccess = await DeleteSingleEmpJobAsync(path, PageHelper.id); // add jobs break; } }catch (Exception e) { Console.WriteLine(e.ToString()); } }