Changed read from database

This commit is contained in:
Stedd 2021-08-08 08:55:38 +02:00
parent 154c21fdcd
commit 3ffde5cf4b
3 changed files with 25 additions and 19 deletions

1
.gitignore vendored
View File

@ -361,3 +361,4 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
/nicehash_export.txt

View File

@ -34,21 +34,7 @@ namespace CryptoCalc
private void saveButton_Click(object sender, RoutedEventArgs e)
{
Transaction t = new();
t.Date_Year = DateTime.Today.Year;
t.Date_Month = DateTime.Today.Month;
t.Date_Day = DateTime.Today.Day;
t.Time_Hour = DateTime.Today.Hour;
t.Time_Minute = DateTime.Today.Minute;
t.Time_Second = DateTime.Today.Second;
t.DateTimeString = DateTime.Now.ToString();
t.CryptoCurrency = "ETH";
t.Amount = (float)rand.NextDouble();
t.TransactionType = "WITHDRAWAL";
t.Service = "MiraiEx";
t.Comment = "Test";
SqliteDataAccess.SaveTransaction(t);
SqliteDataAccess.SaveTransaction(dummyTransaction());
}
private void readButton_click(object sender, RoutedEventArgs e)
@ -56,9 +42,28 @@ namespace CryptoCalc
transactions = SqliteDataAccess.LoadTransactions();
foreach (var x in transactions)
{
Debug.WriteLine(x.Date_Year);
Debug.WriteLine($"{x.DateTimeString} *** {x.CryptoCurrency} - {x.Amount}");
}
//Debug.WriteLine(transactions.Date_Year.ToString());
//Debug.WriteLine(DateTime.Now.Minute.ToString());
}
private Transaction dummyTransaction()
{
Transaction t = new();
t.Date_Year = DateTime.Now.Year;
t.Date_Month = DateTime.Now.Month;
t.Date_Day = DateTime.Now.Day;
t.Time_Hour = DateTime.Now.Hour;
t.Time_Minute = DateTime.Now.Minute;
t.Time_Second = DateTime.Now.Second;
t.DateTimeString = DateTime.Now.ToString();
t.CryptoCurrency = "ETH";
t.Amount = (float)rand.NextDouble();
t.TransactionType = "WITHDRAWAL";
t.Service = "MiraiEx";
t.Comment = "Test";
return t;
}
}
}

View File

@ -17,7 +17,7 @@ namespace CryptoCalc
{
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
{
var output = cnn.Query<Transaction>("select Date_Year from RawData", new DynamicParameters());
var output = cnn.Query<Transaction>("select * from RawData", new DynamicParameters());
Debug.WriteLine("Loaded DB data");
return output.ToList();