Exemplo n.º 1
0
 public bool updateWaluta(Waluta waluta)
 {
     try
     {
         using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "Waluty.db")))
         {
             connection.Query <Waluta>("UPDATE Waluta set Data=?,Kupno=?,Sprzedaz=? Where Kod=?", waluta.Data, waluta.Kupno, waluta.Sprzedaz, waluta.Kod);
             return(true);
         }
     }
     catch (SQLiteException e)
     {
         Log.Info("SQLiteEX", e.Message);
         return(false);
     }
 }
Exemplo n.º 2
0
 public bool InsertIntoWaluta(Waluta waluta)
 {
     try
     {
         using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "Waluty.db")))
         {
             connection.Insert(waluta);
             return(true);
         }
     }
     catch (SQLiteException e)
     {
         Log.Info("SQLiteEX", e.Message);
         return(false);
     }
 }
Exemplo n.º 3
0
        void UpdateData(List <TabelaC.RootObject> mItems)
        {
            for (int i = 0; i < mItems[0].rates.Count; i++)
            {
                Waluta awaluta = new Waluta()
                {
                    Id       = i,
                    Data     = DateTime.Parse(mItems[0].effectiveDate),
                    Nazwa    = mItems[0].rates[i].currency,
                    Kod      = mItems[0].rates[i].code,
                    Kupno    = mItems[0].rates[i].bid,
                    Sprzedaz = mItems[0].rates[i].ask
                };
                db.updateWaluta(awaluta);
            }
            mWaluta = db.selectWaluta();
            ListViewAdapter adapter = new ListViewAdapter(this, mWaluta);

            mListView.Adapter = adapter;
        }
Exemplo n.º 4
0
        void AddData(List <TabelaA.RootObject> mItems)
        {
            for (int i = 0; i < mItems[0].rates.Count; i++)
            {
                Waluta awaluta = new Waluta()
                {
                    Id     = i,
                    Data   = DateTime.Parse(mItems[0].effectiveDate),
                    Nazwa  = mItems[0].rates[i].currency,
                    Kod    = mItems[0].rates[i].code,
                    Średni = mItems[0].rates[i].mid
                };

                db.InsertIntoWaluta(awaluta);
            }

            mClient1 = new WebClient();
            mUrl1    = new System.Uri("http://api.nbp.pl/api/exchangerates/tables/c/?format=json");
            mClient1.DownloadDataAsync(mUrl1);
            mClient1.DownloadDataCompleted += MClient_DownloadDataCompleted1;
        }