public DataTable GetSearchResumeList(SearchResumeModel searches) { using (var connection = new SqlConnection(connectionString)) { try { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Skills", searches.Skills), new SqlParameter("@JobIndustryAreaId", searches.JobCategory), new SqlParameter("@CityCode", searches.City), new SqlParameter("@MinExp", searches.MinExp), new SqlParameter("@MaxExp", searches.MaxExp) }; var searchList = SqlHelper.ExecuteReader ( connection, CommandType.StoredProcedure, "usp_SearchResume", parameters ); if (null != searchList && searchList.HasRows) { var dt = new DataTable(); dt.Load(searchList); return(dt); } } finally { SqlHelper.CloseConnection(connection); } } throw new DataNotFound("Data not found"); }
public List <SearchResumeListViewModel> GetSearchResumeList(SearchResumeViewModel searches) { List <SearchResumeListViewModel> lstSearchedResume = new List <SearchResumeListViewModel>(); var sFilters = new SearchResumeModel { Skills = searches.Skills, JobCategory = string.Join(Constants.CommaSeparator, searches.JobCategory), City = string.Join(Constants.CommaSeparator, searches.City), MinExp = searches.MinExp, MaxExp = searches.MaxExp }; DataTable searchedResume = _serarchresumeProcess.GetSearchResumeList(sFilters); if (searchedResume.Rows.Count > 0) { for (int i = 0; i < searchedResume.Rows.Count; i++) { string resumePath = Convert.ToString(searchedResume.Rows[i]["Resume"]); if (!string.IsNullOrWhiteSpace(resumePath)) { if (!File.Exists($"{_hostingEnviroment.WebRootPath}{resumePath}")) { resumePath = string.Empty; } } var skillsObject = new SearchResumeListViewModel { Skills = JsonConvert.DeserializeObject <Skills>(Convert.ToString(searchedResume.Rows[i]["Skills"])), FirstName = (searchedResume.Rows[i]["FirstName"] as string) ?? "", LastName = (searchedResume.Rows[i]["LastName"] as string) ?? "", Email = (searchedResume.Rows[i]["Email"] as string) ?? "", Resume = resumePath, UserId = (searchedResume.Rows[i]["UserId"] as int?) ?? 0, CityName = (searchedResume.Rows[i]["CityName"] as string) ?? "", JobIndustryAreaName = (searchedResume.Rows[i]["JobIndustryAreaName"] as string) ?? "", JobTitle = (searchedResume.Rows[i]["JobTitleName"] as string) ?? "", //Address = (searchedResume.Rows[i]["Address"] as string) ?? "", AboutMe = (searchedResume.Rows[i]["AboutMe"] as string) ?? "", ProfilePic = Convert.ToString(searchedResume.Rows[i]["ProfilePic"]), }; //var len = skillsObject.Skills.SkillSets.Length; //if (skillsObject.Skills != null && skillsObject.Skills.SkillSets.Substring(len-1) != ",") //{ // skillsObject.Skills.SkillSets += ","; //} //skillsObject.Skills.SkillSets += Convert.ToString(searchedResume.Rows[i]["ITSkill"]); lstSearchedResume.Add(skillsObject); string picpath = Path.GetFullPath(_hostingEnviroment.WebRootPath + lstSearchedResume[i].ProfilePic); if (!System.IO.File.Exists(picpath)) { string fName = $@"\ProfilePic\" + "Avatar.jpg"; lstSearchedResume[i].ProfilePic = fName; } } return(lstSearchedResume); } throw new UserNotFoundException("Data Not found"); }
public List <SearchResumeModel> GetOldResumes() { var searchResumeList = new List <SearchResumeModel>(); using (var db = new ResumeMatchDBEntities()) { var resumeList = db.OldResumeSummary.Where(w => w.ResumeId.Length == 11 && !w.IsMatched && (w.Status == 0 || w.Status == 99)).Take(500).ToList(); foreach (var resume in resumeList) { resume.Status = 2; } db.SaveChanges(); foreach (var resume in resumeList) { var searchResume = new SearchResumeModel(); var filePath = $@"\\DOLPHIN-PC\Data\智联招聘\{resume.Template}\{resume.ResumeId}.{Path.GetFileNameWithoutExtension(resume.Template)}"; if (!File.Exists(filePath)) { LogFactory.Warn($"指定路径不存在!ResumeNumber=>{resume.ResumeId} Path=>{filePath}"); resume.Status = 1; resume.MatchTime = DateTime.Now; db.SaveChanges(); continue; } var sourceCode = File.ReadAllText(filePath); var genderMatch = Regex.Match(sourceCode, "(男|女)"); if (genderMatch.Success) { searchResume.Gender = genderMatch.Value; } var replaceMatch = Regex.Match(sourceCode, "应聘机构:.+?>(.+?)</strong>"); if (replaceMatch.Success) { sourceCode = sourceCode.Replace(replaceMatch.Result("$1"), ""); } var matchs = Regex.Matches(sourceCode, "([\u4e00-\u9fa5]{4,11}有限公司[\u4e00-\u9fa5]{0,6})"); if (matchs.Count == 0) { Console.WriteLine($"该简历未匹配到公司!ResumeNumber=> {resume.ResumeId}"); resume.Status = 1; resume.MatchTime = DateTime.Now; db.SaveChanges(); continue; } var companys = new List <string>(); for (var i = 0; i < matchs.Count; i++) { if (i == 2) { break; } companys.Add(matchs[i].Result("$1")); } searchResume.Companys = companys; searchResume.Cellphone = resume.Cellphone; searchResume.Email = resume.Email; searchResume.SearchResumeId = resume.ResumeId; searchResumeList.Add(searchResume); } } return(searchResumeList); }