public async Task <IActionResult> OnPostCreateAsync() { JobCertificates = await _jobCompetencyService.GetJobCertificates(); JobCompetenciesKnowledge = await _jobCompetencyService.GetJobCompetenciesByTypeId(1); JobCompetenciesTechnical = await _jobCompetencyService.GetJobCompetenciesByTypeId(2); JobCompetenciesBehavioural = await _jobCompetencyService.GetJobCompetenciesByTypeId(3); JobCompetenciesExecutive = await _jobCompetencyService.GetJobCompetenciesByTypeId(4); CurrentSelectedJobGroup = await _jobCompetencyService.GetJobGroupById(JobGroupId); JobGroupPositions = await _jobCompetencyService.GetSubGroupLevelsByGroupId(JobGroupId); JobGroups = await _jobCompetencyService.GetJobGroups(); JobCertificateDescriptions = await _jobCompetencyService.GetAllJobCertificateDescriptions(); LevelCode = LevelValue.Split("/")[2]; RegionIds = string.Empty; foreach (var id in SelectedRegionIds) { RegionIds += id + "-"; } foreach (var cid in AddedCertificateIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidInt = int.Parse(cid.Split("&")[0]); var certificateDto = await _jobCompetencyService.GetJobCertificateById(cidInt); certificateDto.CertificateDescId = int.Parse(cid.Split("&")[1]); AddedCertificates.Add(certificateDto); } } foreach (var cid in AddedKnowledgeCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedKnowledgeCompetencies.Add(competency); } } } foreach (var cid in AddedTechnicalCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedTechnicalCompetencies.Add(competency); } } } foreach (var cid in AddedBehaviouralCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedBehaviouralCompetencies.Add(competency); } } } foreach (var cid in AddedExecutiveCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedExecutiveCompetencies.Add(competency); } } } var jobPositionId = _jobCompetencyService.GetJobPositionIdByTitle(Request.Form["titleEng"]).Result; if (jobPositionId == 0) { jobPositionId = await _jobCompetencyService.PostJobPositionGetId(Request.Form["titleEng"], Request.Form["titleFre"]); var jobGroupPosition = new JobGroupPosition() { JobGroupId = JobGroupId, JobPositionId = jobPositionId, SubJobGroupId = int.Parse(LevelValue.Split("/")[0]), JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]), }; _jobCompetencyService.PostJobGroupPosition(jobGroupPosition); foreach (var competency in AddedKnowledgeCompetencies) { var jobrolepositioncompetency = new JobRolePositionCompetencyRating() { JobPositionId = jobPositionId, CompetencyId = competency.CompetencyId, CompetencyLevelRequirementId = competency.CompetencyLevelRequirementId, CompetencyTypeId = 1, CompetencyRatingLevelId = competency.CompetencyRatingLevelId, SubJobGroupId = int.Parse(LevelValue.Split("/")[0]), JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]), JobGroupId = JobGroupId }; _jobCompetencyService.PostJobRolePositionCompetency(jobrolepositioncompetency); } foreach (var competency in AddedTechnicalCompetencies) { var jobrolepositioncompetency = new JobRolePositionCompetencyRating() { JobPositionId = jobPositionId, CompetencyId = competency.CompetencyId, CompetencyLevelRequirementId = competency.CompetencyLevelRequirementId, CompetencyTypeId = 2, CompetencyRatingLevelId = competency.CompetencyRatingLevelId, SubJobGroupId = int.Parse(LevelValue.Split("/")[0]), JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]), JobGroupId = JobGroupId }; _jobCompetencyService.PostJobRolePositionCompetency(jobrolepositioncompetency); } foreach (var competency in AddedBehaviouralCompetencies) { var jobrolepositioncompetency = new JobRolePositionCompetencyRating() { JobPositionId = jobPositionId, CompetencyId = competency.CompetencyId, CompetencyLevelRequirementId = competency.CompetencyLevelRequirementId, CompetencyTypeId = 3, CompetencyRatingLevelId = competency.CompetencyRatingLevelId, SubJobGroupId = int.Parse(LevelValue.Split("/")[0]), JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]), JobGroupId = JobGroupId }; _jobCompetencyService.PostJobRolePositionCompetency(jobrolepositioncompetency); } foreach (var competency in AddedExecutiveCompetencies) { var jobrolepositioncompetency = new JobRolePositionCompetencyRating() { JobPositionId = jobPositionId, CompetencyId = competency.CompetencyId, CompetencyLevelRequirementId = competency.CompetencyLevelRequirementId, CompetencyTypeId = 4, CompetencyRatingLevelId = competency.CompetencyRatingLevelId, SubJobGroupId = int.Parse(LevelValue.Split("/")[0]), JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]), JobGroupId = JobGroupId }; _jobCompetencyService.PostJobRolePositionCompetency(jobrolepositioncompetency); } foreach (var id in SelectedRegionIds) { var jobrolepositionlocation = new JobRolePositionLocation() { JobLocationRegionId = int.Parse(id), JobGroupId = JobGroupId, JobPositionId = jobPositionId, SubJobGroupId = int.Parse(LevelValue.Split("/")[0]), JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]) }; _jobCompetencyService.PostJobRolePositionLocation(jobrolepositionlocation); } var jobrolepositionhlcategory = new JobRolePositionHLCategory() { JobGroupId = JobGroupId, JobPositionId = jobPositionId, SubJobGroupId = int.Parse(LevelValue.Split("/")[0]), JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]), JobHLCategoryId = int.Parse(JobHLCategory) }; _jobCompetencyService.PostJobRolePositionHLCategory(jobrolepositionhlcategory); foreach (var certificate in AddedCertificates) { var jobrolepositioncertificate = new JobRolePositionCertificate() { JobPositionId = jobPositionId, JobGroupId = JobGroupId, SubJobGroupId = int.Parse(LevelValue.Split("/")[0]), JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]), CertificateDescriptionId = certificate.CertificateDescId, CertificateId = certificate.Id, }; _jobCompetencyService.PostJobRolePositionCertificate(jobrolepositioncertificate); } } else { return(Page()); } /* * if (!ModelState.IsValid) * { * return Page(); * } * * _context.Competencies.Add(Competency); * await _context.SaveChangesAsync(); */ // string parameters = $"nameEng={Competency.NameEng}&nameFre={Competency.NameFre}&descEng={Competency.DescEng}&descFre={Competency.DescFre}"; // try // { // _jobCompetencyService.PostJobCompetency(Competency); // } // catch(Exception ex) { return(RedirectToPage("Index")); // } //return Page(); }
public async Task OnPostCompetency(string competencytypename) { var Id = Request.Form[$"{competencytypename}Competency"]; var level = Request.Form[$"{competencytypename}Level"]; TitleEng = Request.Form["titleEng"]; TitleFre = Request.Form["titleFre"]; CurrentSelectedJobGroup = await _jobCompetencyService.GetJobGroupById(JobGroupId); RegionIds = string.Empty; foreach (var id in SelectedRegionIds) { RegionIds += id + "-"; } if (competencytypename == "knowledge") { AddedKnowledgeCompetencyIds += Id[0] + "&" + level[0] + "-"; } else if (competencytypename == "technical") { AddedTechnicalCompetencyIds += Id[0] + "&" + level[0] + "-"; } else if (competencytypename == "behavioural") { AddedBehaviouralCompetencyIds += Id[0] + "&" + level[0] + "-"; } else if (competencytypename == "executive") { AddedExecutiveCompetencyIds += Id[0] + "&" + level[0] + "-"; } JobCertificates = await _jobCompetencyService.GetJobCertificates(); JobCompetenciesKnowledge = await _jobCompetencyService.GetJobCompetenciesByTypeId(1); JobCompetenciesTechnical = await _jobCompetencyService.GetJobCompetenciesByTypeId(2); JobCompetenciesBehavioural = await _jobCompetencyService.GetJobCompetenciesByTypeId(3); JobCompetenciesExecutive = await _jobCompetencyService.GetJobCompetenciesByTypeId(4); CurrentSelectedJobGroup = await _jobCompetencyService.GetJobGroupById(JobGroupId); JobGroupPositions = await _jobCompetencyService.GetSubGroupLevelsByGroupId(JobGroupId); JobGroups = await _jobCompetencyService.GetJobGroups(); JobCertificateDescriptions = await _jobCompetencyService.GetAllJobCertificateDescriptions(); SubJobGroupId = int.Parse(LevelValue.Split("/")[0]); JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]); LevelCode = LevelValue.Split("/")[2]; foreach (var cid in AddedKnowledgeCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedKnowledgeCompetencies.Add(competency); } } } foreach (var cid in AddedTechnicalCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedTechnicalCompetencies.Add(competency); } } } foreach (var cid in AddedBehaviouralCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedBehaviouralCompetencies.Add(competency); } } } foreach (var cid in AddedExecutiveCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedExecutiveCompetencies.Add(competency); } } } foreach (var cid in AddedCertificateIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidInt = int.Parse(cid.Split("&")[0]); var certificateDto = await _jobCompetencyService.GetJobCertificateById(cidInt); certificateDto.CertificateDescId = int.Parse(cid.Split("&")[1]); AddedCertificates.Add(certificateDto); } } }
public async Task OnPostDelete(int competencyid) { JobCompetenciesKnowledge = await _jobCompetencyService.GetJobCompetenciesByTypeId(1); JobCompetenciesTechnical = await _jobCompetencyService.GetJobCompetenciesByTypeId(2); JobCompetenciesBehavioural = await _jobCompetencyService.GetJobCompetenciesByTypeId(3); JobCompetenciesExecutive = await _jobCompetencyService.GetJobCompetenciesByTypeId(4); JobCertificates = await _jobCompetencyService.GetJobCertificates(); TitleEng = Request.Form["titleEng"]; TitleFre = Request.Form["titleFre"]; CurrentSelectedJobGroup = await _jobCompetencyService.GetJobGroupById(JobGroupId); JobGroupPositions = await _jobCompetencyService.GetSubGroupLevelsByGroupId(JobGroupId); JobGroups = await _jobCompetencyService.GetJobGroups(); JobCertificateDescriptions = await _jobCompetencyService.GetAllJobCertificateDescriptions(); SubJobGroupId = int.Parse(LevelValue.Split("/")[0]); JobGroupLevelId = int.Parse(LevelValue.Split("/")[1]); LevelCode = LevelValue.Split("/")[2]; RegionIds = string.Empty; foreach (var id in SelectedRegionIds) { RegionIds += id + "-"; } foreach (var cid in AddedCertificateIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidInt = int.Parse(cid.Split("&")[0]); var certificateDto = await _jobCompetencyService.GetJobCertificateById(cidInt); certificateDto.CertificateDescId = int.Parse(cid.Split("&")[1]); AddedCertificates.Add(certificateDto); } } foreach (var cid in AddedKnowledgeCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); if (cidInt != competencyid) { var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedKnowledgeCompetencies.Add(competency); } } } } foreach (var cid in AddedBehaviouralCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); if (cidInt != competencyid) { var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedBehaviouralCompetencies.Add(competency); } } } } foreach (var cid in AddedTechnicalCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); if (cidInt != competencyid) { var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedTechnicalCompetencies.Add(competency); } } } } foreach (var cid in AddedExecutiveCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); if (cidInt != competencyid) { var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedExecutiveCompetencies.Add(competency); } } } } AddedKnowledgeCompetencyIds = string.Empty; AddedTechnicalCompetencyIds = string.Empty; AddedBehaviouralCompetencyIds = string.Empty; AddedExecutiveCompetencyIds = string.Empty; foreach (var competency in AddedKnowledgeCompetencies) { AddedKnowledgeCompetencyIds += competency.CompetencyId + "&" + competency.RatingValue + "-"; } foreach (var competency in AddedTechnicalCompetencies) { AddedTechnicalCompetencyIds += competency.CompetencyId + "&" + competency.RatingValue + "-"; } foreach (var competency in AddedBehaviouralCompetencies) { AddedBehaviouralCompetencyIds += competency.CompetencyId + "&" + competency.RatingValue + "-"; } foreach (var competency in AddedExecutiveCompetencies) { AddedExecutiveCompetencyIds += competency.CompetencyId + "&" + (competency.RatingValue + 5) + "-"; } }
public async Task OnPostGroup() { JobCompetenciesKnowledge = await _jobCompetencyService.GetJobCompetenciesByTypeId(1); JobCompetenciesTechnical = await _jobCompetencyService.GetJobCompetenciesByTypeId(2); JobCompetenciesBehavioural = await _jobCompetencyService.GetJobCompetenciesByTypeId(3); JobCompetenciesExecutive = await _jobCompetencyService.GetJobCompetenciesByTypeId(4); JobCertificates = await _jobCompetencyService.GetJobCertificates(); JobGroupPositions = await _jobCompetencyService.GetSubGroupLevelsByGroupId(JobGroupId); JobGroups = await _jobCompetencyService.GetJobGroups(); JobCertificateDescriptions = await _jobCompetencyService.GetAllJobCertificateDescriptions(); CurrentSelectedJobGroup = await _jobCompetencyService.GetJobGroupById(JobGroupId); SubJobGroupId = JobGroupPositions.FirstOrDefault().SubJobGroupId; JobGroupLevelId = JobGroupPositions.FirstOrDefault().LevelId; LevelCode = JobGroupPositions.FirstOrDefault().LevelCode; RegionIds = string.Empty; foreach (var id in SelectedRegionIds) { RegionIds += id + "-"; } foreach (var cid in AddedKnowledgeCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedKnowledgeCompetencies.Add(competency); } } } foreach (var cid in AddedTechnicalCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedTechnicalCompetencies.Add(competency); } } } foreach (var cid in AddedBehaviouralCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedBehaviouralCompetencies.Add(competency); } } } foreach (var cid in AddedExecutiveCompetencyIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidc = cid.Split("&")[0]; var clevel = cid.Split("&")[1]; if (!string.IsNullOrEmpty(cidc) && !string.IsNullOrEmpty(clevel)) { var cidInt = int.Parse(cidc); var cLevel = int.Parse(clevel); var competency = await _jobCompetencyService.GetJobCompetencyLevelByIdLevelId(cidInt, cLevel); AddedExecutiveCompetencies.Add(competency); } } } foreach (var cid in AddedCertificateIds.Split("-")) { if (!string.IsNullOrEmpty(cid)) { var cidInt = int.Parse(cid.Split("&")[0]); var certificateDto = await _jobCompetencyService.GetJobCertificateById(cidInt); certificateDto.CertificateDescId = int.Parse(cid.Split("&")[1]); AddedCertificates.Add(certificateDto); } } }