예제 #1
0
        public void ReportExecuteResult(ReportModel model)
        {
            var status = model.Status == 1 ? JobExecuteStatus.Success : JobExecuteStatus.Fail;

            var dao = new Data.JobExecuteDAO();

            dao.Update(model.ID, status, model.StartTime, model.EndTime, model.ExecuteTime, model.Output);

            var data = dao.Get(model.ID);
            ClientManager.Instance.NotifyOnJobExecuted(data);
        }
예제 #2
0
        public void Run()
        {
            if (this.Status == JobStatus.Running)
            {
                var id = Guid.NewGuid();

                var dao = new Data.JobExecuteDAO();
                dao.Add(id, this.ID);

                using (Process process = new Process())
                {
                    if (!File.Exists(this.ExeFilePath))
                    {
                        dao.Update(id, JobExecuteStatus.Fail, DateTime.Now, DateTime.Now, 0, "未找到Job执行文件");
                    }
                    else
                    {
                        process.StartInfo = new ProcessStartInfo
                        {
                            Arguments = id.ToString(),
                            FileName = this.ExeFilePath,
                            CreateNoWindow = true,
                            UseShellExecute = false
                        };

                        process.Start();
                    }
                }

                this.NotifyJobExecuted(id);
            }
        }