Files
webdoorcreator/WebDoorCreator.UI/Pages/DoorDefinition.razor.cs
T

61 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using WebDoorCreator.UI;
using WebDoorCreator.UI.Components;
using WebDoorCreator.UI.Shared;
using WebDoorCreator.Data.DbModels;
using MailKit;
using Microsoft.AspNetCore.WebUtilities;
using System.Drawing.Printing;
using WebDoorCreator.Data.Controllers;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Pages
{
public partial class DoorDefinition
{
[Inject]
protected NavigationManager navManager { get; set; } = null!;
[Inject]
protected WebDoorCreatorService WDService { get; set; } = null!;
protected int idOrd { get; set; } = 0;
protected OrderStatusViewModel? orderStatus { get; set; } = null;
private List<OrderStatusViewModel>? ListOrdersStatus = null;
protected async override Task OnInitializedAsync()
{
await Task.Delay(1);
var uri = navManager.ToAbsoluteUri(navManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOrd", out var _idOrd))
{
idOrd = int.Parse(_idOrd);
await reloadData();
}
}
protected async Task reloadData()
{
var adesso = DateTime.Now.Date;
ListOrdersStatus = null;
await Task.Delay(1);
ListOrdersStatus = await WDService.GetOrderStatus(0, 0, adesso.AddYears(-2), adesso);
if (ListOrdersStatus != null)
{
orderStatus = ListOrdersStatus.Where(x => x.OrderId == idOrd).FirstOrDefault();
}
await Task.Delay(1);
}
}
}