Exemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var dialogResult = MessageBox.Show("Update changes?", "Job Update", MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.OK)
            {
                if (PageHelper.isEmployer)
                {
                    globalEmployerJob = new EmployerJob {
                        ID          = PageHelper.id,
                        SubID       = PageHelper.subId,
                        Description = tbJobDescription.Text == null ? "" : tbJobDescription.Text,
                        JobTitle    = tbTitle.Text == null ? "" : tbTitle.Text,
                        SkillSet    = PageHelper.globalSkills //before updating this make sure to make skills design updatable
                    };

                    updateJobWorker1.RunWorkerAsync();
                }
                else
                {
                    globalResume = new JobSeeker_Resume
                    {
                        ID          = PageHelper.resumeId,
                        SubID       = PageHelper.resumeSubId,
                        Description = tbJobDescription.Text == null ? "" : tbJobDescription.Text,
                        SkillSet    = PageHelper.resumeSkills //before updating this make sure to make skills design updatable
                    };

                    updateJobWorker1.RunWorkerAsync();
                }
            }
        }
Exemplo n.º 2
0
        static async Task <JobSeeker_Resume> GetSingleResumeAsync(string path)
        {
            response = await client.GetAsync(path);

            if (response.IsSuccessStatusCode)
            {
                var tempResume = await response.Content.ReadAsStringAsync();

                jobSeeker_Resume = JsonConvert.DeserializeObject <JobSeeker_Resume>(tempResume);
            }

            return(jobSeeker_Resume);
        }
Exemplo n.º 3
0
        /***
         * 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());
            }
        }
Exemplo n.º 4
0
        static async Task <Boolean> UpdateSingleResume(string path, JobSeeker_Resume resume)
        {
            response = await client.PutAsJsonAsync(path, resume);

            return(response.IsSuccessStatusCode);
        }