update nach Schuelererfassung
This commit is contained in:
166
BlazorApp - Kopie (4)/Pages/Admin/Anrede/Anrede.razor
Normal file
166
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/AspNetUsers/AspNetUsers.razor
Normal file
175
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/AspNetUsers/UserRollen.razor
Normal file
140
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/Beruf/BerufListe.razor
Normal file
186
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/ListBase.cs
Normal file
36
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/Optionen/OptionenList.razor
Normal file
170
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/Schulhaus/SchulhausList.razor
Normal file
178
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/ScriptGenerator.razor
Normal file
111
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/User/UserList.cshtml.cs
Normal file
34
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/User/UserList.razor
Normal file
133
BlazorApp - Kopie (4)/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 (4)/Pages/Admin/Zeiten/Zeitenlist.razor
Normal file
187
BlazorApp - Kopie (4)/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 (4)/Pages/Administration.razor
Normal file
404
BlazorApp - Kopie (4)/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 (4)/Pages/Buttons.razor
Normal file
80
BlazorApp - Kopie (4)/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="Buttonx" 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;
|
||||
} }
|
||||
426
BlazorApp - Kopie (4)/Pages/Company/Berufsangebot.razor
Normal file
426
BlazorApp - Kopie (4)/Pages/Company/Berufsangebot.razor
Normal file
@@ -0,0 +1,426 @@
|
||||
@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" @ref="Berufsliste" 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>
|
||||
<SfTextBox Value="@fid"></SfTextBox>
|
||||
|
||||
<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 fid { get; set; } = "";
|
||||
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 = "";
|
||||
SfListBox<string[], Beruf> Berufsliste { get; set; }
|
||||
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 Task OnInitializedAsync()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
firmaid = await sessionStorage.GetItemAsync<string>("FirmaID");
|
||||
get_ansprechaprtner(firmaid);
|
||||
}
|
||||
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;
|
||||
|
||||
}
|
||||
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));
|
||||
|
||||
get_ansprechaprtner(firmaid);
|
||||
|
||||
}
|
||||
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";
|
||||
}
|
||||
|
||||
private void get_ansprechaprtner(string firmaid)
|
||||
{
|
||||
if (firmaid=="") {return;};
|
||||
lap.Clear();
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
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 (4)/Pages/Company/Company.razor
Normal file
275
BlazorApp - Kopie (4)/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 (4)/Pages/Company/CompanyContact.razor
Normal file
212
BlazorApp - Kopie (4)/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 (4)/Pages/Company/Test.razor
Normal file
273
BlazorApp - Kopie (4)/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 (4)/Pages/Component.razor
Normal file
5
BlazorApp - Kopie (4)/Pages/Component.razor
Normal file
@@ -0,0 +1,5 @@
|
||||
<h3>Component</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
16
BlazorApp - Kopie (4)/Pages/Counter.razor
Normal file
16
BlazorApp - Kopie (4)/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 (4)/Pages/Error.cshtml
Normal file
16
BlazorApp - Kopie (4)/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 (4)/Pages/FetchData.razor
Normal file
46
BlazorApp - Kopie (4)/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 (4)/Pages/Index.razor
Normal file
11
BlazorApp - Kopie (4)/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>
|
||||
|
||||
|
||||
131
BlazorApp - Kopie (4)/Pages/Reporting/Reporting.razor
Normal file
131
BlazorApp - Kopie (4)/Pages/Reporting/Reporting.razor
Normal file
@@ -0,0 +1,131 @@
|
||||
@page "/Reporting/Reporting"
|
||||
@page "/Reporting/Reporting/{ReportNr}"
|
||||
@inherits Admin.ListBase;
|
||||
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@using Microsoft.AspNetCore.Hosting;
|
||||
@using System.IO;
|
||||
@using System.Data;
|
||||
@using FastReport
|
||||
@using FastReport.Web
|
||||
@using FastReport.Web.Blazor.Components
|
||||
@using BWPMModels;
|
||||
@using Syncfusion.Blazor.Spinner
|
||||
<div id="container">
|
||||
|
||||
<WebReportContainer WebReport="@UserWebReport" />
|
||||
<SfSpinner @bind-Visible="@Spinnervisible">
|
||||
</SfSpinner>
|
||||
</div>
|
||||
@emsg;
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string ReportNr { get; set; }
|
||||
|
||||
public string emsg { get; set; } = "";
|
||||
private IHostingEnvironment Environment;
|
||||
private bool Spinnervisible { get; set; } = true;
|
||||
public string ReportName { get; set; }
|
||||
public DataSet DataSet { get; set; } = new DataSet();
|
||||
public WebReport UserWebReport { get; set; } = new WebReport();
|
||||
public Report Report { get; set; } = new Report();
|
||||
string guserid = "";
|
||||
string sql = "";
|
||||
|
||||
private Firma _firma { get; set; } = new BWPMModels.Firma();
|
||||
public List<BWPMModels.Firma> Firmendaten { get; set; }
|
||||
|
||||
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
Spinnervisible = false;
|
||||
}
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
string paramtyp1 = "";
|
||||
string paramtyp2 = "";
|
||||
string paramtyp3 = "";
|
||||
|
||||
Helper.dbhelper dbh = new Helper.dbhelper();
|
||||
string reportdir = dbh.Get_Option(28);
|
||||
|
||||
reportdir += "/";
|
||||
dbh.Get_Tabledata("Select * from Report where id=" + ReportNr.ToString(), false, true);
|
||||
@*reportdir = "Reports/";*@
|
||||
try
|
||||
{
|
||||
Report = Report.FromFile(reportdir + dbh.dsdaten.Tables[0].Rows[0]["reportfile"]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
emsg=e.Message;
|
||||
return;
|
||||
}
|
||||
paramtyp1 = dbh.dsdaten.Tables[0].Rows[0]["paramtype1"].ToString();
|
||||
paramtyp2 = dbh.dsdaten.Tables[0].Rows[0]["paramtype2"].ToString();
|
||||
paramtyp3 = dbh.dsdaten.Tables[0].Rows[0]["paramtype3"].ToString();
|
||||
|
||||
sql = dbh.dsdaten.Tables[0].Rows[0]["sql"].ToString();
|
||||
|
||||
switch (paramtyp1)
|
||||
{
|
||||
case "%firmaID%":
|
||||
Firmendaten = BlazorApp.Controller.FirmaController.GetByUserID(userid);
|
||||
_firma = Firmendaten.First<BWPMModels.Firma>();
|
||||
sql = sql.Replace("%firmaid%", _firma.ID.ToString());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
dbh.dsdaten.Tables.Clear();
|
||||
DataSet.Tables.Clear();
|
||||
DataSet.Tables.Add(dbh.Get_Tabledata(sql, false, true).Copy());
|
||||
Report.SetParameterValue("Parcours", dbh.Get_Option(2));
|
||||
Report.SetParameterValue("Spruch", dbh.Get_Option(3));
|
||||
Report.SetParameterValue("URL", dbh.Get_Option(27));
|
||||
Report.RegisterData(DataSet);
|
||||
Report.GetDataSource("Daten").Enabled = true;
|
||||
|
||||
UserWebReport.Report = Report;
|
||||
UserWebReport.Report.Refresh();
|
||||
Spinnervisible = false;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
UserWebReport = new WebReport();
|
||||
}
|
||||
catch (Exception e)
|
||||
{ emsg = e.Message.ToString(); };
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
38
BlazorApp - Kopie (4)/Pages/Reporting/Reporting.razor.cs
Normal file
38
BlazorApp - Kopie (4)/Pages/Reporting/Reporting.razor.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using FastReport;
|
||||
using FastReport.Web;
|
||||
|
||||
|
||||
namespace BlazorApp.Pages.Reporting
|
||||
{
|
||||
public partial class Reporting
|
||||
{
|
||||
readonly string directory;
|
||||
const string DEFAULT_REPORT = "userliste.frx";
|
||||
string userid = "";
|
||||
//Report Report { get; set; }
|
||||
//DataSet DataSet { get; } = new DataSet();
|
||||
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
base.OnParametersSet();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Reporting()
|
||||
{
|
||||
|
||||
BlazorApp.Helper.dbhelper dbh = new Helper.dbhelper();
|
||||
DataSet.Tables.Add(dbh.Get_Tabledata("Select * from AspNetUsers", false, true).Copy());
|
||||
DataSet.Tables[0].TableName = "Daten";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<LPReports>
|
||||
<Auswertungen>
|
||||
<Bericht>Firmendaten</Bericht>
|
||||
<SQL> SELECT dbo.Firma.ID, dbo.Firma.NameZ1, dbo.Firma.NameZ2, dbo.Firma.Strasse, dbo.Firma.PLZ, dbo.Firma.Ort, dbo.Firma.Tel, dbo.Firma.handy, dbo.Firma.Web, dbo.Firma.Mail,
|
||||
dbo.Firma.Bemerkung, dbo.Firma.Anrede, dbo.Firma.Ausbildungsstandort, dbo.Firma.Ausbildungsbemerkung, dbo.Firma.ansprechperson_name, dbo.Firma.ansprechperon_vorname, dbo.Ansprechpartner.id,
|
||||
dbo.Ansprechpartner.Name AS AName, dbo.Ansprechpartner.Vorname AS AVorname, dbo.Ansprechpartner.Tel AS ATel, dbo.Ansprechpartner.EMail AS AMail, dbo.Ansprechpartner.Anrede AS AAnrede, dbo.Beruf.Bezeichnung,
|
||||
dbo.KlassenTyp.bezeichnung AS Klasse, dbo.Zeiten.Bezeichnung AS Zeit, dbo.FirmaBeruf.Anzahl, dbo.FirmaBeruf.Schuelerbemerkung, dbo.FirmaBeruf.Standortbemerkung
|
||||
,dbo.Firma.mandantnr
|
||||
FROM dbo.Beruf INNER JOIN
|
||||
dbo.FirmaBeruf ON dbo.Beruf.id = dbo.FirmaBeruf.Berufid INNER JOIN
|
||||
dbo.Zeiten ON dbo.FirmaBeruf.Zeitid = dbo.Zeiten.id INNER JOIN
|
||||
dbo.Firma INNER JOIN
|
||||
dbo.Ansprechpartner ON dbo.Firma.ID = dbo.Ansprechpartner.FirmaID ON dbo.FirmaBeruf.Ansprechpartnerid = dbo.Ansprechpartner.id INNER JOIN
|
||||
dbo.KlassenTyp ON dbo.FirmaBeruf.KlassetypID = dbo.klassentyp.id
|
||||
|
||||
WHERE (dbo.Ansprechpartner.Aktiv = 1) AND (dbo.FirmaBeruf.Aktiv = 1) and (dbo.firma.id=4)</SQL>
|
||||
<SQLTYPE>SQL</SQLTYPE>
|
||||
<Filename>Firmendaten.frx</Filename>
|
||||
</Auswertungen>
|
||||
|
||||
|
||||
|
||||
<Auswertungen>
|
||||
<Bericht>Userliste</Bericht>
|
||||
<SQL>SELECT * FROM [BWPM].[dbo].[AspNetUsers]</SQL>
|
||||
<SQLTYPE>SQL</SQLTYPE>
|
||||
<Filename>Userliste.frx</Filename>
|
||||
</Auswertungen>
|
||||
|
||||
</LPReports>
|
||||
142
BlazorApp - Kopie (4)/Pages/Reporting/Reports/Firmendaten.frx
Normal file
142
BlazorApp - Kopie (4)/Pages/Reporting/Reports/Firmendaten.frx
Normal file
@@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Report ScriptLanguage="Vb" ReportInfo.Created="07/19/2012 16:02:38" ReportInfo.Modified="07/29/2021 11:42:09" ReportInfo.CreatorVersion="2021.3.20.0">
|
||||
<ScriptText>Imports System
|
||||
Imports System.Collections
|
||||
Imports System.Collections.Generic
|
||||
Imports System.ComponentModel
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Drawing
|
||||
Imports Microsoft.VisualBasic
|
||||
Imports FastReport
|
||||
Imports FastReport.Data
|
||||
Imports FastReport.Dialog
|
||||
Imports FastReport.Table
|
||||
Imports FastReport.Barcode
|
||||
Imports FastReport.Utils
|
||||
|
||||
Namespace FastReport
|
||||
Public Class ReportScript
|
||||
|
||||
|
||||
Private Sub Picture1_BeforePrint(ByVal sender As object, ByVal e As EventArgs)
|
||||
Picture1.ImageLocation= CType(Report.GetParameterValue("URL"), String)
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
</ScriptText>
|
||||
<Dictionary>
|
||||
<TableDataSource Name="Daten" ReferenceName="Data.Daten" DataType="System.Int32" Enabled="true">
|
||||
<Column Name="NameZ1" DataType="System.String"/>
|
||||
<Column Name="NameZ2" DataType="System.String"/>
|
||||
<Column Name="Strasse" DataType="System.String"/>
|
||||
<Column Name="PLZ" DataType="System.String"/>
|
||||
<Column Name="Ort" DataType="System.String"/>
|
||||
<Column Name="Tel" DataType="System.String"/>
|
||||
<Column Name="Web" DataType="System.String"/>
|
||||
<Column Name="Bemerkung" DataType="System.String"/>
|
||||
<Column Name="Anrede" DataType="System.String"/>
|
||||
<Column Name="Ausbildungsstandort" DataType="System.String"/>
|
||||
<Column Name="Ausbildungsbemerkung" DataType="System.String"/>
|
||||
<Column Name="Bezeichnung" DataType="System.String"/>
|
||||
<Column Name="Anzahl" DataType="System.Int32"/>
|
||||
<Column Name="AName" DataType="System.String"/>
|
||||
<Column Name="AVorname" DataType="System.String"/>
|
||||
<Column Name="ATel" DataType="System.String"/>
|
||||
<Column Name="AMail" DataType="System.String"/>
|
||||
<Column Name="AAnrede" DataType="System.String"/>
|
||||
<Column Name="Klasse" DataType="System.String"/>
|
||||
<Column Name="Zeit" DataType="System.String"/>
|
||||
<Column Name="Schuelerbemerkung" DataType="System.String"/>
|
||||
<Column Name="Standortbemerkung" DataType="System.String"/>
|
||||
<Column Name="ID" DataType="System.Int32"/>
|
||||
<Column Name="handy" DataType="System.String"/>
|
||||
<Column Name="Mail" DataType="System.String"/>
|
||||
<Column Name="ansprechperson_name" DataType="System.String"/>
|
||||
<Column Name="ansprechperon_vorname" DataType="System.String"/>
|
||||
<Column Name="id1" DataType="System.Int32"/>
|
||||
<Column Name="mandantnr" DataType="System.Int32"/>
|
||||
</TableDataSource>
|
||||
<Parameter Name="Parcours" DataType="System.String"/>
|
||||
<Parameter Name="Spruch" DataType="System.String"/>
|
||||
<Parameter Name="URL" DataType="System.String"/>
|
||||
</Dictionary>
|
||||
<ReportPage Name="Page1" Landscape="true" PaperWidth="297" PaperHeight="210" RawPaperSize="9" Watermark.Font="Arial, 60pt">
|
||||
<ReportTitleBand Name="ReportTitle1" Width="1047.06" Height="245.7">
|
||||
<TextObject Name="Text32" Left="567" Top="9.45" Width="463.05" Height="18.9" Text="[Parcours]" HorzAlign="Right" Font="Arial, 12pt, style=Bold"/>
|
||||
<TextObject Name="Text33" Left="567" Top="37.8" Width="463.05" Height="18.9" Text="Firmendaten" HorzAlign="Right" Font="Arial, 12pt, style=Bold"/>
|
||||
<TextObject Name="Text1" Left="122.85" Top="94.5" Width="207.9" Height="18.9" Text="[Daten.NameZ1]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text9" Left="18.9" Top="94.5" Width="103.95" Height="18.9" Text="Name Zeile 1:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text40" Left="359.1" Top="94.5" Width="66.15" Height="18.9" Text="Telefon:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text10" Left="434.7" Top="94.5" Width="141.75" Height="18.9" Text="[Daten.Tel]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text2" Left="122.85" Top="113.4" Width="207.9" Height="18.9" Text="[Daten.NameZ2]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text3" Left="122.85" Top="132.3" Width="207.9" Height="18.9" Text="[Daten.Anrede]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text34" Left="18.9" Top="113.4" Width="103.95" Height="18.9" Text="Name Zeile 2:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text35" Left="18.9" Top="132.3" Width="103.95" Height="18.9" Text="Anrede:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text42" Left="359.1" Top="141.75" Width="66.15" Height="18.9" Text="Internet:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text12" Left="434.7" Top="141.75" Width="245.7" Height="18.9" Text="[Daten.Web]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text36" Left="18.9" Top="151.2" Width="103.95" Height="18.9" Text="Name:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text43" Left="359.1" Top="160.65" Width="66.15" Height="18.9" Text="E-Mail:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text13" Left="434.7" Top="160.65" Width="245.7" Height="18.9" Text="[Daten.Mail]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text37" Left="18.9" Top="170.1" Width="103.95" Height="18.9" Text="Vorname:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text6" Left="122.85" Top="189" Width="207.9" Height="18.9" Text="[Daten.Strasse]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text38" Left="18.9" Top="189" Width="103.95" Height="18.9" Text="Strasse:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text7" Left="122.85" Top="207.9" Width="47.25" Height="18.9" Text="[Daten.PLZ]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text8" Left="170.1" Top="207.9" Width="132.3" Height="18.9" Text="[Daten.Ort]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text39" Left="18.9" Top="207.9" Width="103.95" Height="18.9" Text="PLZ / Ort:" Font="Arial, 10pt, style=Bold"/>
|
||||
<PictureObject Name="Picture1" Left="9.45" Top="-18.9" Width="103.95" Height="85.05" BeforePrintEvent="Picture1_BeforePrint" Image=""/>
|
||||
<TextObject Name="Text55" Left="359.1" Top="113.4" Width="66.15" Height="18.9" Text="Natel:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text28" Left="434.7" Top="113.4" Width="141.75" Height="18.9" Text="[Daten.handy]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text58" Left="122.85" Top="151.2" Width="189" Height="18.9" Text="[Daten.ansprechperson_name]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text59" Left="122.85" Top="170.1" Width="189" Height="18.9" Text="[Daten.ansprechperon_vorname]" Font="Arial, 10pt"/>
|
||||
<LineObject Name="Line5" Left="18.9" Top="75.6" Width="1011.15"/>
|
||||
<ChildBand Name="Child5" Top="249.7" Width="1047.06" Height="37.8" CanGrow="true">
|
||||
<TextObject Name="Text14" Left="18.9" Top="18.9" Width="1011.15" Height="18.9" CanGrow="true" Text="[Daten.Bemerkung]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text44" Left="18.9" Width="311.85" Height="18.9" Text="Bemerkung für Organisatoren des BWP" Font="Arial, 10pt, style=Bold"/>
|
||||
<ChildBand Name="Child6" Top="291.5" Width="1047.06" Height="47.25" CanGrow="true">
|
||||
<TextObject Name="Text45" Left="18.9" Top="9.45" Width="529.2" Height="18.9" Text="Folgendes muss der Schüler mitbringen (spezielle Kleidung, Ausweis, usw.)" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text16" Left="18.9" Top="28.35" Width="1011.15" Height="18.9" CanGrow="true" Text="[Daten.Ausbildungsbemerkung]" Font="Arial, 10pt"/>
|
||||
<ChildBand Name="Child7" Top="342.75" Width="1047.06" Height="66.15" CanGrow="true">
|
||||
<TextObject Name="Text15" Left="18.9" Top="28.35" Width="1011.15" Height="18.9" CanGrow="true" Text="[Daten.Ausbildungsstandort]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text46" Left="18.9" Top="9.45" Width="529.2" Height="18.9" Text="Treffpunkt für Schüler, falls abweichend zur Geschäftsadresse" Font="Arial, 10pt, style=Bold"/>
|
||||
<ChildBand Name="Child8" Top="412.9" Width="1047.06"/>
|
||||
</ChildBand>
|
||||
</ChildBand>
|
||||
</ChildBand>
|
||||
</ReportTitleBand>
|
||||
<PageHeaderBand Name="PageHeader1" Top="416.9" Width="1047.06"/>
|
||||
<GroupHeaderBand Name="GroupHeader1" Top="420.9" Width="1047.06" Height="113.4" KeepChild="true" KeepWithData="true" Condition="[Daten.id1]" KeepTogether="true">
|
||||
<ShapeObject Name="Shape1" Left="18.9" Width="1011.15" Height="75.6"/>
|
||||
<TextObject Name="Text19" Left="160.65" Top="9.45" Width="330.75" Height="18.9" Text="[Daten.AAnrede] [Daten.AName] [Daten.AVorname]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text20" Left="160.65" Top="28.35" Width="217.35" Height="18.9" Text="[Daten.ATel]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text47" Left="22.9" Top="28.35" Width="66.15" Height="18.9" Text="Telefon:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text17" Left="22.9" Top="9.45" Width="132.3" Height="18.9" Text="Ansprechpartner:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text48" Left="22.9" Top="47.25" Width="66.15" Height="18.9" Text="E-Mail:" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text21" Left="160.65" Top="47.25" Width="500.85" Height="18.9" CanGrow="true" Text="[Daten.AMail]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text50" Left="463.05" Top="94.5" Width="113.4" Height="18.9" Text="Zeit" HorzAlign="Right" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text25" Left="349.65" Top="94.5" Width="85.05" Height="18.9" Text="Anz. Plätze" HorzAlign="Right" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text23" Left="255.15" Top="94.5" Width="66.15" Height="18.9" Text="Min.Anf." Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text49" Left="18.9" Top="94.5" Width="94.5" Height="18.9" Text="Beruf" Font="Arial, 10pt, style=Bold"/>
|
||||
<LineObject Name="Line2" Left="18.9" Top="113.4" Width="1011.15"/>
|
||||
<TextObject Name="Text53" Left="585.9" Top="94.5" Width="179.55" Height="18.9" Text="Bemerkung für Schüler" Font="Arial, 10pt, style=Bold"/>
|
||||
<TextObject Name="Text54" Left="784.35" Top="94.5" Width="179.55" Height="18.9" Text="Bemerkung zum Standort" Font="Arial, 10pt, style=Bold"/>
|
||||
<DataBand Name="Data1" Top="538.3" Width="1047.06" Height="18.9" CanGrow="true" DataSource="Daten" KeepTogether="true">
|
||||
<TextObject Name="Text18" Left="18.9" Width="226.8" Height="18.9" CanGrow="true" Text="[Daten.Bezeichnung]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text22" Left="255.15" Width="103.95" Height="18.9" Text="[Daten.Klasse]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text26" Left="444.15" Width="132.3" Height="18.9" Text="[Daten.Zeit]" HorzAlign="Right" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text24" Left="378" Width="56.7" Height="18.9" Text="[Daten.Anzahl]" HorzAlign="Right" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text27" Left="585.9" Width="189" Height="18.9" CanGrow="true" Text="[Daten.Schuelerbemerkung]" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text29" Left="784.35" Width="245.7" Height="18.9" CanGrow="true" Text="[Daten.Standortbemerkung]" Font="Arial, 10pt"/>
|
||||
<Sort>
|
||||
<Sort Expression="[Daten.Zeit]"/>
|
||||
<Sort Expression="[Daten.Bezeichnung]"/>
|
||||
</Sort>
|
||||
</DataBand>
|
||||
<GroupFooterBand Name="GroupFooter1" Top="561.2" Width="1047.06" Height="18.9"/>
|
||||
</GroupHeaderBand>
|
||||
<PageFooterBand Name="PageFooter1" Top="584.1" Width="1047.06" Height="28.35">
|
||||
<TextObject Name="Text51" Left="963.9" Top="9.45" Width="66.15" Height="18.9" Text="[Page#]" HorzAlign="Right" Font="Arial, 10pt"/>
|
||||
<TextObject Name="Text52" Left="18.9" Top="9.45" Width="94.5" Height="18.9" Text="[Date]" Format="Date" Format.Format="d" Font="Arial, 10pt"/>
|
||||
<LineObject Name="Line4" Left="18.9" Top="9.45" Width="1011.15"/>
|
||||
</PageFooterBand>
|
||||
</ReportPage>
|
||||
</Report>
|
||||
45
BlazorApp - Kopie (4)/Pages/Reporting/Reports/userliste.frx
Normal file
45
BlazorApp - Kopie (4)/Pages/Reporting/Reports/userliste.frx
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Report ScriptLanguage="CSharp" ReportInfo.Created="07/24/2021 10:48:45" ReportInfo.Modified="07/24/2021 10:49:35" ReportInfo.CreatorVersion="2021.3.17.0">
|
||||
<Styles Name="Standard">
|
||||
<Style Name="Title" Font="Arial, 12pt, style=Bold"/>
|
||||
<Style Name="Header" Font="Arial, 10pt, style=Bold"/>
|
||||
<Style Name="Group" Font="Arial, 10pt, style=Bold"/>
|
||||
<Style Name="Data" Font="Arial, 10pt"/>
|
||||
<Style Name="Footer" Font="Arial, 10pt"/>
|
||||
<Style Name="EvenRows" Fill.Color="WhiteSmoke" Font="Arial, 10pt"/>
|
||||
</Styles>
|
||||
<Dictionary>
|
||||
<TableDataSource Name="Daten" ReferenceName="Data.Daten" DataType="System.Int32" Enabled="true">
|
||||
<Column Name="Id" DataType="System.String"/>
|
||||
<Column Name="UserName" DataType="System.String"/>
|
||||
<Column Name="NormalizedUserName" DataType="System.String"/>
|
||||
<Column Name="Email" DataType="System.String"/>
|
||||
<Column Name="NormalizedEmail" DataType="System.String"/>
|
||||
<Column Name="EmailConfirmed" DataType="System.Boolean" BindableControl="CheckBox"/>
|
||||
<Column Name="PasswordHash" DataType="System.String"/>
|
||||
<Column Name="SecurityStamp" DataType="System.String"/>
|
||||
<Column Name="ConcurrencyStamp" DataType="System.String"/>
|
||||
<Column Name="PhoneNumber" DataType="System.String"/>
|
||||
<Column Name="PhoneNumberConfirmed" DataType="System.Boolean" BindableControl="CheckBox"/>
|
||||
<Column Name="TwoFactorEnabled" DataType="System.Boolean" BindableControl="CheckBox"/>
|
||||
<Column Name="LockoutEnd" DataType="System.DateTimeOffset"/>
|
||||
<Column Name="LockoutEnabled" DataType="System.Boolean" BindableControl="CheckBox"/>
|
||||
<Column Name="AccessFailedCount" DataType="System.Int32"/>
|
||||
<Column Name="LockoutEndDateUtc" DataType="System.DateTimeOffset"/>
|
||||
</TableDataSource>
|
||||
</Dictionary>
|
||||
<ReportPage Name="Page1" Watermark.Font="Arial, 60pt">
|
||||
<ReportTitleBand Name="ReportTitle1" Width="718.2" Height="37.8">
|
||||
<TextObject Name="Text1" Width="718.2" Height="37.8" Dock="Fill" Text="Daten" HorzAlign="Center" VertAlign="Center" Font="Arial, 12pt, style=Bold" Style="Title"/>
|
||||
</ReportTitleBand>
|
||||
<PageHeaderBand Name="PageHeader1" Top="41.8" Width="718.2" Height="28.35">
|
||||
<TextObject Name="Text2" Left="18.9" Width="94.5" Height="18.9" Text="UserName" Font="Arial, 10pt"/>
|
||||
</PageHeaderBand>
|
||||
<DataBand Name="Data1" Top="74.15" Width="718.2" Height="56.7" EvenStyle="EvenRows" DataSource="Daten">
|
||||
<TextObject Name="Text35" Left="18.9" Top="9.45" Width="94.5" Height="18.9" Text="[Daten.UserName]" Font="Arial, 10pt"/>
|
||||
</DataBand>
|
||||
<PageFooterBand Name="PageFooter1" Top="134.85" Width="718.2" Height="75.6">
|
||||
<TextObject Name="Text34" Width="718.2" Height="75.6" Dock="Fill" Text="[PageN]" HorzAlign="Right" Font="Arial, 10pt" Style="Footer"/>
|
||||
</PageFooterBand>
|
||||
</ReportPage>
|
||||
</Report>
|
||||
57
BlazorApp - Kopie (4)/Pages/Shared/_Layout.cshtml
Normal file
57
BlazorApp - Kopie (4)/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 (4)/Pages/Shared/_LoginPartial.cshtml
Normal file
27
BlazorApp - Kopie (4)/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>
|
||||
43
BlazorApp - Kopie (4)/Pages/ShowConfig.razor
Normal file
43
BlazorApp - Kopie (4)/Pages/ShowConfig.razor
Normal file
@@ -0,0 +1,43 @@
|
||||
@page "/showconfig"
|
||||
@using BlazorApp.Helper
|
||||
@using System.IO;
|
||||
|
||||
<h3>ShowConfig</h3>
|
||||
|
||||
<button @onclick="ShowConfiguration">Config</button>
|
||||
<br />
|
||||
<label>Autologin: @alogin</label><br />
|
||||
<label>Connectionstring: @connstring</label><br />
|
||||
<label>Directory: @mydir</label><br />
|
||||
<br />
|
||||
<input placeholder="Enter your text" @bind-value="@pathi" />
|
||||
<button @onclick="@UpdateFilelist">Refresh</button>
|
||||
<br />
|
||||
<label>Files: @filelist</label>
|
||||
|
||||
<hr />
|
||||
|
||||
@code {
|
||||
public string alogin { get; set; } = "";
|
||||
public string connstring { get; set; } = "";
|
||||
public string mydir { get; set; } = "";
|
||||
public string filelist { get; set; } = "";
|
||||
public string pathi { get; set; } = "";
|
||||
private void ShowConfiguration()
|
||||
{
|
||||
Helper.ParameterHelper ph = new Helper.ParameterHelper();
|
||||
alogin = ph.GetParameter("autologin");
|
||||
connstring = ph.GetConnString("BlazorAppContextConnection");
|
||||
mydir = AppContext.BaseDirectory;
|
||||
|
||||
|
||||
}
|
||||
private void UpdateFilelist()
|
||||
{
|
||||
filelist = "";
|
||||
string [] fileEntries = Directory.GetFiles(pathi);
|
||||
foreach (string fileName in fileEntries)
|
||||
filelist = filelist + ", " + fileName;
|
||||
}
|
||||
|
||||
}
|
||||
386
BlazorApp - Kopie (4)/Pages/Teacher/Teacher.razor
Normal file
386
BlazorApp - Kopie (4)/Pages/Teacher/Teacher.razor
Normal file
@@ -0,0 +1,386 @@
|
||||
@page "/Teacher/TeacherContact"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inject NavigationManager NavManager
|
||||
@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="control-section e-tab-section">
|
||||
|
||||
<EditForm Model="_lehrer" OnValidSubmit="@Submit" OnInvalidSubmit="@InvalidSubmit">
|
||||
|
||||
|
||||
<DataAnnotationsValidator />
|
||||
<SfTab ID="BlazorTab" Height="390" @ref="Tab">
|
||||
<TabEvents Created="TabCreate"></TabEvents>
|
||||
<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="Anrede" class="col-2 col-form-label">Anrede</label>
|
||||
<div class="col-10">
|
||||
<select id="Anrede" name="Anrede" class="form-control" @bind="@_lehrer.anredeID">
|
||||
<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="nameZ1" class="col-2 col-form-label">Name</label>
|
||||
<div class="col-10">
|
||||
<InputText id="namez1" class="form-control" @bind-Value="_lehrer.name" placeholder="Nachname" />
|
||||
<ValidationMessage For="@(() => _lehrer.name)" />
|
||||
</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="@_lehrer.vorname" placeholder="vorname" />
|
||||
<ValidationMessage For="@(() => _lehrer.vorname)" />
|
||||
</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="@_lehrer.tel" placeholder="Telefon-Nummer" />
|
||||
<ValidationMessage For="@(() => _lehrer.tel)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="handy" class="col-2 col-form-label">Mobile</label>
|
||||
<div class="col-10">
|
||||
<InputText id="handy" class="form-control" @bind-Value="@_lehrer.handy" placeholder="Mobile-Nummer" />
|
||||
<ValidationMessage For="@(() => _lehrer.handy)" />
|
||||
</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="@_lehrer.email" placeholder="E-Mail" required="required" typeof="email" />
|
||||
<ValidationMessage For="@(() => _lehrer.email)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="Schulhaus" class="col-2 col-form-label">Schulhaus</label>
|
||||
<div class="col-10">
|
||||
<select id="Schulhaus" name="Schulhaus" class="form-control" @bind="@_lehrer.schulhausID">
|
||||
@foreach (var sh in _schulhaus)
|
||||
{
|
||||
<option value="@sh.ID">@sh.bezeichnung</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
<SfButton IsPrimary="true" OnClick="@(() => SaveClick())">Speichern und weiter</SfButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</TabItem>
|
||||
<TabItem>
|
||||
<ChildContent>
|
||||
<TabHeader Text="Stammdaten"></TabHeader>
|
||||
</ChildContent>
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6" id="TestCol">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Klassen und Klassengrösse</h5>
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<SfGrid @bind-Visible="@ShowErrorDialog_grid" 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="Klasse" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klasse.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60" Visible="true"></GridColumn>
|
||||
<GridForeignColumn Field=@nameof(Klasse.schulhausID) HeaderText="Schulhaus" ForeignKeyValue="bezeichnung" ForeignKeyField="ID" ForeignDataSource="@_schulhaus" Width="150"></GridForeignColumn>
|
||||
@*<GridColumn Field=@nameof(Klasse.schulhausID) HeaderText="Schulhausid" Width="100" Visible="true"></GridColumn>*@
|
||||
|
||||
<GridColumn Field=@nameof(Klasse.bezeichnung) HeaderText="Bezeichnung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klasse.klassengroesse) HeaderText="Klassengrösse" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klasse.aktiv) HeaderText="Aktiv" Width="100" Visible="false" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klasse.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klasse.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klasse.mutierer) HeaderText="Mutierer" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
|
||||
<GridColumn Field=@nameof(Klasse.lehrerID) HeaderText="Lehrerid" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(Klasse.mandantnr) HeaderText="Mandantnr" Width="100" Visible="false"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
|
||||
<form>
|
||||
</form>
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
<SfButton IsPrimary="true" OnClick="@(() => WeiterClick())">Weiter zu Schülerdaten</SfButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
SfTab Tab;
|
||||
SfGrid<Klasse> Grid { get; set; }
|
||||
public int Value = 0;
|
||||
public List<BWPMModels.Klasse> GridData { get; set; }
|
||||
public List<BWPMModels.Klasse> Klasses { get; set; }
|
||||
public int foundrow = 0;
|
||||
public bool ContinuePaging = true;
|
||||
public bool InitialRender { get; set; }
|
||||
|
||||
private List<BWPMModels.Schulhaus> _schulhaus { get; set; } = BlazorApp.Controller.SchulhausController.GetAllData();
|
||||
private Lehrer _lehrer { get; set; } = new BWPMModels.Lehrer();
|
||||
public List<BWPMModels.Lehrer> Lehrerdaten { get; set; }
|
||||
string userid = "";
|
||||
public static int? pkey { get; set; }
|
||||
public bool Initial { get; set; } = true;
|
||||
private bool ShowErrorDialog { get; set; } = false;
|
||||
private bool ShowErrorDialog_grid { get; set; } = false;
|
||||
|
||||
public void Submit()
|
||||
{
|
||||
BlazorApp.Controller.LehrerController.PUT(_lehrer);
|
||||
Tab.EnableTab(1, true);
|
||||
Tab.Select(1);
|
||||
|
||||
}
|
||||
public void InvalidSubmit()
|
||||
{
|
||||
Tab.EnableTab(1, false);
|
||||
Tab.Select(0);
|
||||
ShowErrorDialog = true;
|
||||
}
|
||||
private void CloseDialog()
|
||||
{
|
||||
this.ShowErrorDialog = false;
|
||||
}
|
||||
|
||||
private void SaveClick()
|
||||
{
|
||||
}
|
||||
private void WeiterClick()
|
||||
{
|
||||
NavManager.NavigateTo("/Teacher/TeacherStudent");
|
||||
}
|
||||
|
||||
protected override async void OnInitialized()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task TabCreate()
|
||||
{
|
||||
await Tab.EnableTab(1, false);
|
||||
@*await Tab.EnableTab(2, false);*@
|
||||
@*Tab.EnableTab(3, false);*@
|
||||
}
|
||||
public async Task SelectTrainBack()
|
||||
{
|
||||
await Tab.Select(0);
|
||||
}
|
||||
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);
|
||||
userid = userId;
|
||||
}
|
||||
else
|
||||
{
|
||||
await sessionStorage.SetItemAsync("UserID", userId);
|
||||
userid = userId;
|
||||
}
|
||||
}
|
||||
if (firstRender)
|
||||
{
|
||||
Lehrerdaten = BlazorApp.Controller.LehrerController.GetByUserID(userid);
|
||||
_lehrer = Lehrerdaten.First<BWPMModels.Lehrer>();
|
||||
GridData = BlazorApp.Controller.KlasseController.GetByLehrerID(_lehrer.ID);
|
||||
await sessionStorage.SetItemAsync("LehrerID", _lehrer.ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.Klasse> Args)
|
||||
|
||||
{
|
||||
|
||||
@* try
|
||||
{
|
||||
if (_lehrer.ID == 0)
|
||||
{
|
||||
ShowErrorDialog_grid = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
ShowErrorDialog_grid = true;
|
||||
return;
|
||||
}*@
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
if (Args.Action == "Add")
|
||||
{
|
||||
Args.Data.lehrerID = _lehrer.ID;
|
||||
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.KlasseController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.KlasseController.PUT(Args.Data);
|
||||
|
||||
Value = Args.Data.ID;
|
||||
Grid.Refresh();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Klasse> 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.Klasse> 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<Klasse> 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;
|
||||
}
|
||||
}
|
||||
448
BlazorApp - Kopie (4)/Pages/Teacher/TeacherStudent.razor
Normal file
448
BlazorApp - Kopie (4)/Pages/Teacher/TeacherStudent.razor
Normal file
@@ -0,0 +1,448 @@
|
||||
@page "/Teacher/TeacherStudent"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inject IJSRuntime jsRuntime
|
||||
@inject NavigationManager NavManager
|
||||
@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 BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="card">
|
||||
<h6 class="card-header">
|
||||
Klasse
|
||||
</h6>
|
||||
<div class="card-body">
|
||||
<SfDropDownList @bind-Value="@KlasseID" TValue="string" TItem="Klasse" Placeholder="Klasse" DataSource="@Klasse">
|
||||
<DropDownListFieldSettings Value="ID" Text="bezeichnung"></DropDownListFieldSettings>
|
||||
<DropDownListEvents TValue="string" TItem="Klasse" ValueChange="ChangeKlasse"></DropDownListEvents>
|
||||
</SfDropDownList>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="card">
|
||||
<h6 class="card-header">
|
||||
Schüler
|
||||
</h6>
|
||||
<div class="card-body">
|
||||
<RadzenListBox @bind-Value=@SchuelerID Data=@schuelerliste TextProperty="bezeichnung" ValueProperty="id" Style="height:350px" Change=@(args => SchuelerChange(args, "schuelerlist")) />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<div class="card">
|
||||
<h6 class="card-header">
|
||||
Schüler
|
||||
</h6>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<SfButton IsPrimary="true" OnClick="@(() => NewClick())">Neuer Schüler</SfButton>
|
||||
<SfButton Disabled="@FieldDisabled" IsPrimary="true" OnClick="@(() => SaveClick())">Änderungen speichern</SfButton>
|
||||
<SfButton Disabled="@FieldDisabled" IsPrimary="true" OnClick="@(() => DeleteClick())">Schüler löschen</SfButton>
|
||||
|
||||
</div>
|
||||
<hr />
|
||||
<EditForm Model="_schueler" OnValidSubmit="@Submit" OnInvalidSubmit="@InvalidSubmit">
|
||||
<input type="hidden" id="hiddenschuelerid" name="hiddenschuelerid" @bind="_schueler.ID">
|
||||
<div class="row">
|
||||
<div class="col-md-1">
|
||||
@*<label for="Name" class="col-2 col-form-label">Name</label>*@
|
||||
Name
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<InputText id="Name" class="form-control" @bind-Value="_schueler.name" placeholder="Nachname" disabled="@FieldDisabled" />
|
||||
<ValidationMessage For="@(() => _schueler.name)" />
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
@*<label for="Name" class="col-2 col-form-label">Name</label>*@
|
||||
Vorname
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
@*<label for="Vorname" class="col-2 col-form-label">Name</label>*@
|
||||
<InputText id="Vorname" class="form-control" @bind-Value="_schueler.vorname" placeholder="Vorname" disabled="@FieldDisabled" />
|
||||
<ValidationMessage For="@(() => _schueler.name)" />
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
@*<label for="Name" class="col-2 col-form-label">Name</label>*@
|
||||
Bemerkung
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<InputText id="Bemerkung" class="form-control" @bind-Value="_schueler.bemerkung" placeholder="Bemerkung" disabled="@FieldDisabled" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-1">
|
||||
Klasse
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<SfDropDownList @bind-Value="@SchuelerklasseID" TValue="string" TItem="Klasse" Placeholder="Klasse" DataSource="@Schuelerklasse" Enabled="@DropDownEnabled">
|
||||
<DropDownListFieldSettings Value="ID" Text="bezeichnung"></DropDownListFieldSettings>
|
||||
</SfDropDownList>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
Typ
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<SfDropDownList @bind-Value="@KlasseTypID" TValue="string" TItem="Klassentyp" Placeholder="Klassentyp" DataSource="@klassentyp" Enabled="@DropDownEnabled">
|
||||
<DropDownListFieldSettings Value="ID" Text="bezeichnung"></DropDownListFieldSettings>
|
||||
</SfDropDownList>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
leer
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
das ist noch leer
|
||||
</div>
|
||||
|
||||
</div>>
|
||||
|
||||
</EditForm>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card">
|
||||
<h6 class="card-header">
|
||||
Berufe / Berfufswünsche
|
||||
</h6>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<SfListBox TValue="string[]" DataSource="@Berufe" TItem="Beruf" Height="350px">
|
||||
<ListBoxFieldSettings Text="bezeichnung" Value="Id" />
|
||||
<ListBoxSelectionSettings Mode="Syncfusion.Blazor.DropDowns.SelectionMode.Single" ShowCheckbox="false"></ListBoxSelectionSettings>
|
||||
</SfListBox>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<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="false" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="SchuelerBeruf" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Visible="false" Width="60"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.schuelerID) HeaderText="Schuelerid" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.berufID) HeaderText="Berufid" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.bemerkung) HeaderText="Bemerkung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.prioritaet) HeaderText="Prioritaet" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.aktiv) HeaderText="Aktiv" Width="100" Visible="false" DisplayAsCheckBox="true"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.erstellt_am) HeaderText="Erstellt_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.mutiert_am) HeaderText="Mutiert_am" Width="100" Visible="false" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.mutierer) HeaderText="Mutierer" Width="100" Visible="false"></GridColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.mandantnr) HeaderText="Mandantnr" Width="100" Visible="false"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SfDialog Width="350px" IsModal="true" @bind-Visible="@ShowDeleteConfirmation">
|
||||
<DialogTemplates>
|
||||
<Header>Schüler löschen? </Header>
|
||||
<Content>Möchten Sie den Schüler '@_schueler.name @_schueler.vorname' löschen?</Content>
|
||||
|
||||
</DialogTemplates>
|
||||
<DialogButtons>
|
||||
<DialogButton Content="Ja" IsPrimary="true" OnClick="@DeleteConfirmed" />
|
||||
<DialogButton Content="Nein" OnClick="@AbortDelete" />
|
||||
</DialogButtons>
|
||||
</SfDialog>
|
||||
|
||||
|
||||
@code {
|
||||
public bool ShowDeleteConfirmation { get; set; } = false;
|
||||
protected ElementReference ToFocus;
|
||||
public int lehrerID = 0;
|
||||
public int hiddenschuelerid = 0;
|
||||
public string KlasseID = "0";
|
||||
public string SchuelerklasseID = "0";
|
||||
public string KlasseTypID = "0";
|
||||
public string userid;
|
||||
public bool FieldDisabled = true;
|
||||
public bool DropDownEnabled = false;
|
||||
public List<BWPMModels.Klasse> Klasse { get; set; }
|
||||
public List<BWPMModels.Klasse> Schuelerklasse { get; set; }
|
||||
public List<BWPMModels.Klassentyp> klassentyp { get; set; } = BlazorApp.Controller.KlassentypController.GetAllAktiveData();
|
||||
public List<BWPMModels.Schueler> Schueler { get; set; }
|
||||
private Schueler _schueler { get; set; } = new BWPMModels.Schueler();
|
||||
public List<BWPMModels.Beruf> Berufe { get; set; } = BlazorApp.Controller.BerufController.GetBerufsangebot();
|
||||
|
||||
public List<Schuelerlist> schuelerliste = new List<Schuelerlist>();
|
||||
public int SchuelerID;
|
||||
|
||||
public class Schuelerlist
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string bezeichnung { get; set; }
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
//Schülerberuf / beruf
|
||||
//--------------------------------------
|
||||
SfGrid<SchuelerBeruf> Grid { get; set; }
|
||||
public List<BWPMModels.SchuelerBeruf> 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;
|
||||
public bool Initial { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
lehrerID = await sessionStorage.GetItemAsync<int>("LehrerID");
|
||||
Klasse = BlazorApp.Controller.KlasseController.GetByLehrerID(Convert.ToInt32(lehrerID));
|
||||
KlasseID = Klasse[0].ID.ToString();
|
||||
Schuelerklasse = BlazorApp.Controller.KlasseController.GetByLehrerID(Convert.ToInt32(lehrerID));
|
||||
SchuelerklasseID = Schuelerklasse[0].ID.ToString();
|
||||
KlasseTypID = klassentyp[0].ID.ToString();
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
//Klassenliste / Schuelerliste
|
||||
//----------------------------------------------------------
|
||||
public void ChangeKlasse(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, Klasse> args)
|
||||
{
|
||||
|
||||
UpdateSchulerliste();
|
||||
}
|
||||
|
||||
public void UpdateSchulerliste()
|
||||
{
|
||||
Schueler = BlazorApp.Controller.SchuelerController.GetByKlasseID(Convert.ToInt32(KlasseID));
|
||||
schuelerliste.Clear();
|
||||
int newschuelerid = 0;
|
||||
bool found = false;
|
||||
foreach (BWPMModels.Schueler item in Schueler)
|
||||
{
|
||||
|
||||
Schuelerlist sl = new Schuelerlist();
|
||||
sl.id = item.ID;
|
||||
if (newschuelerid == 0) { newschuelerid = sl.id; };
|
||||
if (SchuelerID == sl.id) { found = true; }
|
||||
sl.bezeichnung = item.name + " " + item.vorname;
|
||||
schuelerliste.Add(sl);
|
||||
};
|
||||
if (found != true)
|
||||
{
|
||||
FieldDisabled = true;
|
||||
DropDownEnabled = false;
|
||||
SchuelerID = -1;
|
||||
SchuelerID = newschuelerid;
|
||||
if (schuelerliste.Count > 0) { SchuelerSelected(); }
|
||||
}
|
||||
|
||||
}
|
||||
private void SchuelerChange(object value, string name)
|
||||
{
|
||||
var str = value is IEnumerable<object> ? string.Join(", ", (IEnumerable<object>)value) : value;
|
||||
SchuelerSelected();
|
||||
|
||||
}
|
||||
private void SchuelerSelected()
|
||||
{
|
||||
Schueler = BlazorApp.Controller.SchuelerController.GetByID(Convert.ToInt32(SchuelerID));
|
||||
_schueler = Schueler.First<BWPMModels.Schueler>();
|
||||
SchuelerklasseID = _schueler.klasseID.ToString();
|
||||
KlasseTypID = _schueler.klassemtypID.ToString();
|
||||
FieldDisabled = false;
|
||||
DropDownEnabled = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//Schüler-Formular
|
||||
//----------------------------------------------------------
|
||||
|
||||
public void Submit()
|
||||
{
|
||||
BlazorApp.Controller.SchuelerController.PUT(_schueler);
|
||||
}
|
||||
public void InvalidSubmit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void SaveClick()
|
||||
{
|
||||
Schueler _tmpschueler = new BWPMModels.Schueler();
|
||||
_tmpschueler = BlazorApp.Controller.SchuelerController.GetByID(_schueler.ID).First<BWPMModels.Schueler>();
|
||||
_tmpschueler.name = _schueler.name;
|
||||
_tmpschueler.vorname = _schueler.vorname;
|
||||
_tmpschueler.bemerkung = _schueler.bemerkung;
|
||||
_tmpschueler.klasseID = Convert.ToInt32(SchuelerklasseID);
|
||||
_tmpschueler.klassemtypID = Convert.ToInt32(KlasseTypID);
|
||||
BlazorApp.Controller.SchuelerController.PUT(_tmpschueler);
|
||||
UpdateSchulerliste();
|
||||
|
||||
}
|
||||
private void NewClick()
|
||||
{
|
||||
int schuelerid = 0;
|
||||
BWPMModels.Schueler schuelerdata = new Schueler();
|
||||
schuelerdata.aktiv = true;
|
||||
schuelerdata.erstellt_am = DateTime.Now;
|
||||
schuelerdata.mutiert_am = DateTime.Now;
|
||||
schuelerdata.mutierer = userid;
|
||||
schuelerdata.name = "Neuer Schüler";
|
||||
schuelerdata.vorname = "";
|
||||
schuelerdata.bemerkung = "";
|
||||
schuelerdata.klasseID = Convert.ToInt32(KlasseID);
|
||||
schuelerdata.klassemtypID = Convert.ToInt32(KlasseTypID);
|
||||
schuelerid = BlazorApp.Controller.SchuelerController.POST(schuelerdata);
|
||||
FieldDisabled = false;
|
||||
|
||||
DropDownEnabled = true;
|
||||
UpdateSchulerliste();
|
||||
SchuelerID = schuelerid;
|
||||
SchuelerSelected();
|
||||
jsRuntime.InvokeVoidAsync("SetFocusToElement", ToFocus);
|
||||
|
||||
}
|
||||
private void DeleteClick()
|
||||
{
|
||||
ShowDeleteConfirmation = true;
|
||||
}
|
||||
|
||||
private void DeleteConfirmed()
|
||||
{
|
||||
_schueler.aktiv = false;
|
||||
_schueler.mutierer = userid;
|
||||
_schueler.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.SchuelerController.PUT(_schueler);
|
||||
BlazorApp.Controller.SchuelerBerufController.DeleteBerufswunsch(_schueler.ID, userid);
|
||||
ShowDeleteConfirmation = false;
|
||||
UpdateSchulerliste();
|
||||
}
|
||||
|
||||
private void AbortDelete()
|
||||
{
|
||||
ShowDeleteConfirmation = false;
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
//SchülerBeruf / Beruf
|
||||
//--------------------------------------
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.SchuelerBeruf> 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.SchuelerBerufController.POST(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.SchuelerBerufController.PUT(Args.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.SchuelerBeruf> 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.SchuelerBeruf> 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<SchuelerBeruf> 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;
|
||||
}
|
||||
}
|
||||
44
BlazorApp - Kopie (4)/Pages/_Host.cshtml
Normal file
44
BlazorApp - Kopie (4)/Pages/_Host.cshtml
Normal file
@@ -0,0 +1,44 @@
|
||||
@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="Server" />
|
||||
@*<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 (4)/Pages/_ViewImports.cshtml
Normal file
6
BlazorApp - Kopie (4)/Pages/_ViewImports.cshtml
Normal file
@@ -0,0 +1,6 @@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
|
||||
|
||||
BlazorApp.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
3
BlazorApp - Kopie (4)/Pages/_ViewStart.cshtml
Normal file
3
BlazorApp - Kopie (4)/Pages/_ViewStart.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
Reference in New Issue
Block a user