Esempio n. 1
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                ConsoleFactory.LoadConfig();
                ConsoleFactory.ParseParameters(args);

                RunXfer();
            }
            else
            {
                Console.WriteLine("");
                Console.WriteLine("Loading Config...");
                ConsoleFactory.LoadConfig();

                try
                {
                    RunXfer();

                    Console.WriteLine("Completed processing Xfer file(s)");
                    ConsoleFactory.WriteEnd();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Esempio n. 2
0
        public static void OnError(string message)
        {
            ConsoleFactory.WriteLine("An error has occured:");
            ConsoleFactory.WriteLine(message);

            if (DisplayGUI)
            {
                Console.WriteLine("Press enter to exit", true);
                Console.ReadLine();
            }


            Environment.Exit(0);
        }
Esempio n. 3
0
        private static void Core_LogEvent(string log)
        {
            if (Global.DisplayGUI)
            {
                if (Global.DisplayLog != "NONE")
                {
                    try
                    {
                        JObject jsonLog = JObject.Parse(log);
                        JObject meta    = (JObject)jsonLog.GetValue("meta");
                        JObject r       = (JObject)jsonLog.GetValue("response");

                        string logLine = "DataElement: " + meta.GetValue("dataElement").ToString() + ", Org Unit: " + meta.GetValue("orgUnit").ToString() + ", Period: " + meta.GetValue("period").ToString() + ", Status : " + r.GetValue("status").ToString() + ", Description : " + r.GetValue("description").ToString();
                        string status;
                        switch (Global.DisplayLog)
                        {
                        case "ALL":
                            ConsoleFactory.WriteLine(logLine);

                            break;

                        case "SUCCESS":
                            status = r.GetValue("status").ToString();
                            if (status == "SUCCESS")
                            {
                                ConsoleFactory.WriteLine(logLine);
                            }
                            break;

                        case "ERROR":
                            status = r.GetValue("status").ToString();
                            if (status == "ERROR")
                            {
                                ConsoleFactory.WriteLine(logLine);
                            }
                            break;

                        default:
                            ConsoleFactory.WriteLine(logLine);
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        ConsoleFactory.WriteLine(log);
                    }
                }
            }
        }