using Microsoft.AspNetCore.Components; namespace Biskilog_Accounting.Client.Pages.Dashboard.Elements { public partial class WelcomeCard { [Parameter] public string Username { get; set; } = string.Empty; [Parameter] public double CurrentTradeSales { get; set; } = 0; [Parameter] public double PreviousTradeSales { get; set; } = 0; private string m_remarks { get; set; } = ""; protected override void OnInitialized() { CalculateStatistic(); base.OnInitialized(); } private void CalculateStatistic() { if (CurrentTradeSales > PreviousTradeSales) { double change = (CurrentTradeSales / (CurrentTradeSales + PreviousTradeSales)) * 100; string changePercent = change.ToString("0.00") + "%"; m_remarks = $"You made a total of {m_calculator.FormatMoneyWithCurrency(CurrentTradeSales)} in the current trade, {changePercent} more than the previous trade sales"; } else if (PreviousTradeSales > CurrentTradeSales) { double change = (CurrentTradeSales / (CurrentTradeSales + PreviousTradeSales)) * -100; string changePercent = change.ToString("0.00") + "%"; m_remarks = $"You made a total of {m_calculator.FormatMoneyWithCurrency(CurrentTradeSales)} in the current trade, {changePercent} less than the previous trade sales"; } else { m_remarks = $"You made a total of {m_calculator.FormatMoneyWithCurrency(CurrentTradeSales)} in the current trade, same as the previous trade sales"; } } } }