Пример #1
0
        public override int Run(string[] remainingArguments)
        {
            var defaultcolor = Console.ForegroundColor;

            try
            {
                if (Columns == null)
                {
                    Columns = GetDefaultColumns(Entity);
                }

                var client = StaticDI.GetDefaultClient();

                if (!client.Logon())
                {
                    Console.WriteLine("Username password wrong");
                    return(ProcessResult.Error);
                }

                var query = GetQuery(client);
                Task.Run(() => PrintQuery(query)).Wait();

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("done.");
                Console.ForegroundColor = defaultcolor;

                return(ProcessResult.Success);
            }
            catch (Exception ex)
            {
                Exceptions.PrintException(ex);
                return(ProcessResult.Error);
            }
        }
        public override int Run(string[] remainingArguments)
        {
            var defaultColor = Console.ForegroundColor;

            try
            {
                if (remainingArguments.Length > 0)
                {
                    Entity = EnumParser.ParseFuzzy <Entity>(remainingArguments[0]);
                }

                var client = StaticDI.GetDefaultClient();
                if (!client.Logon())
                {
                    Console.WriteLine("Username password wrong");
                    return(FailureState);
                }

                var sync = new CsvSync(client, Entity);
                sync.Run(FileLocation).Wait();

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("done.");
                Console.ForegroundColor = defaultColor;

                if (KeepConsoleOpen)
                {
                    Console.ReadLine();
                }

                return(SuccessState);
            }
            catch (Exception ex)
            {
                Exceptions.PrintException(ex);
                return(FailureState);
            }
        }