diff --git a/demko_term/AcceptStatementWindow.axaml.cs b/demko_term/AcceptStatementWindow.axaml.cs index a198c7f..e2506b7 100644 --- a/demko_term/AcceptStatementWindow.axaml.cs +++ b/demko_term/AcceptStatementWindow.axaml.cs @@ -12,18 +12,29 @@ namespace demko_term; public partial class AcceptStatementWindow : Window { - public List AcceptApplicantList { get; } - public List AcceptSpecialtyList { get; } + public List AcceptApplicantList { get; set; } + public List AcceptSpecialtyList { get; set; } public AcceptStatementWindow() { using var context = new DemoCourseworkContext(); InitializeComponent(); - + DisplayComboBoxes(); + } + + public void LoadComboBoxes() + { + using var context = new DemoCourseworkContext(); AcceptApplicantList = context.Applicants.Select(a => a.Code.ToString()).ToList(); - AcceptApplicantComboBox.ItemsSource = AcceptApplicantList; AcceptSpecialtyList = context.Specialties.Select(s => s.Code).ToList(); + } + + public void DisplayComboBoxes() + { + LoadComboBoxes(); + + AcceptApplicantComboBox.ItemsSource = AcceptApplicantList; AcceptSpecialtyListBox.ItemsSource = AcceptSpecialtyList; } @@ -77,9 +88,11 @@ public partial class AcceptStatementWindow : Window } - private void CreateApplicantWindowButton_OnClick(object? sender, RoutedEventArgs e) + private async void CreateApplicantWindowButton_OnClick(object? sender, RoutedEventArgs e) { - CreateApplicantWindow ordersWindow = new CreateApplicantWindow(); - ordersWindow.ShowDialog(this); + CreateApplicantWindow createApplicantWindow = new CreateApplicantWindow(); + await createApplicantWindow.ShowDialog(this); + + DisplayComboBoxes(); } } \ No newline at end of file diff --git a/demko_term/CreateApplicantWindow.axaml.cs b/demko_term/CreateApplicantWindow.axaml.cs index 6b94506..a2fd199 100644 --- a/demko_term/CreateApplicantWindow.axaml.cs +++ b/demko_term/CreateApplicantWindow.axaml.cs @@ -10,7 +10,7 @@ namespace demko_term; public partial class CreateApplicantWindow : Window { - public string code_prew; + public int code_prew; public CreateApplicantWindow() { @@ -18,8 +18,8 @@ public partial class CreateApplicantWindow : Window InitializeComponent(); using var context = new DemoCourseworkContext(); - code_prew = context.Applicants.Select(a => a.Code).Max().ToString(); - CodeTextBox.Text = code_prew; + code_prew = context.Applicants.Select(a => a.Code).Max(); + CodeTextBox.Text = (code_prew + 1).ToString(); } public void CreateApplicant_OnClick(object? sender, RoutedEventArgs e) diff --git a/demko_term/FormPersonalFileWindow.axaml b/demko_term/FormPersonalFileWindow.axaml index 8c15333..d6536c0 100644 --- a/demko_term/FormPersonalFileWindow.axaml +++ b/demko_term/FormPersonalFileWindow.axaml @@ -9,7 +9,7 @@