Changed float to decimal for better precision

This commit is contained in:
Stedd 2022-02-12 20:33:46 +01:00
parent b425986885
commit f491c3305c
2 changed files with 8 additions and 8 deletions

View File

@ -62,10 +62,10 @@ namespace CryptoCalc
public int WalletID { get; set; } public int WalletID { get; set; }
public string Currency { get; set; } public string Currency { get; set; }
public float Amount { get; set; } public decimal Amount { get; set; }
public string TransactionType { get; set; } public string TransactionType { get; set; }
public string FeeCurrency { get; set; } public string FeeCurrency { get; set; }
public float FeeAmount { get; set; } public decimal FeeAmount { get; set; }
public string Platform { get; set; } public string Platform { get; set; }
public string Note { get; set; } public string Note { get; set; }
@ -75,7 +75,7 @@ namespace CryptoCalc
public Transaction() { SetDBStrings(); } public Transaction() { SetDBStrings(); }
public Transaction(int walletID, string currency, float amount, string type) public Transaction(int walletID, string currency, decimal amount, string type)
{ {
SaveUnixTimeNow(); SaveUnixTimeNow();
WalletID = walletID; WalletID = walletID;
@ -89,7 +89,7 @@ namespace CryptoCalc
SetDBStrings(); SetDBStrings();
} }
public Transaction(string currency, float amount, string type, string feeCurrency, float feeAmount) public Transaction(string currency, decimal amount, string type, string feeCurrency, decimal feeAmount)
{ {
SaveUnixTimeNow(); SaveUnixTimeNow();
Currency = currency; Currency = currency;
@ -156,7 +156,7 @@ namespace CryptoCalc
public string Platform { get; set; } public string Platform { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Currency { get; set; } public string Currency { get; set; }
public float Balance { get; set; } public decimal Balance { get; set; }
public int DefaultWallet { get; set; } public int DefaultWallet { get; set; }
public string Note { get; set; } public string Note { get; set; }
@ -173,7 +173,7 @@ namespace CryptoCalc
Platform = platform; Platform = platform;
Name = name; Name = name;
Currency = currency; Currency = currency;
Balance = 0; Balance = 0M;
DefaultWallet = 0; DefaultWallet = 0;
Note = note; Note = note;

View File

@ -49,7 +49,7 @@ namespace CryptoCalc
new Transaction( new Transaction(
selectedWallet.Index, selectedWallet.Index,
inputCurrency.Text, inputCurrency.Text,
Convert.ToSingle(inputAmount.Text), Convert.ToDecimal(inputAmount.Text),
inputType.Text inputType.Text
) )
); );
@ -110,7 +110,7 @@ namespace CryptoCalc
t.WalletID = selectedWallet.Index; t.WalletID = selectedWallet.Index;
t.SaveUnixTimeNow(); t.SaveUnixTimeNow();
t.Currency = "SOL"; t.Currency = "SOL";
t.Amount = Convert.ToSingle(30 * rand.NextDouble()); t.Amount = Convert.ToDecimal(30 * rand.NextDouble());
t.TransactionType = "BUY"; t.TransactionType = "BUY";
t.Platform = "Firi"; t.Platform = "Firi";
t.Note = "Test"; t.Note = "Test";