Example #1
0
        public void Carregar()
        {
            if (!System.IO.File.Exists(_caminhoBanco))
            {
                CriarBancoVazio();
            }

            using (var db = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(), _caminhoBanco, storeDateTimeAsTicks: false))
            {
                Estabelecimentos = db.Table <Models.Estabelecimento>().ToList();
                Gastos           = db.Table <Models.Gasto>().ToList();
                foreach (var gasto in Gastos)
                {
                    gasto.Estabelecimento = Estabelecimentos.FirstOrDefault(e => e.Id == gasto.EstabelecimentoId);
                }
            }
        }