Update vor Clone
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@page "/Teacher/TeacherStudent"
|
||||
@page "/Teacher/TeacherStudent/{paramtid:int}"
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
@inject IJSRuntime jsRuntime
|
||||
@inject NavigationManager NavManager
|
||||
@@ -107,7 +108,7 @@
|
||||
|
||||
</EditForm>
|
||||
<div class="row">
|
||||
<SfButton Disabled="@FieldDisabled" IsPrimary="true" OnClick="@(() => SaveClick())">Änderungen speichern</SfButton>
|
||||
<SfButton Disabled="@FieldDisabled" IsPrimary="true" OnClick="@(() => SaveClick())">Änderungen speichern</SfButton>
|
||||
<SfButton Disabled="@FieldDisabled" IsPrimary="true" OnClick="@(() => DeleteClick())">Schüler löschen</SfButton>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,16 +120,19 @@
|
||||
</h6>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<RadzenListBox @bind-Value=@BerufID Data=@berufe TextProperty="bezeichnung" ValueProperty="ID" Style="height:350px" />
|
||||
<div class="col-md-4" @ondblclick="DoubleClick">
|
||||
<RadzenListBox @bind-Value=@BerufID Data=@berufe TextProperty="bezeichnung" ValueProperty="ID" Style="height:350px" />
|
||||
<br />
|
||||
<RadzenButton style="margin: 0 1rem 1rem 0" Click=@(args => InsertBeruf()) Text="Beruf zuordnen" ButtonStyle="ButtonStyle.Secondary" />
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<SfGrid ID="Grid3" DataSource="@GridData" @ref="Grid" AllowPaging="false" AllowSorting="true" Toolbar="@(new List<string>() { "Edit", "Delete" })">
|
||||
<SfGrid ID="Grid3" DataSource="@GridData" @ref="Grid" AllowRowDragAndDrop="true" AllowPaging="false" AllowSorting="true" Toolbar="@(new List<string>() { "Edit", "Delete" })"
|
||||
ContextMenuItems="@ContextMenuItems">
|
||||
@*ContextMenuItems="@(new List<ContextMenuItemModel>() { new ContextMenuItemModel { Text = "Bearbeiten", Target = ".e-content", Id = "Bearbeiten"},new ContextMenuItemModel { Text = "Löschen", Target = ".e-content", Id = "Loeschen"} })">*@
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="SchuelerBeruf" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridEvents RowDropped="RowDropHandler" ContextMenuItemClicked="OnContextMenuClick" OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="SchuelerBeruf" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
|
||||
<GridColumns>
|
||||
<GridColumn Type="ColumnType.CheckBox" AllowFiltering="false" AllowSorting="false" Width="60"></GridColumn>
|
||||
|
||||
@@ -197,6 +201,17 @@
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public int paramtid { get; set; }
|
||||
|
||||
|
||||
private List<object> ContextMenuItems = new List<object>()
|
||||
|
||||
{"Edit", "Delete",
|
||||
new ContextMenuItemModel
|
||||
{Text = "Priorität -1", Id = "PrioUp" },new ContextMenuItemModel{Text = "Priorität +1", Id = "PrioDown" }
|
||||
};
|
||||
|
||||
public string[] sfSchuelerID { get; set; }
|
||||
public string DialogHeader { get; set; } = "";
|
||||
public string DialogText { get; set; } = "";
|
||||
@@ -256,7 +271,16 @@
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
lehrerID = await sessionStorage.GetItemAsync<string>("LehrerID");
|
||||
if (paramtid!=0)
|
||||
{
|
||||
lehrerID = paramtid.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
lehrerID = await sessionStorage.GetItemAsync<string>("LehrerID");
|
||||
}
|
||||
|
||||
//lehrerID = await sessionStorage.GetItemAsync<string>("LehrerID");
|
||||
userid = await sessionStorage.GetItemAsync<string>("UserID");
|
||||
Klasse = BlazorApp.Controller.KlasseController.GetByLehrerID(Convert.ToInt32(lehrerID));
|
||||
intKlasse.Clear();
|
||||
@@ -423,6 +447,10 @@
|
||||
//--------------------------------------
|
||||
//SchülerBeruf / Beruf
|
||||
//--------------------------------------
|
||||
private void DoubleClick()
|
||||
{
|
||||
InsertBeruf();
|
||||
}
|
||||
private void InsertBeruf()
|
||||
{
|
||||
if (SchuelerID == 0)
|
||||
@@ -455,11 +483,14 @@
|
||||
BlazorApp.Controller.SchuelerBerufController.POST(sberuf);
|
||||
update_griddata();
|
||||
pruefung();
|
||||
Grid.Refresh();
|
||||
}
|
||||
|
||||
private void update_griddata()
|
||||
{
|
||||
//GridData.Clear();
|
||||
GridData = BlazorApp.Controller.SchuelerBerufController.GetBySchuelerID(SchuelerID);
|
||||
Grid.Refresh();
|
||||
}
|
||||
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.SchuelerBeruf> Args)
|
||||
@@ -494,6 +525,95 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void OnContextMenuClick(ContextMenuClickEventArgs<BWPMModels.SchuelerBeruf> args)
|
||||
{
|
||||
|
||||
|
||||
switch (args.Item.Id)
|
||||
{
|
||||
case "PrioUp":
|
||||
args.RowInfo.RowData.prioritaet = args.RowInfo.RowData.prioritaet - 1;
|
||||
args.RowInfo.RowData.mutierer = userid.ToString();
|
||||
BlazorApp.Controller.SchuelerBerufController.PUT(args.RowInfo.RowData);
|
||||
update_griddata();
|
||||
pruefung();
|
||||
break;
|
||||
case "PrioDown":
|
||||
args.RowInfo.RowData.prioritaet = args.RowInfo.RowData.prioritaet + 1;
|
||||
args.RowInfo.RowData.mutierer = userid.ToString();
|
||||
BlazorApp.Controller.SchuelerBerufController.PUT(args.RowInfo.RowData);
|
||||
update_griddata();
|
||||
pruefung();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
if (args.Item.Id =="Prio")
|
||||
if (args.Item.Id == "Bearbeiten")
|
||||
{
|
||||
|
||||
}
|
||||
if (args.Item.Id == "Loeschen")
|
||||
{
|
||||
args.RowInfo.RowData.aktiv = false;
|
||||
args.RowInfo.RowData.mutiert_am = DateTime.Now;
|
||||
args.RowInfo.RowData.mutierer = userid.ToString();
|
||||
BlazorApp.Controller.SchuelerBerufController.PUT(args.RowInfo.RowData);
|
||||
update_griddata();
|
||||
pruefung();
|
||||
|
||||
}
|
||||
}
|
||||
public void RowDropHandler(RowDragEventArgs<BWPMModels.SchuelerBeruf> args)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.add_sp_param("Param1", args.Data[0].ID.ToString());
|
||||
dbh.add_sp_param("Param2", userid.ToString());
|
||||
dbh.add_sp_param("Param3", args.DropIndex.ToString());
|
||||
|
||||
dbh.Get_Tabledata("sp_set_prio_schuelerberuf", true, false);
|
||||
args.Data[0].prioritaet = Convert.ToInt32(args.DropIndex) + 1;
|
||||
update_griddata();
|
||||
pruefung();
|
||||
return;
|
||||
|
||||
//double di = args.DropIndex;
|
||||
//int key = args.Data[0].ID;
|
||||
//int p = Convert.ToInt32(di) + 2;
|
||||
//var RowsData = Grid.CurrentViewData;
|
||||
//SchuelerBeruf _tmpschuelerberuf = new BWPMModels.SchuelerBeruf();
|
||||
//foreach (BWPMModels.SchuelerBeruf row in RowsData)
|
||||
//{
|
||||
// if (row.ID == key)
|
||||
// {
|
||||
// row.prioritaet = Convert.ToInt32(args.DropIndex) + 1;
|
||||
// row.mutiert_am = DateTime.Now;
|
||||
// row.mutierer = userid.ToString();
|
||||
// BlazorApp.Controller.SchuelerBerufController.PUT(row);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (row.prioritaet >= Convert.ToInt32(args.DropIndex) + 1)
|
||||
// {
|
||||
// row.prioritaet = p;
|
||||
// p = p + 1;
|
||||
// row.mutiert_am = DateTime.Now;
|
||||
// row.mutierer = userid.ToString();
|
||||
// BlazorApp.Controller.SchuelerBerufController.PUT(row);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//}
|
||||
//update_griddata();
|
||||
// pruefung();
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.SchuelerBeruf> Args)
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
|
||||
Reference in New Issue
Block a user