Ejemplo n.º 1
0
 public CentralProcessor(CentralEngine inEngine, CentralLogger inLogger)
 {
     engine        = inEngine;
     log           = inLogger;
     fileDate      = DateTime.Today;
     priorAuthList = new List <PriorAuthTestObject>();
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // instantiate central engine
            CentralEngine    engine    = new CentralEngine();
            CentralLogger    log       = new CentralLogger(engine.OutputPath, engine.AppName, eLogLevel.Informational);
            CentralProcessor processor = new CentralProcessor(engine, log);

            try
            {
                log.WriteLine("************************************************************", eLogLevel.Informational);
                log.WriteLine("Initializing Sample Application.", eLogLevel.Informational);
                log.WriteLine("************************************************************", eLogLevel.Informational);

                processor.RunProcess();


                log.WriteLine("*****************************************************************", eLogLevel.Informational);
                log.WriteLine("The Sample application has finished Successfully!!!", eLogLevel.Informational);
                log.WriteLine("*****************************************************************", eLogLevel.Informational);
            }
            catch (Exception ex)
            {
                log.WriteLine("*****************************************************************", eLogLevel.Informational);
                log.WriteLine("The Sample Application has finished processing with Errors - ", eLogLevel.Error);
                log.WriteLine("An error has occurred: " + ex.Message + ". " + ex.InnerException, eLogLevel.Error);
                log.WriteLine("*****************************************************************", eLogLevel.Informational);
            }
            finally
            {
                log.WriteLine("Job Complete!");
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            //eLogLevel logLevel = eLogLevel.Informational;
            //CentralArguments arguments = null;

            //try
            //{
            //    if(Environment.GetCommandLineArgs().Count() > 1)
            //    {
            //        arguments = CommandLine.Parse<CentralArguments>();
            //    }
            //}
            //catch (Exception ex)
            //{
            //    TextWriter errorWriter = Console.Error;
            //    errorWriter.WriteLine("*** ERR *** :: " + ex.Message);
            //    Environment.Exit(4);
            //}

            //CentralEngine ce = new CentralEngine();

            //if (arguments != null)
            //{
            //    if (arguments.LogLevel != 0)
            //    {
            //        logLevel = (eLogLevel)arguments.LogLevel;
            //    }
            //}

            //Console.WriteLine("Log level set to " + logLevel.ToString());

            //foreach(PropertyInfo property in ce.GetType().GetProperties())
            //{
            //    Console.WriteLine(property.Name + ": " + property.GetValue(ce, null));
            //}

            //Console.ReadKey();

            CentralEngine ce   = new CentralEngine("GHC-HMO\\cminnickel", "CLM136RPS", "CENTRAL");
            string        test = ce.OutputPath;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Override for constructor that also accepts arguments object.
 /// </summary>
 /// <param name="inEngine"></param>
 /// <param name="inLog"></param>
 /// <param name="inArguments"></param>
 public CentralProcessor(CentralEngine inEngine, CentralLogger inLog, CentralArguments inArguments)
 {
     log       = inLog;
     engine    = inEngine;
     arguments = inArguments;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// The CentralProcess constructor takes an instantiated engine and log object.  The engine
 /// will contain all of the paths and system variables consistent with a Central job. This
 /// constructor can be extended, but CentralEngine and CentralLogger must ALWAYS be implemented.
 /// </summary>
 /// <param name="engine"></param>
 /// <param name="log"></param>
 public CentralProcessor(CentralEngine inEngine, CentralLogger inLog) : this(inEngine, inLog, null)
 {
     // chained constructor
 }
Ejemplo n.º 6
0
        static int Main(string[] args)
        {
            #region "Common Configuration"

            eLogLevel        logLevel  = eLogLevel.Informational; // set default log level to informational. this can be overridden through a CLI argument or in code below.
            CentralArguments arguments = null;

            // parse command-line. properties set in the parameter string
            // can override the properties in the CentralEngine.
            try
            {
                arguments = GetCommandLineArguments();
            }
            catch
            {
                // return error code to caller
                return(4);
            }

            // instantiate central engine
            CentralEngine engine = new CentralEngine();

            // check for arguments that override CentralEngine defaults
            if (arguments != null)
            {
                if (arguments.Input != null)
                {
                    engine.InputPath = arguments.Input;
                }
                if (arguments.Output != null)
                {
                    engine.OutputPath = arguments.Output;
                }
                if (arguments.LogLevel != 0)
                {
                    logLevel = (eLogLevel)arguments.LogLevel;
                }
            }

            // instantiate central logger.  an additional parameter can be used to override
            // the default log level of Informational. Informational will include all messages
            // flagged as informational, warning, or error.  Use eLogLevel.Debug if you want
            // to see all debug messages.
            CentralLogger log = new CentralLogger(engine.OutputPath, engine.AppName, logLevel);

            // log all command-line arguments that are not Help, null, or empty.
            if (arguments != null)
            {
                log.WriteLine("Command-Line Arguments:");
                foreach (PropertyInfo property in arguments.GetType().GetProperties())
                {
                    if (property.Name != "Help" &&
                        property.GetValue(arguments, null) != null &&
                        property.GetValue(arguments, null).ToString().Trim().Length > 0)
                    {
                        log.WriteLine("".PadRight(4) + property.Name + " = " + property.GetValue(arguments, null));
                    }
                }
            }
            else
            {
                log.WriteLine("No parameters for current execution.");
            }

            #endregion

            /******************************************************************
            *
            *  This section is for executing the bulk of the business logic.
            *  This should mostly be handled by the application processor, which
            *  CentralProcessor is a template for.  This should be renamed with
            *  the application name: <AppName>Processor.cs, allowing the IDE to
            *  change any existing references.
            *
            *  Main() must return an int.  0 is used to indicate success.  4 is
            *  reserved for errors loading command-line arguments.  All other codes
            *  are currently dependent on the application, although common error
            *  codes may be defined in the future.
            *
            *  The processor must have a constructor that accepts the
            *  CentralEngine and CentralLogger objects, instantiated above.
            *  These objects should be made available to any other classes that
            *  may be defined, to provide consist logging, application paths and
            *  other additional functionality.
            *
            *  There is an override to the constuctor that also accepts the
            *  arguments object.  If there are no arguments that pertain to
            *  the actual execution of the job (versus configuration) this
            *  can be excluded.
            *
            *  Example use:
            *  CentralProcessor proc = new CentralProcessor(engine, log);
            *  CentralProcessor proc = new CentralProcessor(engine, log, arguments);
            ******************************************************************/

            // excecute processes here...
            CentralProcessor proc = new CentralProcessor(engine, log);

            try
            {
                proc.Run();
                return(0);
            }
            catch (Exception ex)
            {
                // TODO: log additional information related to error...

                log.WriteLine(ex.Message, eLogLevel.Error, true);
                log.WriteLine("Exit(1) - Failure", eLogLevel.Error, true);
                return(1);
            }
            finally
            {
                log.WriteLine("Job Complete!");
            }
        }