Removed pass by reference
This commit is contained in:
parent
3f833429c8
commit
19b6012717
|
@ -10,7 +10,7 @@ namespace CryptoCalc
|
||||||
{
|
{
|
||||||
public class DBInteraction
|
public class DBInteraction
|
||||||
{
|
{
|
||||||
public static void SaveData<T>(ref T data) where T : DBClasses
|
public static void SaveData<T>(T data) where T : DBClasses
|
||||||
{
|
{
|
||||||
if (data is null)
|
if (data is null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,19 +22,16 @@ namespace CryptoCalc
|
||||||
|
|
||||||
private void saveButton_Click(object sender, RoutedEventArgs e)
|
private void saveButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
genericT = DummyTransaction();
|
DBInteraction.SaveData(DummyTransaction());
|
||||||
DBInteraction.SaveData(ref genericT);
|
|
||||||
}
|
}
|
||||||
private void saveWalletButton_Click(object sender, RoutedEventArgs e)
|
private void saveWalletButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
genericW = DummyWallet();
|
DBInteraction.SaveData(DummyWallet());
|
||||||
DBInteraction.SaveData(ref genericW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveButtonFromInput_Click(object sender, RoutedEventArgs e)
|
private void saveButtonFromInput_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
genericT = new(inputCurrency.Text, Convert.ToSingle(inputAmount.Text), inputType.Text);
|
DBInteraction.SaveData(new Transaction(inputCurrency.Text, Convert.ToSingle(inputAmount.Text), inputType.Text));
|
||||||
DBInteraction.SaveData(ref genericT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readButton_click(object sender, RoutedEventArgs e)
|
private void readButton_click(object sender, RoutedEventArgs e)
|
||||||
|
@ -49,7 +46,6 @@ namespace CryptoCalc
|
||||||
{
|
{
|
||||||
string query = $"SELECT * from {genericT.DBTableName} WHERE {nameof(genericT.Currency)}=\'{currencyText.Text}\'";
|
string query = $"SELECT * from {genericT.DBTableName} WHERE {nameof(genericT.Currency)}=\'{currencyText.Text}\'";
|
||||||
IEnumerable<Transaction> transactions = transactionDB.QueryData(genericT.DBTableName, query);
|
IEnumerable<Transaction> transactions = transactionDB.QueryData(genericT.DBTableName, query);
|
||||||
//transactions = DBInteraction.LoadTransactionsOfCurrency(currencyText.Text);
|
|
||||||
transactionsFoundListBox.Items.Clear();
|
transactionsFoundListBox.Items.Clear();
|
||||||
foreach (Transaction x in transactions)
|
foreach (Transaction x in transactions)
|
||||||
{
|
{
|
||||||
|
@ -57,12 +53,6 @@ namespace CryptoCalc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private IEnumerable<Transaction> ReadTransactionFromDB()
|
|
||||||
//{
|
|
||||||
// Transaction t = new();
|
|
||||||
// return transactionDB.LoadAllData(t.DBTableName);
|
|
||||||
//}
|
|
||||||
|
|
||||||
private Transaction DummyTransaction()
|
private Transaction DummyTransaction()
|
||||||
{
|
{
|
||||||
Transaction t = new();
|
Transaction t = new();
|
||||||
|
|
Loading…
Reference in New Issue