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 partial class AcceptStatementWindow : Window
{ {
public List<string> AcceptApplicantList { get; } public List<string> AcceptApplicantList { get; set; }
public List<string> AcceptSpecialtyList { get; } public List<string> AcceptSpecialtyList { get; set; }
public AcceptStatementWindow() public AcceptStatementWindow()
{ {
using var context = new DemoCourseworkContext(); using var context = new DemoCourseworkContext();
InitializeComponent(); InitializeComponent();
DisplayComboBoxes();
}
public void LoadComboBoxes()
{
using var context = new DemoCourseworkContext();
AcceptApplicantList = context.Applicants.Select(a => a.Code.ToString()).ToList(); AcceptApplicantList = context.Applicants.Select(a => a.Code.ToString()).ToList();
AcceptApplicantComboBox.ItemsSource = AcceptApplicantList;
AcceptSpecialtyList = context.Specialties.Select(s => s.Code).ToList(); AcceptSpecialtyList = context.Specialties.Select(s => s.Code).ToList();
}
public void DisplayComboBoxes()
{
LoadComboBoxes();
AcceptApplicantComboBox.ItemsSource = AcceptApplicantList;
AcceptSpecialtyListBox.ItemsSource = AcceptSpecialtyList; 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(); CreateApplicantWindow createApplicantWindow = new CreateApplicantWindow();
ordersWindow.ShowDialog(this); await createApplicantWindow.ShowDialog(this);
DisplayComboBoxes();
} }
} }

View File

@ -10,7 +10,7 @@ namespace demko_term;
public partial class CreateApplicantWindow : Window public partial class CreateApplicantWindow : Window
{ {
public string code_prew; public int code_prew;
public CreateApplicantWindow() public CreateApplicantWindow()
{ {
@ -18,8 +18,8 @@ public partial class CreateApplicantWindow : Window
InitializeComponent(); InitializeComponent();
using var context = new DemoCourseworkContext(); using var context = new DemoCourseworkContext();
code_prew = context.Applicants.Select(a => a.Code).Max().ToString(); code_prew = context.Applicants.Select(a => a.Code).Max();
CodeTextBox.Text = code_prew; CodeTextBox.Text = (code_prew + 1).ToString();
} }
public void CreateApplicant_OnClick(object? sender, RoutedEventArgs e) public void CreateApplicant_OnClick(object? sender, RoutedEventArgs e)

View File

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

View File

@ -16,12 +16,18 @@ public partial class FormPersonalFileWindow : Window
private ObservableCollection<StatementPresenter> statements = new(); private ObservableCollection<StatementPresenter> statements = new();
private List<StatementPresenter> dataSourceStatements; private List<StatementPresenter> dataSourceStatements;
private List<string> ApplicantCodeList;
public FormPersonalFileWindow() public FormPersonalFileWindow()
{ {
InitializeComponent(); InitializeComponent();
using var context = new DemoCourseworkContext(); 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(); DisplayStatements();
} }
@ -66,9 +72,9 @@ public partial class FormPersonalFileWindow : Window
var temp = dataSourceStatements; 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(); statements.Clear();
@ -80,7 +86,7 @@ public partial class FormPersonalFileWindow : Window
StatementListBox.ItemsSource = statements; StatementListBox.ItemsSource = statements;
} }
public void PersonalNumberComboBox_OnSelectionChanged(object? sender, RoutedEventArgs e) public void ApplicantCodeListComboBox_OnSelectionChanged(object? sender, RoutedEventArgs e)
{ {
DisplayStatements(); DisplayStatements();
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("demko_term")] [assembly: System.Reflection.AssemblyCompanyAttribute("demko_term")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [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.AssemblyProductAttribute("demko_term")]
[assembly: System.Reflection.AssemblyTitleAttribute("demko_term")] [assembly: System.Reflection.AssemblyTitleAttribute("demko_term")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
c8339bf00dc15d968378e3a1f1367ef7e592cda2aa47631998adb04dc3e9d282 73e5f84317abed58d7fbb2a432ce58f4fe49f4df21d2e4b06013629fc3a7e788