public ActionResult AddApplicant(JObApplicationdata jobapplication, HttpPostedFileBase file) { string applicationid = ""; string candidateid = Guid.NewGuid().ToString().Replace("-", ""); Business.ApplicationService.AppServiceClient bd = new Business.ApplicationService.AppServiceClient(); Business.CoreService.MyFile fileuploaded = new Business.CoreService.MyFile(); Business.CoreService.IobjectServicesWebappVer2Client coreclient = new Business.CoreService.IobjectServicesWebappVer2Client(); string customtoken = coreclient.Login("*****@*****.**", "password", ""); AmazonFile af = new AmazonFile(); fileuploaded = af.WriteFile(Request.Files[0].FileName, Request.Files[0].InputStream, candidateid, customtoken); coreclient.AddRelation(candidateid, fileuploaded.Id, "resume", customtoken); IList document = af.GetResourceTokens(null, candidateid, "resume", customtoken); string contentid = ""; contentid = ((Business.CoreService.ResourceToken)document[0]).ContentId; string fileurl = af.GetFileUrl(contentid, customtoken); Business.ApplicantActions objApplicantActions = new ApplicantActions(); try { applicationid = objApplicantActions.AddApplicant(Session["userid"].ToString(), Session["companyid"].ToString(), jobapplication.jobid, candidateid, "", contentid, "", jobapplication.data); } catch { applicationid = objApplicantActions.AddApplicant(candidateid, jobapplication.companyid, jobapplication.jobid, candidateid, "", contentid, "", jobapplication.data); } return Redirect(Request.UrlReferrer.ToString()); }
public JobPosting GetJobPosting(string jobid, string companyid, string accesstoken) { JobPosting appliedjob = new JobPosting(); List<Job> jobinfo = new Job().getJobDetailsByJobId(jobid, companyid); appliedjob.postedjob = jobinfo[0]; List<JobApplication> applications = new List<JobApplication>(); Business.ApplicantActions ObjApplicantActions = new ApplicantActions(); List<Business.ApplicationService.applicant> candidatesCollection = ObjApplicantActions.GetApplicantsinjob(System.Web.HttpContext.Current.Session["userid"].ToString(), companyid, jobid,"applicant"); foreach (Business.ApplicationService.applicant dr in candidatesCollection) { JobApplication tempjobapplication = new JobApplication(); tempjobapplication.applicationid = dr.transactionid.ToString(); portalcandidate tempcandidate = new portalcandidate(); tempcandidate.id = dr.candidateid.ToString(); tempcandidate.resumeid = dr.resumeid.ToString(); if (tempcandidate.resumeid == "" || tempcandidate.resumeid == null) { tempcandidate.resumeurl = ""; } else { AmazonFile af = new AmazonFile(); tempcandidate.resumeurl = af.GetFileUrl(dr.resumeid.ToString(), accesstoken); } tempcandidate.contactid = dr.contactid.ToString(); tempcandidate.data = dr.data.ToString(); tempjobapplication.candidate = tempcandidate; tempjobapplication.appliedon = dr.createddate.ToString(); try { tempjobapplication.applicationstatus = dr.status.ToString(); } catch { tempjobapplication.applicationstatus = "0"; } applications.Add(tempjobapplication); } appliedjob.applications = applications; return appliedjob; }