Update nach User-Passwort-Change
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inherits ListBase
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using Syncfusion.Blazor.Buttons;
|
||||
@using Syncfusion.Blazor.Spinner;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
@@ -10,92 +11,61 @@
|
||||
|
||||
|
||||
<h1>Schulhaus</h1>
|
||||
<AuthorizeView Roles="Administrators">
|
||||
<Authorized>
|
||||
<div class="col-lg-12 control-section">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div id="container">
|
||||
<SfGrid @ref="Grid" DataSource="@Schulhauss" Toolbar="@(new List<string>() { "Add", "Edit", "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" OnActionComplete="OnCompletedHandler" TValue="Schulhaus"></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(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.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="true" Format="d" Type="ColumnType.Date"></GridColumn>
|
||||
<GridColumn Field=@nameof(Schulhaus.mutierer) HeaderText="mutierer" Width="100" Visible="false"></GridColumn>
|
||||
<GridColumn Field=@nameof(Schulhaus.sort) HeaderText="sort" Width="100" Visible="false"></GridColumn>
|
||||
<GridColumn Field=@nameof(Schulhaus.mandantnr) HeaderText="mandantnr" Width="100" Visible="false"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
|
||||
@code {
|
||||
|
||||
SfGrid<Schulhaus> Grid { get; set; }
|
||||
</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()
|
||||
{
|
||||
Schulhauss = BlazorApp.Controller.SchulhausController.GetAllData();
|
||||
|
||||
}
|
||||
|
||||
private void 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;
|
||||
|
||||
BlazorApp.Controller.SchulhausController.InsertData(Args.Data);
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.SchulhausController.savedata(Args.Data);
|
||||
}
|
||||
}
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Delete)
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
Args.Data.aktiv = false;
|
||||
BlazorApp.Controller.SchulhausController.savedata(Args.Data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.Schulhaus> Args)
|
||||
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save || Args.RequestType==Syncfusion.Blazor.Grids.Action.Delete)
|
||||
{
|
||||
Schulhauss = BlazorApp.Controller.SchulhausController.GetAllData();
|
||||
}
|
||||
/// GridData = OrdersDetails.GetAllRecords();
|
||||
GridData = BlazorApp.Controller.SchulhausController.GetAllData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
@@ -120,4 +90,89 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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.InsertData(Args.Data);
|
||||
Value = Args.Data.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.SchulhausController.savedata(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;
|
||||
} }
|
||||
|
||||
Reference in New Issue
Block a user