Update 20231515
This commit is contained in:
296
BlazorApp/Pages/Shared/BerufswunschListe.razor
Normal file
296
BlazorApp/Pages/Shared/BerufswunschListe.razor
Normal file
@@ -0,0 +1,296 @@
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
@if (@AllowUpdates == true)
|
||||
{
|
||||
<SfGrid ID="Grid3" DataSource="@GridData2" @ref="Grid22" AllowRowDragAndDrop="true" AllowPaging="false" AllowSorting="true" Toolbar="@(new List<string>() { "Edit", "Delete" })"
|
||||
ContextMenuItems="@(new List<ContextMenuItemModel>() { new ContextMenuItemModel { Text = "Bearbeiten", Target = ".e-content", Id = "Edit"},new ContextMenuItemModel { Text = "Löschen", Target = ".e-content", Id = "Loeschen"} })">
|
||||
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="@AllowUpdates" AllowDeleting="AllowUpdates" AllowEditing="AllowUpdates" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<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>
|
||||
*@
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<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 class="container">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body" style="color:red">@((MarkupString)berufhinweis)</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<SfGrid ID="Grid3" DataSource="@GridData2" @ref="Grid22" AllowRowDragAndDrop="false" AllowPaging="false" AllowSorting="false">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="@AllowUpdates" AllowDeleting="AllowUpdates" AllowEditing="AllowUpdates" ></GridEditSettings>
|
||||
<GridEvents OnActionBegin="OnBeginHandler" OnActionComplete="OnCompletedHandler" TValue="SchuelerBeruf" OnDataBound="RowDataBoundHandler"></GridEvents>
|
||||
<GridEvents OnRecordClick="Berufswunsch_Click" TValue="SchuelerBeruf"></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>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
}
|
||||
@code {
|
||||
[Parameter]
|
||||
public bool AllowUpdates { get; set; } = false;
|
||||
[Parameter]
|
||||
public EventCallback<string> OnGridClicked { get; set; }
|
||||
|
||||
//[Parameter]
|
||||
public int SchuelerID { get; set; }
|
||||
|
||||
|
||||
public string userid = "";
|
||||
|
||||
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;
|
||||
public bool ContinuePaging = true;
|
||||
public string berufhinweis = "";
|
||||
|
||||
SfGrid<SchuelerBeruf> Grid22 { get; set; }
|
||||
public List<BWPMModels.SchuelerBeruf> GridData2 { get; set; }
|
||||
public List<BWPMModels.Beruf> berufe { get; set; } = BlazorApp.Controller.BerufController.GetBerufsangebot();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Task Berufswunsch_Click(RecordClickEventArgs<SchuelerBeruf> args)
|
||||
{
|
||||
return OnGridClicked.InvokeAsync(args.RowData.berufID.ToString());
|
||||
}
|
||||
|
||||
public void ReloadData(int iSchuelerID)
|
||||
{
|
||||
SchuelerID = iSchuelerID;
|
||||
GridData2 = BlazorApp.Controller.SchuelerBerufController.GetBySchuelerID(iSchuelerID);
|
||||
Grid22.Refresh();
|
||||
|
||||
pruefung();
|
||||
//return Task.CompletedTask;
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
pruefung();
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Data.mutierer = userid.ToString();
|
||||
Args.Data.mutiert_am = DateTime.Now;
|
||||
BlazorApp.Controller.SchuelerBerufController.PUT(Args.Data);
|
||||
pruefung();
|
||||
}
|
||||
}
|
||||
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);
|
||||
pruefung();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
private void update_griddata()
|
||||
{
|
||||
//GridData.Clear();
|
||||
GridData2 = BlazorApp.Controller.SchuelerBerufController.GetBySchuelerID(SchuelerID);
|
||||
Grid22.Refresh();
|
||||
}
|
||||
|
||||
public async Task OnCompletedHandler(ActionEventArgs<BWPMModels.SchuelerBeruf> Args)
|
||||
{
|
||||
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
|
||||
{
|
||||
await Grid22.SetRowData(Args.Data.ID, Args.Data);
|
||||
double xx = 0;
|
||||
Value = Args.Data.ID;
|
||||
xx = await DataHandler();
|
||||
await Grid22.SelectRow(xx);
|
||||
}
|
||||
}
|
||||
public async void RowDataBoundHandler(BeforeDataBoundArgs<BWPMModels.SchuelerBeruf> args)
|
||||
{
|
||||
if (!Initial)
|
||||
{
|
||||
}
|
||||
Initial = false;
|
||||
}
|
||||
|
||||
public async Task<double> DataHandler()
|
||||
{
|
||||
var PageCount = (GridData2.Count / Grid22.PageSettings.PageSize) + 1;
|
||||
ContinuePaging = true;
|
||||
var CurrentPage = 1;
|
||||
Grid22.Refresh();
|
||||
await Grid22.GoToPage(1);
|
||||
for (int i = 1; i <= PageCount; i++)
|
||||
{
|
||||
List<SchuelerBeruf> Rows = await Grid22.GetCurrentViewRecords(); // returns the current view data
|
||||
for (int j = 0; j < Grid22.PageSettings.PageSize; j++)
|
||||
{
|
||||
if (j < Rows.Count && Rows[j].ID == Value)
|
||||
{
|
||||
foundrow = j;
|
||||
|
||||
ContinuePaging = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContinuePaging)
|
||||
{
|
||||
if (i >= PageCount)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
await Grid22.GoToPage(i + 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return foundrow;
|
||||
}
|
||||
}
|
||||
return foundrow;
|
||||
}
|
||||
|
||||
public void pruefung()
|
||||
{
|
||||
berufhinweis = "";
|
||||
int Anzahl_Berufe = 0;
|
||||
try
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
if (BlazorApp.Controller.SchuelerBerufController.Get_Anzahl(SchuelerID) < Convert.ToInt32(dbh.Get_Option(4)))
|
||||
{
|
||||
berufhinweis += "\r\n- es sollten 3 Berufswünsche ausgewählt werden<br />";
|
||||
}
|
||||
if (BlazorApp.Controller.SchuelerBerufController.Has_Prio1(SchuelerID) == false)
|
||||
{
|
||||
berufhinweis += "\r\n- Es fehlt ein Berufswunsch mit Priorität 1";
|
||||
}
|
||||
if (BlazorApp.Controller.SchuelerBerufController.Has_Dublicates(SchuelerID) == true)
|
||||
{
|
||||
berufhinweis += "\r\n- Berufe wurden doppelt ausgewählt";
|
||||
}
|
||||
|
||||
}
|
||||
catch { };
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
74
BlazorApp/Pages/Shared/KlasseList.razor
Normal file
74
BlazorApp/Pages/Shared/KlasseList.razor
Normal file
@@ -0,0 +1,74 @@
|
||||
@using BWPMModels;
|
||||
|
||||
<RadzenDropDown AllowClear="true" TValue="string" @bind-Value=@KlasseID
|
||||
Data=@intKlasse
|
||||
Change=@(args => OnChange(args, "DropDown")) TextProperty="bezeichnung" ValueProperty="id" />
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public EventCallback<string> OnKlasseChanged { get; set; }
|
||||
|
||||
public string KlasseID;
|
||||
public List<iKlasse> intKlasse = new List<iKlasse>();
|
||||
public List<BWPMModels.Klasse> Klasse { get; set; } = BlazorApp.Controller.KlasseController.GetAllActiveData();
|
||||
|
||||
public class iKlasse
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string bezeichnung { get; set; }
|
||||
}
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
intKlasse.Clear();
|
||||
foreach (BWPMModels.Klasse item in Klasse)
|
||||
{
|
||||
iKlasse kl = new iKlasse();
|
||||
kl.id = item.ID.ToString();
|
||||
kl.bezeichnung = item.bezeichnung;
|
||||
intKlasse.Add(kl);
|
||||
};
|
||||
KlasseID = Klasse[0].ID.ToString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Task OnChange(object value, string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
KlasseID = value.ToString();
|
||||
return OnKlasseChanged.InvokeAsync(KlasseID);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return OnKlasseChanged.InvokeAsync("0");
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public string GetKlasseID()
|
||||
{
|
||||
return KlasseID;
|
||||
}
|
||||
|
||||
public void ReloadByLehrer(string LID)
|
||||
{
|
||||
Klasse = BlazorApp.Controller.KlasseController.GetByLehrerID(Convert.ToInt32(LID));
|
||||
intKlasse.Clear();
|
||||
foreach (BWPMModels.Klasse item in Klasse)
|
||||
{
|
||||
iKlasse kl = new iKlasse();
|
||||
kl.id = item.ID.ToString();
|
||||
kl.bezeichnung = item.bezeichnung;
|
||||
intKlasse.Add(kl);
|
||||
};
|
||||
try
|
||||
{
|
||||
KlasseID = Klasse[0].ID.ToString();
|
||||
}
|
||||
catch { KlasseID = "0"; }
|
||||
}
|
||||
|
||||
}
|
||||
55
BlazorApp/Pages/Shared/LehrerList.razor
Normal file
55
BlazorApp/Pages/Shared/LehrerList.razor
Normal file
@@ -0,0 +1,55 @@
|
||||
@using BWPMModels;
|
||||
|
||||
<RadzenDropDown AllowClear="true" TValue="string" @bind-Value=@LehrerID
|
||||
Data=@intLehrer
|
||||
Change=@(args => OnChange(args, "DropDown")) TextProperty="bezeichnung" ValueProperty="id" />
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public EventCallback<string> OnLehrerChanged { get; set; }
|
||||
|
||||
public string LehrerID;
|
||||
public List<iLehrer> intLehrer = new List<iLehrer>();
|
||||
public List<BWPMModels.Lehrer> Lehrer { get; set; } = BlazorApp.Controller.LehrerController.GetAllActiveData();
|
||||
|
||||
public class iLehrer
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string bezeichnung { get; set; }
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Lehrer = BlazorApp.Controller.LehrerController.GetAllActiveData();
|
||||
intLehrer.Clear();
|
||||
foreach (BWPMModels.Lehrer item in Lehrer)
|
||||
{
|
||||
iLehrer ll = new iLehrer();
|
||||
ll.id = item.ID.ToString();
|
||||
ll.bezeichnung = item.name.ToString() + " " + item.vorname.ToString();
|
||||
intLehrer.Add(ll);
|
||||
}
|
||||
LehrerID = Lehrer[0].ID.ToString();
|
||||
}
|
||||
|
||||
|
||||
public Task OnChange(object value, string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
LehrerID = value.ToString();
|
||||
return OnLehrerChanged.InvokeAsync(LehrerID);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return OnLehrerChanged.InvokeAsync("0");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public string GetLehrerID()
|
||||
{
|
||||
return LehrerID;
|
||||
}
|
||||
|
||||
}
|
||||
48
BlazorApp/Pages/Shared/OffenePlaetze.razor
Normal file
48
BlazorApp/Pages/Shared/OffenePlaetze.razor
Normal file
@@ -0,0 +1,48 @@
|
||||
@using Syncfusion.Blazor.Grids;
|
||||
@using BlazorApp.Helper
|
||||
@using BWPMModels;
|
||||
|
||||
<SfGrid ID="Grid6" DataSource="@GridDataZuteilung" @ref="GridZuteilung" AllowPaging="true" AllowSorting="true"
|
||||
Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })"
|
||||
ContextMenuItems="@(new List<Object>(){ new ContextMenuItemModel { Text = "Zuteilen", Target = ".e-content"} })">
|
||||
<GridPageSettings PageCount="5" PageSizes="true"></GridPageSettings>
|
||||
<GridEditSettings AllowAdding="false" AllowDeleting="false" AllowEditing="false" Mode="EditMode.Dialog"></GridEditSettings>
|
||||
<GridEvents ContextMenuItemClicked="OnContextMenuClick" TValue="View_Offene_Plaetze"></GridEvents>
|
||||
<GridColumns>
|
||||
<GridColumn Field=@nameof(View_Offene_Plaetze.ID) HeaderText="Id" IsPrimaryKey="true" AllowAdding="false" Width="60" Visible="false"> </GridColumn>
|
||||
<GridColumn Field=@nameof(View_Offene_Plaetze.nameZ1) HeaderText="Firma" Width="100" Visible="true"></GridColumn>
|
||||
<GridColumn Field=@nameof(View_Offene_Plaetze.zeit) HeaderText="Zeit" Width="100" Visible="true"></GridColumn>
|
||||
<GridColumn Field=@nameof(View_Offene_Plaetze.anzahl) HeaderText="Anzahl" Width="100" Visible="true"></GridColumn>
|
||||
<GridColumn Field=@nameof(View_Offene_Plaetze.typ) HeaderText="Typ" Width="40" Visible="true"></GridColumn>
|
||||
</GridColumns>
|
||||
</SfGrid>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> OnGridChanged { get; set; }
|
||||
public int SchuelerID { get; set; }
|
||||
|
||||
SfGrid<View_Offene_Plaetze> GridZuteilung { get; set; }
|
||||
|
||||
public List<BWPMModels.View_Offene_Plaetze> GridDataZuteilung { get; set; }
|
||||
BWPMModels.Zuteilung NeuZuteilung { get; set; }
|
||||
|
||||
private Task OnContextMenuClick(ContextMenuClickEventArgs<View_Offene_Plaetze> args)
|
||||
{
|
||||
|
||||
int s =0;
|
||||
s = SchuelerID;
|
||||
int b = 0;
|
||||
b = GridDataZuteilung[Convert.ToInt32(args.RowInfo.RowIndex)].ID;
|
||||
BlazorApp.Controller.ZuteilungController.insert_zuteilung(s, b);
|
||||
return OnGridChanged.InvokeAsync(s.ToString());
|
||||
}
|
||||
|
||||
public void ReloadData(int IBerufID, int IKlassentypID)
|
||||
{
|
||||
GridDataZuteilung = BlazorApp.Controller.ZuteilungController.GetOffenePlaetze(IBerufID, IKlassentypID);
|
||||
GridZuteilung.Refresh();
|
||||
}
|
||||
}
|
||||
75
BlazorApp/Pages/Shared/SchuelerList.razor
Normal file
75
BlazorApp/Pages/Shared/SchuelerList.razor
Normal file
@@ -0,0 +1,75 @@
|
||||
@using BWPMModels;
|
||||
<RadzenListBox @bind-Value=@SchuelerID
|
||||
Data=@schuelerliste TextProperty="bezeichnung" ValueProperty="id" Style="height:350px"
|
||||
Change=@(args => SchuelerChange(args, "schuelerlist")) />
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public EventCallback<string> OnSchuelerChanged { get; set; }
|
||||
|
||||
public List<BWPMModels.Schueler> Schueler { get; set; }
|
||||
private Schueler _schueler { get; set; } = new BWPMModels.Schueler();
|
||||
public List<Schuelerlist> schuelerliste = new List<Schuelerlist>();
|
||||
public int SchuelerID;
|
||||
public class Schuelerlist
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string bezeichnung { get; set; }
|
||||
}
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string ReloadData(string KlasseID)
|
||||
{
|
||||
if (KlasseID == "-1")
|
||||
{
|
||||
Schueler = BlazorApp.Controller.SchuelerController.GetAllActiveData();
|
||||
}
|
||||
else{
|
||||
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);
|
||||
|
||||
};
|
||||
SelectFirst();
|
||||
return SchuelerID.ToString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Task SchuelerChange(object value, string name)
|
||||
{
|
||||
var str = value is IEnumerable<object> ? string.Join(", ", (IEnumerable<object>)value) : value;
|
||||
return OnSchuelerChanged.InvokeAsync(str.ToString());
|
||||
}
|
||||
|
||||
public string GetSchuelerID()
|
||||
{
|
||||
return SchuelerID.ToString();
|
||||
}
|
||||
|
||||
public void SelectFirst()
|
||||
{
|
||||
try
|
||||
{
|
||||
SchuelerID = schuelerliste[0].id;
|
||||
}
|
||||
catch { SchuelerID = 0; };
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user