/// <summary> /// Get family details list /// </summary> /// <param name="userid"></param> /// <returns></returns> private IPagedList <FamilyHistory> FamilyDetailsPagedList(int userid) { List <EmployeeFamilyDetail> list = _IFamilyDetailsService.GetEmployeeFamilyDetailsByUserID(userid); var genderlist = GetGenderList(); var dependentlist = GetDependentList(); var countryCodeList = GetCountryCode(); List <Master_Relation> relationShipList = _IRelationService.GetAll(null, null, "").ToList(); List <FamilyHistory> ModelList = new List <FamilyHistory>(); int id = 0; ModelList = list .Select(x => new FamilyHistory() { ID = 0, FamDetID = x.FamDetID, //FullName = x.FullName, FirstName = x.FirstName, LastName = x.LastName, DOB = x.DOB.HasValue ? x.DOB.Value.ToShortDateString() : string.Empty, Gender = (x.Gender != null) ? genderlist.SingleOrDefault(s => s.Text == x.Gender).Text : string.Empty, IsActive = x.IsActive.ToString(), RelationShipName = relationShipList.SingleOrDefault(s => s.RelationID == x.RelationshipID).RelationName, Dependent = (x.Dependent != null) ? dependentlist.SingleOrDefault(s => s.Value == x.Dependent).Text : string.Empty, RelationshipID = x.RelationshipID, UserID = x.UserID, CountryCode = x.CountryCode, ContactNumber = x.ContactNumber, IsEmergencyContact = x.IsEmergencyContact.HasValue ? x.IsEmergencyContact.Value : false }) .ToList(); var personalDetails = _IPersonalService.GetPersonalDetailsByUserId(userId); if (personalDetails != null && personalDetails.MaritalStatID == Constants.Single) { ModelList = ModelList.Where(m => m.RelationshipID != Constants.Child).ToList(); ModelList = ModelList.Where(m => m.RelationshipID != Constants.Spouse).ToList(); } int pageSize = 10; //not required int pageIndex = 1; //not required foreach (var item in ModelList) { item.ID = id + 1; id = item.ID; } return(ModelList.ToPagedList(pageIndex, pageSize)); }
public IActionResult GetAll() { var result = _relationService.GetAll(); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
private double GetFamilyDetialsPercentage(LoginDetail userDetails) { double educationDetialsPercentage = 0.0; int averageCount = 0; if (userDetails != null) { var relationList = _IRelationService.GetAll(null, null, ""); var personalDetails = userDetails.EmployeePersonalDetails.FirstOrDefault(x => x.IsActive == true); var familydetails = userDetails.EmployeeFamilyDetails .Where(x => x.IsActive == true && x.RelationshipID != Constants.Child).ToList(); if (personalDetails != null && personalDetails.MaritalStatID == Constants.Single) { relationList = relationList .Where(r => r.RelationID != Constants.Spouse && r.RelationID != Constants.Child && r.RelationID != Constants.Relative).ToList(); if (familydetails.Any() && familydetails.Count != 0) { averageCount = relationList.Count(); foreach (var item in familydetails.Where(x => x.RelationshipID != Constants.Spouse)) { if (!String.IsNullOrEmpty(item.FirstName) && !String.IsNullOrEmpty(item.LastName) && item.RelationshipID != Constants.Relative) { educationDetialsPercentage = educationDetialsPercentage + 100.00; } else { educationDetialsPercentage = educationDetialsPercentage + 0.00; } } educationDetialsPercentage = educationDetialsPercentage / Convert.ToDouble(averageCount); } } else { var relList = relationList.Where(x => x.RelationID != Constants.Relative && x.RelationID != Constants.Child).Select(r => new { r.RelationID, r.RelationName }) .GroupBy(x => x.RelationID).ToList(); if (familydetails.Any() && familydetails.Count != 0) { averageCount = relList.Count(); foreach (var item in familydetails) { if (item.RelationshipID == Constants.Spouse) { int acuatalCount = 0; String[] _chosenOtherDetails = new string[] { Convert.ToString(item.FirstName), Convert.ToString(item.LastName), Convert.ToString(item.DOB), Convert.ToString(item.ContactNumber), }; int totalFieldCount = _chosenOtherDetails.Length; for (int i = 0; i < _chosenOtherDetails.Length; i++) { if (!String.IsNullOrEmpty(_chosenOtherDetails[i])) { acuatalCount++; } } educationDetialsPercentage = educationDetialsPercentage + ((Convert.ToDouble(acuatalCount) / Convert.ToDouble(totalFieldCount)) * Convert.ToDouble(100)); } else { if (!String.IsNullOrEmpty(item.FirstName) && !String.IsNullOrEmpty(item.LastName) && item.RelationshipID != Constants.Relative && item.RelationshipID != Constants.Child) { educationDetialsPercentage = educationDetialsPercentage + 100.00; } else { educationDetialsPercentage = educationDetialsPercentage + 0.00; } } } //var childDetails = userDetails.EmployeeFamilyDetails.Where(x => x.IsActive == true && x.RelationshipID == Constants.Child).FirstOrDefault(); //if (childDetails != null && !String.IsNullOrEmpty(childDetails.FirstName) && !String.IsNullOrEmpty(childDetails.LastName) && !String.IsNullOrEmpty(childDetails.Gender)) //{ // educationDetialsPercentage = educationDetialsPercentage + 100.00; //} //else //{ // educationDetialsPercentage = educationDetialsPercentage + 0.00; //} educationDetialsPercentage = educationDetialsPercentage / Convert.ToDouble(averageCount); } } } return(educationDetialsPercentage); }
public ActionResult FinalStatus() { userId = Convert.ToInt32(System.Web.HttpContext.Current.User.Identity.Name.Split('|')[1]); var userDetails = _IUserService.GetById(userId); var relationList = _IRelationService.GetAll(null, null, ""); CandidateProgressDetails candidateProgressDetails = new CandidateProgressDetails(_IUserService, _IRelationService, _ICandidateProgressDetailService, _IEmploymentCountService); var candidateGraphProgressDetailViewModel = candidateProgressDetails.SaveCandidateProgressDetails(userId); FinalSubmitViewModel finalSubmitViewModel = new FinalSubmitViewModel(); if (userDetails != null) { finalSubmitViewModel.FinalStatus = userDetails.IsSubmitted == null ? false : userDetails.IsSubmitted.Value; var personalDetail = userDetails.EmployeePersonalDetails.FirstOrDefault(x => x.IsActive == true); var contactDetail = userDetails.EmployeeContactDetails.FirstOrDefault(); var userEmployemntList = userDetails.EmploymentDetails.Where(x => x.IsActive == true); var assignedEducationCategaries = userDetails.AdminEducationCategoryForUsers.Where(x => x.IsActive == true).ToList(); var userEducationList = userDetails.EmployeeEducationDetails.Where(x => x.IsActive == true); var documentDetails = userDetails.DocumentDetails.Where(x => x.IsActive == true); var familydetails = userDetails.EmployeeFamilyDetails.Where(x => x.IsActive == true).ToList(); relationList = relationList.Where(r => r.RelationID != Constants.Spouse && r.RelationID != Constants.Child).ToList(); if (personalDetail == null) { finalSubmitViewModel.PersonalDetailsError = "Personal Details"; } if (contactDetail == null) { finalSubmitViewModel.ContactDetailsError = "Contact Details"; } //if (!userEmployemntList.Any(x => x.IsCurrentEmployment == true)) //{ // finalSubmitViewModel.EmploymentDetailsError = "Employment Details"; //} if (candidateGraphProgressDetailViewModel.EmploymentDetailsPercentage != null && candidateGraphProgressDetailViewModel.EmploymentDetailsPercentage < 100) { finalSubmitViewModel.EmploymentDetailsError = "Employment Details"; } if (userEducationList.Any() && assignedEducationCategaries.Any()) { assignedEducationCategaries.Remove(assignedEducationCategaries.FirstOrDefault(x => x.EducationCategoryId == 8)); if (userEducationList.Where(x => x.EducationCategoryID != 8).Count() != assignedEducationCategaries.Count) { finalSubmitViewModel.EducationDetailsError = "Education Details"; } } else { finalSubmitViewModel.EducationDetailsError = "Education Details"; } if (familydetails.Any()) { //if (personalDetail != null && personalDetail.MaritalStatID == Constants.Single) //{ // relationList = relationList.Where(r => r.RelationID != Constants.Spouse && r.RelationID != Constants.Child && r.RelationID != Constants.Sibling && r.RelationID != Constants.Relative).ToList(); // if (familydetails.Where(a => a.RelationshipID == Constants.Father || a.RelationshipID == Constants.Mother).ToList().Count != relationList.Count()) // { // finalSubmitViewModel.FamilyDetailsError = "Family Details"; // } //} //else if (personalDetail != null && personalDetail.MaritalStatID == Constants.Married) //{ // relationList = relationList.Where(r => r.RelationID != Constants.Child && r.RelationID != Constants.Sibling && r.RelationID != Constants.Relative).ToList(); // if (familydetails.Count <= relationList.Count()) // { // finalSubmitViewModel.FamilyDetailsError = "Family Details"; // } //} if (candidateGraphProgressDetailViewModel.FamilyDetailsPercentage < 100) { finalSubmitViewModel.FamilyDetailsError = "Family Details"; } } else { finalSubmitViewModel.FamilyDetailsError = "Family Details"; } if (documentDetails.Any() && documentDetails.Count() != 0) { //var docValidation = true; //if (documentDetails.FirstOrDefault(x => x.DocumentID == Constant.IDProof.PANCard) == null) //{ // docValidation = false; //} //foreach (var item in userDetails.AdminEducationCategoryForUsers) //{ // var education= item.Master_EducationCategory.EducationDocumentCategoryMappings.FirstOrDefault(); // if (education != null) // { // var docid = education.DocumentID; // if (!documentDetails.Any(x => x.DocumentID == docid)) // { // docValidation = false; // } // } //} //foreach (var item in userEmployemntList) //{ // if (item.IsCurrentEmployment.HasValue && item.IsCurrentEmployment.Value) // { // if (!documentDetails.Any(x => x.EmploymentDetID == item.EmploymentDetID && x.DocumentID == Constant.EmploymentProof.Latest3PaySlips)) // { // docValidation = false; // } // } // else // { // if (!documentDetails.Any(x => x.EmploymentDetID == item.EmploymentDetID && (x.DocumentID == Constant.EmploymentProof.Latest3PaySlips))) // { // docValidation = false; // } // if (!documentDetails.Any(x => x.EmploymentDetID == item.EmploymentDetID && (x.DocumentID == Constant.EmploymentProof.ExperienceLetter))) // { // docValidation = false; // } // } //} //if (!docValidation) //{ // finalSubmitViewModel.UploadDetailsError = "Upload Documents"; //} if (candidateGraphProgressDetailViewModel.UploadDcoumentsPercentage < 100) { finalSubmitViewModel.UploadDetailsError = "Upload Documents"; } } else { finalSubmitViewModel.UploadDetailsError = "Upload Documents"; } } return(View(finalSubmitViewModel)); }