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

View File

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