add AuthorizeView to alle Pages
parent
2bc970ad13
commit
2a8852f7af
@ -0,0 +1,61 @@
|
||||
@page "/Accounts"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject GenericController genericController
|
||||
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<h1>Accounts</h1>
|
||||
<DataGrid TItem="Account" Data="@accounts" SelectedRow="@selectedAccount" SelectedRowChanged="@OnSelectedAccountChanged" UseValidation Narrow Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn/>
|
||||
<DataGridColumn Field="@nameof(Account.AccountId)" Caption="AccountId" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(Account.AccountName)" Caption="AccountName" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(Account.Street)" Caption="Street" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Account.Zip)" Caption="Zip" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(Account.City)" Caption="City" Filterable Sortable Editable/>
|
||||
</DataGrid>
|
||||
|
||||
@if (selectedAccount != null)
|
||||
{
|
||||
<h2>Contacts in @selectedAccount.AccountName</h2>
|
||||
<DataGrid TItem="Contact" Data="@selectedAccount.Contacts" UseValidation Narrow Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn/>
|
||||
<DataGridColumn Field="@nameof(Contact.ContactId)" Caption="ContactId" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(Contact.LastName)" Caption="LastName" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(Contact.FirstName)" Caption="FirstName" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.Gender)" Caption="Gender" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.EMail)" Caption="EMail" Filterable Sortable Editable/>
|
||||
</DataGrid>
|
||||
}
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<h3>Authentication Failure!</h3>
|
||||
<p>You're not signed in. Please click on the upper right to either register or log in.</p>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
private Task<AuthenticationState>? authenticationStateTask { get; set; }
|
||||
|
||||
private IList<Account>? accounts;
|
||||
private Account? selectedAccount;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (authenticationStateTask != null)
|
||||
{
|
||||
var user = (await authenticationStateTask).User;
|
||||
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
accounts = genericController.GetAll<Account>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectedAccountChanged(Account sA) => selectedAccount = sA;
|
||||
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
@page "/Accounts/AccountIndex"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject GenericController GenericController
|
||||
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<h1>Accounts</h1>
|
||||
<DataGrid TItem="Account" Data="@accounts" SelectedRow="@selectedAccount" SelectedRowChanged="@OnSelectedAccountChanged" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn/>
|
||||
<DataGridColumn Field="@nameof(Account.AccountId)" Caption="AccountId" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Account.AccountName)" Caption="AccountName" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Account.Street)" Caption="Street" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Account.Zip)" Caption="Zip" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Account.City)" Caption="City" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Account.SapAccountNumber)" Caption="SapAccountNumber" Filterable Sortable Editable/>
|
||||
</DataGrid>
|
||||
|
||||
<h2>Contacts in @selectedAccount.AccountName</h2>
|
||||
<DataGrid TItem="Contact" Data="@selectedAccount.Contacts" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn/>
|
||||
<DataGridColumn Field="@nameof(Contact.ContactId)" Caption="ContactId" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.AccountId)" Caption="AccountId" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.LastName)" Caption="LastName" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.FirstName)" Caption="FirstName" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.Gender)" Caption="Gender" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.EMail)" Caption="EMail" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.SapContactNumber)" Caption="SAPContactNumber" Filterable Sortable Editable/>
|
||||
</DataGrid>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<h3>Authentication Failure!</h3>
|
||||
<p>You're not signed in. Please click on the upper right to either register or log in.</p>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
private Task<AuthenticationState>? authenticationStateTask { get; set; }
|
||||
|
||||
private IList<Account>? accounts;
|
||||
private Account? selectedAccount;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (authenticationStateTask != null)
|
||||
{
|
||||
var user = (await authenticationStateTask).User;
|
||||
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
accounts = GenericController.GetAll<Account>();
|
||||
selectedAccount = accounts.First();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectedAccountChanged(Account sA) => selectedAccount = sA;
|
||||
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
@page "/Accounts/Add"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject AccountService AccountService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h2>Add Account</h2>
|
||||
<hr />
|
||||
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="SAPAccountNumber" class="control-label">SAPAccountNumber</label>
|
||||
<input form="SAPAccountNumber" class="form-control" @bind="@account.SapAccountNumber" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="AccountName" class="control-label">AccountName</label>
|
||||
<input form="AccountName" class="form-control" @bind="@account.AccountName" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Street" class="control-label">Street</label>
|
||||
<input form="Street" class="form-control" @bind="@account.Street" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ZIP" class="control-label">ZIP</label>
|
||||
<input form="ZIP" class="form-control" @bind="@account.Zip" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="City" class="control-label">City</label>
|
||||
<input form="City" class="form-control" @bind="@account.City" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<input type="button" class="btn btn-primary" @onclick="@CreateAccount" value="Save"/>
|
||||
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
Account account = new();
|
||||
|
||||
protected async void CreateAccount()
|
||||
{
|
||||
account.DataModificationByUser = "Gremlin_BlazorServer";
|
||||
account.AccountType.AccountTypeCode = "SUP";
|
||||
|
||||
if (await AccountService.InsertAccountAsync(account))
|
||||
{
|
||||
NavigationManager.NavigateTo("Accounts/Index");
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel() => NavigationManager.NavigateTo("Accounts/Index");
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
@page "/Accounts/Delete/{AccountId}"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject AccountService AccountService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h2>Delete Employee</h2>
|
||||
<hr />
|
||||
<h3>Are you sure want to delete this?</h3>
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class=" col-md-8">
|
||||
<div class="form-group">
|
||||
<label>AccountId:</label>
|
||||
<label>@account.AccountId</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>AccountName:</label>
|
||||
<label>@account.AccountName</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Street:</label>
|
||||
<label>@account.Street</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>ZIP:</label>
|
||||
<label>@account.Zip</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>City:</label>
|
||||
<label>@account.City</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<input type="button" class="btn btn-danger" @onclick="@DeleteAccount" value="Delete" />
|
||||
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string AccountId { get; set; } = default!;
|
||||
Account account = new();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
account = await Task.Run(() => AccountService.GetAccountAsync(Convert.ToUInt32(AccountId)));
|
||||
}
|
||||
protected async void DeleteAccount()
|
||||
{
|
||||
await AccountService.DeleteAccountAsync(account);
|
||||
NavigationManager.NavigateTo("Accounts/Index");
|
||||
}
|
||||
void Cancel()
|
||||
{
|
||||
NavigationManager.NavigateTo("Accounts/Index");
|
||||
}
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
@page "/Accounts/Edit/{AccountId}"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject AccountService AccountService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h2>Edit Account</h2>
|
||||
<hr />
|
||||
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="AccountId" class="control-label">AccountId</label>
|
||||
<input form="AccountId" class="form-control" @bind="@account.AccountId" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="SAPAccountNumber" class="control-label">SAPAccountNumber</label>
|
||||
<input form="SAPAccountNumber" class="form-control" @bind="@account.SapAccountNumber" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="AccountName" class="control-label">Name</label>
|
||||
<input form="AccountName" class="form-control" @bind="@account.AccountName" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Street" class="control-label">Street</label>
|
||||
<input form="Street" class="form-control" @bind="@account.Street" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ZIP" class="control-label">ZIP</label>
|
||||
<input form="ZIP" class="form-control" @bind="@account.Zip" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="City" class="control-label">City</label>
|
||||
<input form="City" class="form-control" @bind="@account.City" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<input type="button" class="btn btn-primary" @onclick="@UpdateAccount" value="Update" />
|
||||
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string AccountId { get; set; } = string.Empty;
|
||||
Account account = new();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
account = await Task.Run(() => AccountService.GetAccountAsync(Convert.ToUInt32(AccountId)));
|
||||
}
|
||||
|
||||
protected async void UpdateAccount()
|
||||
{
|
||||
await AccountService.UpdateAccountAsync(account);
|
||||
NavigationManager.NavigateTo("Accounts/Index");
|
||||
}
|
||||
|
||||
void Cancel() => NavigationManager.NavigateTo("Accounts/Index");
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
@page "/Contacts"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
@using System.Globalization;
|
||||
|
||||
@inject GenericController genericController
|
||||
|
||||
<h1>Contacts</h1>
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<DataGrid TItem="Contact" Data="@contacts" SelectedRow="@selectedContact" SelectedRowChanged="@OnSelectedContactChanged" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn />
|
||||
<DataGridColumn Field="@nameof(Contact.ContactId)" Caption="ContactId" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.AccountId)" Caption="AccountId" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.LastName)" Caption="LastName" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.FirstName)" Caption="FirstName" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.Gender)" Caption="Gender" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.EMail)" Caption="EMail" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.SapContactNumber)" Caption="SAPContactNumber" Filterable Sortable Editable/>
|
||||
</DataGrid>
|
||||
|
||||
@if (selectedContact != null)
|
||||
{
|
||||
<h2>Quotes for SelectedContact: @selectedContact.FirstName @selectedContact.LastName</h2>
|
||||
<DataGrid TItem=" Quote" Data="@selectedContact.Quotes" SelectedRow="@selectedQuote" SelectedRowChanged="@OnSelectedQuoteChanged" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn />
|
||||
<DataGridColumn Field="@nameof(Quote.QuoteId)" Caption="#" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.QuotationNumber)" Caption="QuotationNumber" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.QuotationDate)" Caption="Date" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.ValidUntil)" Caption="ValidUntil" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.TotalNet)" Caption="TotalNet" DisplayFormat="{0:C}" DisplayFormatProvider=cultureInfo Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.TotalGross)" Caption="TotalGross" DisplayFormat="{0:C}" DisplayFormatProvider=cultureInfo Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.QuoteContains3Pp)" Caption="3PP" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.QuoteContainsRb)" Caption="RB" Filterable Sortable/>
|
||||
</DataGrid>
|
||||
}
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<h3>Authentication Failure!</h3>
|
||||
<p>You're not signed in. Please click on the upper right to either register or log in.</p>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
||||
@if (selectedQuote != null)
|
||||
{
|
||||
<h2>LineItems in SelectedQuote: @selectedQuote.QuotationNumber</h2>
|
||||
<DataGrid TItem="LineItem" Data="@selectedQuote.LineItems" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn />
|
||||
<DataGridColumn Field="@nameof(LineItem.Amount)" Caption="Amount" />
|
||||
<DataGridColumn Field="@nameof(LineItem.ProductNumber)" Caption="ProductNumber" />
|
||||
<DataGridColumn Field="@nameof(LineItem.OptionNumber)" Caption="OptionNumber" />
|
||||
<DataGridColumn Field="@nameof(LineItem.ListPrice)" DisplayFormat="{0:C}" DisplayFormatProvider=cultureInfo Caption="ListPrice" />
|
||||
<DataGridColumn Field="@nameof(LineItem.TotalDiscount)" Caption="TotalDiscount" DisplayFormat="{0.00%}." DisplayFormatProvider=cultureInfo />
|
||||
<DataGridColumn Field="@nameof(LineItem.Total)" DisplayFormat="{0:C}" DisplayFormatProvider=cultureInfo Caption="Total" />
|
||||
</DataGrid>
|
||||
}
|
||||
@code {
|
||||
private IList<Contact>? contacts;
|
||||
private Contact? selectedContact;
|
||||
private Quote? selectedQuote;
|
||||
private IList<Quote>? quotesOfSelectedContact;
|
||||
private IList<LineItem>? lineItemsInSelectedQuote;
|
||||
private readonly CultureInfo cultureInfo = new("de-DE");
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
contacts = genericController.GetAll<Contact>();
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
private Task OnSelectedContactChanged(Contact sC)
|
||||
{
|
||||
selectedContact = null;
|
||||
quotesOfSelectedContact = genericController.GetAll<Quote>(q => q.Recipient == sC);
|
||||
selectedContact = sC;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task OnSelectedQuoteChanged(Quote sQ)
|
||||
{
|
||||
selectedQuote = null;
|
||||
lineItemsInSelectedQuote = genericController.GetAll<LineItem>(l => l.Quote == sQ);
|
||||
selectedQuote = sQ;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
@page "/Contacts/Add"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject ContactService ContactService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject AccountService AccountService
|
||||
|
||||
<h2>Add Contact</h2>
|
||||
<hr />
|
||||
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="ContactId" class="control-label">ContactId</label>
|
||||
<input form="ContactId" class="form-control" @bind="@contact.ContactId" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="AccountId" class="control-label">AccountId</label>
|
||||
<input form="AccountId" class="form-control" @bind="@contact.AccountId" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="LastName" class="control-label">LastName</label>
|
||||
<input form="LastName" class="form-control" @bind="@contact.LastName" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="FirstName" class="control-label">FirstName</label>
|
||||
<input form="FirstName" class="form-control" @bind="@contact.FirstName" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Gender" class="control-label">Gender</label>
|
||||
<input form="Gender" class="form-control" @bind="@contact.Gender" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="EMail" class="control-label">EMail</label>
|
||||
<input form="EMail" class="form-control" @bind="@contact.EMail" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="SAPContactNumber" class="control-label">SAPContactNumber</label>
|
||||
<input form="SAPContactNumber" class="form-control" @bind="@contact.SapContactNumber" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<input type="button" class="btn btn-primary" @onclick="@CreateContact" value="Save"/>
|
||||
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
Contact contact = new();
|
||||
|
||||
protected async void CreateContact()
|
||||
{
|
||||
contact.DataModificationByUser = "Gremlin_BlazorServer";
|
||||
//contact.DataStatus = "Active";
|
||||
|
||||
if (await ContactService.InsertContactAsync(contact))
|
||||
{
|
||||
NavigationManager.NavigateTo("Contacts/Index");
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel() => NavigationManager.NavigateTo("Contacts/Index");
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
@page "/Contacts/ContactIndex"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
@using System.Globalization;
|
||||
|
||||
@inject GenericController genericController
|
||||
|
||||
<h1>Contacts</h1>
|
||||
|
||||
<DataGrid TItem="Contact" Data="@contacts" SelectedRow="@selectedContact" SelectedRowChanged="@OnSelectedContactChanged" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn />
|
||||
<DataGridColumn Field="@nameof(Contact.ContactId)" Caption="ContactId" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.AccountId)" Caption="AccountId" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.LastName)" Caption="LastName" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.FirstName)" Caption="FirstName" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.Gender)" Caption="Gender" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.EMail)" Caption="EMail" Filterable Sortable Editable/>
|
||||
<DataGridColumn Field="@nameof(Contact.SapContactNumber)" Caption="SAPContactNumber" Filterable Sortable Editable/>
|
||||
</DataGrid>
|
||||
|
||||
@if (selectedContact != null)
|
||||
{
|
||||
<h2>Quotes for SelectedContact: @selectedContact.FirstName @selectedContact.LastName</h2>
|
||||
<DataGrid TItem="Quote" Data="@selectedContact.Quotes" SelectedRow="@selectedQuote" SelectedRowChanged="@OnSelectedQuoteChanged" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn />
|
||||
<DataGridColumn Field="@nameof(Quote.QuoteId)" Caption="#" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.QuotationNumber)" Caption="QuotationNumber" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.QuotationDate)" Caption="Date" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.ValidUntil)" Caption="ValidUntil" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.TotalNet)" Caption="TotalNet" DisplayFormat="{0:C}" DisplayFormatProvider=cultureInfo Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.TotalGross)" Caption="TotalGross" DisplayFormat="{0:C}" DisplayFormatProvider=cultureInfo Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.QuoteContains3Pp)" Caption="3PP" Filterable Sortable/>
|
||||
<DataGridColumn Field="@nameof(Quote.QuoteContainsRb)" Caption="RB" Filterable Sortable/>
|
||||
</DataGrid>
|
||||
}
|
||||
|
||||
@if (selectedQuote != null)
|
||||
{
|
||||
<h2>LineItems in SelectedQuote: @selectedQuote.QuotationNumber</h2>
|
||||
<DataGrid TItem="LineItem" Data="@selectedQuote.LineItems" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn />
|
||||
<DataGridColumn Field="@nameof(LineItem.Amount)" Caption="Amount" />
|
||||
<DataGridColumn Field="@nameof(LineItem.ProductNumber)" Caption="ProductNumber" />
|
||||
<DataGridColumn Field="@nameof(LineItem.OptionNumber)" Caption="OptionNumber" />
|
||||
<DataGridColumn Field="@nameof(LineItem.ListPrice)" DisplayFormat="{0:C}" DisplayFormatProvider=cultureInfo Caption="ListPrice" />
|
||||
<DataGridColumn Field="@nameof(LineItem.TotalDiscount)" Caption="TotalDiscount" DisplayFormat="{0.00%}." DisplayFormatProvider=cultureInfo />
|
||||
<DataGridColumn Field="@nameof(LineItem.Total)" DisplayFormat="{0:C}" DisplayFormatProvider=cultureInfo Caption="Total" />
|
||||
</DataGrid>
|
||||
}
|
||||
@code {
|
||||
private IList<Contact>? contacts;
|
||||
private Contact? selectedContact;
|
||||
private Quote? selectedQuote;
|
||||
private IList<Quote>? quotesOfSelectedContact;
|
||||
private IList<LineItem>? lineItemsInSelectedQuote;
|
||||
private readonly CultureInfo cultureInfo = new("de-DE");
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
contacts = genericController.GetAll<Contact>();
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
private Task OnSelectedContactChanged(Contact sC)
|
||||
{
|
||||
selectedContact = null;
|
||||
quotesOfSelectedContact = genericController.GetAll<Quote>(q => q.Recipient == sC);
|
||||
selectedContact = sC;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task OnSelectedQuoteChanged(Quote sQ)
|
||||
{
|
||||
selectedQuote = null;
|
||||
lineItemsInSelectedQuote = genericController.GetAll<LineItem>(l => l.Quote == sQ);
|
||||
selectedQuote = sQ;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
@page "/Contacts/Delete/{ContactId}"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject ContactService ContactService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h2>Delete Employee</h2>
|
||||
<hr />
|
||||
<h3>Are you sure want to delete this?</h3>
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class=" col-md-8">
|
||||
<div class="form-group">
|
||||
<label>ContactId:</label>
|
||||
<label>@contact.ContactId</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>ContactId:</label>
|
||||
<label>@contact.ContactId</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>LastName:</label>
|
||||
<label>@contact.LastName</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>FirstName:</label>
|
||||
<label>@contact.FirstName</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Gender:</label>
|
||||
<label>@contact.Gender</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>EMail:</label>
|
||||
<label>@contact.EMail</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>SAPContactNumber:</label>
|
||||
<label>@contact.SapContactNumber</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<input type="button" class="btn btn-danger" @onclick="@DeleteContact" value="Delete" />
|
||||
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string ContactId { get; set; } = default!;
|
||||
Contact contact = new();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
contact = await Task.Run(() => ContactService.GetContactAsync(Convert.ToUInt32(ContactId)));
|
||||
}
|
||||
protected async void DeleteContact()
|
||||
{
|
||||
await ContactService.DeleteContactAsync(contact);
|
||||
NavigationManager.NavigateTo("Contacts/Index");
|
||||
}
|
||||
void Cancel()
|
||||
{
|
||||
NavigationManager.NavigateTo("Contacts/Index");
|
||||
}
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
@page "/Contacts/Edit/{ContactId}"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject ContactService ContactService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h2>Edit Contact</h2>
|
||||
<hr />
|
||||
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="ContactId" class="control-label">ContactId</label>
|
||||
<input form="ContactId" class="form-control" @bind="@contact.ContactId" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="AccountId" class="control-label">AccountId</label>
|
||||
<input form="AccountId" class="form-control" @bind="@contact.AccountId" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="LastName" class="control-label">LastName</label>
|
||||
<input form="LastName" class="form-control" @bind="@contact.LastName" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="FirstName" class="control-label">FirstName</label>
|
||||
<input form="FirstName" class="form-control" @bind="@contact.FirstName" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Gender" class="control-label">Gender</label>
|
||||
<input form="Gender" class="form-control" @bind="@contact.Gender" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="EMail" class="control-label">EMail</label>
|
||||
<input form="EMail" class="form-control" @bind="@contact.EMail" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="SAPContactNumber" class="control-label">SAPContactNumber</label>
|
||||
<input form="SAPContactNumber" class="form-control" @bind="@contact.SapContactNumber" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<input type="button" class="btn btn-primary" @onclick="@UpdateContact" value="Update" />
|
||||
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string ContactId { get; set; } = string.Empty;
|
||||
Contact contact = new();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
contact = await Task.Run(() => ContactService.GetContactAsync(Convert.ToUInt32(ContactId)));
|
||||
}
|
||||
|
||||
protected async void UpdateContact()
|
||||
{
|
||||
contact.DataModificationByUser = "Gremlin_BlazorServer";
|
||||
contact.DataModificationDate = DateTime.Now;
|
||||
contact.DataVersionNumber++;
|
||||
await ContactService.UpdateContactAsync(contact);
|
||||
NavigationManager.NavigateTo("Contacts/Index");
|
||||
}
|
||||
|
||||
void Cancel() => NavigationManager.NavigateTo("Contacts/Index");
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
@page "/CustomDescriptions"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject GenericController genericController
|
||||
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<h1>CustomDescriptions</h1>
|
||||
<DataGrid TItem="CustomDescription" Data="@customDescriptions" SelectedRow="@selectedCustomDescription" SelectedRowChanged="@OnSelectedCustomDescriptionChanged" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn />
|
||||
<DataGridColumn Field="@nameof(CustomDescription.ProductNumber)" Caption="ProductNumber" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(CustomDescription.OptionNumber)" Caption="OptionNumber" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(CustomDescription.Heading)" Caption="Heading" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(CustomDescription.DescriptionText)" Caption="DescriptionText" Filterable Sortable Editable />
|
||||
</DataGrid>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<h3>Authentication Failure!</h3>
|
||||
<p>You're not signed in. Please click on the upper right to either register or log in.</p>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
private Task<AuthenticationState>? authenticationStateTask { get; set; }
|
||||
|
||||
private IList<CustomDescription>? customDescriptions;
|
||||
private CustomDescription? selectedCustomDescription;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (authenticationStateTask != null)
|
||||
{
|
||||
var user = (await authenticationStateTask).User;
|
||||
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
customDescriptions = genericController.GetAll<CustomDescription>();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnSelectedCustomDescriptionChanged(CustomDescription sCd) => selectedCustomDescription = sCd;
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
@page "/CustomDescriptions/Add"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject CustomDescriptionService CustomDescriptionService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h2>Add CustomDescription</h2>
|
||||
<hr />
|
||||
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="CustomDescriptionId" class="control-label">CustomDescriptionId</label>
|
||||
<input form="CustomDescriptionId" class="form-control" @bind="@customDescription.CustomDescriptionId" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ProductNumber" class="control-label">ProductNumber</label>
|
||||
<input form="ProductNumber" class="form-control" @bind="@customDescription.ProductNumber" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="OptionNumber" class="control-label">OptionNumber</label>
|
||||
<input form="OptionNumber" class="form-control" @bind="@customDescription.OptionNumber" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Heading" class="control-label">Heading</label>
|
||||
<input form="Heading" class="form-control" @bind="@customDescription.Heading" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="DescriptionText" class="control-label">DescriptionText</label>
|
||||
<input form="DescriptionText" class="form-control" @bind="@customDescription.DescriptionText" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<input type="button" class="btn btn-primary" @onclick="@CreateCustomDescription" value="Save"/>
|
||||
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
CustomDescription customDescription = new();
|
||||
|
||||
protected async void CreateCustomDescription()
|
||||
{
|
||||
customDescription.DataModificationByUser = "Gremlin_BlazorServer";
|
||||
|
||||
if (await CustomDescriptionService.InsertCustomDescriptionAsync(customDescription))
|
||||
{
|
||||
NavigationManager.NavigateTo("CustomDescriptions/Index");
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel() => NavigationManager.NavigateTo("CustomDescriptions/Index");
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
@page "/CustomDescriptions/Delete/{CustomDescriptionId}"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject CustomDescriptionService CustomDescriptionService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h2>Delete Employee</h2>
|
||||
<hr />
|
||||
<h3>Are you sure want to delete this?</h3>
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class=" col-md-8">
|
||||
<div class="form-group">
|
||||
<label>CustomDescriptionId:</label>
|
||||
<label>@customDescription!.CustomDescriptionId</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>ProductNumber:</label>
|
||||
<label>@customDescription.ProductNumber</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>OptionNumber:</label>
|
||||
<label>@customDescription.OptionNumber</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Heading:</label>
|
||||
<label>@customDescription.Heading</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>DescriptionText:</label>
|
||||
<label>@customDescription.DescriptionText</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<input type="button" class="btn btn-danger" @onclick="@DeleteCustomDescription" value="Delete" />
|
||||
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string CustomDescriptionId { get; set; } = string.Empty;
|
||||
CustomDescription customDescription = new();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
customDescription = await Task.Run(() => CustomDescriptionService.GetCustomDescriptionAsync(Convert.ToUInt32(CustomDescriptionId)));
|
||||
}
|
||||
protected async void DeleteCustomDescription()
|
||||
{
|
||||
await CustomDescriptionService.DeleteCustomDescriptionAsync(customDescription);
|
||||
NavigationManager.NavigateTo("CustomDescriptions/Index");
|
||||
}
|
||||
void Cancel()
|
||||
{
|
||||
NavigationManager.NavigateTo("CustomDescriptions/Index");
|
||||
}
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
@page "/CustomDescriptions/Edit/{CustomDescriptionId}"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject CustomDescriptionService CustomDescriptionservice
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h2>Edit CustomDescription</h2>
|
||||
<hr />
|
||||
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="CustomDescriptionId" class="control-label">CustomDescriptionId</label>
|
||||
<input form="CustomDescriptionId" class="form-control" @bind="@customDescription.CustomDescriptionId" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ProductNumber" class="control-label">ProductNumber</label>
|
||||
<input form="ProductNumber" class="form-control" @bind="@customDescription.ProductNumber" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="OptionNumber" class="control-label">OptionNumber</label>
|
||||
<input form="OptionNumber" class="form-control" @bind="@customDescription.OptionNumber" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Heading" class="control-label">Heading</label>
|
||||
<input form="Heading" class="form-control" @bind="@customDescription.Heading" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="DescriptionText" class="control-label">DescriptionText</label>
|
||||
<input form="DescriptionText" class="form-control" @bind="@customDescription.DescriptionText" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<input type="button" class="btn btn-primary" @onclick="@UpdateCustomDescription" value="Update" />
|
||||
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string? CustomDescriptionId { get; set; }
|
||||
CustomDescription customDescription = new();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
customDescription = await Task.Run(() => CustomDescriptionservice.GetCustomDescriptionAsync(Convert.ToUInt32(CustomDescriptionId)));
|
||||
}
|
||||
|
||||
protected async void UpdateCustomDescription()
|
||||
{
|
||||
customDescription.DataModificationByUser = "Gremlin_BlazorServer";
|
||||
customDescription.DataModificationDate = DateTime.Now;
|
||||
customDescription.DataVersionNumber++;
|
||||
await CustomDescriptionservice.UpdateCustomDescriptionAsync(customDescription);
|
||||
NavigationManager.NavigateTo("CustomDescriptions/Index");
|
||||
}
|
||||
|
||||
void Cancel() => NavigationManager.NavigateTo("CustomDescriptions/Index");
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
@page "/CustomDescriptions/Index"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
|
||||
@inject CustomDescriptionService CustomDescriptionservice
|
||||
|
||||
<h1>CustomDescriptions</h1>
|
||||
|
||||
<div class="text-center bg-blue-100">
|
||||
<input class="border-4 w-1/3 rounded m-6 p-6 h-8
|
||||
border-blue-300" @bind-value="SearchCustomDescription"
|
||||
@bind-value:event="oninput" placeholder="Search by ProductNumber"
|
||||
@onchange="SearchCustomDescription_OnChange"/>
|
||||
</div>
|
||||
|
||||
<NavLink class="nav-link" href="CustomDescriptions/Add">
|
||||
<span class="oi oi-plus" aria-hidden="true">Add New CustomDescription</span>
|
||||
</NavLink>
|
||||
|
||||
|
||||
@if (allCustomDescriptions is null)
|
||||
{
|
||||
<p><em>Loading... !</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>Es wurden @filteredCustomDescriptions.Count CustomDescriptions gefunden.</p>
|
||||
@if (allCustomDescriptions != null)
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>@nameof(CustomDescription.CustomDescriptionId)</th>
|
||||
<th>@nameof(CustomDescription.ProductNumber)</th>
|
||||
<th>@nameof(CustomDescription.OptionNumber)</th>
|
||||
<th>@nameof(CustomDescription.Heading)</th>
|
||||
<th>@nameof(CustomDescription.DescriptionText)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (CustomDescription customDescription in filteredCustomDescriptions)
|
||||
{<tr>
|
||||
<td>@customDescription.CustomDescriptionId</td>
|
||||
<td>@customDescription.ProductNumber</td>
|
||||
<td>@customDescription.OptionNumber</td>
|
||||
<td>@customDescription.Heading</td>
|
||||
<td>@customDescription.DescriptionText</td>
|
||||
<td>
|
||||
<a class="nav-link" href="CustomDescriptions/Edit/@customDescription.CustomDescriptionId">
|
||||
<span class="oi oi-pencil" aria-hidden="true">Edit</span>
|
||||
</a>
|
||||
<a class="nav-link" href="CustomDescriptions/Delete/@customDescription.CustomDescriptionId">
|
||||
<span class="oi oi-trash" aria-hidden="true">Delete</span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
|
||||
public string SearchCustomDescription = "";
|
||||
List<CustomDescription> allCustomDescriptions = new();
|
||||
List<CustomDescription> filteredCustomDescriptions = new();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
allCustomDescriptions = await Task.Run(() => CustomDescriptionservice.GetAllCustomDescriptionsAsync());
|
||||
filteredCustomDescriptions = allCustomDescriptions;
|
||||
}
|
||||
|
||||
private void SearchCustomDescription_OnChange()
|
||||
{
|
||||
filteredCustomDescriptions = allCustomDescriptions.Where(cD => cD.ProductNumber.ToLower().Contains(SearchCustomDescription.ToLower())).ToList();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
@page "/LineItems"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
@using System.Globalization;
|
||||
|
||||
@inject GenericController genericController
|
||||
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<h1>LineItems</h1>
|
||||
<DataGrid TItem="LineItem" Data="@lineItems" SelectedRow="@selectedLineItem" SelectedRowChanged="@OnSelectedLineItemChanged" Editable ShowPager Bordered Hoverable Sortable Filterable Striped Responsive>
|
||||
<DataGridCommandColumn />
|
||||
<DataGridColumn Field="@nameof(LineItem.LineItemId)" Caption="LineItemId" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.QuoteId)" Caption="QuoteId" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.Position)" Caption="Position" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.Amount)" Caption="Amount" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.ProductNumber)" Caption="LineItemId" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.OptionNumber)" Caption="QuoteId" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.SapShortDescription)" Caption="Position" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.SapLongDescription)" Caption="Amount" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.ProductLine)" Caption="ProductLine" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.TotalDiscount)" Caption="TotalDiscount" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.SalesDiscount)" Caption="SalesDiscount" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.PromotionalDiscount)" Caption="PromotionalDiscount" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.ContractualDiscount)" Caption="ContractualDiscount" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.DemoDiscount)" Caption="DemoDiscount" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.ListPrice)" Caption="ListPrice" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.ExtendedListPrice)" Caption="ExtendedListPrice" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.NetPrice)" Caption="NetPrice" Filterable Sortable Editable />
|
||||
<DataGridColumn Field="@nameof(LineItem.Total)" Caption="Total" Filterable Sortable Editable />
|
||||
</DataGrid>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<h3>Authentication Failure!</h3>
|
||||
<p>You're not signed in. Please click on the upper right to either register or log in.</p>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
private Task<AuthenticationState>? authenticationStateTask { get; set; }
|
||||
|
||||
private IList<LineItem>? lineItems;
|
||||
private LineItem? selectedLineItem;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (authenticationStateTask != null)
|
||||
{
|
||||
var user = (await authenticationStateTask).User;
|
||||
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
lineItems = genericController.GetAll<LineItem>();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnSelectedLineItemChanged(LineItem sCd) => selectedLineItem = sCd;
|
||||
}
|
||||
@ -1,108 +0,0 @@
|
||||
@page "/LineItems/Index"
|
||||
|
||||
@using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
@using Gremlin_BlazorServer.Services;
|
||||
@using System.Globalization;
|
||||
|
||||
@inject LineItemService LineItemservice
|
||||
|
||||
<h1>LineItems</h1>
|
||||
|
||||
<div class="text-center bg-blue-100">
|
||||
<input class="border-4 w-1/3 rounded m-6 p-6 h-8
|
||||
border-blue-300" @bind-value="SearchLineItem"
|
||||
@bind-value:event="oninput" placeholder="Search by ProductNumber"
|
||||
@onchange="SearchLineItem_OnChange"/>
|
||||
</div>
|
||||
|
||||
<NavLink class="nav-link" href="LineItems/Add">
|
||||
<span class="oi oi-plus" aria-hidden="true">Add New LineItem</span>
|
||||
</NavLink>
|
||||
|
||||
|
||||
@if (allLineItems is null)
|
||||
{
|
||||
<p><em>Loading... !</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>Es wurden @filteredLineItems.Count LineItems gefunden.</p>
|
||||
@if (allLineItems != null)
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>@nameof(LineItem.LineItemId)</th>
|
||||
<th>@nameof(LineItem.QuoteId)</th>
|
||||
<th>@nameof(LineItem.Position)</th>
|
||||
<th>@nameof(LineItem.Amount)</th>
|
||||
<th>@nameof(LineItem.ProductNumber)</th>
|
||||
<th>@nameof(LineItem.OptionNumber)</th>
|
||||
<th>@nameof(LineItem.SapShortDescription)</th>
|
||||
<th>@nameof(LineItem.SapLongDescription)</th>
|
||||
<th>@nameof(LineItem.ProductLine)</th>
|
||||
<th>@nameof(LineItem.TotalDiscount)</th>
|
||||
<th>@nameof(LineItem.SalesDiscount)</th>
|
||||
<th>@nameof(LineItem.PromotionalDiscount)</th>
|
||||
<th>@nameof(LineItem.ContractualDiscount)</th>
|
||||
<th>@nameof(LineItem.DemoDiscount)</th>
|
||||
<th>@nameof(LineItem.ListPrice)</th>
|
||||
<th>@nameof(LineItem.ExtendedListPrice)</th>
|
||||
<th>@nameof(LineItem.NetPrice)</th>
|
||||
<th>@nameof(LineItem.Total)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (LineItem lineItem in filteredLineItems)
|
||||
{<tr>
|
||||
<td>@lineItem.LineItemId</td>
|
||||
<td>@lineItem.QuoteId</td>
|
||||
<td>@lineItem.Position</td>
|
||||
<td>@lineItem.Amount</td>
|
||||
<td>@lineItem.ProductNumber</td>
|
||||
<td>@lineItem.OptionNumber</td>
|
||||
<td>@lineItem.SapShortDescription</td>
|
||||
<td>@lineItem.SapLongDescription</td>
|
||||
<td>@lineItem.ProductLine</td>
|
||||
<td>@lineItem.TotalDiscount</td>
|
||||
<td>@lineItem.SalesDiscount</td>
|
||||
<td>@lineItem.SalesDiscount</td>
|
||||
<td>@lineItem.PromotionalDiscount</td>
|
||||
<td>@lineItem.ContractualDiscount</td>
|
||||
<td>@lineItem.DemoDiscount</td>
|
||||
<td>@lineItem.ListPrice.ToString("C", cultureInfo)</td>
|
||||
<td>@lineItem.ExtendedListPrice.ToString("C", cultureInfo)</td>
|
||||
<td>@lineItem.NetPrice.ToString("C", cultureInfo)</td>
|
||||
<td>@lineItem.Total.ToString("C", cultureInfo)</td>
|
||||
<td>
|
||||
<a class="nav-link" href="LineItems/Edit/@lineItem.LineItemId">
|
||||
<span class="oi oi-pencil" aria-hidden="true">Edit</span>
|
||||
</a>
|
||||
<a class="nav-link" href="LineItems/Delete/@lineItem.LineItemId">
|
||||
<span class="oi oi-trash" aria-hidden="true">Delete</span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
|
||||
public string SearchLineItem = "";
|
||||
List<LineItem> allLineItems = new();
|
||||
List<LineItem> filteredLineItems = new();
|
||||
CultureInfo cultureInfo = new("de-DE");
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
allLineItems = await Task.Run(() => LineItemservice.GetLineItemsAsync());
|
||||
filteredLineItems = allLineItems;
|
||||
}
|
||||
|
||||
private void SearchLineItem_OnChange()
|
||||
{
|
||||
filteredLineItems = allLineItems.Where(cD => cD.ProductNumber!.ToLower().Contains(SearchLineItem.ToLower())).ToList();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 250 KiB |
@ -0,0 +1,17 @@
|
||||
# Part Number Opt PL Description Qty Price EUR Breaks EUR Uplift % Total Discount % Net EUR Total EUR Sales Discount YA9% Contractual Discount Y99% Promotion Discount Y07% Demo Discount Y04% PH Code PH Description YMax
|
||||
1 G7104C 29 1260 Infinity II Flexible Pumpe 1 33344 0 0 40 20006.4 20006.4 40 0 0 0 ISL100P1 Pumps
|
||||
2 G7104C 001 29 HPLC System Tool-Kit 1260 Infinity II 1 377 0 0 40 226.2 226.2 40 0 0 0
|
||||
3 G7104C 004 29 Agilent Lab Advisor Advanced Software 1 1574 0 0 40 944.4 944.4 40 0 0 0
|
||||
4 G7104C 034 29 InfinityLab Stay Safe Verschl., St.-Kit 1 664 0 0 40 398.4 398.4 40 0 0 0
|
||||
5 G7104C 097 29 Poroshell 120 EC-C18 3,0x150mm, 2,7um 1 1 0 0 40 0.6 0.6 40 0 0 0
|
||||
6 G7167A 29 1260 Infinity II Mehrfachprobengeber 1 27195 0 0 40 16317 16317 40 0 0 0 ISL100A1 Autosamplers
|
||||
7 G7167A 060 29 Nutzung vorhandene Lizenz 1 -1733 0 0 40 -1039.8 -1039.8 40 0 0 0
|
||||
8 G7167A 101 29 Agilent InfinityLab Proben-Thermostat 1 5871 0 0 40 3522.6 3522.6 40 0 0 0
|
||||
9 G7116A 29 1260 Infinity II Therm. f. mehr. Saeulen 1 6275 0 0 40 3765 3765 40 0 0 0 ISL100LC1 LC Hardware
|
||||
10 G7162A 29 1260 Infinity II Brechungsindexdetektor 1 13516 0 0 40 8109.6 8109.6 40 0 0 0 ISL100D1 Detectors
|
||||
11 M8414AA LI OpenLab CDS Workstation PC-Paket 1 16854 0 0 40 10112.4 10112.4 40 0 0 0 ISF300F110 OpenLAB CDS w/Hardware
|
||||
12 M8414AA 001 LI LC Geraeteverbindung 1 0 0 0 40 0 0 40 0 0 0
|
||||
13 SYS-LC-1260II 74 LC 1260 Infinity II System 1 0 0 0 20 0 0 20 0 0 0 TSSYS0SYLC Service Systems - Liquid Chromatography
|
||||
14 SYS-LC-1260II 2A9 74 Standard-Einweisung 1 999 0 0 20 799.2 799.2 20 0 0 0 TSSTRN Training Services
|
||||
15 SYS-LC-1260II 8R2 74 CrossLab Silver - 2J, kompl. 1 10403 0 0 35 6761.95 6761.95 30 0 5 0 TSSYS2 Serviced As Systems - 2 YR > 29
|
||||
|
||||
|
@ -1,165 +0,0 @@
|
||||
using Gremlin_BlazorServer.Data.DBClasses;
|
||||
using Gremlin_BlazorServer.Data.EntityClasses;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Gremlin_BlazorServer.Services;
|
||||
|
||||
public class GenericTypeController<T> where T : class
|
||||
{
|
||||
private readonly GremlinDb gremlinDb = new();
|
||||
|
||||
public async Task<List<T>> GetAllAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
return await gremlinDb.Set<T>().ToListAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> InsertAsync(T entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
_ = await gremlinDb.Set<T>().AddAsync(entity);
|
||||
_ = await gremlinDb.SaveChangesAsync();
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(T entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
_ = gremlinDb.Set<T>().Update(entity);
|
||||
_ = await gremlinDb.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(T entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
_ = gremlinDb.Set<T>().Remove(entity);
|
||||
_ = await gremlinDb.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<Product>> GetAllProductsAsync(ProductLine productLine)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await gremlinDb.Products.Where(p => p.ProductLine.Equals(productLine)).ToListAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<Account>> GetAllAccountsAsync(AccountType accountType)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await gremlinDb.Accounts.Where(a => a.AccountType.Equals(accountType)).ToListAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<Contact>> GetAllContactsAsync(Account account)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await gremlinDb.Contacts.Where(a => a.Account.Equals(account)).ToListAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//public async Task<List<LineItem>> GetAllLineItemsAsync(Quote quote)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// return await gremlinDb.LineItems.Where(a => a.Quote.Equals(quote)).ToListAsync();
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// Console.WriteLine(e);
|
||||
// throw;
|
||||
// }
|
||||
//}
|
||||
|
||||
public async Task<Account> GetAccountAsync(Contact contact)
|
||||
{
|
||||
try
|
||||
{
|
||||
Account result = await gremlinDb.Accounts.FirstAsync(a => a.AccountId.Equals(contact.AccountId));
|
||||
return result;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Contact> GetContactAsync(string lastName)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await gremlinDb.Contacts.FirstAsync(c => c.LastName.Equals(lastName));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<CustomDescription> GetCustomDescriptionAsync(LineItem lineItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await gremlinDb.CustomDescriptions.FirstAsync(l => l.ProductNumber.Equals(lineItem.ProductNumber) && l.OptionNumber.Equals(lineItem.OptionNumber));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<uint> GetLastId()
|
||||
{
|
||||
return await gremlinDb.Quotes.MaxAsync(q => q.QuoteId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 250 KiB |
Binary file not shown.
Loading…
Reference in New Issue