session 1
This commit is contained in:
parent
e077c54b14
commit
04343c0917
@ -7,9 +7,11 @@
|
||||
<entry key="demko_term/AdminWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
<entry key="demko_term/BlankWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
<entry key="demko_term/CreateApplicantWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
<entry key="demko_term/FormPersonalFileWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
<entry key="demko_term/HistoryWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
<entry key="demko_term/MainWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
<entry key="demko_term/ManagerWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
<entry key="demko_term/ViewApplicantWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
<entry key="demko_term/VolunteerWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
<entry key="demko_term/WorkerWindow.axaml" value="demko_term/demko_term.csproj" />
|
||||
</map>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/demko_term" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -14,7 +14,7 @@
|
||||
|
||||
<CheckBox x:Name="PassportCheckBox" Content="Паспорт предоставлен"/>
|
||||
<CheckBox x:Name="DiplomaCheckBox" Content="Диплом предоставлен"/>
|
||||
<TextBox x:Name="PointsTextBox" Text="Введите баллы"/>
|
||||
<TextBox x:Name="PointsTextBox" Watermark="Введите баллы"/>
|
||||
|
||||
<StackPanel>
|
||||
<Button Content="Сформировать заявления" Click="AcceptStatementButton_OnClick"/>
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
@ -8,14 +9,22 @@ namespace demko_term;
|
||||
|
||||
public partial class CreateApplicantWindow : Window
|
||||
{
|
||||
|
||||
public string code_prew;
|
||||
|
||||
public CreateApplicantWindow()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
using var context = new DemoCourseworkContext();
|
||||
|
||||
code_prew = context.Applicants.Select(a => a.Code).Max().ToString();
|
||||
CodeTextBox.Text = code_prew;
|
||||
}
|
||||
|
||||
public void CreateApplicant_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
using var ctx = new DemoCourseworkContext();
|
||||
using var context = new DemoCourseworkContext();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(FirstNameTextBox.Text) ||
|
||||
string.IsNullOrWhiteSpace(LastNameTextBox.Text) ||
|
||||
@ -43,8 +52,8 @@ public partial class CreateApplicantWindow : Window
|
||||
Address = AddressTextBox.Text
|
||||
};
|
||||
|
||||
ctx.Applicants.Add(newApplicant);
|
||||
ctx.SaveChanges();
|
||||
context.Applicants.Add(newApplicant);
|
||||
context.SaveChanges();
|
||||
|
||||
Close();
|
||||
}
|
||||
|
34
demko_term/FormPersonalFileWindow.axaml
Normal file
34
demko_term/FormPersonalFileWindow.axaml
Normal file
@ -0,0 +1,34 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="demko_term.FormPersonalFileWindow"
|
||||
x:CompileBindings="False"
|
||||
Title="FormPersonalFileWindow">
|
||||
<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"/>
|
||||
</StackPanel>
|
||||
<Border>
|
||||
<ListBox x:Name="StatementListBox" Margin="10">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<TextBlock Text="{Binding Id}"/>
|
||||
<TextBlock Text="{Binding PersonalNumber}"/>
|
||||
<TextBlock Text="{Binding SubmissionDate, StringFormat=yyyy-MM-dd}"/>
|
||||
<TextBlock Text="{Binding SubmissionTime}"/>
|
||||
<TextBlock Text="{Binding ApplicantCode}"/>
|
||||
<TextBlock Text="{Binding ApplicantSpecialty}"/>
|
||||
<TextBlock Text="{Binding PassportBool}"/>
|
||||
<TextBlock Text="{Binding DiplomaBool}"/>
|
||||
<TextBlock Text="{Binding Points}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Border>
|
||||
</DockPanel>
|
||||
</Window>
|
93
demko_term/FormPersonalFileWindow.axaml.cs
Normal file
93
demko_term/FormPersonalFileWindow.axaml.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using demko_term.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace demko_term;
|
||||
|
||||
public partial class FormPersonalFileWindow : Window
|
||||
{
|
||||
|
||||
private ObservableCollection<StatementPresenter> statements = new();
|
||||
private List<StatementPresenter> dataSourceStatements;
|
||||
|
||||
public FormPersonalFileWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
using var context = new DemoCourseworkContext();
|
||||
|
||||
PersonalNumberComboBox.ItemsSource = context.Statements.Select(s => s.PersonalNumber).ToList();
|
||||
DisplayStatements();
|
||||
}
|
||||
|
||||
public class StatementPresenter : Statement
|
||||
{
|
||||
public string ApplicantCode { get; set; }
|
||||
|
||||
public string ApplicantSpecialty { get; set; }
|
||||
|
||||
public bool? PassportBool { get; set; }
|
||||
|
||||
public bool? DiplomaBool { get; set; }
|
||||
|
||||
public string Passport => PassportBool.HasValue ? (PassportBool.Value ? "Да" : "Нет") : "";
|
||||
|
||||
public string Diploma => DiplomaBool.HasValue ? (DiplomaBool.Value ? "Да" : "Нет") : "";
|
||||
}
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
using var context = new DemoCourseworkContext();
|
||||
dataSourceStatements = context.Statements
|
||||
.Include(s => s.ApplicantCodeNavigation)
|
||||
.Include(s => s.ApplicantSpecialityNavigation)
|
||||
.Select(s => new StatementPresenter
|
||||
{
|
||||
Id = s.Id,
|
||||
PersonalNumber = s.PersonalNumber,
|
||||
SubmissionDate = s.SubmissionDate,
|
||||
SubmissionTime = s.SubmissionTime,
|
||||
ApplicantCode = s.ApplicantCodeNavigation.Code.ToString(),
|
||||
ApplicantSpecialty = s.ApplicantSpecialityNavigation.Code.ToString(),
|
||||
PassportBool = s.Passport,
|
||||
DiplomaBool = s.Diploma,
|
||||
Points = s.Points,
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private void DisplayStatements()
|
||||
{
|
||||
LoadData();
|
||||
|
||||
var temp = dataSourceStatements;
|
||||
|
||||
if (PersonalNumberComboBox.SelectedItem is string selectedPersonalNumber)
|
||||
{
|
||||
temp = temp.Where(it => it.PersonalNumber == selectedPersonalNumber).ToList();
|
||||
}
|
||||
|
||||
statements.Clear();
|
||||
foreach (var item in temp)
|
||||
{
|
||||
statements.Add(item);
|
||||
}
|
||||
|
||||
StatementListBox.ItemsSource = statements;
|
||||
}
|
||||
|
||||
public void PersonalNumberComboBox_OnSelectionChanged(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
DisplayStatements();
|
||||
}
|
||||
|
||||
private void ViewApplicantButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewApplicantWindow viewApplicantWindow = new ViewApplicantWindow();
|
||||
viewApplicantWindow.ShowDialog(this);
|
||||
}
|
||||
}
|
33
demko_term/ViewApplicantWindow.axaml
Normal file
33
demko_term/ViewApplicantWindow.axaml
Normal file
@ -0,0 +1,33 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="demko_term.ViewApplicantWindow"
|
||||
x:CompileBindings="False"
|
||||
Title="ViewApplicantWindow">
|
||||
<DockPanel>
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" DockPanel.Dock="Top" Spacing="10" Height="50">
|
||||
<Button Content="Добавить абитуриента" x:Name="CreateApplicantWindowButton" Click="CreateApplicantWindowButton_OnClick"/>
|
||||
</StackPanel>
|
||||
<Border>
|
||||
<ListBox x:Name="ApplicantListBox" Margin="10">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<TextBlock Text="{Binding Id}"/>
|
||||
<TextBlock Text="{Binding Code}"/>
|
||||
<TextBlock Text="{Binding Firstname}"/>
|
||||
<TextBlock Text="{Binding Lastname}"/>
|
||||
<TextBlock Text="{Binding Patronymic}"/>
|
||||
<TextBlock Text="{Binding Date, StringFormat=yyyy-MM-dd}"/>
|
||||
<TextBlock Text="{Binding Address}"/>
|
||||
<TextBlock Text="{Binding Email}"/>
|
||||
<TextBlock Text="{Binding Phone}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Border>
|
||||
</DockPanel>
|
||||
</Window>
|
59
demko_term/ViewApplicantWindow.axaml.cs
Normal file
59
demko_term/ViewApplicantWindow.axaml.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using demko_term.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace demko_term;
|
||||
|
||||
public partial class ViewApplicantWindow : Window
|
||||
{
|
||||
|
||||
private List<Applicant> dataSourceApplicants;
|
||||
|
||||
public ViewApplicantWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
using var context = new DemoCourseworkContext();
|
||||
DisplayApplicant();
|
||||
}
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
using var context = new DemoCourseworkContext();
|
||||
dataSourceApplicants = context.Applicants
|
||||
.Select(a => new Applicant
|
||||
{
|
||||
Id = a.Id,
|
||||
Firstname = a.Firstname,
|
||||
Lastname = a.Lastname,
|
||||
Patronymic = a.Patronymic,
|
||||
Code = a.Code,
|
||||
Date = a.Date,
|
||||
Address = a.Address,
|
||||
Email = a.Email,
|
||||
Phone = a.Phone
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public void DisplayApplicant()
|
||||
{
|
||||
LoadData();
|
||||
|
||||
var temp = dataSourceApplicants;
|
||||
|
||||
ApplicantListBox.ItemsSource = temp;
|
||||
}
|
||||
|
||||
private async void CreateApplicantWindowButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
CreateApplicantWindow сreateApplicantWindow = new CreateApplicantWindow();
|
||||
await сreateApplicantWindow.ShowDialog(this);
|
||||
|
||||
DisplayApplicant();
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ public partial class WorkerWindow : Window
|
||||
|
||||
private void FormPersonalFile_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
BlankWindow formOrderWindow = new BlankWindow();
|
||||
FormPersonalFileWindow formOrderWindow = new FormPersonalFileWindow();
|
||||
formOrderWindow.ShowDialog(this);
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
f36369443af68cb831707dc4dcb9ba39651db7a48ec94e878458b605c18ff106
|
||||
e7fa30969dd006409f4ac9a4dd7dad76663440a0b950763228c136cad725fc6f
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e077c54b141f4457ab3b6d4c49d4696817ef5147")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("demko_term")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("demko_term")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
77e022cf4a0aa3182e1f3ddf38fe3685a30c3fd9903b3a342b3eb739fb5bca28
|
||||
c8339bf00dc15d968378e3a1f1367ef7e592cda2aa47631998adb04dc3e9d282
|
||||
|
@ -31,6 +31,9 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
[/Users/feitanportor/dev/C\#/demko_term/demko_term/CreateApplicantWindow.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[/Users/feitanportor/dev/C\#/demko_term/demko_term/FormPersonalFileWindow.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[/Users/feitanportor/dev/C\#/demko_term/demko_term/HistoryWindow.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
@ -40,6 +43,9 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
[/Users/feitanportor/dev/C\#/demko_term/demko_term/ManagerWindow.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[/Users/feitanportor/dev/C\#/demko_term/demko_term/ViewApplicantWindow.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[/Users/feitanportor/dev/C\#/demko_term/demko_term/VolunteerWindow.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
|
@ -1 +1 @@
|
||||
020631c5db98a9be0b9ecb53d57bcc1b55727af1c32fd2176669379d4e4987b4
|
||||
b8a0f15a7e4a89eeaa7b8089565dd47aa2489c08fd0cfd45dd9e501eeb4b4756
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user