public List <Jobs> JobRanking(int userId) { try { var dao = new DaoJobs(); DataTable tableData = dao.GetAllJobs(userId); var listRankJobs = new List <Jobs>(); if (tableData != null && tableData.Rows.Count > 0) { foreach (DataRow dataRow in tableData.Rows) { int rank = 1; rank += Province.Id == dataRow["ProvinceID"].ToString() ? 3 : 0; rank += JobPosition.JobPositionId == dataRow["JobPositionID"].ToString() ? 1 : 0; rank += JobSalaryLevel.JobSalaryLevelId == dataRow["SalaryLevelID"].ToString() ? 1 : 0; rank += WorkType.WorkTypeId == dataRow["WorkTypeID"].ToString() ? 1 : 0; rank += JobIndustries.JobIndutriesId == dataRow["JobIndustryID"].ToString() ? 1 : 0; rank += ExperienceLevel.ExperianceLevelId == dataRow["ExperienceLevelID"].ToString() ? 1 : 0; rank += Certificate.CertificateId == dataRow["CertificateID"].ToString() ? 1 : 0; switch (LangSkill.SillId) { case "1": case "2": rank += 0; break; case "3": rank += 1; break; case "4": case "7": case "8": case "9": case "10": rank += 2; break; case "5": case "6": rank += 3; break; case "11": rank -= 2; break; default: break; } var job = new Jobs(dataRow["JobID"].ToString(), rank); job.SetFullJobInfo(); listRankJobs.Add(job); } } return(listRankJobs); } catch (Exception exception) { Console.Write(exception); return(null); } }
public List<Jobs> JobRanking( int userId) { try { var dao = new DaoJobs(); DataTable tableData = dao.GetAllJobs(userId); var listRankJobs = new List<Jobs>(); if (tableData != null && tableData.Rows.Count > 0) { foreach (DataRow dataRow in tableData.Rows) { int rank = 1; rank += Province.Id == dataRow["ProvinceID"].ToString() ? 3 : 0; rank += JobPosition.JobPositionId == dataRow["JobPositionID"].ToString() ? 1 : 0; rank += JobSalaryLevel.JobSalaryLevelId == dataRow["SalaryLevelID"].ToString() ? 1 : 0; rank += WorkType.WorkTypeId == dataRow["WorkTypeID"].ToString() ? 1 : 0; rank += JobIndustries.JobIndutriesId == dataRow["JobIndustryID"].ToString() ? 1 : 0; rank += ExperienceLevel.ExperianceLevelId == dataRow["ExperienceLevelID"].ToString() ? 1 : 0; rank += Certificate.CertificateId == dataRow["CertificateID"].ToString() ? 1 : 0; switch (LangSkill.SillId) { case "1": case "2": rank += 0; break; case "3": rank += 1; break; case "4": case "7": case "8": case "9": case "10": rank += 2; break; case "5": case "6": rank += 3; break; case "11": rank -= 2; break; default: break; } var job = new Jobs(dataRow["JobID"].ToString(),rank); job.SetFullJobInfo(); listRankJobs.Add(job); } } return listRankJobs; } catch (Exception exception) { Console.Write(exception); return null; } }