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.

96 lines
3.4 KiB

@using System.ComponentModel.DataAnnotations
@using Syncfusion.Blazor.Grids;
@using Syncfusion.Blazor.Buttons;
@using Syncfusion.Blazor.Spinner;
@using Syncfusion.Blazor.Navigations;
@using Syncfusion.Blazor.Popups;
@using Syncfusion.Blazor.DropDowns
@using BlazorApp.Helper
@using BWPMModels
<div class="row">
<div class="col-md-4" @ondblclick="InsertBeruf">
<h6>Berufe</h6>
<SfListBox @bind-Value=@BerufID TValue="string[]" DataSource="@berufe" @ref="Berufsliste" TItem="Beruf" Height="250px">
<ListBoxSelectionSettings Mode="Syncfusion.Blazor.DropDowns.SelectionMode.Single" ShowCheckbox="false"></ListBoxSelectionSettings>
<ListBoxFieldSettings Text="bezeichnung" Value="id" />
</SfListBox>
<SfButton OnClick="InsertBeruf">Beruf auswählen</SfButton>
</div>
<div class="col-md-8">
<h6>Gewählte Berufe</h6>
<BlazorApp.Pages.Shared.BerufswunschListe AllowUpdates="true" @ref="BWL" OnGridClicked="OnGridClicked1"></BlazorApp.Pages.Shared.BerufswunschListe>
</div>
</div>
@code {
public string userid { get; set; } = "";
BlazorApp.Pages.Shared.BerufswunschListe BWL { get; set; }
public int SchuelerID = 0;
public bool ShowDeleteConfirmation { get; set; } = false;
public string DialogHeader { get; set; } = "";
public string DialogText { get; set; } = "";
public bool DialogShowYesNO { get; set; } = true;
//public int BerufID;
//public List<BWPMModels.Beruf> berufe { get; set; } = BlazorApp.Controller.BerufController.GetBerufsangebot();
SfGrid<SchuelerBeruf> Grid { get; set; }
public List<BWPMModels.SchuelerBeruf> GridData { get; set; }
public string berufhinweis = "";
public bool ContinuePaging = true;
public int foundrow = 0;
public int Value = 0;
public string[] BerufID;
SfListBox<string[], Beruf> Berufsliste { get; set; }
public List<Beruf> berufe = new List<Beruf>();
public List<BWPMModels.Beruf> _berufe { get; set; } = BlazorApp.Controller.BerufController.GetBerufsangebot();
public class Beruf
{
public int id { get; set; }
public string bezeichnung { get; set; }
}
protected override async Task OnInitializedAsync()
{
foreach (BWPMModels.Beruf item in _berufe)
{
Beruf be = new Beruf();
be.id = item.ID;
be.bezeichnung = item.bezeichnung;
berufe.Add(be);
}
}
public void ReloadData(string SchuelerID)
{
BWL.userid = userid;
BWL.ReloadData(Convert.ToInt32(SchuelerID));
}
private void InsertBeruf()
{
BWPMModels.SchuelerBeruf sberuf = new BWPMModels.SchuelerBeruf();
sberuf.aktiv = true;
sberuf.bemerkung = "";
sberuf.berufID = Convert.ToInt32(BerufID[0]);
sberuf.erstellt_am = DateTime.Now;
sberuf.mutiert_am = DateTime.Now;
sberuf.mutierer = userid;
sberuf.schuelerID = Convert.ToInt32(SchuelerID);
int prio = BlazorApp.Controller.SchuelerBerufController.Get_Prio(Convert.ToInt32(SchuelerID));
sberuf.prioritaet = prio + 1;
BlazorApp.Controller.SchuelerBerufController.POST(sberuf);
BWL.ReloadData(Convert.ToInt32(SchuelerID));
}
private void OnGridClicked1(string Berufid)
{ }
}