Esempio n. 1
0
        public static void run(Simple.Sqlite.SqliteDB db)
        {
            db.CreateTables()
            .Add <ServidoresCadastroModel>()
            .Commit();

            Console.WriteLine("Entre com a pasta:");
            string pasta = Console.ReadLine();

            uids = new HashSet <string>();
            processaPasta(pasta, db);
        }
Esempio n. 2
0
        public static void run(Simple.Sqlite.SqliteDB db)
        {
            db.CreateTables()
            .Add <AuxilioModel>()
            .Commit();

            string pasta = "";

            while (!Directory.Exists(pasta))
            {
                Console.WriteLine("Entre com a pasta:");
                pasta = Console.ReadLine();
            }

            {
                // recovery from where it stopped
                var allNis = db.Query <string>("SELECT NIS FROM AuxilioModel WHERE NIS IS NOT NULL", null)
                             .Select(nis => long.Parse(nis));
                uids = new HashSet <long>(allNis);
            }

            processaPasta(pasta, db);
        }
Esempio n. 3
0
        // One dot per line
        void run()
        {
            var view = new Lib.Aula08.ProdutoView_SQLite();

            // don't do that ....
            Console.WriteLine(view.BuscarProdutoParteNome("a").First().Nome);

            // do that
            var produtosBuscados = view.BuscarProdutoParteNome("a");
            var primeiro         = produtosBuscados.First();

            Console.WriteLine(primeiro.Nome);

            // Exceção:
            // 1. Linq pode .... mas não exagera

            var items = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            //não fazer
            items.Where(i => i % 2 == 0).Select(i => i.ToString()).OrderBy(o => o);

            //fazer
            items.Where(i => i % 2 == 0)
            .Select(i => i.ToString())
            .OrderBy(o => o);


            // 2. Chaining
            var db = new Simple.Sqlite.SqliteDB("f**k");

            // chaining ... ... vai...
            db.CreateTables()
            .Add <int>()
            .Add <decimal>()
            .Commit();
        }