예제 #1
0
        public List <SearchJobListViewModel> GetRecentJobs()
        {
            DataTable dt = _homeRepositories.GetRecentJobs();
            List <SearchJobListViewModel> lstRecentJobs = new List <SearchJobListViewModel>();

            try
            {
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        SearchJobListViewModel RecentJobs = new SearchJobListViewModel
                        {
                            CompanyLogo        = Convert.ToString(dt.Rows[i]["CompanyLogo"]) ?? "",
                            JobTitle           = Convert.ToString(dt.Rows[i]["JobTitle"]) ?? "",
                            EmploymentStatus   = Convert.ToString(dt.Rows[i]["EmploymentStatus"]) ?? "",
                            City               = Convert.ToString(dt.Rows[i]["City"]) ?? "",
                            HiringCriteria     = Convert.ToString(dt.Rows[i]["HiringCriteria"]) ?? "",
                            CompanyName        = Convert.ToString(dt.Rows[i]["CompanyName"]) ?? "",
                            JobPostId          = (dt.Rows[i]["JobPostId"] as int?) ?? 0,
                            JobTitleByEmployer = Convert.ToString(dt.Rows[i]["JobTitleByEmployer"]) ?? "",
                            CTC          = Convert.ToString(dt.Rows[i]["CTC"]) ?? "",
                            NumberOfDays = Convert.ToString(dt.Rows[i]["NumberOfDays"]) ?? ""
                        };
                        lstRecentJobs.Add(RecentJobs);
                    }
                }
            }
            catch {
                throw new DataNotFound("data not found!");
            }
            return(lstRecentJobs);
        }
예제 #2
0
        public List <SearchJobListViewModel> GetRecentJobs()
        {
            DataTable dt = _homeRepositories.GetRecentJobs();
            List <SearchJobListViewModel> lstRecentJobs = new List <SearchJobListViewModel>();

            try
            {
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string picpath = System.IO.Path.GetFullPath(hostingEnviroment.WebRootPath + dt.Rows[i]["CompanyLogo"]);
                        if (!System.IO.File.Exists(picpath))
                        {
                            string fName = $@"\ProfilePic\" + "Avatar_company.jpg";
                            dt.Rows[i]["CompanyLogo"] = fName;
                        }
                        SearchJobListViewModel RecentJobs = new SearchJobListViewModel
                        {
                            CompanyLogo        = Convert.ToString(dt.Rows[i]["CompanyLogo"]) ?? "",
                            JobTitle           = Convert.ToString(dt.Rows[i]["JobTitle"]) ?? "",
                            EmploymentStatus   = Convert.ToString(dt.Rows[i]["EmploymentStatus"]) ?? "",
                            City               = Convert.ToString(dt.Rows[i]["City"]) ?? "",
                            HiringCriteria     = Convert.ToString(dt.Rows[i]["HiringCriteria"]) ?? "",
                            CompanyName        = Convert.ToString(dt.Rows[i]["CompanyName"]) ?? "",
                            JobPostId          = (dt.Rows[i]["JobPostId"] as int?) ?? 0,
                            JobTitleByEmployer = Convert.ToString(dt.Rows[i]["JobTitleByEmployer"]) ?? "",
                            CTC          = Convert.ToString(dt.Rows[i]["CTC"]) ?? "",
                            NumberOfDays = Convert.ToString(dt.Rows[i]["NumberOfDays"]) ?? ""
                        };
                        lstRecentJobs.Add(RecentJobs);
                    }
                }
            }
            catch
            {
                throw new DataNotFound("data not found!");
            }
            return(lstRecentJobs);
        }