Пример #1
0
 /// <summary>
 /// Check integrity in program processes
 /// </summary>
 /// <param name="fi"></param>
 /// <param name="FindedPrograms"></param>
 /// <returns></returns>
 private bool check_integrity_in_process(FileInfo fi, ref ArrayList FindedPrograms)
 {
     try
     {
         JSonFile jProgram     = new JSonFile(fi.FullName);
         String   program_path = fi.FullName.Replace(Globals.AppDataSection(dPATH.PROGRAM).FullName + "\\", "").Replace("\\", ".").Replace(".json", "");
         TErrors  er           = new TErrors(Globals, program_path);
         foreach (JObject prc_node in jProgram.jActiveObj["Logic"] as JArray)
         {
             if (prc_node.Properties().Count() > 0)
             {
                 TProcess prc = new TProcess(sys, Globals, prc_node);
                 if (!CDataIntegrity.CheckAllVariables(prc, ref er))
                 {
                     FindedPrograms.Add(String.Format("Program: {0}: \r\n   -> Process: {1} \r\n   -> {2}",
                                                      program_path, prc.Name, er.getErrors().ToString()));
                 }
             }
         }
     }
     catch (Exception exc)
     {
         FindedPrograms.Add(exc.Message);
     }
     return(false);
 }
Пример #2
0
        /// <summary>
        /// Prepare for execute process
        /// </summary>
        /// <param name="prc"></param>
        /// <returns></returns>
        public void Run(TProcess proc)
        {
            prc = proc;

            // Check inputs first
            if (CDataIntegrity.CheckAllVariables(prc, ref errors))
            {
                // init timer
                DateTime prcInitTime = DateTime.Now;

                // Execute process
                debug.cprint(String.Format("Running process: '{0}', from program {1} and view {2}",
                                           (prc.Name != null) ? prc.Name.ToString() : prc.Guid, event_desc.Program, event_desc.View_Name));

                try
                {
                    Type       t  = this.GetType();
                    MethodInfo mi = t.GetMethod("f_" + TLogic.Utils.escape_sc(prc.Guid));
                    mi.Invoke(this, null);
                }
                catch (Exception exc)
                {
                    errors.unhandledError = exc.Message;
                }

                // set process time
                prc.Total_time = Math.Round((DateTime.Now - prcInitTime).TotalSeconds, 2);
            }
        }
Пример #3
0
        /// <summary>
        /// Prepare for execute process
        /// </summary>
        /// <param name="prc"></param>
        /// <returns></returns>
        public void Run(TProcess proc)
        {
            prc_error = false;
            prc       = proc;

            // Check inputs first
            if (CDataIntegrity.CheckAllVariables(prc, ref errors))
            {
                if ((Globals.is_system) && (!App_globals.is_system))
                {
                    try
                    {
                        Type       t  = this.GetType();
                        MethodInfo mi = t.GetMethod("f_" + escape_sc(prc.Guid));
                        mi.Invoke(this, null);
                    }
                    catch (Exception exc)
                    {
                        errors.unhandledError = exc.Message;
                    }
                }
                else
                {
                    // init timer
                    DateTime prcInitTime = DateTime.Now;

                    // Execute process
                    debug.cprint(String.Format("Running process: '{0}', from program {1} and view {2}",
                                               (prc.Name != null) ? prc.Name.ToString() : prc.Guid, event_desc.Program, event_desc.View_Name));

                    if (prc.Edit_code == "1")
                    {
                        SendToEditor();
                    }
                    else
                    {
                        if (execute_process(prc.Guid))
                        {
                            //si no se encuentra el proceso enviar a código la ejecución
                            SendToEditor();
                        }
                    }

                    // set process time
                    prc.Total_time = Math.Round((DateTime.Now - prcInitTime).TotalSeconds, 2);

                    if (prc_error)
                    {
                        // if error send process to editor
                        SendToEditor();
                    }
                }
            }
        }