Esempio n. 1
0
        // GET: /TMSVacancyCompetency/
        public ActionResult Index(ApplicantCompetencyPDfViewModel dataModel)
        {
            var ApplicantDetails = _AdminTMSMethod.getApplicantDetailsById(dataModel.ApplicantId);

            dataModel.FirstName = ApplicantDetails.FirstName;
            dataModel.LastName  = ApplicantDetails.LastName;
            var vacancyDetails = _AdminTMSMethod.getVacancyDetailsById(dataModel.VacancyId);

            dataModel.VacancyName = vacancyDetails.Title;

            var competency = JsonConvert.DeserializeObject <List <TMSSettingCompetencyDetails> >(ApplicantDetails.CompatencyJSV);

            if (competency.Count > 0)
            {
                foreach (var c in competency)
                {
                    TMSSettingCompetencyDetails cc = new TMSSettingCompetencyDetails();
                    cc.Id             = c.Id;
                    cc.CompetencyName = c.CompetencyName;
                    cc.Score          = c.Score;
                    dataModel.CompatencyJSV.Add(cc);
                }
            }
            return(View(dataModel));
        }
Esempio n. 2
0
 public ActionResult genaratePDF(int ApplicantID, int VacancyID)
 {
     try
     {
         //int ApplicantID, int VacancyID
         ApplicantCompetencyPDfViewModel model = new ApplicantCompetencyPDfViewModel();
         var ApplicantDetails = _AdminTMSMethod.getApplicantDetailsById(ApplicantID);
         model.ApplicantId = ApplicantDetails.Id;
         model.VacancyId   = VacancyID;
         model.VacancyName = _db.Vacancies.Where(x => x.Archived == false && x.Id == VacancyID).FirstOrDefault().Title;
         model.FirstName   = ApplicantDetails.FirstName;
         model.LastName    = ApplicantDetails.LastName;
         DateTime currentDate = DateTime.Now;
         if (ApplicantDetails.CompatencyJSV != null && ApplicantDetails.CompatencyJSV != "")
         {
             var com   = JsonConvert.DeserializeObject <List <TMSSettingCompetencyDetails> >(ApplicantDetails.CompatencyJSV);
             int total = 0;
             if (com.Count > 0)
             {
                 foreach (var c in com)
                 {
                     TMSSettingCompetencyDetails cc = new TMSSettingCompetencyDetails();
                     cc.Id             = c.Id;
                     cc.CompetencyName = c.CompetencyName;
                     cc.Score          = c.Score;
                     total             = total + Convert.ToInt32(cc.Score);
                     model.CompatencyJSV.Add(cc);
                 }
                 int     totalCom = model.CompatencyJSV.Count();
                 decimal avg      = total / totalCom;
                 model.totalAvg = Convert.ToString(avg);
             }
         }
         string newfileName = string.Format("" + model.FirstName + "_" + model.LastName + "_Competencies.pdf", currentDate.Date);
         return(new Rotativa.ViewAsPdf("Index", model)
         {
             PageSize = Size.A4,
             PageOrientation = Orientation.Landscape,
             FileName = newfileName
         });
     }
     catch (Exception e)
     {
         throw e;
     }
 }