internal CandidateGraphProgressDetailViewModel GetCandidateProgressDetails(int userId) { var userDetails = _IUserService.GetById(userId); CandidateGraphProgressDetailViewModel candidateGraphProgressDetailViewModel = new CandidateGraphProgressDetailViewModel(); CandidateGraphProgressDetail candidateGraphProgressDetail = userDetails.CandidateGraphProgressDetails.FirstOrDefault(); if (candidateGraphProgressDetail == null) { return(SaveCandidateProgressDetails(userId)); } Mapper.CreateMap <CandidateGraphProgressDetail, CandidateGraphProgressDetailViewModel>(); candidateGraphProgressDetailViewModel = Mapper.Map <CandidateGraphProgressDetail, CandidateGraphProgressDetailViewModel>(candidateGraphProgressDetail); candidateGraphProgressDetailViewModel.AverragePercentage = (candidateGraphProgressDetailViewModel.PersonalDetailsPercentage + candidateGraphProgressDetailViewModel.ContactDetailsPercentage + candidateGraphProgressDetailViewModel.EducationDetailsPercentage + candidateGraphProgressDetailViewModel.EmploymentDetailsPercentage + candidateGraphProgressDetailViewModel.FamilyDetailsPercentage + candidateGraphProgressDetailViewModel.UploadDcoumentsPercentage) / Convert.ToDouble(6); return(candidateGraphProgressDetailViewModel); }
public ActionResult GetCandidateProgressBar() { userId = Convert.ToInt32(System.Web.HttpContext.Current.User.Identity.Name.Split('|')[1]); CandidateProgressDetails candidateProgressDetails = new CandidateProgressDetails(_IUserService, _IRelationService, _ICandidateProgressDetailService, _IEmploymentCountService); CandidateGraphProgressDetailViewModel candidateGraphProgressDetailViewModel = candidateProgressDetails.SaveCandidateProgressDetails(userId); return(View(candidateGraphProgressDetailViewModel)); }
internal CandidateGraphProgressDetailViewModel SaveCandidateProgressDetails(int userId) { var userDetails = _IUserService.GetById(userId); CandidateGraphProgressDetailViewModel candidateGraphProgressDetailViewModel = new CandidateGraphProgressDetailViewModel(); try { CandidateGraphProgressDetail candidateGraphProgressDetail = new CandidateGraphProgressDetail(); var canidateProgressBarList = _ICandidateProgressDetailService.GetAll(null, null, ""); candidateGraphProgressDetail = canidateProgressBarList.FirstOrDefault(x => x.UserId == userId); if (canidateProgressBarList.Any() && candidateGraphProgressDetail != null) { candidateGraphProgressDetail.UserId = userId; candidateGraphProgressDetail.PersonalDetailsPercentage = GetPersonalDetailsPercentage(userDetails); candidateGraphProgressDetail.EducationDetailsPercentage = GetEducationDetialsPercentage(userDetails); candidateGraphProgressDetail.ContactDetailsPercentage = GetContactDetialsPercentage(userDetails); candidateGraphProgressDetail.EmploymentDetailsPercentage = GetEmployementDetialsPercentage(userDetails); candidateGraphProgressDetail.FamilyDetailsPercentage = GetFamilyDetialsPercentage(userDetails); candidateGraphProgressDetail.UploadDcoumentsPercentage = GetUploadDocumentPercentage(userDetails); bool status = _ICandidateProgressDetailService.Update(candidateGraphProgressDetail, null, ""); } else { candidateGraphProgressDetail = new CandidateGraphProgressDetail(); candidateGraphProgressDetail.UserId = userId; candidateGraphProgressDetail.PersonalDetailsPercentage = GetPersonalDetailsPercentage(userDetails); candidateGraphProgressDetail.EducationDetailsPercentage = GetEducationDetialsPercentage(userDetails); candidateGraphProgressDetail.ContactDetailsPercentage = GetContactDetialsPercentage(userDetails); candidateGraphProgressDetail.EmploymentDetailsPercentage = GetEmployementDetialsPercentage(userDetails); candidateGraphProgressDetail.FamilyDetailsPercentage = GetFamilyDetialsPercentage(userDetails); candidateGraphProgressDetail.UploadDcoumentsPercentage = GetUploadDocumentPercentage(userDetails); _ICandidateProgressDetailService.Insert(candidateGraphProgressDetail, null, ""); } Mapper.CreateMap <CandidateGraphProgressDetail, CandidateGraphProgressDetailViewModel>(); candidateGraphProgressDetailViewModel = Mapper.Map <CandidateGraphProgressDetail, CandidateGraphProgressDetailViewModel>(candidateGraphProgressDetail); candidateGraphProgressDetailViewModel.AverragePercentage = (candidateGraphProgressDetailViewModel.PersonalDetailsPercentage + candidateGraphProgressDetailViewModel.ContactDetailsPercentage + candidateGraphProgressDetailViewModel.EducationDetailsPercentage + candidateGraphProgressDetailViewModel.EmploymentDetailsPercentage + candidateGraphProgressDetailViewModel.FamilyDetailsPercentage + candidateGraphProgressDetailViewModel.UploadDcoumentsPercentage) / Convert.ToDouble(6); } catch (Exception ex) { candidateGraphProgressDetailViewModel.ErrorMessage = ex.Message; } return(candidateGraphProgressDetailViewModel); }