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;
 }
        public List<JobApplication> GetJobApplicants(string jobid, string companyid)
        {
            List<JobApplication> applications = new List<JobApplication>();

            Business.ApplicationService.AppServiceClient appclient = new Business.ApplicationService.AppServiceClient();
            List<Business.ApplicationService.applicant> serviceapplicants = appclient.GetApplicantsinjob(System.Web.HttpContext.Current.Session["userid"].ToString(), companyid, jobid, "","applicant").ToList();

            foreach (Business.ApplicationService.applicant serviceapplicant in serviceapplicants)
            {
                JobApplication tempjobapplication = new JobApplication();
                tempjobapplication.applicationid = serviceapplicant.transactionid;

                portalcandidate tempcandidate = new portalcandidate();
                tempcandidate.id = serviceapplicant.candidateid;
                tempcandidate.resumeid = serviceapplicant.resumeid;
                if (tempcandidate.resumeid == "" || tempcandidate.resumeid == null)
                {

                    tempcandidate.resumeurl = "";
                }
                else
                {
                    try
                    {
                        AmazonFile af = new AmazonFile();
                        tempcandidate.resumeurl = af.GetFileUrl(serviceapplicant.resumeid, System.Web.HttpContext.Current.Session["usertoken"].ToString());
                    }
                    catch
                    {

                    }
                }

                tempcandidate.contactid = serviceapplicant.contactid;
                tempcandidate.data = serviceapplicant.data;

                tempjobapplication.candidate = tempcandidate;

                try
                {
                    tempjobapplication.applicationstatus = serviceapplicant.status.ToString();
                }
                catch
                {
                    tempjobapplication.applicationstatus = "0";
                }

                applications.Add(tempjobapplication);
            }
            return applications;
        }