示例#1
0
        public WfResult Start(WorkflowAttributeCollection args, CancellationToken token)
        {
            WfResult result = WfResult.Succeeded;

            _args = args;

            Parameters parameters = new Parameters();

            try
            {
                Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

                string inputXml;
                if (_args.ContainsKey(XML))
                {
                    inputXml = _args[XML];
                }
                else
                {
                    inputXml = DeParameters();
                }

                if (!inputXml.StartsWith("<?xml version="))
                {
                    byte[] base64ByteArr = Convert.FromBase64String(XML);
                    inputXml = System.Text.UnicodeEncoding.Unicode.GetString(base64ByteArr);
                }

                parameters = Parameters.DeSerializefromXml(inputXml);

                _logger.Information("Running DE v.{Version} ({Bit} bit)", v.ToString(), 8 * IntPtr.Size);
                _logger.Information("Executing as: {User}", WindowsIdentity.GetCurrent().Name.ToString());
                _logger.Debug("DE input parameter: {DeXml}", inputXml);

                //logger.WriteDebug("DE XML: " + inputXml);

                DEController controller = new DEController(_logger);
                controller.Execute(parameters, token);
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Exception: {Message}", ex.Message);
                result = WfResult.Failed;
            }

            return(result);
        }
示例#2
0
        /// <summary>
        /// Entry point to CDR Delta Extractor. Takes parameters defined by an XML string based
        /// on the parameters.XSD schema.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static void Main(string[] args)
        {
            Parameters parameters = new Parameters();

            try
            {
                Version v   = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                string  XML = args[0];
                if (!XML.StartsWith("<?xml version="))
                {
                    byte[] base64ByteArr = Convert.FromBase64String(args[0]);
                    XML = System.Text.UnicodeEncoding.Unicode.GetString(base64ByteArr);
                }

                parameters = Parameters.DeSerializefromXml(XML);
                //Enable ETLController loging
                //EventLoggerDE de = EventLoggerDE.Create();
                debug = parameters.Debug;

                if (parameters.HeaderType == HeaderType.ETLHeader)
                {
                    //de.SetEventContext(new Dictionary<string, string>()
                    //{
                    //    {"CS",String.Format(@"Data Source={0};Initial Catalog={1};Integrated Security=SSPI;",parameters.ETLHeader.Controller.Server,parameters.ETLHeader.Controller.Database)},
                    //    {"Timeout",parameters.ETLHeader.Controller.QueryTimeout.ToString()},
                    //    {"prcPrint", "dbo.prc_Print"}
                    //});

                    ETLController.Connect(parameters.ETLHeader);
                }

                PrintOutput.PrintToOutput(String.Format(CultureInfo.InvariantCulture, "Running DE v.{0} ({1})bit", v.ToString(), 8 * IntPtr.Size));
                PrintOutput.PrintToOutput("Executing as: " + WindowsIdentity.GetCurrent().Name.ToString(), DERun.Debug);

                PrintOutput.PrintToOutput("DE XML: " + XML, DERun.Debug);


                DEController.Execute(parameters);
            }
            catch (Exception ex)
            {
                PrintOutput.PrintToError(ex.Message);
                Environment.Exit(1);
            }
            Environment.Exit(0);
        }