Gremlin/Gremlin_BlazorServer/Pages/QuoteDebug.razor.cs

59 lines
2.2 KiB
C#

using System.Diagnostics;
using System.Globalization;
using System.Security.Claims;
using Gremlin_BlazorServer.Data.EntityClasses;
using Gremlin_BlazorServer.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
namespace Gremlin_BlazorServer.Pages;
public partial class QuoteDebug {
private const bool debug = true;
private readonly CultureInfo cultureInfo = new("de-DE");
private readonly Quote quote = new() {
Recipient = GenericController.Get<Contact>(c => c.ContactId == 1),
SalesRep = GenericController.Get<SalesRep>(sR => sR.SalesRepId == 15)
};
private LineItem? selectedLineItem;
[CascadingParameter] private Task<AuthenticationState>? AuthenticationStateTask { get; set; }
protected override async Task OnParametersSetAsync() {
if (AuthenticationStateTask is not null) {
ClaimsPrincipal user = (await AuthenticationStateTask).User;
if (user.Identity is { IsAuthenticated: true })
quote.LineItems.Add(new() {
ProductNumber = "M8414AA",
QuoteId = quote.QuoteId
});
}
await base.OnInitializedAsync();
}
private async Task OnSave() {
Debug.WriteLine(await GenericController.InsertAsync(quote) > 0 ? "Wrote Quote to db." : "Error on writing Quote to db!");
}
private Task OnDescriptionChanged() => throw new NotImplementedException();
private Task OnQuotationNumberChanged() => throw new NotImplementedException();
private Task OnWarrantyChanged() => throw new NotImplementedException();
private Task OnValidForChanged() => throw new NotImplementedException();
private Task OnVATChanged() => throw new NotImplementedException();
private Task OnIsPriceInformationChanged() => throw new NotImplementedException();
private Task OnShowBruttoChanged() => throw new NotImplementedException();
private Task OnShowSinglePricesChanged() => throw new NotImplementedException();
private Task OnShowDiscountsChanged() => throw new NotImplementedException();
private Task OnSelectedLineItemChanged() => throw new NotImplementedException();
}