New source control repo for Biskilog POS - secure hub to store & manage source code. Streamlines dev process, tracks changes, & improves collaboration. Ensures reliable software.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
using Biskilog_Accounting.Shared.CustomModels ;
using System.Net.Http.Json ;
using System.Text.Json ;
namespace Biskilog_Accounting.Client.Pages.Dashboard
{
public partial class Dashboard
{
private TradeSummary m_tradeSummary { get ; set ; } = new TradeSummary ( ) ;
private string m_username { get ; set ; } = string . Empty ;
protected override async Task OnInitializedAsync ( )
{
m_username = m_tokenService . GetUserNameFromToken ( await m_tokenService . GetToken ( ) ) ! ;
await GetSummary ( ) ;
return ;
}
/// <summary>
/// Gets the tade summary
/// </summary>
/// <returns></returns>
async Task GetSummary ( )
{
try
{
var response = await m_http . GetAsync ( "api/analytics/tradesummary" ) ;
if ( response . IsSuccessStatusCode )
{
var jsonContent = await response . Content . ReadAsStringAsync ( ) ;
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true } ;
var tradeSummary = JsonSerializer . Deserialize < TradeSummary > ( jsonContent , options ) ;
m_tradeSummary = tradeSummary ;
StateHasChanged ( ) ;
}
} catch ( Exception ex )
{
Console . WriteLine ( ex . Message ) ;
}
}
}
}