Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("HockeyPlayerDatabase - import dat");
            dbContext = new HockeyContext();

            try
            {
                // nacitanie argumentov, na poradi nezalezi
                var order = 0;
                foreach (var arg in args)
                {
                    if (arg == "-clubs")
                    {
                        clubsCsvPath = args[order + 1];
                    }
                    else if (arg == "-players")
                    {
                        playersCsvPath = args[order + 1];
                    }
                    order++;
                }

                // zmazat data ak je nastaveny argument
                if (args.Contains("-clearDatabase"))
                {
                    dbContext.ClearDatabase();
                }

                FileHelperEngine <ClubsHeader> engineClubs = new FileHelperEngine <ClubsHeader>();
                ImportClubs(engineClubs, clubsCsvPath);
                FileHelperEngine <PlayersHeader> enginePlayers = new FileHelperEngine <PlayersHeader>();
                ImportPlayers(enginePlayers, playersCsvPath);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Neocakavana chyba pri spracovani importu: {e}");
            }

            Console.WriteLine("Import bol uspesne dokonceny.");
            Console.ReadLine();
        }