mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 21:25:52 +12:00
Fix interest.
This commit is contained in:
parent
8b36407981
commit
b939c9e142
6 changed files with 20 additions and 17 deletions
|
@ -2177,12 +2177,17 @@ namespace HISP.Server
|
|||
|
||||
public static void DoIntrestPayments(int intrestRate)
|
||||
{
|
||||
if (intrestRate == 0)
|
||||
{
|
||||
Logger.WarnPrint("Intrest rate is 0, as deviding by 0 causes the universe to implode, adding intrest has been skipped.");
|
||||
return;
|
||||
}
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE UserExt SET BankInterest=BankInterest * (1/@interestRate) AND NOT BankInterest * (1/@interestRate) > 9999999999.9999";
|
||||
sqlCommand.Parameters.AddWithValue("@interest", intrestRate);
|
||||
sqlCommand.CommandText = "UPDATE UserExt SET BankInterest = BankInterest + (BankInterest * (1/@interestRate)) WHERE NOT BankInterest + (BankInterest * (1/@interestRate)) > 9999999999.9999";
|
||||
sqlCommand.Parameters.AddWithValue("@interestRate", intrestRate);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue