示例#1
0
        static void sqlite(IDictionary<string, string> param)
        {
            var bsn = new Bsn();

            if (param.ContainsKey("-alterar"))
            {
                string tipo = Console.ReadLine();
                string colunas = Console.ReadLine();

                if (tipo != "#TYPE bsn.core.Alvo")
                    throw new Exception("Não é um Alvo");

                Console.WriteLine("Persistindo Alvos...");

                string alvoCsv;
                while ((alvoCsv = Console.ReadLine()) != null)
                {
                    var alvo = Alvo.FromCSV(alvoCsv);
                    try
                    {
                        Console.Write(alvo);
                        bsn.Persistir(alvo);
                        Console.WriteLine(" - OK");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(" - FALHOU: {0}", ex.Message);
                    }
                }
            }
            else
            {
                bsn.ConsultarSqlite(param);
            }
        }