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 void LogSearchResumeList(SearchResumeViewModel searches, string userip, int empid) { try { //string ipinfo = new WebClient().DownloadString("http://ipinfo.io/" + "171.76.228.130"); string ipinfo = new WebClient().DownloadString("http://ipinfo.io/" + userip); //var ipInfo = JsonConvert.DeserializeObject<IpInfo>(info); //RegionInfo myRI1 = new RegionInfo(ipInfo.Country); //ipInfo.Country = myRI1 != null ? myRI1.EnglishName : ""; var search = JsonConvert.SerializeObject(searches); _serarchresumeProcess.LogSearchResumeList(search, userip, ipinfo, empid); } catch (Exception ex) { } }
public IActionResult SearchResumeList(SearchResumeViewModel searches) { List <SearchResumeListViewModel> lstResumeList = new List <SearchResumeListViewModel>(); try { var user = HttpContext.Session.Get <UserViewModel>(Constants.SessionKeyUserInfo); var props = searches.GetType().GetProperties(); foreach (PropertyInfo prop in props) { if (prop.PropertyType.IsArray) { var values = prop.GetValue(searches) as string[]; if (null != values) { List <string> finalValues = new List <string>(); foreach (var value in values) { if (null != value) { finalValues.AddRange(value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)); } } prop.SetValue(searches, finalValues.ToArray()); } } } ViewBag.JobIndustryArea = jobpastHandler.GetJobIndustryAreaWithStudentData(); ViewBag.City = homeHandler.GetCitiesWithJobSeekerInfo(); ViewBag.Searches = searches; //GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(); var userip = _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString(); searchresumehandler.LogSearchResumeList(searches, userip, user.UserId); lstResumeList = searchresumehandler.GetSearchResumeList(searches); } catch (DataNotFound ex) { Logger.Logger.WriteLog(Logger.Logtype.Error, ex.Message, 0, typeof(SearchResumeController), ex); } return(View(lstResumeList)); }