Exemplo n.º 1
0
 public JobCommandEditorFrame(JobConnection jobconn, JobCommand command)
 {
     InitializeComponent();
     m_jobconn = jobconn;
     m_command = command;
     propertyFrame1.SelectedObject = m_command;
 }
Exemplo n.º 2
0
 public JobReportProcessorBase(JobReportConfigurationBase config, JobCommand command)
 {
     Config    = config;
     Command   = command;
     FilePlace = FilePlaceAddonType.PlaceFromVirtualFile(config.FilePlace.GetVirtualFile());
     FilePlace.SetFileHolderInfo(Config);
 }
Exemplo n.º 3
0
 public void LoadCommand(string file, JobCommand cmd)
 {
     m_jobconn = new JobConnection(file);
     m_cmd     = m_jobconn.GetCommand(cmd.GroupId);
     RefreshFactories();
     RefreshConfigs();
 }
Exemplo n.º 4
0
        private void EditCommand(Dictionary <string, string> args)
        {
            Job           job     = Job.LoadFromFile(args["job"]);
            JobConnection jobconn = new JobConnection(args["job"]);
            JobCommand    cmd     = job.Root.FindCommand(args["cmd"]);

            cmd.Edit(jobconn);
        }
Exemplo n.º 5
0
 public RunOrSaveJobForm(JobCommand command, Func <JobCommand, bool> checkConfig, string label)
 {
     InitializeComponent();
     m_command     = command;
     label1.Text   = Texts.Get(label);
     m_checkConfig = checkConfig;
     propertyFrame1.SelectedObject = m_command;
 }
Exemplo n.º 6
0
 public JobCommandTreeNode(PolyCommandTreeNode parent, JobConnection jobconn, JobCommand command)
     : base(parent, command.GroupId)
 {
     m_command = command;
     m_jobconn = jobconn;
     SetAppObject(new JobCommandAppObject {
         JobFile = jobconn.FileName, CommandGroupId = command.GroupId
     });
 }
Exemplo n.º 7
0
 public void AddCommand(JobCommand command)
 {
     m_rootCommand.m_commands.Add(command);
     command.m_job = this;
     if (m_title == null)
     {
         m_title = command.ToString();
     }
 }
