private void OnModifyProcessParams() { DataTable dt = this.dataGridView1.DataSource as DataTable; if (dt == null || dt.Rows.Count < 1) { return; } foreach (DataRow dr in dt.Rows) { string processID = dr["processStepID"].ToString(); ProcessStepModel process = processStepBll.GetModel(processID); if (process == null) { continue; } float processVal = 0; if (!float.TryParse(dr["tag1"].ToString(), out processVal)) { continue; } process.tag1 = dr["tag1"].ToString(); processStepBll.Update(process); } }
/// <summary> /// Procesa un paso /// </summary> private async Task ProcessStepAsync(ProcessStepModel step) { IJobStepProcessor processor = Processors[step.PluginKey]; // Procesa el trabajo if (processor == null) { Context.WriteError("JobManager - Process", $"Can't find the processor for step {step.PluginKey}"); } else { // Ejecuta el trabajo try { // Inicializa el procesador processor.Initialize(Context, step); // Procesa await processor.ProcessAsync(); } catch (Exception exception) { Context.WriteError("JobManager - Process", exception.Message); } // Muestra los benchmarks ShowBenchmarks(Context.Benchmarks); } }
/// <summary> /// Carga los datos de un paso /// </summary> private ProcessBaseModel LoadStep(JobModel job, MLNode rootML) { ProcessStepModel step = new ProcessStepModel(job); // Asigna las propiedades básicas step.Key = rootML.Attributes[TagKey].Value; step.PluginKey = rootML.Attributes[TagPluginKey].Value; step.StartWithPreviousError = rootML.Attributes[TagStartWithPreviousError].Value.GetBool(false); step.Name = rootML.Nodes[TagName].Value; step.Description = rootML.Nodes[TagDescription].Value; step.ScriptFileName = rootML.Nodes[TagScript].Value; // Carga los datos foreach (MLNode nodeML in rootML.Nodes) { switch (nodeML.Name) { case TagParameter: LoadParameter(nodeML, step.Parameters); break; } } // Devuelve los datos del paso return(step); }
/// <summary> /// Inicializa el procesador /// </summary> public void Initialize(Models.Context.JobContextModel context, ProcessStepModel step) { Context = context; Step = step; }
/// <summary> /// Actualiza el trabajo y paso actual /// </summary> public void UpdateJobStep(string processorKey, ProcessStepModel step) { ActualProcessorKey = processorKey; ActualStep = step; }