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 OnParametersSet() { CalculateStatistic(); } private void CalculateStatistic() { double change = ((CurrentTradeSales - PreviousTradeSales) / PreviousTradeSales) * 100; if (CurrentTradeSales > PreviousTradeSales) { 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) { string changePercent = (change * -1).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"; } StateHasChanged(); } } }