Exemplo n.º 8
0
        private void RunCommand(Dictionary <string, string> args)
        {
            Job        fulljob = Job.LoadFromFile(args["job"]);
            JobCommand cmd     = fulljob.Root.FindCommand(args["cmd"]);
            Job        job     = Job.FromCommand(cmd, new JobProperties());

            if (MessageBox.Show(Texts.Get("s_really_run$job", "job", job), VersionInfo.ProgramTitle, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                job.StartProcess();
            }
        }
Exemplo n.º 9
0
 public static ITreeNode GetCommandTreeNode(PolyCommandTreeNode parent, JobCommand command, JobConnection jobconn)
 {
     if (command is JobPolyCommand)
     {
         return(new PolyCommandTreeNode(parent, jobconn, (JobPolyCommand)command));
     }
     else
     {
         return(new JobCommandTreeNode(parent, jobconn, command));
     }
 }
Exemplo n.º 10
0
        public static bool Run(string file, JobCommand cmd)
        {
            var win = new JobReportForm();

            win.jobReportFrame1.LoadCommand(file, cmd);
            if (win.ShowDialogEx() == DialogResult.OK)
            {
                win.jobReportFrame1.Save();
                return(true);
            }
            return(false);
        }
Exemplo n.º 11
0
        public static Job FromCommand(JobCommand command, JobProperties jobProps)
        {
            Job res = new Job();

            res.m_jobProps = jobProps;
            res.AddCommand(command);
            using (var ub = new UsageBuilder("create_job:" + command.GetType().FullName))
            {
                command.GetUsageParams(ub);
            }
            return(res);
        }
Exemplo n.º 12
0
        public virtual JobCommand Clone(bool newGroupId)
        {
            JobCommand  res = (JobCommand)this.GetType().GetConstructor(new Type[] { }).Invoke(new object[] { });
            XmlDocument doc = XmlTool.CreateDocument("Command");

            SaveToXml(doc.DocumentElement);
            res.LoadFromXml(doc.DocumentElement);
            if (newGroupId)
            {
                res.GroupId = Guid.NewGuid().ToString();
            }
            return(res);
        }
Exemplo n.º 13
0
        public void SaveReports(JobCommand cmd)
        {
            m_job = null;
            Reload();
            var cmd2 = m_job.Root.FindCommand(cmd.GroupId);

            cmd2.ReportConfigs.Clear();
            foreach (var rep in cmd.ReportConfigs)
            {
                cmd2.ReportConfigs.Add(rep.Clone());
            }
            SaveToFile();
        }
Exemplo n.º 14
0
 private void RenderCommand(HtmlGenerator hg, string jobfn, JobCommand cmd)
 {
     if (cmd is JobPolyCommand)
     {
         RenderPolyCommandItems(hg, jobfn, (JobPolyCommand)cmd);
     }
     else
     {
         hg.Write(cmd.ToString());
         hg.Write(" - ");
         hg.Write("<a href=\"callback://runcmd?job:{1}&cmd:{2}\">{0}</a>", Texts.Get("s_run"), HttpUtility.UrlEncode(jobfn), HttpUtility.UrlEncode(cmd.GroupId));
         hg.Write(" | <a href=\"callback://editcmd?job:{1}&cmd:{2}\">{0}</a>", Texts.Get("s_edit"), HttpUtility.UrlEncode(jobfn), HttpUtility.UrlEncode(cmd.GroupId));
     }
 }
Exemplo n.º 15
0
 public void ReplaceCommand(JobCommand command)
 {
     for (int i = 0; i < m_commands.Count; i++)
     {
         if (m_commands[i].GroupId == command.GroupId)
         {
             m_commands[i] = command;
             return;
         }
         var p = m_commands[i] as JobPolyCommand;
         if (p != null)
         {
             p.ReplaceCommand(command);
         }
     }
 }
Exemplo n.º 16
0
 public override bool Save()
 {
     if (m_cmd != null)
     {
         m_jobconn.SaveReports(m_cmd);
         m_cmd = m_jobconn.GetCommand(m_cmd.GroupId);
     }
     else
     {
         m_jobconn.SaveReports(m_job);
         m_job = m_jobconn.GetJob();
     }
     RefreshFactories();
     RefreshConfigs();
     return(true);
 }
Exemplo n.º 17
0
 public override void LoadFromXml(XmlElement xml)
 {
     base.LoadFromXml(xml);
     foreach (XmlElement child in xml.SelectNodes("Command"))
     {
         try
         {
             JobCommand cmd = (JobCommand)JobCommandAddonType.Instance.LoadAddon(child);
             cmd.m_job = m_job;
             m_commands.Add(cmd);
         }
         catch (Exception err)
         {
             var cmd = new JobErrorCommand {
                 Message = err.Message
             };
             cmd.m_job = m_job;
             m_commands.Add(cmd);
             Errors.LogError(err);
         }
     }
 }
Exemplo n.º 18
0
 public void Edit()
 {
     m_jobconn.Reload();
     m_command = m_jobconn.GetCommand(m_command.GroupId);
     m_command.Edit(m_jobconn);
 }
Exemplo n.º 19
0
 public abstract IJobReportProcessor CreateProcessor(JobCommand cmd);
Exemplo n.º 20
0
 public override IJobReportProcessor CreateProcessor(JobCommand cmd)
 {
     return(new JobLogProcessor(this, cmd));
 }
Exemplo n.º 21
0
 public JobLogProcessor(JobLogConfiguration config, JobCommand cmd)
     : base(config, cmd)
 {
 }
Exemplo n.º 22
0
        public static void Run(JobCommand command, Func <JobCommand, bool> checkConfig, string label)
        {
            var win = new RunOrSaveJobForm(command, checkConfig, label);

            win.ShowDialogEx();
        }
Exemplo n.º 23
0
 protected JobReportEnvBase(JobCommand cmd)
 {
     m_cmd = cmd;
 }
Exemplo n.º 24
0
 public FormattedJobReportProcessorBase(FormattedJobReportConfigurationBase config, JobCommand command)
     : base(config, command)
 {
 }
Exemplo n.º 25
0
 public void SaveCommand(JobCommand command)
 {
     Reload();
     m_job.Root.ReplaceCommand(command);
     SaveToFile();
 }
Exemplo n.º 26
0
        public virtual void Run(IJobRunEnv env)
        {
            JobReportEnvBase repenv = null;

            if (m_job.Root != this)
            {
                repenv = CreateReportEnv();
            }
            if (repenv != null)
            {
                try
                {
                    env.SetReportEnv(GroupId, repenv);
                    repenv.OnStart();
                }
                catch (Exception err)
                {
                    ProgressInfo.Warning("Error initializing reports:" + err.Message);
                }
            }
            try
            {
                using (var ub = new UsageBuilder(UsageEventName))
                {
                    GetUsageParams(ub);

                    try
                    {
                        if (m_job.m_process != null)
                        {
                            JobCommand oldcmd = m_job.m_process.CurrentCommand;
                            try
                            {
                                m_job.m_process.CurrentCommand = this;
                                DoRun(env);
                            }
                            finally
                            {
                                m_job.m_process.CurrentCommand = oldcmd;
                                // close connections
                                ConnPack = null;
                            }
                        }
                        else
                        {
                            try
                            {
                                DoRun(env);
                            }
                            finally
                            {
                                // close connections
                                ConnPack = null;
                            }
                        }
                        ub["result"] = "ok";
                    }
                    catch (Exception err)
                    {
                        ub["result"] = "error";
                        ub["error"]  = err.Message;
                        throw;
                    }
                }
            }
            finally
            {
                if (repenv != null)
                {
                    try
                    {
                        repenv.OnFinish();
                    }
                    catch (Exception err)
                    {
                        ProgressInfo.Warning("Error finishing reports:" + err.Message);
                    }
                    try
                    {
                        repenv.Dispose();
                    }
                    catch (Exception err)
                    {
                        ProgressInfo.Warning("Error disposing reports:" + err.Message);
                    }
                }
            }
        }