You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
141 lines
5.6 KiB
141 lines
5.6 KiB
@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;
|
|
}
|
|
|
|
}
|