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;
|
||||
} }
|
||||
Reference in New Issue
Block a user