Update 07082021
This commit is contained in:
166
BlazorApp - Kopie (3)/Pages/Admin/Anrede/Anrede.razor
Normal file
166
BlazorApp - Kopie (3)/Pages/Admin/Anrede/Anrede.razor
Normal file
@@ -0,0 +1,166 @@
|
||||
@page "/Admin/Anrede/AnredeList"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>Anrede</h1>
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="BWPMModels.Anrede" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.Anrede.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.Anrede.bezeichnung) HeaderText="Bezeichnung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.Anrede.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="true" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.Anrede.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="true" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.Anrede.mutierer) HeaderText="Mutierer" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.Anrede.aktiv) HeaderText="Aktiv" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@code{ SfGrid<BWPMModels.Anrede> Grid { get; set; }
|
||||
public List<BWPMModels.Anrede> GridData { get; set; }
|
||||
public List<BWPMModels.Anrede> Anredes { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.AnredeController.GetAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Anrede> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
Args.Data.erstellt_am = DateTime.Now;
|
||||
Args.Data.mutierer = userid;
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
Args.Data.aktiv = true;
|
||||
Args.Data.ID = BlazorApp.Controller.AnredeController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.AnredeController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Anrede> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid.SetRowData(Args.Data.ID, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.ID;
|
||||
xx = await DataHandler();
|
||||
await Grid.SelectRow(xx);
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.Anrede> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid.Refresh();
|
||||
await Grid.GoToPage(1);
|
||||
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
|
||||
{
|
||||
List < BWPMModels.Anrede> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].ID == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false; // prevent the default navigation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
} }
|
||||
@@ -0,0 +1,240 @@
|
||||
@page "/Admin/AspNetUsers/AspNetUserRolleList"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using Microsoft.AspNetCore.Identity;
|
||||
@inject UserManager<IdentityUser> _UserManager
|
||||
@inject RoleManager<IdentityRole> _RoleManager
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using Syncfusion.Blazor.Popups;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>AspNetUserRolle</h1>
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSelection="true" AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel", "Passwort ändern" })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="false" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Normal"></GridEditSettings>
|
||||
<GridEvents RowSelected="GetSelectedRecords" OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="BWPMModels.AspNetUserRolle" OnToolbarClick="ToolBarClickHandler" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridSelectionSettings EnableToggle="true" Type="Syncfusion.Blazor.Grids.SelectionType.Single"></GridSelectionSettings>
|
||||
<GridColumns>
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.Id) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60"></GridColumn>
|
||||
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.UserName) HeaderText="Username" AllowEditing="false" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.NormalizedUserName) HeaderText="Normalizedusername" AllowEditing="false" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.Email) HeaderText="Email" Width="100" AllowEditing="false" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.NormalizedEmail) HeaderText="Normalizedemail" Width="100" AllowEditing="false" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.EmailConfirmed) HeaderText="Emailconfirmed" Width="100" AllowEditing="false" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.PasswordHash) HeaderText="Passwordhash" Width="100" AllowEditing="false" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.SecurityStamp) HeaderText="Securitystamp" Width="100" AllowEditing="false" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.ConcurrencyStamp) HeaderText="Concurrencystamp" Width="100" AllowEditing="false" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.PhoneNumber) HeaderText="Phonenumber" Width="100" AllowEditing="false" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.PhoneNumberConfirmed) HeaderText="Phonenumberconfirmed" Width="100" Visible="false" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.TwoFactorEnabled) HeaderText="Twofactorenabled" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.LockoutEnabled) HeaderText="Lockoutenabled" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.AccessFailedCount) HeaderText="Accessfailedcount" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUserRolle.RoleId) HeaderText="Roleid" Width="100" Visible="false">
|
||||
<GridForeignColumn Field=@nameof(BWPMModels.AspNetUserRolle.RoleId) HeaderText="Rolle" ForeignKeyValue=@nameof(BWPMModels.AspNetRoles.Name) ForeignKeyField=@nameof(BWPMModels.AspNetRoles.Id) ForeignDataSource="@AspNetRoles" Width="150"></GridForeignColumn>
|
||||
</GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SfDialog Width="400px" IsModal="true" @bind-Visible="@IsVisible">
|
||||
<DialogEvents OnOverlayClick="@OnOverlayclick">
|
||||
</DialogEvents>
|
||||
<DialogTemplates>
|
||||
<Header>Passwort-Änderung für @Username</Header>
|
||||
<Content>
|
||||
<label style="color:red">@ErrorMsg</label>
|
||||
<label>
|
||||
Neues Passwort:
|
||||
<input type="password" @bind-value="newpassword" id="password" name="Required" class="e-input">
|
||||
Passwort-Bestätigung
|
||||
<input type="password" @bind-value="newpassword1" id="password1" name="Required" class="e-input">
|
||||
</label>
|
||||
</Content>
|
||||
|
||||
</DialogTemplates>
|
||||
<DialogButtons>
|
||||
<DialogButton Content="OK" IsPrimary="true" OnClick="@SavePasswort" />
|
||||
<DialogButton Content="Abbruch" OnClick="@CloseDialog" />
|
||||
</DialogButtons>
|
||||
</SfDialog>
|
||||
@code{
|
||||
private bool IsVisible { get; set; } = false;
|
||||
private string Gridid = "";
|
||||
public List<BWPMModels.AspNetUserRolle> Temp { get; set; }
|
||||
private string newpassword { get; set; } = "";
|
||||
private string newpassword1 { get; set; } = "";
|
||||
private string ErrorMsg { get; set; } = "";
|
||||
private string Username { get; set; } = "";
|
||||
|
||||
SfGrid<BWPMModels.AspNetUserRolle> Grid { get; set; }
|
||||
|
||||
private void OnOverlayclick(MouseEventArgs arg)
|
||||
{
|
||||
this.IsVisible = false;
|
||||
}
|
||||
private void ShowDialog()
|
||||
{
|
||||
this.ErrorMsg = "";
|
||||
this.IsVisible = true; ;
|
||||
}
|
||||
private void CloseDialog()
|
||||
{
|
||||
this.IsVisible = false; ;
|
||||
}
|
||||
private void SavePasswort()
|
||||
{
|
||||
if (newpassword != newpassword1)
|
||||
{
|
||||
this.ErrorMsg = "Passworte stimmen nicht überein.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
IdentityUser objUser = new IdentityUser();
|
||||
objUser.Id = Gridid;
|
||||
var user = _UserManager.FindByIdAsync(Gridid);
|
||||
var password = _UserManager.PasswordHasher.HashPassword(objUser,newpassword);
|
||||
|
||||
BWPMModels.AspNetUsers usr = new BWPMModels.AspNetUsers();
|
||||
usr.Id = Gridid;
|
||||
usr.PasswordHash = password;
|
||||
BlazorApp.Controller.AspNetUserRolleController.PUTPassword(usr);
|
||||
|
||||
this.IsVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ToolBarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)
|
||||
{
|
||||
if (args.Item.Text == "Passwort ändern")
|
||||
{
|
||||
var temp = await this.Grid.GetSelectedRecords(); // return the details of selceted record
|
||||
|
||||
if (temp != null)
|
||||
{
|
||||
Username = temp[0].UserName;
|
||||
Gridid = temp[0].Id;
|
||||
ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task GetSelectedRecords(RowSelectEventArgs<BWPMModels.AspNetUserRolle> args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public List<BWPMModels.AspNetUserRolle> GridData { get; set; }
|
||||
public List<BWPMModels.AspNetUserRolle> AspNetUserRolles { get; set; }
|
||||
public List<BWPMModels.AspNetRoles> AspNetRoles { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.AspNetUserRolleController.GetAllData();
|
||||
AspNetRoles = BlazorApp.Controller.AspNetRolesController.GetAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.AspNetUserRolle> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
AspNetUserRoles rolle = new AspNetUserRoles();
|
||||
rolle.RoleId = Args.Data.RoleId;
|
||||
rolle.UserId = Args.Data.Id;
|
||||
BlazorApp.Controller.AspNetUserRolesController.PUT(rolle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.AspNetUserRolle> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.AspNetUserRolle> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
}
|
||||
175
BlazorApp - Kopie (3)/Pages/Admin/AspNetUsers/AspNetUsers.razor
Normal file
175
BlazorApp - Kopie (3)/Pages/Admin/AspNetUsers/AspNetUsers.razor
Normal file
@@ -0,0 +1,175 @@
|
||||
@page "/Admin/AspNetUsers/AspNetUsersList"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>AspNetUsers</h1>
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
@*<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="AspNetUsers" OnDataBound="RowDataBoundHandler"></GridEvents>*@
|
||||
<GridColumns>
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.Id) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60"></GridColumn><GridColumn Field=@nameof(BWPMModels.AspNetUsers.Id) HeaderText="Id" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.UserName) HeaderText="Username" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.NormalizedUserName) HeaderText="Normalizedusername" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.Email) HeaderText="Email" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.NormalizedEmail) HeaderText="Normalizedemail" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.EmailConfirmed) HeaderText="Emailconfirmed" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.PasswordHash) HeaderText="Passwordhash" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.SecurityStamp) HeaderText="Securitystamp" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.ConcurrencyStamp) HeaderText="Concurrencystamp" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.PhoneNumber) HeaderText="Phonenumber" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.PhoneNumberConfirmed) HeaderText="Phonenumberconfirmed" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.TwoFactorEnabled) HeaderText="Twofactorenabled" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.LockoutEnabled) HeaderText="Lockoutenabled" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.AccessFailedCount) HeaderText="Accessfailedcount" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@code{ SfGrid<BWPMModels.AspNetUsers> Grid { get; set; }
|
||||
public List<BWPMModels.AspNetUsers> GridData { get; set; }
|
||||
public List<BWPMModels.AspNetUsers> AspNetUserss { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public string Value = ""; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.AspNetUsersController.GetAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.AspNetUsers> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
//Args.Data.Id = BlazorApp.Controller.AspNetUsersController.InsertData(Args.Data);
|
||||
//Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
BlazorApp.Controller.AspNetUsersController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.AspNetUsers> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid.SetRowData(Args.Data.Id, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.Id;
|
||||
xx = await DataHandler();
|
||||
await Grid.SelectRow(xx);
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.AspNetUsers> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid.Refresh();
|
||||
await Grid.GoToPage(1);
|
||||
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
|
||||
{
|
||||
List<BWPMModels.AspNetUsers> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].Id == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false; // prevent the default navigation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
} }
|
||||
140
BlazorApp - Kopie (3)/Pages/Admin/AspNetUsers/UserRollen.razor
Normal file
140
BlazorApp - Kopie (3)/Pages/Admin/AspNetUsers/UserRollen.razor
Normal file
@@ -0,0 +1,140 @@
|
||||
@page "/Admin/AspNetUsers/UserRollen"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>AspNetRoles</h1>
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
|
||||
<SfGrid ID="GridUser" DataSource="@GridDataUser" AllowPaging="true" AllowSorting="true" AllowRowDragAndDrop="true">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
@*<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>*@
|
||||
@*<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="BWPMModels.AspNetUsers" OnDataBound="RowDataBoundHandler"></GridEvents>*@
|
||||
<GridRowDropSettings TargetID="GridRolle"></GridRowDropSettings>
|
||||
<GridColumns>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.Id) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.UserName) HeaderText="Name" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(BWPMModels.AspNetUsers.Email) HeaderText="Name" Width="100" Visible="true"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<SfGrid ID="GridRolle" DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" AllowRowDragAndDrop="true">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
@*<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>*@
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="AspNetRoles" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
|
||||
<GridColumn Field=@nameof(AspNetRoles.Id) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(AspNetRoles.Name) HeaderText="Name" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(AspNetRoles.NormalizedName) HeaderText="Normalizedname" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(AspNetRoles.ConcurrencyStamp) HeaderText="Concurrencystamp" Width="100" Visible="false"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@code{
|
||||
SfGrid<AspNetRoles> Grid { get; set; }
|
||||
|
||||
public List<BWPMModels.AspNetRoles> GridData { get; set; }
|
||||
public List<BWPMModels.AspNetRoles> AspNetRoless { get; set; }
|
||||
|
||||
public List<BWPMModels.AspNetUsers> GridDataUser { get; set; }
|
||||
public List<BWPMModels.AspNetUsers> AspNetUsers { get; set; }
|
||||
|
||||
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.AspNetRolesController.GetAllData();
|
||||
GridDataUser = BlazorApp.Controller.AspNetUsersController.GetAllData();
|
||||
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.AspNetRoles> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
BlazorApp.Controller.AspNetRolesController.POST(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.AspNetRoles> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.AspNetRoles> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
}
|
||||
186
BlazorApp - Kopie (3)/Pages/Admin/Beruf/BerufListe.razor
Normal file
186
BlazorApp - Kopie (3)/Pages/Admin/Beruf/BerufListe.razor
Normal file
@@ -0,0 +1,186 @@
|
||||
@page "/Admin/Beruf/BerufList"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
@using Radzen;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>Beruf</h1>
|
||||
@*<RadzenDataGrid AllowFiltering="true" AllowColumnResize="true" FilterMode="FilterMode.Advanced" PageSize="5" AllowPaging="true" AllowSorting="true" Data="@berufe" TItem="Beruf" ColumnWidth="300px" LogicalFilterOperator="LogicalFilterOperator.Or">
|
||||
<Columns>
|
||||
<RadzenDataGridColumn TItem="Beruf" Property="ID" Filterable="false" Title="ID" Frozen="true" Width="50px" TextAlign="Radzen.TextAlign.Left" />
|
||||
<RadzenDataGridColumn TItem="Beruf" Property="bezeichnung" Title="Bezeichnung" />
|
||||
<RadzenDataGridColumn TItem="Beruf" Property="beschreibung" Title="Beschreibung" Width="150px" />
|
||||
</Columns>
|
||||
</RadzenDataGrid>*@
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="Beruf" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.bezeichnung) HeaderText="Bezeichnung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.lehrjahre) HeaderText="Lehrjahre" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.anmerkung) HeaderText="Anmerkung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.beschreibung) HeaderText="Beschreibung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.klasseNr) HeaderText="Klassenr" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.aktiv) HeaderText="Aktiv" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.mutierer) HeaderText="Mutierer" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Beruf.mandantnr) HeaderText="Mandantnr" Width="100" Visible="false"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@code{
|
||||
IEnumerable<Beruf> berufe;
|
||||
SfGrid<Beruf> Grid { get; set; }
|
||||
public List<BWPMModels.Beruf> GridData { get; set; }
|
||||
public List<BWPMModels.Beruf> Berufs { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.BerufController.GetAllData();
|
||||
berufe = BlazorApp.Controller.BerufController.GetAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Beruf> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
Args.Data.erstellt_am = DateTime.Now;
|
||||
Args.Data.mutierer = userid;
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
Args.Data.aktiv = true;
|
||||
Args.Data.ID = BlazorApp.Controller.BerufController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.BerufController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Beruf> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid.SetRowData(Args.Data.ID, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.ID;
|
||||
xx = await DataHandler();
|
||||
await Grid.SelectRow(xx);
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.Beruf> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid.Refresh();
|
||||
await Grid.GoToPage(1);
|
||||
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
|
||||
{
|
||||
List<Beruf> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].ID == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false; // prevent the default navigation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
} }
|
||||
@@ -0,0 +1,168 @@
|
||||
@page "/Admin/Klassentyp/KlassentypList"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>Klassentyp</h1>
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="Klassentyp" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klassentyp.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klassentyp.bezeichnung) HeaderText="Bezeichnung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klassentyp.aktiv) HeaderText="Aktiv" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klassentyp.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="true" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klassentyp.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="true" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klassentyp.mutierer) HeaderText="Mutierer" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klassentyp.mandantID) HeaderText="Mandantid" Width="100" Visible="true"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@code{ SfGrid<Klassentyp> Grid { get; set; }
|
||||
public List<BWPMModels.Klassentyp> GridData { get; set; }
|
||||
public List<BWPMModels.Klassentyp> Klassentyps { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.KlassentypController.GetAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Klassentyp> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
Args.Data.erstellt_am = DateTime.Now;
|
||||
Args.Data.mutierer = userid;
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
Args.Data.aktiv = true;
|
||||
Args.Data.ID = BlazorApp.Controller.KlassentypController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.KlassentypController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Klassentyp> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid.SetRowData(Args.Data.ID, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.ID;
|
||||
xx = await DataHandler();
|
||||
await Grid.SelectRow(xx);
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.Klassentyp> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid.Refresh();
|
||||
await Grid.GoToPage(1);
|
||||
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
|
||||
{
|
||||
List<Klassentyp> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].ID == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false; // prevent the default navigation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
} }
|
||||
36
BlazorApp - Kopie (3)/Pages/Admin/ListBase.cs
Normal file
36
BlazorApp - Kopie (3)/Pages/Admin/ListBase.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace BlazorApp.Pages.Admin
|
||||
{
|
||||
public class ListBase : ComponentBase
|
||||
{
|
||||
[CascadingParameter]
|
||||
public Task<AuthenticationState> authenticationStateTask { get; set; }
|
||||
|
||||
[Inject]
|
||||
public NavigationManager NavigationManager { get; set; }
|
||||
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
var authenticationState = await authenticationStateTask;
|
||||
|
||||
//if (!authenticationState.User.Identity.IsAuthenticated)
|
||||
//{
|
||||
// NavigationManager.NavigateTo($"/identity/account/login");
|
||||
// // string returnUrl = WebUtility.UrlEncode($"/");
|
||||
// // NavigationManager.NavigateTo(WebUtility.UrlEncode("/identity/Account/Login"));
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
170
BlazorApp - Kopie (3)/Pages/Admin/Optionen/OptionenList.razor
Normal file
170
BlazorApp - Kopie (3)/Pages/Admin/Optionen/OptionenList.razor
Normal file
@@ -0,0 +1,170 @@
|
||||
@page "/Admin/Optionen/OptionenList"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>Optionen</h1>
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="Optionen" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Optionen.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Optionen.mandantnr) HeaderText="Mandantnr" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Optionen.Bezeichnung) HeaderText="Bezeichnung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Optionen.inhalt) HeaderText="Inhalt" Width="200" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Optionen.erstellt_am) HeaderText="Erstellt_am" Width="400" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Optionen.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Optionen.mutierer) HeaderText="Mutierer" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Optionen.aktiv) HeaderText="Aktiv" Width="100" Visible="false" DisplayAsCheckBox="true"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@code{ SfGrid<Optionen> Grid { get; set; }
|
||||
public List<BWPMModels.Optionen> GridData { get; set; }
|
||||
public List<BWPMModels.Optionen> Optionens { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.OptionenController.GetAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Optionen> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
Args.Data.erstellt_am = DateTime.Now;
|
||||
Args.Data.mutierer = userid;
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
Args.Data.aktiv = true;
|
||||
Args.Data.ID = BlazorApp.Controller.OptionenController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.OptionenController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Optionen> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid.SetRowData(Args.Data.ID, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.ID;
|
||||
xx = await DataHandler();
|
||||
await Grid.SelectRow(xx);
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.Optionen> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid.Refresh();
|
||||
await Grid.GoToPage(1);
|
||||
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
|
||||
{
|
||||
List<Optionen> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].ID == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false; // prevent the default navigation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
} }
|
||||
178
BlazorApp - Kopie (3)/Pages/Admin/Schulhaus/SchulhausList.razor
Normal file
178
BlazorApp - Kopie (3)/Pages/Admin/Schulhaus/SchulhausList.razor
Normal file
@@ -0,0 +1,178 @@
|
||||
@page "/Admin/Schulhaus/SchulhausList"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>Schulhaus</h1>
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="Schulhaus" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.bezeichnung) HeaderText="Bezeichnung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.strasse) HeaderText="Strasse" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.plz) HeaderText="Plz" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.ort) HeaderText="Ort" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.telefon) HeaderText="Telefon" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.sort) HeaderText="Sort" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.aktiv) HeaderText="Aktiv" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.mutierer) HeaderText="Mutierer" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Schulhaus.mandantnr) HeaderText="Mandantnr" Width="100" Visible="false"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@code{ SfGrid<Schulhaus> Grid { get; set; }
|
||||
public List<BWPMModels.Schulhaus> GridData { get; set; }
|
||||
public List<BWPMModels.Schulhaus> Schulhauss { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.SchulhausController.GetAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Schulhaus> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
Args.Data.erstellt_am = DateTime.Now;
|
||||
Args.Data.mutierer = userid;
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
Args.Data.aktiv = true;
|
||||
Args.Data.ID = BlazorApp.Controller.SchulhausController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.SchulhausController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Schulhaus> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid.SetRowData(Args.Data.ID, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.ID;
|
||||
xx = await DataHandler();
|
||||
await Grid.SelectRow(xx);
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.Schulhaus> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid.Refresh();
|
||||
await Grid.GoToPage(1);
|
||||
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
|
||||
{
|
||||
List<Schulhaus> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].ID == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false; // prevent the default navigation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
} }
|
||||
111
BlazorApp - Kopie (3)/Pages/Admin/ScriptGenerator.razor
Normal file
111
BlazorApp - Kopie (3)/Pages/Admin/ScriptGenerator.razor
Normal file
@@ -0,0 +1,111 @@
|
||||
@page "/Admin/ScriptGenerator"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using System.Text;
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Navigations
|
||||
@using System.Text.RegularExpressions;
|
||||
@using Newtonsoft.Json;
|
||||
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h2>Script-Generator</h2>
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
|
||||
<input type="text" @bind-value="tablename" id="tablename" name="Required" class="e-input">
|
||||
<SfButton OnClick="GenerateCode">Generieren</SfButton>
|
||||
<p></p>
|
||||
<div class="sample-browser e-view sf-new">
|
||||
<div class="sb-tab-content">
|
||||
<div class="sb-source-section">
|
||||
<SfTab CssClass="sb-content-tab">
|
||||
|
||||
<TabItems>
|
||||
<TabItem CssClass="e-tab">
|
||||
<HeaderTemplate>Model-Class</HeaderTemplate>
|
||||
<ContentTemplate>
|
||||
<div class="login-form">
|
||||
<div class='wrap'>
|
||||
<pre class="code">
|
||||
@Code1
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</TabItem>
|
||||
<TabItem>
|
||||
<HeaderTemplate>WebAPI Service-Controller</HeaderTemplate>
|
||||
<ContentTemplate>
|
||||
<div class="login-form">
|
||||
<div class='wrap'>
|
||||
<pre class="code">
|
||||
@Code2
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</TabItem>
|
||||
<TabItem>
|
||||
<HeaderTemplate>Razor-Page</HeaderTemplate>
|
||||
<ContentTemplate>
|
||||
<div class="login-form">
|
||||
<div class='wrap'>
|
||||
<pre class="code">
|
||||
@Code3
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</TabItem>
|
||||
<TabItem>
|
||||
<HeaderTemplate>Razor App-Controller</HeaderTemplate>
|
||||
<ContentTemplate>
|
||||
<div class="login-form">
|
||||
<div class='wrap'>
|
||||
<pre class="code">
|
||||
@Code4
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</TabItem>
|
||||
|
||||
</TabItems>
|
||||
</SfTab>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private List<TabItem> sourceCodeItems;
|
||||
public string tablename { get; set; } = "beruf";
|
||||
public string Code1 { get; set; } = "";
|
||||
public string Code2 { get; set; } = "";
|
||||
public string Code3 { get; set; } = "";
|
||||
public string Code4 { get; set; } = "";
|
||||
|
||||
public void GenerateCode()
|
||||
{
|
||||
|
||||
var clist1 = BlazorApp.Controller.MyScriptController.GetData(1, tablename);
|
||||
Code1 = clist1[0].script;
|
||||
var clist2 = BlazorApp.Controller.MyScriptController.GetData(4, tablename);
|
||||
Code2 = clist2[0].script;
|
||||
var clist3 = BlazorApp.Controller.MyScriptController.GetData(7, tablename);
|
||||
Code3 = clist3[0].script;
|
||||
var clist4 = BlazorApp.Controller.MyScriptController.GetData(8, tablename);
|
||||
Code4 = clist4[0].script;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
34
BlazorApp - Kopie (3)/Pages/Admin/User/UserList.cshtml.cs
Normal file
34
BlazorApp - Kopie (3)/Pages/Admin/User/UserList.cshtml.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace BlazorApp.Pages.Admin
|
||||
{
|
||||
public class UserListBase : ComponentBase
|
||||
{
|
||||
[CascadingParameter]
|
||||
public Task<AuthenticationState> authenticationStateTask { get; set; }
|
||||
|
||||
[Inject]
|
||||
public NavigationManager NavigationManager { get; set; }
|
||||
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
var authenticationState = await authenticationStateTask;
|
||||
|
||||
if (!authenticationState.User.Identity.IsAuthenticated)
|
||||
{
|
||||
string returnUrl = WebUtility.UrlEncode($"/User/UserList/");
|
||||
NavigationManager.NavigateTo(WebUtility.UrlEncode("/identity/Account/Login?returnUrl=/User/UserList"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
133
BlazorApp - Kopie (3)/Pages/Admin/User/UserList.razor
Normal file
133
BlazorApp - Kopie (3)/Pages/Admin/User/UserList.razor
Normal file
@@ -0,0 +1,133 @@
|
||||
@page "/Admin/User/UserList"
|
||||
@inherits UserListBase
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
|
||||
<h1>Benutzer</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<AuthorizeView Roles="Administrators">
|
||||
<Authorized>
|
||||
@*@if (@context.User.IsInRole("Administrators"))
|
||||
{
|
||||
<div>Gugus</div>
|
||||
}*@
|
||||
|
||||
This content is displayed only if the user is Authorized
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
This content is displayed if the user is Not Authorized
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<div id="container">
|
||||
|
||||
<SfGrid DataSource="@users" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" Height="315" AllowSelection="true" AllowSorting="true" AllowFiltering="true" EnableVirtualization="true">
|
||||
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" TValue="User"></GridEvents>
|
||||
<GridSelectionSettings CheckboxOnly="true" PersistSelection="true" Type="SelectionType.Multiple"></GridSelectionSettings>
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
<GridColumn Field=@nameof(User.ID) HeaderText="ID" IsPrimaryKey="true" Visible="true" Width="40"></GridColumn>
|
||||
<GridForeignColumn Field=@nameof(User.usertype) HeaderText="Typ" ForeignKeyValue="Typ" ForeignDataSource="@usertypes" Width="150"></GridForeignColumn>
|
||||
<GridColumn Field=@nameof(User.username) HeaderText="Username" Visible="true" Width="60"></GridColumn>
|
||||
<GridColumn Field=@nameof(User.passwort) HeaderText="Passwort" Visible="true" Width="60"></GridColumn>
|
||||
<GridColumn Field=@nameof(User.email) HeaderText="Mail" Visible="true" Width="60"></GridColumn>
|
||||
<GridColumn Field=@nameof(User.mutiert_am) HeaderText="Mutiert" Visible="true" Format="d" Type="ColumnType.Date" Width="100"></GridColumn>
|
||||
<GridColumn Field=@nameof(User.aktiv) HeaderText="Aktiv" Visible="true" Width="60" DisplayAsCheckBox="true"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
@code {
|
||||
|
||||
|
||||
public List<User> users { get; set; }
|
||||
public List<usertypedata> usertypes { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
users = BlazorApp.Controller.UserController.GetAllData();
|
||||
usertypes = new List<usertypedata>();
|
||||
usertypes.Add(new usertypedata { usertype = 0, Typ = "Admin" });
|
||||
usertypes.Add(new usertypedata { usertype = 1, Typ = "User" });
|
||||
|
||||
}
|
||||
|
||||
private void OnBeginHandler(ActionEventArgs<User> Args)
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "add")
|
||||
{
|
||||
var t = Args.Data; //returns the edited / insrted record details.
|
||||
//insert into your db
|
||||
}
|
||||
else
|
||||
{
|
||||
string userid = "";
|
||||
userid = sessionStorage.GetItemAsync<string>("UserID").ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.UserController.savedata(Args.Data);
|
||||
//var t = Args.Data;
|
||||
|
||||
if (userid==null) { sessionStorage.SetItemAsync("UserID", "Stefan"); };
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
string userid = "";
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class usertypedata
|
||||
{
|
||||
public int usertype { get; set; }
|
||||
public string Typ { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
187
BlazorApp - Kopie (3)/Pages/Admin/Zeiten/Zeitenlist.razor
Normal file
187
BlazorApp - Kopie (3)/Pages/Admin/Zeiten/Zeitenlist.razor
Normal file
@@ -0,0 +1,187 @@
|
||||
@page "/Admin/Zeiten/ZeitenList"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>Zeiten</h1>
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" AllowRowDragAndDrop="true" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })">
|
||||
@* <GridPageSettings PageCount="5" PageSizes="true" ></GridPageSettings>*@
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="Zeiten" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
@*<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>*@
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.ID) HeaderText="ID" IsIdentity="true" IsPrimaryKey="true" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.bezeichnung) HeaderText="Bezeichnung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.beschreibung) HeaderText="Beschreibung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.reihenfolge) HeaderText="Reihenfolge" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.aktiv) HeaderText="Aktiv" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.mutierer) HeaderText="Mutierer" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.oeffentlich) HeaderText="Oeffentlich" Width="100" Visible="true" DisplayAsCheckBox="true" DefaultValue="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Zeiten.mandantnr) HeaderText="Mandantnr" Width="100" Visible="false"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@code{ SfGrid<Zeiten> Grid { get; set; }
|
||||
public List<BWPMModels.Zeiten> GridData { get; set; }
|
||||
public List<BWPMModels.Zeiten> Zeitens { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.ZeitenController.GetAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Zeiten> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
Args.Data.erstellt_am = DateTime.Now;
|
||||
Args.Data.mutierer = userid;
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
Args.Data.aktiv = true;
|
||||
Args.Data.ID = BlazorApp.Controller.ZeitenController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.ZeitenController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Zeiten> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.RowDragAndDrop)
|
||||
{
|
||||
List<Zeiten> Rows = await Grid.GetCurrentViewRecords();
|
||||
int order = 1;
|
||||
foreach (Zeiten row in Rows)
|
||||
{
|
||||
row.reihenfolge = order;
|
||||
BlazorApp.Controller.ZeitenController.PUT(row);
|
||||
order = order + 1;
|
||||
Grid.Refresh();
|
||||
}
|
||||
|
||||
}
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid.SetRowData(Args.Data.ID, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.ID;
|
||||
xx = await DataHandler();
|
||||
await Grid.SelectRow(xx);
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.Zeiten> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid.Refresh();
|
||||
await Grid.GoToPage(1);
|
||||
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
|
||||
{
|
||||
List<Zeiten> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].ID == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false; // prevent the default navigation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
} }
|
||||
404
BlazorApp - Kopie (3)/Pages/Administration.razor
Normal file
404
BlazorApp - Kopie (3)/Pages/Administration.razor
Normal file
@@ -0,0 +1,404 @@
|
||||
@page "/administration"
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using Microsoft.AspNetCore.Identity;
|
||||
@inject UserManager<IdentityUser> _UserManager
|
||||
@inject RoleManager<IdentityRole> _RoleManager
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
<h3>Administration</h3>
|
||||
<AuthorizeView Roles="Administrators">
|
||||
<Authorized>Gugus</Authorized>
|
||||
</AuthorizeView>
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
@if (@context.User.IsInRole(ADMINISTRATION_ROLE))
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>User Name</th>
|
||||
<th>Email</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var user in ColUsers)
|
||||
{
|
||||
<tr>
|
||||
<td>@user.Id.Substring(0, 5) ...</td>
|
||||
<td>@user.UserName</td>
|
||||
<td>@user.Email</td>
|
||||
<td>
|
||||
<!-- Edit the current forecast -->
|
||||
<button class="btn btn-primary"
|
||||
@onclick="(() => EditUser(user))">
|
||||
Edit
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@if (ShowPopup)
|
||||
{
|
||||
<!-- This is the popup to create or edit a user -->
|
||||
<div class="modal" tabindex="-1" style="display:block" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Edit User</h3>
|
||||
<!-- Button to close the popup -->
|
||||
<button type="button" class="close"
|
||||
@onclick="ClosePopup">
|
||||
<span aria-hidden="true">X</span>
|
||||
</button>
|
||||
</div>
|
||||
<!-- Edit form for the current forecast -->
|
||||
<div class="modal-body">
|
||||
<!-- Only show Id if not a new user -->
|
||||
@if (objUser.Id != "")
|
||||
{
|
||||
<p>@objUser.Id</p>
|
||||
}
|
||||
<!-- Only allow edit if a new user -->
|
||||
@if (objUser.Id != "")
|
||||
{
|
||||
<p>@objUser.UserName</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input class="form-control" type="text"
|
||||
placeholder="UserName"
|
||||
@bind="objUser.UserName" />
|
||||
}
|
||||
<input class="form-control" type="text"
|
||||
placeholder="Email"
|
||||
@bind="objUser.Email" />
|
||||
<input class="form-control" type="password"
|
||||
placeholder="Password"
|
||||
@bind="objUser.PasswordHash" />
|
||||
<select class="form-control"
|
||||
@bind="@CurrentUserRole">
|
||||
@foreach (var option in Options)
|
||||
{
|
||||
<option value="@option">
|
||||
@option
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
<br /><br />
|
||||
<!-- Button to save the user -->
|
||||
<button class="btn btn-primary"
|
||||
@onclick="SaveUser">
|
||||
Save
|
||||
</button>
|
||||
<!-- Only show delete button if not a new record -->
|
||||
@if (objUser.Id != "")
|
||||
{
|
||||
<!-- Button to delete the forecast -->
|
||||
<button class="btn btn-danger"
|
||||
@onclick="DeleteUser">
|
||||
Delete
|
||||
</button>
|
||||
}
|
||||
<br />
|
||||
<span style="color:red">@strError</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<button class="btn btn-success" @onclick="AddNewUser">Add User</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>You're not signed in as a user in @ADMINISTRATION_ROLE.</p>
|
||||
}
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<p>You're not loggged in.</p>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
private Task<AuthenticationState> authenticationStateTask { get; set; }
|
||||
|
||||
string ADMINISTRATION_ROLE = "Administrators";
|
||||
System.Security.Claims.ClaimsPrincipal CurrentUser;
|
||||
|
||||
// Property used to add or edit the currently selected user
|
||||
IdentityUser objUser = new IdentityUser();
|
||||
|
||||
// Tracks the selected role for the currently selected user
|
||||
string CurrentUserRole { get; set; } = "Users";
|
||||
|
||||
// Collection to display the existing users
|
||||
List<IdentityUser> ColUsers = new List<IdentityUser>();
|
||||
|
||||
// Options to display in the roles dropdown when editing a user
|
||||
List<string> Options = new List<string>() { "Users", "Administrators" };
|
||||
|
||||
// To hold any possible errors
|
||||
string strError = "";
|
||||
|
||||
// To enable showing the Popup
|
||||
bool ShowPopup = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// ensure there is a ADMINISTRATION_ROLE
|
||||
var RoleResult = await _RoleManager.FindByNameAsync(ADMINISTRATION_ROLE);
|
||||
if (RoleResult == null)
|
||||
{
|
||||
// Create ADMINISTRATION_ROLE Role
|
||||
await _RoleManager.CreateAsync(new IdentityRole(ADMINISTRATION_ROLE));
|
||||
}
|
||||
|
||||
// Ensure a user named Admin@BlazorHelpWebsite.com is an Administrator
|
||||
var user = await _UserManager.FindByNameAsync("Admin@BlazorHelpWebsite.com");
|
||||
if (user != null)
|
||||
{
|
||||
// Is Admin@BlazorHelpWebsite.com in administrator role?
|
||||
var UserResult = await _UserManager.IsInRoleAsync(user, ADMINISTRATION_ROLE);
|
||||
if (!UserResult)
|
||||
{
|
||||
// Put admin in Administrator role
|
||||
await _UserManager.AddToRoleAsync(user, ADMINISTRATION_ROLE);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the current logged in user
|
||||
CurrentUser = (await authenticationStateTask).User;
|
||||
|
||||
// Get the users
|
||||
GetUsers();
|
||||
}
|
||||
|
||||
public void GetUsers()
|
||||
{
|
||||
// clear any error messages
|
||||
strError = "";
|
||||
|
||||
// Collection to hold users
|
||||
ColUsers = new List<IdentityUser>();
|
||||
|
||||
// get users from _UserManager
|
||||
var user = _UserManager.Users.Select(x => new IdentityUser
|
||||
{
|
||||
Id = x.Id,
|
||||
UserName = x.UserName,
|
||||
Email = x.Email,
|
||||
PasswordHash = "*****"
|
||||
});
|
||||
|
||||
foreach (var item in user)
|
||||
{
|
||||
ColUsers.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
void AddNewUser()
|
||||
{
|
||||
// Make new user
|
||||
objUser = new IdentityUser();
|
||||
objUser.PasswordHash = "*****";
|
||||
|
||||
// Set Id to blank so we know it is a new record
|
||||
objUser.Id = "";
|
||||
|
||||
// Open the Popup
|
||||
ShowPopup = true;
|
||||
}
|
||||
|
||||
async Task SaveUser()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Is this an existing user?
|
||||
if (objUser.Id != "")
|
||||
{
|
||||
// Get the user
|
||||
var user = await _UserManager.FindByIdAsync(objUser.Id);
|
||||
|
||||
// Update Email
|
||||
user.Email = objUser.Email;
|
||||
|
||||
// Update the user
|
||||
await _UserManager.UpdateAsync(user);
|
||||
|
||||
// Only update password if the current value
|
||||
// is not the default value
|
||||
if (objUser.PasswordHash != "*****")
|
||||
{
|
||||
var resetToken =
|
||||
await _UserManager.GeneratePasswordResetTokenAsync(user);
|
||||
|
||||
var passworduser =
|
||||
await _UserManager.ResetPasswordAsync(
|
||||
user,
|
||||
resetToken,
|
||||
objUser.PasswordHash);
|
||||
|
||||
if (!passworduser.Succeeded)
|
||||
{
|
||||
if (passworduser.Errors.FirstOrDefault() != null)
|
||||
{
|
||||
strError =
|
||||
passworduser
|
||||
.Errors
|
||||
.FirstOrDefault()
|
||||
.Description;
|
||||
}
|
||||
else
|
||||
{
|
||||
strError = "Pasword error";
|
||||
}
|
||||
|
||||
// Keep the popup opened
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Roles
|
||||
|
||||
// Is user in administrator role?
|
||||
var UserResult =
|
||||
await _UserManager
|
||||
.IsInRoleAsync(user, ADMINISTRATION_ROLE);
|
||||
|
||||
// Is Administrator role selected
|
||||
// but user is not an Administrator?
|
||||
if (
|
||||
(CurrentUserRole == ADMINISTRATION_ROLE)
|
||||
&
|
||||
(!UserResult))
|
||||
{
|
||||
// Put admin in Administrator role
|
||||
await _UserManager
|
||||
.AddToRoleAsync(user, ADMINISTRATION_ROLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Is Administrator role not selected
|
||||
// but user is an Administrator?
|
||||
if ((CurrentUserRole != ADMINISTRATION_ROLE)
|
||||
&
|
||||
(UserResult))
|
||||
{
|
||||
// Remove user from Administrator role
|
||||
await _UserManager
|
||||
.RemoveFromRoleAsync(user, ADMINISTRATION_ROLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Insert new user
|
||||
|
||||
var NewUser =
|
||||
new IdentityUser
|
||||
{
|
||||
UserName = objUser.UserName,
|
||||
Email = objUser.Email
|
||||
};
|
||||
|
||||
var CreateResult =
|
||||
await _UserManager
|
||||
.CreateAsync(NewUser, objUser.PasswordHash);
|
||||
|
||||
if (!CreateResult.Succeeded)
|
||||
{
|
||||
if (CreateResult
|
||||
.Errors
|
||||
.FirstOrDefault() != null)
|
||||
{
|
||||
strError =
|
||||
CreateResult
|
||||
.Errors
|
||||
.FirstOrDefault()
|
||||
.Description;
|
||||
}
|
||||
else
|
||||
{
|
||||
strError = "Create error";
|
||||
}
|
||||
|
||||
// Keep the popup opened
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle Roles
|
||||
if (CurrentUserRole == ADMINISTRATION_ROLE)
|
||||
{
|
||||
// Put admin in Administrator role
|
||||
await _UserManager
|
||||
.AddToRoleAsync(NewUser, ADMINISTRATION_ROLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close the Popup
|
||||
ShowPopup = false;
|
||||
|
||||
// Refresh Users
|
||||
GetUsers();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
strError = ex.GetBaseException().Message;
|
||||
}
|
||||
}
|
||||
|
||||
async Task EditUser(IdentityUser _IdentityUser)
|
||||
{
|
||||
// Set the selected user
|
||||
// as the current user
|
||||
objUser = _IdentityUser;
|
||||
|
||||
// Get the user
|
||||
var user = await _UserManager.FindByIdAsync(objUser.Id);
|
||||
if (user != null)
|
||||
{
|
||||
// Is user in administrator role?
|
||||
var UserResult =
|
||||
await _UserManager
|
||||
.IsInRoleAsync(user, ADMINISTRATION_ROLE);
|
||||
|
||||
if (UserResult)
|
||||
{
|
||||
CurrentUserRole = ADMINISTRATION_ROLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentUserRole = "Users";
|
||||
}
|
||||
}
|
||||
|
||||
// Open the Popup
|
||||
ShowPopup = true;
|
||||
}
|
||||
|
||||
async Task DeleteUser()
|
||||
{
|
||||
// Close the Popup
|
||||
ShowPopup = false;
|
||||
|
||||
// Get the user
|
||||
var user = await _UserManager.FindByIdAsync(objUser.Id);
|
||||
if (user != null)
|
||||
{
|
||||
// Delete the user
|
||||
await _UserManager.DeleteAsync(user);
|
||||
}
|
||||
|
||||
// Refresh Users
|
||||
GetUsers();
|
||||
}
|
||||
|
||||
void ClosePopup()
|
||||
{
|
||||
// Close the Popup
|
||||
ShowPopup = false;
|
||||
}
|
||||
}
|
||||
80
BlazorApp - Kopie (3)/Pages/Buttons.razor
Normal file
80
BlazorApp - Kopie (3)/Pages/Buttons.razor
Normal file
@@ -0,0 +1,80 @@
|
||||
@page "/buttons"
|
||||
@page "/button"
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<h4>Button with text</h4>
|
||||
<RadzenButton Click=@(args => OnClick("Button with text")) Text="Button" Style="margin-bottom: 20px; width: 150px" />
|
||||
</div>
|
||||
<div class="col-xl-6">
|
||||
<h4>Button with text and icon</h4>
|
||||
<RadzenButton Click=@(args => OnClick("Button with text and icon")) Text="Button" Icon="account_circle" Style="margin-bottom: 20px; width: 150px" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<h4>Button with icon</h4>
|
||||
<RadzenButton Click=@(args => OnClick("Button with icon")) Icon="account_circle" Style="margin-bottom: 20px; width: 80px" />
|
||||
</div>
|
||||
<div class="col-xl-6">
|
||||
<h4>Button with image</h4>
|
||||
<RadzenButton Click=@(args => OnClick("Button with image")) Image="images/radzen-nuget.png" ButtonStyle="ButtonStyle.Light" Style="margin-bottom: 20px; width: 80px" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<h4>Button with content</h4>
|
||||
<RadzenButton Click=@(args => OnClick("Button with content")) Image="images/radzen-nuget.png" ButtonStyle="ButtonStyle.Light" Style="margin-bottom: 20px; width: 200px">
|
||||
Some text
|
||||
<RadzenImage Path="images/radzen-nuget.png" Style="width:20px;margin-left: 10px;" />
|
||||
</RadzenButton>
|
||||
</div>
|
||||
<div class="col-xl-6">
|
||||
<h4>Disabled Button</h4>
|
||||
<RadzenButton Disabled="true" Text="Button" Style="margin-bottom: 20px; width: 150px" />
|
||||
</div>
|
||||
</div>
|
||||
<h4>Button styles</h4>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<RadzenButton style="margin: 0 1rem 1rem 0" Click=@(args => OnClick("Primary button")) Text="Primary" ButtonStyle="ButtonStyle.Primary" />
|
||||
<RadzenButton style="margin: 0 1rem 1rem 0" Click=@(args => OnClick("Secondary button")) Text="Secondary" ButtonStyle="ButtonStyle.Secondary" />
|
||||
<RadzenButton style="margin: 0 1rem 1rem 0" Click=@(args => OnClick("Light button")) Text="Light" ButtonStyle="ButtonStyle.Light" />
|
||||
<RadzenButton style="margin: 0 1rem 1rem 0" Click=@(args => OnClick("Danger button")) Text="Danger" ButtonStyle="ButtonStyle.Danger" />
|
||||
<RadzenButton style="margin: 0 1rem 1rem 0" Click=@(args => OnClick("Info button")) Text="Info" ButtonStyle="ButtonStyle.Info" />
|
||||
<RadzenButton style="margin-bottom: 16px" Click=@(args => OnClick("Warning button ")) Text="Warning" ButtonStyle="ButtonStyle.Warning" />
|
||||
</div>
|
||||
</div>
|
||||
<h4>Busy Indicator</h4>
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<h5>Without BusyText</h5>
|
||||
<RadzenButton style="margin: 0 1rem 1rem 0; width: 150px" IsBusy=@busy Click=@OnBusyClick Text="Save" />
|
||||
</div>
|
||||
|
||||
<div class="col-xl-6">
|
||||
<h5>With Busy Text</h5>
|
||||
<RadzenButton style="margin: 0 1rem 1rem 0; width: 200px" Icon="save" BusyText="Saving ..." IsBusy=@busy Click=@OnBusyClick Text="Save" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
bool busy;
|
||||
|
||||
void OnClick(string buttonName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
async Task OnBusyClick()
|
||||
{
|
||||
busy = true;
|
||||
await Task.Delay(2000);
|
||||
busy = false;
|
||||
} }
|
||||
431
BlazorApp - Kopie (3)/Pages/Company/Berufsangebot.razor
Normal file
431
BlazorApp - Kopie (3)/Pages/Company/Berufsangebot.razor
Normal file
@@ -0,0 +1,431 @@
|
||||
@page "/Company/Berufsangebot"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits Admin.ListBase;
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using Syncfusion.Blazor.Navigations;
|
||||
@using Syncfusion.Blazor.Popups;
|
||||
@using Syncfusion.Blazor.DropDowns
|
||||
@using Syncfusion.Blazor.Lists
|
||||
@using Syncfusion.Blazor.Inputs;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
<h3>Berufsangebot</h3> (Bitte erfassen Sie Ihr Berufsangebot)
|
||||
<hr />
|
||||
<p></p>
|
||||
<div class="control-section e-tab-section">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4>Berufe</h4>
|
||||
<SfListBox @bind-Value=@BerufID TValue="string[]" DataSource="@berufe" TItem="Beruf" Height="200px">
|
||||
<ListBoxSelectionSettings Mode="Syncfusion.Blazor.DropDowns.SelectionMode.Single" ShowCheckbox="false"></ListBoxSelectionSettings>
|
||||
<ListBoxFieldSettings Text="bezeichnung" Value="id" />
|
||||
</SfListBox>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<h4>Ansprechperson</h4>
|
||||
|
||||
<SfListBox @bind-Value=@AnsprechpartnerID TValue="string[]" DataSource="@lap" TItem="AP" Height="200px">
|
||||
<ListBoxFieldSettings Text="name" Value="ID" />
|
||||
</SfListBox>
|
||||
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<h4>Zeiten</h4>
|
||||
<SfListBox @bind-Value=@ZeitID TValue="string[]" DataSource="@zeiten" TItem="Zeit" Height="200px">
|
||||
<ListBoxSelectionSettings Mode="Syncfusion.Blazor.DropDowns.SelectionMode.Single" ShowCheckbox="false"></ListBoxSelectionSettings>
|
||||
<ListBoxFieldSettings Text="bezeichnung" Value="id" />
|
||||
</SfListBox>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<h4>Plätze</h4>
|
||||
<label>Max. Anzahl Plätze</label>
|
||||
<SfDropDownList @bind-Value=@PlatzID TValue="string" TItem="Plaetze" Placeholder="Max. Anzahl Plätze" DataSource="@plaetze">
|
||||
<DropDownListFieldSettings Value="id" Text="text"></DropDownListFieldSettings>
|
||||
</SfDropDownList>
|
||||
<label>Klassentyp</label>
|
||||
<SfDropDownList @bind-Value=@KlassenTypID TValue="string" TItem="Klassentyp" Placeholder="Klassentyp" DataSource="@klassentyp">
|
||||
<DropDownListFieldSettings Value="ID" Text="bezeichnung"></DropDownListFieldSettings>
|
||||
</SfDropDownList>
|
||||
<p></p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<hr />
|
||||
<p></p>
|
||||
|
||||
</div>
|
||||
<div class="control-section e-tab-section">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4>Bemerkung</h4>
|
||||
<SfTextBox Multiline=true Placeholder="Allgemeine Bemerkung" @bind-Value="@bemerkung"> </SfTextBox>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<h4>Hinweis für den Schüler</h4>
|
||||
<SfTextBox Multiline=true Placeholder="Hinweise für Schüler" @bind-Value="@schuelerbemerkung"> </SfTextBox>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<h4>Hinweis zum Standortler</h4>
|
||||
<SfTextBox Multiline=true Placeholder="Hinweise bezüglich Standort" @bind-Value="@standortbemerkung"> </SfTextBox>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p></p>
|
||||
<div class="control-section e-tab-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfButton @onclick="einfuegen" CssClass="e-flat" IsPrimary="true">Einfügen</SfButton>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<h3>Ihr Angebot</h3>
|
||||
<div class="col-lg-12 control-section">
|
||||
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" Toolbar="@(new List<string>() { "Edit", "Delete" })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true" ></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="BWPMModels.Firmaberuf" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Single"></GridSelectionSettings>
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Visible="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.firmaID) HeaderText="Firmaid" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
@* <GridColumn Field=@nameof(Firmaberuf.berufID) HeaderText="Berufid" Width="100" Visible="true"></GridColumn>*@
|
||||
<GridForeignColumn Field=@nameof(Firmaberuf.berufID) HeaderText="Beruf" ForeignKeyField="id" ForeignKeyValue="bezeichnung" ForeignDataSource="@berufe" Width="150"></GridForeignColumn>
|
||||
|
||||
@* <GridColumn Field=@nameof(Firmaberuf.ansprechpartnerID) HeaderText="Ansprechpartnerid" Width="100" Visible="true"></GridColumn>*@
|
||||
<GridForeignColumn Field=@nameof(Firmaberuf.ansprechpartnerID) HeaderText="Ansprechpartner" ForeignKeyField="ID" ForeignKeyValue="name" ForeignDataSource="@lap" Width="150"></GridForeignColumn>
|
||||
|
||||
@* <GridColumn Field=@nameof(Firmaberuf.zeitID) HeaderText="Zeitid" Width="100" Visible="true"></GridColumn>*@
|
||||
<GridForeignColumn Field=@nameof(Firmaberuf.zeitID) HeaderText="Zeit" ForeignKeyField="id" ForeignKeyValue="bezeichnung" ForeignDataSource="@zeiten" Width="150"></GridForeignColumn>
|
||||
|
||||
@* <GridColumn Field=@nameof(Firmaberuf.klassetypID) HeaderText="Klassetypid" Width="100" Visible="true"></GridColumn>*@
|
||||
<GridForeignColumn Field=@nameof(Firmaberuf.klassetypID) HeaderText="Klassentyp" ForeignKeyField="ID" ForeignKeyValue="bezeichnung" ForeignDataSource="@klassentyp" Width="150"></GridForeignColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.anzahl) HeaderText="Anzahl" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.bemerkung) HeaderText="Bemerkung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.schuelerbemerkung) HeaderText="Schuelerbemerkung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.standortbemerkung) HeaderText="Standortbemerkung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.minzuteilung) HeaderText="Minzuteilung" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.aktiv) HeaderText="Aktiv" Width="100" Visible="false" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Firmaberuf.mutierer) HeaderText="Mutierer" Width="100" Visible="false"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<SfDialog Width="350px" IsModal="true" @bind-Visible="@ShowDialog">
|
||||
<DialogTemplates>
|
||||
<Header> Angaben sind unvollständig </Header>
|
||||
<Content>@((MarkupString)this.message)</Content>
|
||||
|
||||
</DialogTemplates>
|
||||
<DialogButtons>
|
||||
<DialogButton Content="OK" IsPrimary="true" OnClick="@CloseDialog" />
|
||||
</DialogButtons>
|
||||
</SfDialog>
|
||||
@code {
|
||||
public string[] BerufID;
|
||||
public string[] AnsprechpartnerID;
|
||||
public string[] ZeitID;
|
||||
public string PlatzID = "1";
|
||||
public string KlassenTypID = "1";
|
||||
public string bemerkung { get; set; } = "";
|
||||
public string schuelerbemerkung { get; set; }= "";
|
||||
public string standortbemerkung { get; set; }= "";
|
||||
public bool ShowDialog = false;
|
||||
string message = "";
|
||||
|
||||
SfGrid<BWPMModels.Firmaberuf> Grid { get; set; }
|
||||
string userid = "";
|
||||
static string firmaid = "";
|
||||
|
||||
public List<Beruf> berufe = new List<Beruf>();
|
||||
public List<BWPMModels.Beruf> _berufe { get; set; } = BlazorApp.Controller.BerufController.GetAllAktiveData();
|
||||
public List<Zeit> zeiten = new List<Zeit>();
|
||||
|
||||
public List<BWPMModels.Zeiten> _zeiten { get; set; } = BlazorApp.Controller.ZeitenController.GetAllAktiveData();
|
||||
public List<BWPMModels.Ansprechpartner> ansprechpartner { get; set; }
|
||||
public List<BWPMModels.Klassentyp> klassentyp { get; set; } = BlazorApp.Controller.KlassentypController.GetAllAktiveData();
|
||||
public List<BWPMModels.Firma> Firmendaten { get; set; }
|
||||
public List<AP> lap = new List<AP>();
|
||||
public List<Plaetze> plaetze = new List<Plaetze>();
|
||||
public List<BWPMModels.Firmaberuf> GridData { get; set; }
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
protected override async void OnInitialized()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender != true) { return; };
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
userid = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
@*if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userid);
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userid);
|
||||
}*@
|
||||
|
||||
}
|
||||
firmaid = await sessionStorage.GetItemAsync<string>("FirmaID");
|
||||
if (firmaid == null)
|
||||
{
|
||||
Firmendaten = BlazorApp.Controller.FirmaController.GetByUserID(userid);
|
||||
firmaid = Firmendaten.First<BWPMModels.Firma>().ID.ToString();
|
||||
}
|
||||
try
|
||||
{
|
||||
GridData = BlazorApp.Controller.FirmaberufController.GetAllAktiveByFirmaID(Convert.ToInt32(firmaid));
|
||||
ansprechpartner = BlazorApp.Controller.AnsprechpartnerController.GetAllAktivDataByFirmaID(Convert.ToInt32(firmaid));
|
||||
foreach (Ansprechpartner item in ansprechpartner)
|
||||
{
|
||||
AP a1 = new AP();
|
||||
a1.ID = item.ID;
|
||||
a1.name = item.name;
|
||||
lap.Add(a1);
|
||||
}
|
||||
|
||||
|
||||
foreach (BWPMModels.Beruf item in _berufe)
|
||||
{
|
||||
Beruf be = new Beruf();
|
||||
be.id = item.ID;
|
||||
be.bezeichnung = item.bezeichnung;
|
||||
berufe.Add(be);
|
||||
}
|
||||
|
||||
foreach (BWPMModels.Zeiten item in _zeiten)
|
||||
{
|
||||
Zeit ze = new Zeit();
|
||||
ze.id = item.ID;
|
||||
ze.bezeichnung = item.bezeichnung;
|
||||
zeiten.Add(ze);
|
||||
}
|
||||
|
||||
klassentyp = BlazorApp.Controller.KlassentypController.GetAllAktiveData();
|
||||
foreach (Klassentyp item in klassentyp)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch { };
|
||||
await Task.Delay(200);
|
||||
try
|
||||
{
|
||||
await sessionStorage.SetItemAsync("FirmaID", firmaid);
|
||||
await sessionStorage.SetItemAsync("UserID", userid);
|
||||
|
||||
}
|
||||
catch { }
|
||||
for (int i = 1; i < 51; i++)
|
||||
{
|
||||
plaetze.Add(new Plaetze { id = i, text = i.ToString() });
|
||||
}
|
||||
PlatzID = "1";
|
||||
KlassenTypID = "1";
|
||||
}
|
||||
|
||||
public class AP
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Plaetze
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string text { get; set; }
|
||||
}
|
||||
|
||||
public class Beruf
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string bezeichnung { get; set; }
|
||||
}
|
||||
|
||||
public class Zeit
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string bezeichnung { get; set; }
|
||||
}
|
||||
|
||||
private void CloseDialog()
|
||||
{
|
||||
this.ShowDialog = false;
|
||||
}
|
||||
|
||||
public void einfuegen()
|
||||
{
|
||||
message = "";
|
||||
int bid = 0;
|
||||
int aid = 0;
|
||||
int zid = 0;
|
||||
int pid = 0;
|
||||
int kid = 0;
|
||||
|
||||
try { bid = Convert.ToInt32(BerufID[0]); } catch { };
|
||||
try { aid = Convert.ToInt32(AnsprechpartnerID[0]); } catch { };
|
||||
try { zid = Convert.ToInt32(ZeitID[0]); } catch { };
|
||||
try { pid = Convert.ToInt32(PlatzID); } catch { };
|
||||
try { kid = Convert.ToInt32(KlassenTypID); } catch { };
|
||||
|
||||
if (bid == 0) { message += "- Bitte einen Beruf auswählen<br/>"; };
|
||||
if (aid == 0) { message += "- Bitte einen Ansprechpartner auswählen<br/>"; };
|
||||
if (zid == 0) { message += "- Bitte einen Zeit auswählen<br/>"; };
|
||||
if (pid == 0) { message += "- Bitte Anzahl Plätze auswählen<br/>"; };
|
||||
if (kid == 0) { message += "- Bitte Klassentyp auswählen<br/>"; };
|
||||
if (message != "")
|
||||
{
|
||||
this.ShowDialog = true;
|
||||
return;
|
||||
}
|
||||
|
||||
BWPMModels.Firmaberuf fb = new BWPMModels.Firmaberuf();
|
||||
fb.firmaID = Convert.ToInt32(firmaid);
|
||||
fb.berufID = bid;
|
||||
fb.ansprechpartnerID = aid;
|
||||
fb.zeitID = zid;
|
||||
fb.anzahl = pid;
|
||||
fb.klassetypID = kid;
|
||||
fb.erstellt_am = DateTime.Now;
|
||||
fb.mutiert_am = DateTime.Now;
|
||||
fb.aktiv = true;
|
||||
fb.mutierer = userid;
|
||||
fb.bemerkung = bemerkung;
|
||||
fb.schuelerbemerkung = schuelerbemerkung;
|
||||
fb.standortbemerkung = standortbemerkung;
|
||||
BlazorApp.Controller.FirmaberufController.POST(fb);
|
||||
GridData = BlazorApp.Controller.FirmaberufController.GetAllAktiveByFirmaID(Convert.ToInt32(firmaid));
|
||||
Grid.Refresh();
|
||||
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Firmaberuf> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
Args.Data.erstellt_am = DateTime.Now;
|
||||
Args.Data.mutierer = userid;
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
Args.Data.aktiv = true;
|
||||
Args.Data.ID = BlazorApp.Controller.FirmaberufController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.FirmaberufController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Delete)
|
||||
{
|
||||
Args.Data.aktiv = false;
|
||||
Args.Data.mutierer = userid;
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.FirmaberufController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Firmaberuf> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid.SetRowData(Args.Data.ID, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.ID;
|
||||
xx = await DataHandler();
|
||||
await Grid.SelectRow(xx);
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.Firmaberuf> args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid.Refresh();
|
||||
await Grid.GoToPage(1);
|
||||
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
|
||||
{
|
||||
List<Firmaberuf> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].ID == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false; // prevent the default navigation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
}
|
||||
|
||||
}
|
||||
275
BlazorApp - Kopie (3)/Pages/Company/Company.razor
Normal file
275
BlazorApp - Kopie (3)/Pages/Company/Company.razor
Normal file
@@ -0,0 +1,275 @@
|
||||
@page "/Company/Company"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits Admin.ListBase;
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using Syncfusion.Blazor.Navigations;
|
||||
@using Syncfusion.Blazor.Popups;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@*<div class="container">*@
|
||||
|
||||
|
||||
<div class="control-section e-tab-section">
|
||||
|
||||
<EditForm Model="_firma" OnValidSubmit="@Submit" OnInvalidSubmit="@InvalidSubmit">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
<SfButton IsPrimary="true" OnClick="@(() => SaveClick())">Speichern</SfButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DataAnnotationsValidator />
|
||||
<SfTab ID="BlazorTab" Height="390">
|
||||
<TabItems>
|
||||
<TabItem>
|
||||
<ChildContent>
|
||||
<TabHeader Text="Kontakt-Daten"></TabHeader>
|
||||
</ChildContent>
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Adress-Daten</h5>
|
||||
<form>
|
||||
<div class="form-group row">
|
||||
<label for="nameZ1" class="col-2 col-form-label">Name</label>
|
||||
<div class="col-10">
|
||||
<InputText id="namez1" class="form-control" @bind-Value="_firma.nameZ1" placeholder="Firmenname" />
|
||||
<ValidationMessage For="@(() => _firma.nameZ1)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="nameZ2" class="col-2 col-form-label">Zusatz</label>
|
||||
<div class="col-10">
|
||||
<InputText id="nameZ2" class="form-control" @bind-Value="@_firma.nameZ2" placeholder="Zusatz" />
|
||||
<ValidationMessage For="@(() => _firma.nameZ2)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="strasse" class="col-2 col-form-label">Strasse</label>
|
||||
<div class="col-10">
|
||||
<InputText id="strasse" class="form-control" @bind-Value="@_firma.strasse" placeholder="Strasse" />
|
||||
<ValidationMessage For="@(() => _firma.strasse)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="plz" class="col-2 col-form-label">PLZ</label>
|
||||
<div class="col-10">
|
||||
<InputText id="plz" class="form-control" @bind-Value="@_firma.plz" placeholder="Postleitzahl" />
|
||||
<ValidationMessage For="@(() => _firma.plz)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ort" class="col-2 col-form-label">Ort</label>
|
||||
<div class="col-10">
|
||||
<InputText id="ort" class="form-control" @bind-Value="@_firma.ort" placeholder="Ort" />
|
||||
<ValidationMessage For="@(() => _firma.ort)" />
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="form-group row">
|
||||
<label for="telefon" class="col-2 col-form-label">Telefon</label>
|
||||
<div class="col-10">
|
||||
<InputText id="tel" class="form-control" @bind-Value="@_firma.tel" placeholder="Telefon-Nummer" />
|
||||
<ValidationMessage For="@(() => _firma.tel)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="email" class="col-2 col-form-label">E-Mail</label>
|
||||
<div class="col-10">
|
||||
<InputText id="mail" class="form-control" @bind-Value="@_firma.mail" placeholder="E-Mail" required="required" typeof="email" />
|
||||
<ValidationMessage For="@(() => _firma.mail)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="web" class="col-2 col-form-label">Internet</label>
|
||||
<div class="col-10">
|
||||
<InputText id="internet" class="form-control" @bind-Value="@_firma.web" placeholder="Internet" />
|
||||
<ValidationMessage For="@(() => _firma.web)" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="Bemerkungen" class="col-2 col-form-label">Bemerkung</label>
|
||||
<div class="col-10">
|
||||
<InputTextArea id="bemerkung" class="form-control" @bind-Value="@_firma.bemerkung" placeholder="Bemerkung" />
|
||||
<ValidationMessage For="@(() => _firma.bemerkung)" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Ansprechperson</h5>
|
||||
<form>
|
||||
<div class="form-group row">
|
||||
<label for="Anrede" class="col-2 col-form-label">Anrede</label>
|
||||
<div class="col-10">
|
||||
<select id="Anrede" name="Anrede" class="form-control" @bind="@_firma.anrede">
|
||||
<option value="1">Herr</option>
|
||||
<option value="2">Frau</option>
|
||||
<option value="3">Damen und Herren</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ansprechperson_anme" class="col-2 col-form-label">Name</label>
|
||||
<div class="col-10">
|
||||
<InputText id="ansprechperson_name" class="form-control" @bind-Value="@_firma.ansprechperson_name" placeholder="Name Ansprechperson" />
|
||||
<ValidationMessage For="@(() => _firma.ansprechperson_name)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ansprechperson_vorname" class="col-2 col-form-label">Vorname</label>
|
||||
<div class="col-10">
|
||||
<InputText id="ansprechperson_vorname" class="form-control" @bind-Value="@_firma.ansprechperon_vorname" placeholder="Vorname Ansprechperson" />
|
||||
<ValidationMessage For="@(() => _firma.ansprechperon_vorname)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="briefanrede" class="col-2 col-form-label">Briefanrede</label>
|
||||
<div class="col-10">
|
||||
<InputText id="briefanrede" class="form-control" @bind-Value="@_firma.briefanrede" placeholder="gewünschte Briefanrede" />
|
||||
<ValidationMessage For="@(() => _firma.briefanrede)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="handy" class="col-2 col-form-label">Telefon</label>
|
||||
<div class="col-10">
|
||||
<InputText id="handy" class="form-control" @bind-Value="@_firma.handy" placeholder="Telefon" />
|
||||
<ValidationMessage For="@(() => _firma.handy)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
|
||||
</TabItem>
|
||||
<TabItem>
|
||||
<ChildContent>
|
||||
<TabHeader text="Angaben zur Ausbildung"></TabHeader>
|
||||
</ChildContent>
|
||||
<ContentTemplate>
|
||||
<div class="col-md-10">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Allgemeine Angaben</h5>
|
||||
<form>
|
||||
<div class="form-group row">
|
||||
<label for="ausbildung_Standort" class="col-2 col-form-label">Ausbildungsstandort</label>
|
||||
<div class="col-10">
|
||||
<InputTextArea id="ausbildung_Standort" class="form-control" @bind-Value="@_firma.ausbildungsstandort" placeholder="Allgmeine Angaben über Ausbildungsstandort" />
|
||||
<ValidationMessage For="@(() => _firma.ausbildungsstandort)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ausbildung_bemerkung" class="col-2 col-form-label">Bemerkung</label>
|
||||
<div class="col-10">
|
||||
<InputTextArea id="ausbildung_bemerkung" class="form-control" @bind-Value="@_firma.ausbildungsbemerkung" placeholder="Allgemeine Bemerkungen zu den Ausbildungen" />
|
||||
<ValidationMessage For="@(() => _firma.ausbildungsbemerkung)" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</TabItem>
|
||||
</TabItems>
|
||||
</SfTab>
|
||||
|
||||
|
||||
</EditForm>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<SfDialog Width="250px" IsModal="true" @bind-Visible="@ShowErrorDialog">
|
||||
<DialogTemplates>
|
||||
<Header> Formmular unvollständig </Header>
|
||||
<Content> Bitte das Formular vollständig ausfüllen. </Content>
|
||||
|
||||
</DialogTemplates>
|
||||
<DialogButtons>
|
||||
<DialogButton Content="OK" IsPrimary="true" OnClick="@CloseDialog" />
|
||||
</DialogButtons>
|
||||
</SfDialog>
|
||||
|
||||
@*</div>*@
|
||||
@code {
|
||||
private Firma _firma { get; set; } = new BWPMModels.Firma();
|
||||
public List<BWPMModels.Firma> Firmendaten { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
private bool ShowErrorDialog { get; set; } = false;
|
||||
|
||||
public void Submit()
|
||||
{
|
||||
BlazorApp.Controller.FirmaController.PUT(_firma);
|
||||
}
|
||||
public void InvalidSubmit()
|
||||
{
|
||||
ShowErrorDialog = true;
|
||||
}
|
||||
private void CloseDialog()
|
||||
{
|
||||
this.ShowErrorDialog = false;
|
||||
}
|
||||
|
||||
private void SaveClick()
|
||||
{
|
||||
//BlazorApp.Controller.FirmaController.savedata(_firma);
|
||||
}
|
||||
|
||||
protected override async void OnInitialized()
|
||||
{
|
||||
|
||||
}
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
@*userid = "4c456017-85b9-4f34-a42c-f3ac534cc34f";*@
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
userid = userId;
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
userid = userId;
|
||||
}
|
||||
}
|
||||
if (firstRender)
|
||||
{
|
||||
Firmendaten = BlazorApp.Controller.FirmaController.GetByUserID(userid);
|
||||
_firma = Firmendaten.First<BWPMModels.Firma>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
212
BlazorApp - Kopie (3)/Pages/Company/CompanyContact.razor
Normal file
212
BlazorApp - Kopie (3)/Pages/Company/CompanyContact.razor
Normal file
@@ -0,0 +1,212 @@
|
||||
@page "/Company/CompanyContact"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits Admin.ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using Syncfusion.Blazor.Popups;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@using BlazorApp.Controller;
|
||||
|
||||
|
||||
<h1>Ansprechpartner</h1>
|
||||
|
||||
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="Ansprechpartner" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.FirmaID) HeaderText="Firmaid" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.name) HeaderText="Name" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.vorname) HeaderText="Vorname" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.anrede) HeaderText="Anrede" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.tel) HeaderText="Tel" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.email) HeaderText="Email" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.aktiv) HeaderText="Aktiv" Width="100" Visible="true" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Ansprechpartner.mutierer) HeaderText="Mutierer" Width="100" Visible="false"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SfDialog Width="250px" IsModal="true" @bind-Visible="@ShowDialog">
|
||||
<DialogTemplates>
|
||||
<Header> Formmular unvollständig </Header>
|
||||
<Content> Bitte das Formular vollständig ausfüllen. </Content>
|
||||
|
||||
</DialogTemplates>
|
||||
<DialogButtons>
|
||||
<DialogButton Content="OK" IsPrimary="true" OnClick="@CloseDialog" />
|
||||
</DialogButtons>
|
||||
</SfDialog>
|
||||
@code{
|
||||
SfGrid<Ansprechpartner> Grid { get; set; }
|
||||
public List<BWPMModels.Ansprechpartner> GridData { get; set; }
|
||||
public List<BWPMModels.Ansprechpartner> Ansprechpartners { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
|
||||
private Firma _firma { get; set; } = new BWPMModels.Firma();
|
||||
public List<BWPMModels.Firma> Firmendaten { get; set; }
|
||||
private bool ShowDialog { get; set; } = false;
|
||||
|
||||
private void CloseDialog()
|
||||
{
|
||||
this.ShowDialog = false;
|
||||
}
|
||||
|
||||
protected override async void OnInitialized()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
@*userid = "4c456017-85b9-4f34-a42c-f3ac534cc34f";*@
|
||||
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
userid = userId;
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
userid = userId;
|
||||
}
|
||||
}
|
||||
|
||||
Firmendaten = BlazorApp.Controller.FirmaController.GetByUserID(userid);
|
||||
_firma = Firmendaten.First<BWPMModels.Firma>();
|
||||
if (_firma.nameZ1==""){
|
||||
ShowDialog = true;
|
||||
return;
|
||||
}
|
||||
GridData = BlazorApp.Controller.AnsprechpartnerController.GetByFirmaID(_firma.ID);
|
||||
|
||||
}
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Ansprechpartner> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
|
||||
Args.Data.erstellt_am = DateTime.Now;
|
||||
Args.Data.mutierer = userid;
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
Args.Data.aktiv = true;
|
||||
Args.Data.FirmaID = _firma.ID;
|
||||
Args.Data.ID = BlazorApp.Controller.AnsprechpartnerController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.AnsprechpartnerController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Ansprechpartner> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid.SetRowData(Args.Data.ID, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.ID;
|
||||
xx = await DataHandler();
|
||||
await Grid.SelectRow(xx);
|
||||
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.Ansprechpartner> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
//await Task.Delay(100);
|
||||
//var Idx = await this.Grid.GetRowIndexByPrimaryKey(Convert.ToDouble(Value)); //get index value
|
||||
//this.Grid.SelectRow(Convert.ToDouble(Idx));
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData.Count / Grid.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid.Refresh();
|
||||
await Grid.GoToPage(1);
|
||||
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
|
||||
{
|
||||
List<Ansprechpartner> Rows = await Grid.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].ID == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false; // prevent the default navigation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
273
BlazorApp - Kopie (3)/Pages/Company/Test.razor
Normal file
273
BlazorApp - Kopie (3)/Pages/Company/Test.razor
Normal file
@@ -0,0 +1,273 @@
|
||||
@page "/Company/Test"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits Admin.ListBase;
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using Syncfusion.Blazor.Navigations;
|
||||
@using Syncfusion.Blazor.Popups;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@*<div class="container">*@
|
||||
|
||||
|
||||
<div class="control-section e-tab-section">
|
||||
|
||||
<EditForm Model="_firma" OnValidSubmit="@Submit" OnInvalidSubmit="@InvalidSubmit">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
<SfButton IsPrimary="true" OnClick="@(() => SaveClick())">Speichern</SfButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DataAnnotationsValidator />
|
||||
<SfTab ID="BlazorTab" Height="390">
|
||||
<TabItems>
|
||||
<TabItem>
|
||||
<ChildContent>
|
||||
<TabHeader Text="Kontakt-Daten"></TabHeader>
|
||||
</ChildContent>
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Adress-Daten</h5>
|
||||
<form>
|
||||
<div class="form-group row">
|
||||
<label for="nameZ1" class="col-2 col-form-label">Name</label>
|
||||
<div class="col-10">
|
||||
<InputText id="namez1" class="form-control" @bind-Value="_firma.nameZ1" placeholder="Firmenname" />
|
||||
<ValidationMessage For="@(() => _firma.nameZ1)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="nameZ2" class="col-2 col-form-label">Zusatz</label>
|
||||
<div class="col-10">
|
||||
<InputText id="nameZ2" class="form-control" @bind-Value="@_firma.nameZ2" placeholder="Zusatz" />
|
||||
<ValidationMessage For="@(() => _firma.nameZ2)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="strasse" class="col-2 col-form-label">Strasse</label>
|
||||
<div class="col-10">
|
||||
<InputText id="strasse" class="form-control" @bind-Value="@_firma.strasse" placeholder="Strasse" />
|
||||
<ValidationMessage For="@(() => _firma.strasse)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="plz" class="col-2 col-form-label">PLZ</label>
|
||||
<div class="col-10">
|
||||
<InputText id="plz" class="form-control" @bind-Value="@_firma.plz" placeholder="Postleitzahl" />
|
||||
<ValidationMessage For="@(() => _firma.plz)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ort" class="col-2 col-form-label">Ort</label>
|
||||
<div class="col-10">
|
||||
<InputText id="ort" class="form-control" @bind-Value="@_firma.ort" placeholder="Ort" />
|
||||
<ValidationMessage For="@(() => _firma.ort)" />
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="form-group row">
|
||||
<label for="telefon" class="col-2 col-form-label">Telefon</label>
|
||||
<div class="col-10">
|
||||
<InputText id="tel" class="form-control" @bind-Value="@_firma.tel" placeholder="Telefon-Nummer" />
|
||||
<ValidationMessage For="@(() => _firma.tel)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="email" class="col-2 col-form-label">E-Mail</label>
|
||||
<div class="col-10">
|
||||
<InputText id="mail" class="form-control" @bind-Value="@_firma.mail" placeholder="E-Mail" required="required" typeof="email" />
|
||||
<ValidationMessage For="@(() => _firma.mail)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="web" class="col-2 col-form-label">Internet</label>
|
||||
<div class="col-10">
|
||||
<InputText id="internet" class="form-control" @bind-Value="@_firma.web" placeholder="Internet" />
|
||||
<ValidationMessage For="@(() => _firma.web)" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="Bemerkungen" class="col-2 col-form-label">Bemerkung</label>
|
||||
<div class="col-10">
|
||||
<InputTextArea id="bemerkung" class="form-control" @bind-Value="@_firma.bemerkung" placeholder="Internet" />
|
||||
<ValidationMessage For="@(() => _firma.bemerkung)" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Ansprechperson</h5>
|
||||
<form>
|
||||
<div class="form-group row">
|
||||
<label for="Anrede" class="col-2 col-form-label">Anrede</label>
|
||||
<div class="col-10">
|
||||
<select id="Anrede" name="Anrede" class="form-control" @bind="@_firma.anrede">
|
||||
<option value="1">Herr</option>
|
||||
<option value="2">Frau</option>
|
||||
<option value="3">Damen und Herren</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ansprechperson_anme" class="col-2 col-form-label">Name</label>
|
||||
<div class="col-10">
|
||||
<InputText id="ansprechperson_name" class="form-control" @bind-Value="@_firma.ansprechperson_name" placeholder="Name Ansprechperson" />
|
||||
<ValidationMessage For="@(() => _firma.ansprechperson_name)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ansprechperson_vorname" class="col-2 col-form-label">Vorname</label>
|
||||
<div class="col-10">
|
||||
<InputText id="ansprechperson_vorname" class="form-control" @bind-Value="@_firma.ansprechperon_vorname" placeholder="Vorname Ansprechperson" />
|
||||
<ValidationMessage For="@(() => _firma.ansprechperon_vorname)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="briefanrede" class="col-2 col-form-label">Briefanrede</label>
|
||||
<div class="col-10">
|
||||
<InputText id="briefanrede" class="form-control" @bind-Value="@_firma.briefanrede" placeholder="gewünschte Briefanrede" />
|
||||
<ValidationMessage For="@(() => _firma.briefanrede)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="handy" class="col-2 col-form-label">Telefon</label>
|
||||
<div class="col-10">
|
||||
<InputText id="handy" class="form-control" @bind-Value="@_firma.handy" placeholder="Telefon" />
|
||||
<ValidationMessage For="@(() => _firma.handy)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
|
||||
</TabItem>
|
||||
<TabItem>
|
||||
<ChildContent>
|
||||
<TabHeader text="Angaben zur Ausbildung"></TabHeader>
|
||||
</ChildContent>
|
||||
<ContentTemplate>
|
||||
<div class="col-md-10">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Allgemeine Angaben</h5>
|
||||
<form>
|
||||
<div class="form-group row">
|
||||
<label for="ausbildung_Standort" class="col-2 col-form-label">Ausbildungsstandort</label>
|
||||
<div class="col-10">
|
||||
<InputTextArea id="ausbildung_Standort" class="form-control" @bind-Value="@_firma.ausbildungsstandort" placeholder="Allgmeine Angaben über Ausbildungsstandort" />
|
||||
<ValidationMessage For="@(() => _firma.ausbildungsstandort)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ausbildung_bemerkung" class="col-2 col-form-label">Bemerkung</label>
|
||||
<div class="col-10">
|
||||
<InputTextArea id="ausbildung_bemerkung" class="form-control" @bind-Value="@_firma.ausbildungsbemerkung" placeholder="Allgemeine Bemerkungen zu den Ausbildungen" />
|
||||
<ValidationMessage For="@(() => _firma.ausbildungsbemerkung)" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</ContentTemplate>
|
||||
</TabItem>
|
||||
</TabItems>
|
||||
</SfTab>
|
||||
|
||||
|
||||
</EditForm>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<SfDialog Width="250px" IsModal="true" @bind-Visible="@ShowErrorDialog">
|
||||
<DialogTemplates>
|
||||
<Header> Formmular unvollständig </Header>
|
||||
<Content> Bitte das Formular vollständig ausfüllen. </Content>
|
||||
|
||||
</DialogTemplates>
|
||||
<DialogButtons>
|
||||
<DialogButton Content="OK" IsPrimary="true" OnClick="@CloseDialog" />
|
||||
</DialogButtons>
|
||||
</SfDialog>
|
||||
|
||||
@*</div>*@
|
||||
@code {
|
||||
private Firma _firma { get; set; } = new BWPMModels.Firma();
|
||||
public List<BWPMModels.Firma> Firmendaten { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
private bool ShowErrorDialog { get; set; } = false;
|
||||
|
||||
public void Submit()
|
||||
{
|
||||
BlazorApp.Controller.FirmaController.PUT(_firma);
|
||||
}
|
||||
public void InvalidSubmit()
|
||||
{
|
||||
ShowErrorDialog = true;
|
||||
}
|
||||
private void CloseDialog()
|
||||
{
|
||||
this.ShowErrorDialog = false;
|
||||
}
|
||||
|
||||
private void SaveClick()
|
||||
{
|
||||
//BlazorApp.Controller.FirmaController.savedata(_firma);
|
||||
}
|
||||
|
||||
protected override async void OnInitialized()
|
||||
{
|
||||
userid = "4c456017-85b9-4f34-a42c-f3ac534cc34f";
|
||||
|
||||
@* userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
if (userid == null)
|
||||
{
|
||||
var authState = await authenticationStateTask;
|
||||
var userId = authState.User.Claims.FirstOrDefault().Value;
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
userid = userId;
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
userid = userId;
|
||||
}
|
||||
}*@
|
||||
|
||||
Firmendaten = BlazorApp.Controller.FirmaController.GetByUserID(userid);
|
||||
_firma = Firmendaten.First<BWPMModels.Firma>();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
5
BlazorApp - Kopie (3)/Pages/Component.razor
Normal file
5
BlazorApp - Kopie (3)/Pages/Component.razor
Normal file
@@ -0,0 +1,5 @@
|
||||
<h3>Component</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
16
BlazorApp - Kopie (3)/Pages/Counter.razor
Normal file
16
BlazorApp - Kopie (3)/Pages/Counter.razor
Normal file
@@ -0,0 +1,16 @@
|
||||
@page "/counter"
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p>Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
16
BlazorApp - Kopie (3)/Pages/Error.cshtml
Normal file
16
BlazorApp - Kopie (3)/Pages/Error.cshtml
Normal file
@@ -0,0 +1,16 @@
|
||||
@page
|
||||
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
46
BlazorApp - Kopie (3)/Pages/FetchData.razor
Normal file
46
BlazorApp - Kopie (3)/Pages/FetchData.razor
Normal file
@@ -0,0 +1,46 @@
|
||||
@page "/fetchdata"
|
||||
|
||||
@using BlazorApp.Data
|
||||
@inject WeatherForecastService ForecastService
|
||||
|
||||
<h1>Weather forecast</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from a service.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@code {
|
||||
private WeatherForecast[] forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
|
||||
}
|
||||
}
|
||||
11
BlazorApp - Kopie (3)/Pages/Index.razor
Normal file
11
BlazorApp - Kopie (3)/Pages/Index.razor
Normal file
@@ -0,0 +1,11 @@
|
||||
@page "/"
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
Welcome to your new app.
|
||||
|
||||
<SurveyPrompt Title="How is Blazor working for you?" />
|
||||
|
||||
<SfCalendar TValue="DateTime"></SfCalendar>
|
||||
|
||||
|
||||
57
BlazorApp - Kopie (3)/Pages/Shared/_Layout.cshtml
Normal file
57
BlazorApp - Kopie (3)/Pages/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,57 @@
|
||||
@using Microsoft.AspNetCore.Hosting
|
||||
@using Microsoft.AspNetCore.Mvc.ViewEngines
|
||||
@inject IWebHostEnvironment Environment
|
||||
@inject ICompositeViewEngine Engine
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - BWPM</title>
|
||||
<link rel="stylesheet" href="~/Identity/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/Identity/css/site.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-light navbar-toggleable-sm bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="~/">Berufswahl-Parcours-Manager</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
|
||||
@{
|
||||
var result = Engine.FindView(ViewContext, "_LoginPartial", isMainPage: false);
|
||||
}
|
||||
@if (result.Success)
|
||||
{
|
||||
await Html.RenderPartialAsync("_LoginPartial");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("The default Identity UI layout requires a partial view '_LoginPartial' " +
|
||||
"usually located at '/Pages/_LoginPartial' or at '/Views/Shared/_LoginPartial' to work. Based on your configuration " +
|
||||
$"we have looked at it in the following locations: {System.Environment.NewLine}{string.Join(System.Environment.NewLine, result.SearchedLocations)}.");
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
<footer class="footer border-top text-muted">
|
||||
<div class="container">
|
||||
© 2021 - BlazorApp - <a asp-area="" asp-page="Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/Identity/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/Identity/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/Identity/js/site.js" asp-append-version="true"></script>
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
27
BlazorApp - Kopie (3)/Pages/Shared/_LoginPartial.cshtml
Normal file
27
BlazorApp - Kopie (3)/Pages/Shared/_LoginPartial.cshtml
Normal file
@@ -0,0 +1,27 @@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
|
||||
<ul class="navbar-nav">
|
||||
@*@if (SignInManager.IsSignedIn(User))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a id="manage" class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<form id="logoutForm" class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/Index", new { area = "" })">
|
||||
<button id="logout" type="submit" class="nav-link btn btn-link text-dark">Logout</button>
|
||||
</form>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" id="register" asp-area="Identity" asp-page="/Account/Register">Register</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" id="login" asp-area="Identity" asp-page="/Account/Login">Login</a>
|
||||
</li>
|
||||
}
|
||||
</ul>*@
|
||||
@@ -0,0 +1,18 @@
|
||||
<environment include="Development">
|
||||
<script src="~/Identity/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||
<script src="~/Identity/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||
</environment>
|
||||
<environment exclude="Development">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.17.0/jquery.validate.min.js"
|
||||
asp-fallback-src="~/Identity/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-rZfj/ogBloos6wzLGpPkkOr/gpkBNLZ6b6yLy4o+ok+t/SAKlL5mvXLr0OXNi1Hp">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.9/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-src="~/Identity/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-ifv0TYDWxBHzvAk2Z0n8R434FL1Rlv/Av18DXE43N/1rvHyOG4izKst0f2iSLdds">
|
||||
</script>
|
||||
</environment>
|
||||
42
BlazorApp - Kopie (3)/Pages/_Host.cshtml
Normal file
42
BlazorApp - Kopie (3)/Pages/_Host.cshtml
Normal file
@@ -0,0 +1,42 @@
|
||||
@page "/"
|
||||
@namespace BlazorApp.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BlazorApp</title>
|
||||
<base href="~/" />
|
||||
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
<link href="_content/Syncfusion.Blazor.Themes/bootstrap4.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="_content/Radzen.Blazor/css/default-base.css">
|
||||
<link rel="stylesheet" href="_content/Radzen.Blazor/css/default.css">
|
||||
</head>
|
||||
<body>
|
||||
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
|
||||
<app>
|
||||
<component type="typeof(App)" render-mode="ServerPrerendered" />
|
||||
</app>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
<environment include="Staging,Production">
|
||||
An error has occurred. This application may no longer respond until reloaded.
|
||||
</environment>
|
||||
<environment include="Development">
|
||||
An unhandled exception has occurred. See browser dev tools for details.
|
||||
</environment>
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
6
BlazorApp - Kopie (3)/Pages/_ViewImports.cshtml
Normal file
6
BlazorApp - Kopie (3)/Pages/_ViewImports.cshtml
Normal file
@@ -0,0 +1,6 @@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
|
||||
|
||||
BlazorApp.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
3
BlazorApp - Kopie (3)/Pages/_ViewStart.cshtml
Normal file
3
BlazorApp - Kopie (3)/Pages/_ViewStart.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
Reference in New Issue
Block a user