public ActionResult FilterList(string jobId, string city, int?page) { long userId = 0; if (User.Identity.IsAuthenticated) { userId = RegistrationProvider.GetUseridfromUsername(User.Identity.Name); } int pageSize = 5; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; JobList model = new JobList(); if (Session["ListOfJobs"] != null) { model = (JobList)Session["ListOfJobs"]; } else { model = JobsProvider.GetAllJobs(userId); Session["ListOfJobs"] = model; } model.Jobs = model.Jobs.Where(x => x.Job_details_id == Convert.ToInt32(jobId) || x.Job_city == city).OrderByDescending(x => x.Job_details_id).ToList(); return(PartialView("_Employers", model.Jobs.ToPagedList(pageIndex, pageSize))); }
public ActionResult Details(string ID) { long userId = 0; if (User.Identity.IsAuthenticated) { userId = RegistrationProvider.GetUseridfromUsername(User.Identity.Name); } var id = long.Parse(ID); JobList model = new JobList(); if (Session["ListOfJobs"] != null) { model = (JobList)Session["ListOfJobs"]; } else { model = JobsProvider.GetAllJobs(userId); Session["ListOfJobs"] = model; } var result = model.Jobs.Where(x => x.Job_details_id == id).FirstOrDefault(); return(View(result)); }
public ActionResult ListofServices(int?page) { long userId = 0; if (User.Identity.IsAuthenticated) { userId = RegistrationProvider.GetUseridfromUsername(User.Identity.Name); } int pageSize = 5; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; JobList model = new JobList(); if (Session["ListOfJobs"] != null) { model = (JobList)Session["ListOfJobs"]; } else { model = JobsProvider.GetAllJobs(userId); Session["ListOfJobs"] = model; } model.Jobs = model.Jobs.OrderByDescending(x => x.Job_details_id).ToList(); //ServiceDomainModel domains = new ServiceDomainModel(); // domains = model.ServiceDomain.Where(x => x.Service_domain_id == domainid).FirstOrDefault(); return(PartialView("_Employers", model.Jobs.ToPagedList(pageIndex, pageSize))); }
public ActionResult SearchJobsPost() { long userId = 0; if (User.Identity.IsAuthenticated) { userId = RegistrationProvider.GetUseridfromUsername(User.Identity.Name); } JobList model = new JobList(); //DataTable dt = loc; if (Session["ListOfJobs"] != null) { model = (JobList)Session["ListOfJobs"]; } else { model = JobsProvider.GetAllJobs(userId); Session["ListOfJobs"] = model; } return(PartialView("_MainSearchJobs", model.Jobs)); }
public void Should_pause_a_job() { var scheduler = A.Fake <IScheduler>(); var sut = new JobsProvider(scheduler); var jobGroup = "DEFAULT"; var jobName = "Test 1"; sut.PauseJob(jobGroup, jobName); A.CallTo(() => scheduler.PauseJob(A <JobKey> .That.Matches(key => key.Group == jobGroup && key.Name == jobName), default(CancellationToken))) .MustHaveHappened(); }
public ActionResult PostJobs(JobDetailsModel model) { if (User.Identity.IsAuthenticated) { if (model != null) { model.username = User.Identity.Name; var res = JobsProvider.PostJob(model); if (res) { TempData["Success"] = "Successfully Posted a Job!"; return(Json(new { success = true, message = "Successfully Posted a Job!" }, JsonRequestBehavior.DenyGet)); } } } TempData["Error"] = "Failed! Please try again"; return(Json(new { success = true, message = "Failed! Please try again" }, JsonRequestBehavior.DenyGet)); }
// // GET: /Jobs/ public ActionResult Index(string search, string city, int?page) { long userId = 0; if (User.Identity.IsAuthenticated) { userId = RegistrationProvider.GetUseridfromUsername(User.Identity.Name); } int pageSize = 5; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; JobList model = new JobList(); model = JobsProvider.GetAllJobs(userId); Session["ListOfJobs"] = model; JobList mod = new JobList(); mod.Jobs = new List <JobDetailsModel>(); var list = model.Jobs.Where(x => x.Applied == null).ToList(); if ((search != null && search != "") && (city != null && city != "")) { mod.Jobs = list.Where(x => x.Job_city == city && x.Job_title.Contains(search)).OrderByDescending(x => x.Job_details_id).ToList(); } else if (search != null && search != "") { mod.Jobs = list.Where(x => x.Job_title.Contains(search)).OrderByDescending(x => x.Job_details_id).ToList(); } else if (city != null && city != "") { mod.Jobs = list.Where(x => x.Job_city == city).OrderByDescending(x => x.Job_details_id).ToList(); } else { mod.Jobs = list.ToList(); } return(View(mod.Jobs.ToPagedList(pageIndex, pageSize))); }
public ActionResult ApplyJobs(MultipleJobsModel model) { long userId = 0; if (User.Identity.IsAuthenticated) { userId = RegistrationProvider.GetUseridfromUsername(User.Identity.Name); if (model != null) { model.Registered_user_id = userId; model.Applied_date = DateTime.Now; var res = JobsProvider.ApplicationStatus(model); if (res) { TempData["Success"] = "Job has been applied we may get back to you."; return(Json(new { title = "Favrequest", success = true, message = "S" }, JsonRequestBehavior.DenyGet)); } TempData["Error"] = "Failed."; return(Json(new { title = "Favrequest", success = true, message = "F" }, JsonRequestBehavior.DenyGet)); } } return(Json(new { title = "Favrequest", success = true, message = "NA" }, JsonRequestBehavior.DenyGet)); }
public async Task Should_extract_jobs_from_quartz_scheduler() { var scheduler = A.Fake <IScheduler>(); var sut = new JobsProvider(scheduler); var jobKeys = new ReadOnlyCollection <JobKey>(new List <JobKey> { new JobKey("Job Key 1"), new JobKey("Job Key 2") }); var fakeTrigger = new Fake <ITrigger>(); fakeTrigger.CallsTo(trigger => trigger.GetNextFireTimeUtc()).Returns(DateTimeOffset.Now.AddHours(1)); A.CallTo(() => scheduler.GetJobKeys(GroupMatcher <JobKey> .AnyGroup(), default(CancellationToken))).Returns( jobKeys ); A.CallTo(() => scheduler.GetTriggersOfJob(A <JobKey> .Ignored, default(CancellationToken))).Returns( new ReadOnlyCollection <ITrigger>(new List <ITrigger> { fakeTrigger.FakedObject })); var quartzJobs = await sut.GetScheduledJobs(); A.CallTo(() => scheduler.GetJobKeys(GroupMatcher <JobKey> .AnyGroup(), default(CancellationToken))) .MustHaveHappened(); A.CallTo(() => scheduler.GetTriggersOfJob(A <JobKey> .Ignored, default(CancellationToken))) .MustHaveHappened(); A.CallTo(() => scheduler.GetJobDetail(A <JobKey> .Ignored, default(CancellationToken))) .MustHaveHappenedOnceOrMore(); var quartzJob = quartzJobs.First(); quartzJob.Triggers.Should().NotBeEmpty(); quartzJob.Triggers.First().NextFireTime.Should().BeCloseTo(DateTimeOffset.Now.AddHours(1), 5000); }
public ActionResult AppliedJobs(int?page) { long userId = 0; if (User.Identity.IsAuthenticated) { userId = RegistrationProvider.GetUseridfromUsername(User.Identity.Name); } int pageSize = 5; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; JobList model = new JobList(); model = JobsProvider.GetAllJobs(userId); Session["ListOfJobs"] = model; JobList mod = new JobList(); mod.Jobs = new List <JobDetailsModel>(); var list = model.Jobs.Where(x => x.Applied != null).ToList(); return(View(list.ToPagedList(pageIndex, pageSize))); }
public async Task <IEnumerable <SimpleDataSet> > GetAllDataAsync(string indexType) { if (JobsProvider == null) { throw new InvalidOperationException("You must set the JobsProvider property before using this instance"); } var dataSets = new List <SimpleDataSet>(); try { // Unforunately by this point the index has already been wiped, which means in the _jobsProvider has a problem // we can't just continue with the existing data. If we try to check the data source in the constructor, // the only way to prevent execution proceeding to wiping the index is to throw an exception, and in a cold-boot // scenario where indexes need to be rebuilt that crashes all Umbraco pages. var jobs = await JobsProvider.ReadJobs(new JobSearchQuery()).ConfigureAwait(false); //Looping all the raw models and adding them to the dataset foreach (var job in jobs.Jobs) { try { var jobAdvert = await JobsProvider.ReadJob(job.Id.ToString(CultureInfo.InvariantCulture)).ConfigureAwait(false); jobAdvert.Id = job.Id; if (String.IsNullOrEmpty(jobAdvert.JobTitle)) { jobAdvert.JobTitle = job.JobTitle; } if (jobAdvert.Locations == null || jobAdvert.Locations.Count == 0) { jobAdvert.Locations = job.Locations; } jobAdvert.Salary.SearchRange = job.Salary.SearchRange; if (String.IsNullOrEmpty(jobAdvert.Salary.SalaryRange)) { jobAdvert.Salary.SalaryRange = job.Salary.SearchRange; } if (!jobAdvert.Salary.MinimumSalary.HasValue) { jobAdvert.Salary.MinimumSalary = job.Salary.MinimumSalary; } if (!jobAdvert.Salary.MaximumSalary.HasValue) { jobAdvert.Salary.MaximumSalary = job.Salary.MaximumSalary; } if (!jobAdvert.ClosingDate.HasValue) { jobAdvert.ClosingDate = job.ClosingDate; } if (JobTransformers != null) { foreach (var matchers in JobTransformers.Keys) { var match = true; foreach (var matcher in matchers) { match = match && matcher.IsMatch(jobAdvert); } if (match) { foreach (var transformer in JobTransformers[matchers]) { transformer.TransformJob(jobAdvert); } } } } var simpleDataSet = CreateIndexItemFromJob(jobAdvert, indexType); if (simpleDataSet != null) { dataSets.Add(simpleDataSet); } } catch (Exception ex) { // Catch the error here to ensure the indexer can carry on with indexing the next job ex.ToExceptionless().Submit(); LogHelper.Error <BaseJobsIndexer>("Error indexing:", ex); } } } catch (Exception ex) { ex.ToExceptionless().Submit(); LogHelper.Error <BaseJobsIndexer>("Error indexing:", ex); } LogHelper.Info <BaseJobsIndexer>($"{dataSets.Count} items built for indexing by {this.GetType().ToString()}"); return(dataSets); }