session 1 теперь точно

This commit is contained in:
1billy17 2025-04-14 17:45:48 +03:00
parent 04343c0917
commit 55b76c8840
20 changed files with 50 additions and 31 deletions

View File

@ -12,18 +12,29 @@ namespace demko_term;
public partial class AcceptStatementWindow : Window
{
public List<string> AcceptApplicantList { get; }
public List<string> AcceptSpecialtyList { get; }
public List<string> AcceptApplicantList { get; set; }
public List<string> 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();
}
}

View File

@ -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)

View File

@ -9,7 +9,7 @@
<DockPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" DockPanel.Dock="Top" Spacing="15" Margin="5">
<Button Content="Просмотреть абитуриентов" x:Name="ViewApplicantButton" Click="ViewApplicantButton_OnClick"/>
<ComboBox Width="100" x:Name="PersonalNumberComboBox" SelectionChanged="PersonalNumberComboBox_OnSelectionChanged"/>
<ComboBox Width="100" x:Name="ApplicantCodeListComboBox" SelectionChanged="ApplicantCodeListComboBox_OnSelectionChanged"/>
</StackPanel>
<Border>
<ListBox x:Name="StatementListBox" Margin="10">

View File

@ -16,12 +16,18 @@ public partial class FormPersonalFileWindow : Window
private ObservableCollection<StatementPresenter> statements = new();
private List<StatementPresenter> dataSourceStatements;
private List<string> ApplicantCodeList;
public FormPersonalFileWindow()
{
InitializeComponent();
using var context = new DemoCourseworkContext();
PersonalNumberComboBox.ItemsSource = context.Statements.Select(s => s.PersonalNumber).ToList();
ApplicantCodeList = context.Statements
.Include(a => a.ApplicantCodeNavigation)
.Select(a => a.ApplicantCodeNavigation.Code.ToString()).Distinct().ToList();
ApplicantCodeListComboBox.ItemsSource = ApplicantCodeList;
DisplayStatements();
}
@ -66,9 +72,9 @@ public partial class FormPersonalFileWindow : Window
var temp = dataSourceStatements;
if (PersonalNumberComboBox.SelectedItem is string selectedPersonalNumber)
if (ApplicantCodeListComboBox.SelectedItem is string selectedApplicantCode)
{
temp = temp.Where(it => it.PersonalNumber == selectedPersonalNumber).ToList();
temp = temp.Where(it => it.ApplicantCode == selectedApplicantCode).ToList();
}
statements.Clear();
@ -80,7 +86,7 @@ public partial class FormPersonalFileWindow : Window
StatementListBox.ItemsSource = statements;
}
public void PersonalNumberComboBox_OnSelectionChanged(object? sender, RoutedEventArgs e)
public void ApplicantCodeListComboBox_OnSelectionChanged(object? sender, RoutedEventArgs e)
{
DisplayStatements();
}

View File

@ -47,24 +47,24 @@ public partial class HistoryWindow : Window
private void DisplayServices()
{
var filteredData = dataSourceHistory;
var temp = dataSourceHistory;
if (LoginComboBox.SelectedItem is string selectedLogin)
{
filteredData = filteredData
temp = temp
.Where(it => it.Login == selectedLogin)
.ToList();
}
if (DateComboBox.SelectedItem is DateTime selectedDate)
{
filteredData = filteredData
temp = temp
.Where(it => it.LastLogin.HasValue && it.LastLogin.Value.Date == selectedDate.Date)
.ToList();
}
history.Clear();
foreach (var item in filteredData.OrderBy(it => it.LastLogin))
foreach (var item in temp.OrderBy(it => it.LastLogin))
{
history.Add(item);
}

View File

@ -33,13 +33,13 @@ public partial class ManagerWindow : Window
private void AcceptStatement_OnClick(object? sender, RoutedEventArgs e)
{
AcceptStatementWindow formOrderWindow = new AcceptStatementWindow();
formOrderWindow.ShowDialog(this);
AcceptStatementWindow acceptStatementWindow = new AcceptStatementWindow();
acceptStatementWindow.ShowDialog(this);
}
private void CheckHistoryButton_OnClick(object? sender, RoutedEventArgs e)
{
HistoryWindow formOrderWindow = new HistoryWindow();
formOrderWindow.ShowDialog(this);
HistoryWindow historyWindow = new HistoryWindow();
historyWindow.ShowDialog(this);
}
}

View File

@ -33,7 +33,7 @@ public partial class VolunteerWindow : Window
private void InfoSpecialtyButton_OnClick(object? sender, RoutedEventArgs e)
{
BlankWindow formOrderWindow = new BlankWindow();
formOrderWindow.ShowDialog(this);
BlankWindow blankWindow = new BlankWindow();
blankWindow.ShowDialog(this);
}
}

View File

@ -33,13 +33,13 @@ public partial class WorkerWindow : Window
private void AcceptStatement_OnClick(object? sender, RoutedEventArgs e)
{
AcceptStatementWindow formOrderWindow = new AcceptStatementWindow();
formOrderWindow.ShowDialog(this);
AcceptStatementWindow acceptStatementWindow = new AcceptStatementWindow();
acceptStatementWindow.ShowDialog(this);
}
private void FormPersonalFile_OnClick(object? sender, RoutedEventArgs e)
{
FormPersonalFileWindow formOrderWindow = new FormPersonalFileWindow();
formOrderWindow.ShowDialog(this);
FormPersonalFileWindow formPersonalFileWindow = new FormPersonalFileWindow();
formPersonalFileWindow.ShowDialog(this);
}
}

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("demko_term")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e077c54b141f4457ab3b6d4c49d4696817ef5147")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+04343c09170ef211e11151943df7a44e4744e958")]
[assembly: System.Reflection.AssemblyProductAttribute("demko_term")]
[assembly: System.Reflection.AssemblyTitleAttribute("demko_term")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
c8339bf00dc15d968378e3a1f1367ef7e592cda2aa47631998adb04dc3e9d282
73e5f84317abed58d7fbb2a432ce58f4fe49f4df21d2e4b06013629fc3a7e788