update nach Schuelererfassung
This commit is contained in:
@@ -115,15 +115,14 @@
|
||||
<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>
|
||||
<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 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>
|
||||
<GridEditSettings AllowAdding="true" AllowDeleting="true" 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>
|
||||
@@ -132,7 +131,8 @@
|
||||
|
||||
<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.berufID) HeaderText="Berufid" Width="100" Visible="true"></GridColumn>*@
|
||||
<GridForeignColumn Field=@nameof(SchuelerBeruf.berufID) HeaderText="Beruf" ForeignKeyField="ID" ForeignKeyValue="bezeichnung" ForeignDataSource="@berufe" Width="150"></GridForeignColumn>
|
||||
|
||||
<GridColumn Field=@nameof(SchuelerBeruf.bemerkung) HeaderText="Bemerkung" Width="100" Visible="true"></GridColumn>
|
||||
|
||||
@@ -159,18 +159,26 @@
|
||||
|
||||
<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>
|
||||
<Header>@DialogHeader</Header>
|
||||
<Content>@DialogText</Content>
|
||||
|
||||
</DialogTemplates>
|
||||
<DialogButtons>
|
||||
@if (DialogShowYesNO==true) {
|
||||
<DialogButton Content="Ja" IsPrimary="true" OnClick="@DeleteConfirmed" />
|
||||
<DialogButton Content="Nein" OnClick="@AbortDelete" />
|
||||
}
|
||||
else
|
||||
{<DialogButton Content="OK" IsPrimary="true" OnClick="@DialogConfirmed" />}
|
||||
</DialogButtons>
|
||||
</SfDialog>
|
||||
|
||||
|
||||
@code {
|
||||
public string DialogHeader { get; set; } = "";
|
||||
public string DialogText { get; set; } = "";
|
||||
public bool DialogShowYesNO { get; set; } = true;
|
||||
|
||||
public bool ShowDeleteConfirmation { get; set; } = false;
|
||||
protected ElementReference ToFocus;
|
||||
public int lehrerID = 0;
|
||||
@@ -186,7 +194,7 @@
|
||||
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<BWPMModels.Beruf> berufe { get; set; } = BlazorApp.Controller.BerufController.GetBerufsangebot();
|
||||
|
||||
public List<Schuelerlist> schuelerliste = new List<Schuelerlist>();
|
||||
public int SchuelerID;
|
||||
@@ -207,6 +215,7 @@
|
||||
public int Value = 0; // consider that value your querystring contains
|
||||
public int foundrow = 0;
|
||||
public bool Initial { get; set; } = true;
|
||||
public int BerufID;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
@@ -216,7 +225,6 @@
|
||||
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)
|
||||
@@ -280,6 +288,7 @@
|
||||
KlasseTypID = _schueler.klassemtypID.ToString();
|
||||
FieldDisabled = false;
|
||||
DropDownEnabled = true;
|
||||
update_griddata();
|
||||
|
||||
}
|
||||
|
||||
@@ -337,6 +346,9 @@
|
||||
}
|
||||
private void DeleteClick()
|
||||
{
|
||||
DialogHeader="Löschbestätigung";
|
||||
DialogText = "Schüler '"+_schueler.name+' '+_schueler.vorname+"' wirklich löschen?'";
|
||||
DialogShowYesNO = true;
|
||||
ShowDeleteConfirmation = true;
|
||||
}
|
||||
|
||||
@@ -355,10 +367,52 @@
|
||||
{
|
||||
ShowDeleteConfirmation = false;
|
||||
}
|
||||
|
||||
private void DialogConfirmed()
|
||||
{
|
||||
ShowDeleteConfirmation = false;
|
||||
}
|
||||
//--------------------------------------
|
||||
//SchülerBeruf / Beruf
|
||||
//--------------------------------------
|
||||
private void InsertBeruf()
|
||||
{
|
||||
if (SchuelerID == 0)
|
||||
{
|
||||
DialogHeader="Daten unvollständig";
|
||||
DialogText="Bitte zuerst einen Schüler auswählen!";
|
||||
DialogShowYesNO=false;
|
||||
ShowDeleteConfirmation=true;
|
||||
return;
|
||||
}
|
||||
if (BerufID == 0)
|
||||
{
|
||||
DialogHeader="Daten unvollständig";
|
||||
DialogText="Bitte zuerst einen Beruf auswählen!";
|
||||
DialogShowYesNO=false;
|
||||
ShowDeleteConfirmation=true;
|
||||
return;
|
||||
}
|
||||
ShowDeleteConfirmation = false;
|
||||
BWPMModels.SchuelerBeruf sberuf = new BWPMModels.SchuelerBeruf();
|
||||
sberuf.aktiv = true;
|
||||
sberuf.bemerkung = "";
|
||||
sberuf.berufID = BerufID;
|
||||
sberuf.erstellt_am = DateTime.Now;
|
||||
sberuf.mutiert_am = DateTime.Now;
|
||||
sberuf.mutierer = userid;
|
||||
sberuf.schuelerID = SchuelerID;
|
||||
int prio = BlazorApp.Controller.SchuelerBerufController.Get_Prio(SchuelerID);
|
||||
sberuf.prioritaet = prio + 1;
|
||||
BlazorApp.Controller.SchuelerBerufController.POST(sberuf);
|
||||
update_griddata();
|
||||
|
||||
}
|
||||
|
||||
private void update_griddata()
|
||||
{
|
||||
GridData = BlazorApp.Controller.SchuelerBerufController.GetBySchuelerID(SchuelerID);
|
||||
}
|
||||
|
||||
private async Task OnBeginHandler(ActionEventArgs<BWPMModels.SchuelerBeruf> Args)
|
||||
|
||||
{
|
||||
@@ -381,6 +435,14 @@
|
||||
BlazorApp.Controller.SchuelerBerufController.PUT(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.SchuelerBerufController.PUT(Args.Data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.SchuelerBeruf> Args)
|
||||
|
||||
Reference in New Issue
Block a user