protected void JobAjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e) { if (e.Argument.IndexOf("OpenSelectedJob") > -1) { if (gridJobs.SelectedItems.Count == 1) { Response.Redirect(string.Format("~/JobProfile.aspx?JobId={0}&mode=edit", GetSelectedJobID()), true); } } else if (e.Argument.IndexOf("DeleteSelectedJob") > -1) { if (gridJobs.SelectedItems.Count == 1) { JobAjaxManager.AjaxSettings.AddAjaxSetting(JobAjaxManager, gridJobs); JobRepository jobRepo = new JobRepository(); jobRepo.Delete(new Job(GetSelectedJobID())); gridJobs.Rebind(); } } else if (e.Argument.IndexOf("PreviewJob") > -1) { if (gridJobs.SelectedItems.Count == 1) { string script = string.Format("openPopUp('{0}')", WebConfig.NeosJobDetailURL + GetSelectedJobID()); JobAjaxManager.ResponseScripts.Add(script); JobAjaxManager.ResponseScripts.Add("processJobToolBar(\"JobGridSelected\");"); } } }
//DELORT internal Job Delete(string id) { Job original = GetById(id); _repo.Delete(id); return(original);; }
public void DeleteJob(int jobId) { //unitOfWork.StartTransaction(); JobRepository repo = new JobRepository(unitOfWork); repo.Delete(x => x.JobId == jobId); //unitOfWork.Commit(); }
public bool Delete(string JobId, out string strResult) { strResult = string.Empty; bool result = false; Guid joId = new Guid(JobId); var job = JobRepository.GetQueryable().FirstOrDefault(j => j.ID == joId); if (job != null) { try { JobRepository.Delete(job); JobRepository.SaveChanges(); result = true; } catch (Exception) { strResult = "原因:已在使用"; } } else { strResult = "原因:未找到当前需要删除的数据!"; } return(result); }
internal Job Delete(int id) { Job original = Get(id); _repo.Delete(id); return(original); }
public void DeleteJobWithContent(int id) { _tracer.TraceEvent(TraceEventType.Start, 0); var contentRepository = new PageContentRepository(this._settings); using (contentRepository.AcquireLock(id)) { using (var scope = new TransactionScope(TransactionScopeOption.Required)) { Job job; using (var context = new CoreContext()) { var repository = new JobRepository(context); job = repository.Load(id); repository.Delete(job); context.SaveChanges(); } if (job.HasReferenceScraped) { contentRepository.DeleteReferenceContent(id); } if (job.HasTestScraped) { contentRepository.DeleteTestContent(id); } scope.Complete(); } } _tracer.TraceEvent(TraceEventType.Stop, 0); }
internal string Delete(int id) { if (_repo.Delete(id)) { return("Deleted!"); } return("Unable to be deleted"); }
public string Delete(int id) { if (_repo.Delete(id)) { return("Has been deleted"); } return("no delete"); }
public SchedulerModule() { this.RequiresAuthentication(); Get["/scheduler"] = x => { dynamic vmod = new ExpandoObject(); vmod.JobList = JobRepository.GetAll(); return View["page-scheduler", vmod]; }; Post["/scheduler/now"] = x => { var alias = (string)Request.Form.Alias; var command = (string)Request.Form.Command; Job.Schedule(alias, command); return Response.AsRedirect("/"); }; Post["/scheduler/cron"] = x => { var alias = (string)Request.Form.Alias; var command = (string)Request.Form.Command; var cron = (string)Request.Form.CronResult; Job.Schedule(alias, command, cron); return Response.AsRedirect("/"); }; //Post["/scheduler/other"] = x => { // var _alias = (string)Request.Form.Alias; // var _command = (string)Request.Form.Command; // var _cron = (string)Request.Form.CronResult; // Job.Schedule(_alias, _command, _cron); // dynamic model = new ExpandoObject(); // return Response.AsRedirect("/"); //}; Get["/scheduler/enable/{guid}"] = x => { string guid = x.guid; JobRepository.Enable(guid); return Response.AsJson(true); }; Get["/scheduler/disable/{guid}"] = x => { string guid = x.guid; JobRepository.Disable(guid); return Response.AsJson(true); }; Get["/scheduler/Launch/{guid}"] = x => { string guid = x.guid; Job.ReSchedule(guid); return Response.AsJson(true); }; Get["/scheduler/delete/{guid}"] = x => { string guid = x.guid; JobRepository.Delete(guid); return Response.AsJson(true); }; }
public RestResult Delete(string id) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException(nameof(id)); } _repository.Delete(Guid.Parse(id)); return(Rest(null)); }
public async Task <IActionResult> Delete(int id) { var user = await jobRepository.Get(id); if (user == null) { return(NotFound(new { status = ResultStatus.STATUS_NOT_FOUND, message = "Không tìm thấy nghề nghiệp" })); } await jobRepository.Delete(id); return(Ok(new { status = ResultStatus.STATUS_OK, message = "Xóa thành công!" })); }
//[HttpGet] public ActionResult Delete(int id) { try { _jobRepository = new JobRepository(); _jobRepository.Delete(id); //ViewBag.Mensagem = "Job excluído com sucesso"; return(RedirectToAction("Index")); } catch (Exception) { return(RedirectToAction("Index")); } }
public bool Delete(string JobId) { Guid joId = new Guid(JobId); var job = JobRepository.GetQueryable() .FirstOrDefault(j => j.ID == joId); if (job != null) { JobRepository.Delete(job); JobRepository.SaveChanges(); } else { return(false); } return(true); }
protected void OnGridJobs_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { int jobID = Int32.Parse(e.CommandArgument.ToString()); JobRepository jobRepo = new JobRepository(); jobRepo.Delete(new Job(jobID)); gridJobs.Rebind(); } }
public void DeleteJob(int id) { _jobRepo.Delete(id); _jobRepo.SaveChanges(); }
public IActionResult Delete(int id) { _jobRepository.Delete(id); return(NoContent()); }