예제 #1
0
        public ActionResult Details(string instanceName, string groupName, string itemName)
        {
            Models.InstanceModel     instance    = instanceRepo.GetInstance(instanceName);
            Models.JobRepository     jobRepo     = new QuartzAdmin.web.Models.JobRepository(instance);
            Models.TriggerRepository triggerRepo = new QuartzAdmin.web.Models.TriggerRepository(instance);

            Quartz.IJobDetail   job = jobRepo.GetJob(itemName, groupName).Result;
            Models.JobViewModel jvm = new QuartzAdmin.web.Models.JobViewModel();
            jvm.JobDetail = job;
            if (job != null)
            {
                jvm.Triggers = triggerRepo.GetTriggersForJob(itemName, groupName);
            }


            ViewData["instanceName"] = instanceName;
            if (job == null)
            {
                return(View("NotFound"));
            }
            else
            {
                return(View(jvm));
            }
        }
예제 #2
0
 public ActionResult Details2(string instanceName, string groupName, string itemName)
 {
     Models.JobRepository jobRepo = new QuartzAdmin.web.Models.JobRepository(instanceName);
     Quartz.IJobDetail    job     = jobRepo.GetJob(itemName, groupName).Result;
     if (job == null)
     {
         return(View("NotFound"));
     }
     else
     {
         return(View(job));
     }
 }
        public ActionResult RunNow(string instanceName, string groupName, string itemName)
        {
            Models.InstanceModel instance = Repository.GetByName(instanceName);
            Models.JobRepository jobRepo  = new QuartzAdmin.web.Models.JobRepository(instance);

            //var jdm_keys = this.ValueProvider.Keys.Where(k=>k.StartsWith("jdm_"));
            Quartz.IJobDetail job = jobRepo.GetJob(itemName, groupName);


            foreach (string jdm_key in this.Request.Form.Keys)
            {
                if (jdm_key.StartsWith("jdm_"))
                {
                    if (job.JobDataMap.Contains(jdm_key.Substring(4)))
                    {
                        job.JobDataMap[jdm_key.Substring(4)] = Convert.ChangeType(Request.Form[jdm_key], job.JobDataMap[jdm_key.Substring(4)].GetType());
                    }
                }
            }
            jobRepo.RunJobNow(itemName, groupName, job.JobDataMap);

            return(Content("Job execution started"));
        }