This commit is contained in:
1billy17 2025-04-14 08:39:47 +03:00
commit e077c54b14
208 changed files with 6807 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

13
.idea/.idea.demko_term/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/projectSettingsUpdater.xml
/modules.xml
/.idea.demko_term.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AvaloniaProject">
<option name="projectPerEditor">
<map>
<entry key="demko_term/AcceptStatementWindow.axaml" value="demko_term/demko_term.csproj" />
<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/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/VolunteerWindow.axaml" value="demko_term/demko_term.csproj" />
<entry key="demko_term/WorkerWindow.axaml" value="demko_term/demko_term.csproj" />
</map>
</option>
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/demko_term" vcs="Git" />
</component>
</project>

16
demko_term.sln Normal file
View File

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demko_term", "demko_term\demko_term.csproj", "{BCA57057-4266-46C6-AF94-75FFA69B073C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BCA57057-4266-46C6-AF94-75FFA69B073C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCA57057-4266-46C6-AF94-75FFA69B073C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCA57057-4266-46C6-AF94-75FFA69B073C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCA57057-4266-46C6-AF94-75FFA69B073C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

BIN
demko_term/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
<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.AcceptStatementWindow"
Title="AcceptStatementWindow">
<StackPanel Spacing="5" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="Выберите абитуриента:"/>
<ComboBox x:Name="AcceptApplicantComboBox"/>
<TextBlock Text="Выберите специальности:"/>
<ListBox x:Name="AcceptSpecialtyListBox" SelectionMode="Multiple" Height="150"/>
<CheckBox x:Name="PassportCheckBox" Content="Паспорт предоставлен"/>
<CheckBox x:Name="DiplomaCheckBox" Content="Диплом предоставлен"/>
<TextBox x:Name="PointsTextBox" Text="Введите баллы"/>
<StackPanel>
<Button Content="Сформировать заявления" Click="AcceptStatementButton_OnClick"/>
<Button Content="Добавить абитуриента" Click="CreateApplicantWindowButton_OnClick"/>
</StackPanel>
</StackPanel>
</Window>

View File

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demko_term.Models;
namespace demko_term;
public partial class AcceptStatementWindow : Window
{
public List<string> AcceptApplicantList { get; }
public List<string> AcceptSpecialtyList { get; }
public AcceptStatementWindow()
{
using var context = new DemoCourseworkContext();
InitializeComponent();
AcceptApplicantList = context.Applicants.Select(a => a.Code.ToString()).ToList();
AcceptApplicantComboBox.ItemsSource = AcceptApplicantList;
AcceptSpecialtyList = context.Specialties.Select(s => s.Code).ToList();
AcceptSpecialtyListBox.ItemsSource = AcceptSpecialtyList;
}
private void AcceptStatementButton_OnClick(object? sender, RoutedEventArgs e)
{
using var context = new DemoCourseworkContext();
if (AcceptApplicantComboBox.SelectedItem == null || AcceptSpecialtyListBox.SelectedItems == null)
{
return;
}
string selectedApplicantCodeStr = AcceptApplicantComboBox.SelectedItem.ToString()!;
var applicant = context.Applicants.FirstOrDefault(a => a.Code.ToString() == selectedApplicantCodeStr);
if (applicant == null)
{
return;
}
int? points = null;
if (int.TryParse(PointsTextBox.Text, out int parsedPoints))
{
points = parsedPoints;
}
foreach (var selectedSpecialtyCode in AcceptSpecialtyListBox.SelectedItems.Cast<string>())
{
var specialty = context.Specialties.FirstOrDefault(s => s.Code == selectedSpecialtyCode);
if (specialty == null)
continue;
string personalNumber = $"{specialty.Code}-{applicant.Code}";
var statement = new Statement
{
PersonalNumber = personalNumber,
SubmissionDate = DateOnly.FromDateTime(DateTime.Now),
SubmissionTime = TimeOnly.FromDateTime(DateTime.Now),
ApplicantCode = applicant.Id,
ApplicantSpeciality = specialty.Id,
Passport = PassportCheckBox.IsChecked,
Diploma = DiplomaCheckBox.IsChecked,
Points = points
};
context.Statements.Add(statement);
}
context.SaveChanges();
}
private void CreateApplicantWindowButton_OnClick(object? sender, RoutedEventArgs e)
{
CreateApplicantWindow ordersWindow = new CreateApplicantWindow();
ordersWindow.ShowDialog(this);
}
}

10
demko_term/App.axaml Normal file
View File

@ -0,0 +1,10 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="demko_term.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>

23
demko_term/App.axaml.cs Normal file
View File

@ -0,0 +1,23 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
namespace demko_term;
public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
}
base.OnFrameworkInitializationCompleted();
}
}

View File

@ -0,0 +1,9 @@
<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.BlankWindow"
Title="BlankWindow">
Welcome to Avalonia!
</Window>

View File

@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace demko_term;
public partial class BlankWindow : Window
{
public BlankWindow()
{
InitializeComponent();
}
}

View File

@ -0,0 +1,20 @@
<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.CreateApplicantWindow"
Title="CreateApplicantWindow">
<StackPanel Spacing="5" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBox Width="400" x:Name="FirstNameTextBox" Watermark="Имя"/>
<TextBox Width="400" x:Name="LastNameTextBox" Watermark="Фамилия"/>
<TextBox Width="400" x:Name="PatronymicTextBox" Watermark="Отчество"/>
<DatePicker Width="400" x:Name="DatePicker"/>
<TextBox Width="400" x:Name="CodeTextBox" Watermark="Код"/>
<TextBox Width="400" x:Name="PassportTextBox" Watermark="Паспорт"/>
<TextBox Width="400" x:Name="AddressTextBox" Watermark="Адрес"/>
<TextBox Width="400" x:Name="EmailTextBox" Watermark="Почта"/>
<TextBox Width="400" x:Name="PhoneNumberTextBox" Watermark="Номер телефона"/>
<Button Width="125" x:Name="SaveButton" Content="Сохранить" Click="CreateApplicant_OnClick"/>
</StackPanel>
</Window>

View File

@ -0,0 +1,51 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demko_term.Models;
namespace demko_term;
public partial class CreateApplicantWindow : Window
{
public CreateApplicantWindow()
{
InitializeComponent();
}
public void CreateApplicant_OnClick(object? sender, RoutedEventArgs e)
{
using var ctx = new DemoCourseworkContext();
if (string.IsNullOrWhiteSpace(FirstNameTextBox.Text) ||
string.IsNullOrWhiteSpace(LastNameTextBox.Text) ||
string.IsNullOrWhiteSpace(PatronymicTextBox.Text) ||
DatePicker.SelectedDate == null ||
string.IsNullOrWhiteSpace(CodeTextBox.Text) ||
string.IsNullOrWhiteSpace(PassportTextBox.Text) ||
string.IsNullOrWhiteSpace(AddressTextBox.Text) ||
string.IsNullOrWhiteSpace(EmailTextBox.Text) ||
string.IsNullOrWhiteSpace(PhoneNumberTextBox.Text))
{
return;
}
var newApplicant = new Applicant
{
Firstname = FirstNameTextBox.Text,
Lastname = LastNameTextBox.Text,
Patronymic = PatronymicTextBox.Text,
Date = DatePicker.SelectedDate?.DateTime,
Code = int.Parse(CodeTextBox.Text),
Passport = PassportTextBox.Text,
Email = EmailTextBox.Text,
Phone = PhoneNumberTextBox.Text,
Address = AddressTextBox.Text
};
ctx.Applicants.Add(newApplicant);
ctx.SaveChanges();
Close();
}
}

View File

@ -0,0 +1,28 @@
<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.HistoryWindow"
x:CompileBindings="False"
Title="HistoryWindow">
<DockPanel>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" DockPanel.Dock="Top" Spacing="10" Height="50">
<ComboBox VerticalAlignment="Center" Width="100" x:Name="LoginComboBox" SelectionChanged="LoginComboBox_OnSelectionChanged"/>
<ComboBox VerticalAlignment="Center" Width="100" x:Name="DateComboBox" SelectionChanged="DateComboBox_OnSelectionChanged"/>
</StackPanel>
<Border>
<ListBox x:Name="HistoryListBox" Margin="10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Text="{Binding Login}"></TextBlock>
<TextBlock Text="{Binding LastLogin, StringFormat=yyyy-MM-dd}"></TextBlock>
<TextBlock Text="{Binding SuccessLogin}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</DockPanel>
</Window>

View File

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Interactivity;
using demko_term.Models;
using Microsoft.EntityFrameworkCore;
namespace demko_term;
public partial class HistoryWindow : Window
{
private ObservableCollection<HistoryPresenter> history = new();
private List<HistoryPresenter> dataSourceHistory;
public HistoryWindow()
{
InitializeComponent();
DataContext = this;
using var context = new DemoCourseworkContext();
dataSourceHistory = context.EmployeesHistories
.Include(h => h.Employee)
.Select(h => new HistoryPresenter
{
Login = h.Employee.Login,
LastLogin = h.LastLogin,
SuccessLoginBool = h.SuccessLogin
})
.ToList();
LoginComboBox.ItemsSource = dataSourceHistory.Select(it => it.Login).Distinct().ToList();
DateComboBox.ItemsSource = dataSourceHistory.Select(it => it.LastLogin).Where(it => it.HasValue).Distinct().ToList();
HistoryListBox.ItemsSource = history;
DisplayServices();
}
public class HistoryPresenter
{
public string Login { get; set; } = string.Empty;
public DateTime? LastLogin { get; set; }
public bool? SuccessLoginBool { get; set; }
public string SuccessLogin => SuccessLoginBool.HasValue ? (SuccessLoginBool.Value ? "Успешно" : "Не успешно") : "";
}
private void DisplayServices()
{
var filteredData = dataSourceHistory;
if (LoginComboBox.SelectedItem is string selectedLogin)
{
filteredData = filteredData
.Where(it => it.Login == selectedLogin)
.ToList();
}
if (DateComboBox.SelectedItem is DateTime selectedDate)
{
filteredData = filteredData
.Where(it => it.LastLogin.HasValue && it.LastLogin.Value.Date == selectedDate.Date)
.ToList();
}
history.Clear();
foreach (var item in filteredData.OrderBy(it => it.LastLogin))
{
history.Add(item);
}
}
public void LoginComboBox_OnSelectionChanged(object? sender, RoutedEventArgs e)
{
DisplayServices();
}
public void DateComboBox_OnSelectionChanged(object? sender, RoutedEventArgs e)
{
DisplayServices();
}
}

View File

@ -0,0 +1,16 @@
<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.MainWindow"
Title="demko_term">
<StackPanel Spacing="5" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBox x:Name="LoginTextBox" Width="200" Watermark="Логин"/>
<TextBox x:Name="PasswordTextBox" Width="200" Watermark="Пароль"/>
<StackPanel Orientation="Horizontal" Spacing="5">
<Button Click="AuthButton_OnClick" Content="Вход"/>
<CheckBox Content="Показать пароль" HorizontalAlignment="Right" Name="ShowPasswordCheckBox" Checked="ShowPasswordCheckBox_OnCheck" Unchecked="ShowPasswordCheckBox_OnUncheck"/>
</StackPanel>
</StackPanel>
</Window>

View File

@ -0,0 +1,83 @@
using System;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Interactivity;
using demko_term.Models;
using Microsoft.EntityFrameworkCore;
namespace demko_term;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
PasswordTextBox.PasswordChar = '•';
}
private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
{
using var context = new DemoCourseworkContext();
var loginText = LoginTextBox?.Text?.Trim();
var password = PasswordTextBox?.Text;
if (string.IsNullOrEmpty(loginText) || string.IsNullOrEmpty(password))
{
return;
}
var employee = context.Employees
.Include(e => e.Position)
.FirstOrDefault(e => e.Login == loginText);
if (employee != null && password == employee.Password)
{
var history = new EmployeesHistory
{
EmployeeId = employee.Id,
LastLogin = DateTime.Now,
SuccessLogin = true
};
context.EmployeesHistories.Add(history);
context.SaveChanges();
switch (employee.PositionId)
{
case 1:
new VolunteerWindow(employee).ShowDialog(this);
break;
case 2:
new ManagerWindow(employee).ShowDialog(this);
break;
case 3:
new WorkerWindow(employee).ShowDialog(this);
break;
default:
new BlankWindow().ShowDialog(this);
return;
}
}
else
{
var history = new EmployeesHistory
{
EmployeeId = employee.Id,
LastLogin = DateTime.Now,
SuccessLogin = false
};
context.EmployeesHistories.Add(history);
context.SaveChanges();
}
}
private void ShowPasswordCheckBox_OnCheck(object sender, RoutedEventArgs e)
{
PasswordTextBox.PasswordChar = '\0';
}
private void ShowPasswordCheckBox_OnUncheck(object sender, RoutedEventArgs e)
{
PasswordTextBox.PasswordChar = '•';
}
}

View 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.ManagerWindow"
Title="AdminWindow">
<DockPanel>
<Border>
<Grid>
<Grid ColumnDefinitions="Auto, 1*" VerticalAlignment="Center" Margin="10,0,0,0">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="350">
<Image Width="250" Height="350" x:Name="EmployeeImage"/>
</StackPanel>
</Grid>
<Grid ColumnDefinitions="Auto, 1*" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="350" Spacing="15">
<TextBlock x:Name="FioTextBlock" FontSize="18"/>
<TextBlock x:Name="RoleTextBlock" FontSize="14"/>
<Button x:Name="FormReportButton" Height="80" Width="350" BorderThickness="2" Click="AcceptStatement_OnClick">
<TextBlock Text="Принять заявление" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
<Button x:Name="CheckHistoryButton" Height="80" Width="350" BorderThickness="2" Click="CheckHistoryButton_OnClick">
<TextBlock Text="Посмотреть историю входа" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
</StackPanel>
</Grid>
</Grid>
</Border>
</DockPanel>
</Window>

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media.Imaging;
using demko_term.Models;
namespace demko_term;
public partial class ManagerWindow : Window
{
public ManagerWindow(Employee employee)
{
InitializeComponent();
FioTextBlock.Text = employee.Lastname + " " + employee.Firstname + " " + employee.Patronymic;
RoleTextBlock.Text = employee.Position.Title;
try
{
string absolutePath = Path.Combine(AppContext.BaseDirectory, employee.Logo);
EmployeeImage.Source = new Bitmap(absolutePath);
}
catch
{
EmployeeImage.Source = null;
}
}
private void AcceptStatement_OnClick(object? sender, RoutedEventArgs e)
{
AcceptStatementWindow formOrderWindow = new AcceptStatementWindow();
formOrderWindow.ShowDialog(this);
}
private void CheckHistoryButton_OnClick(object? sender, RoutedEventArgs e)
{
HistoryWindow formOrderWindow = new HistoryWindow();
formOrderWindow.ShowDialog(this);
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
namespace demko_term.Models;
public partial class Applicant
{
public int Id { get; set; }
public string Firstname { get; set; } = null!;
public string Lastname { get; set; } = null!;
public string? Patronymic { get; set; }
public int Code { get; set; }
public string? Passport { get; set; }
public DateTime? Date { get; set; }
public string? Address { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public virtual ICollection<Statement> Statements { get; set; } = new List<Statement>();
}

View File

@ -0,0 +1,187 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace demko_term.Models;
public partial class DemoCourseworkContext : DbContext
{
public DemoCourseworkContext()
{
}
public DemoCourseworkContext(DbContextOptions<DemoCourseworkContext> options)
: base(options)
{
}
public virtual DbSet<Applicant> Applicants { get; set; }
public virtual DbSet<Employee> Employees { get; set; }
public virtual DbSet<EmployeesHistory> EmployeesHistories { get; set; }
public virtual DbSet<Position> Positions { get; set; }
public virtual DbSet<Specialty> Specialties { get; set; }
public virtual DbSet<Statement> Statements { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseNpgsql("Host=localhost;Database=demo_coursework;;Username=demo_coursework;;Password=demo_coursework;Port=5446");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Applicant>(entity =>
{
entity.HasKey(e => e.Id).HasName("applicants_pkey");
entity.ToTable("applicants");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Address)
.HasMaxLength(255)
.HasColumnName("address");
entity.Property(e => e.Code).HasColumnName("code");
entity.Property(e => e.Date)
.HasColumnType("timestamp without time zone")
.HasColumnName("date");
entity.Property(e => e.Email)
.HasMaxLength(255)
.HasColumnName("email");
entity.Property(e => e.Firstname)
.HasMaxLength(100)
.HasColumnName("firstname");
entity.Property(e => e.Lastname)
.HasMaxLength(100)
.HasColumnName("lastname");
entity.Property(e => e.Passport)
.HasMaxLength(10)
.HasColumnName("passport");
entity.Property(e => e.Patronymic)
.HasMaxLength(100)
.HasColumnName("patronymic");
entity.Property(e => e.Phone)
.HasMaxLength(20)
.HasColumnName("phone");
});
modelBuilder.Entity<Employee>(entity =>
{
entity.HasKey(e => e.Id).HasName("employees_pkey");
entity.ToTable("employees");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Firstname)
.HasMaxLength(100)
.HasColumnName("firstname");
entity.Property(e => e.Lastname)
.HasMaxLength(100)
.HasColumnName("lastname");
entity.Property(e => e.Login)
.HasMaxLength(100)
.HasColumnName("login");
entity.Property(e => e.Logo)
.HasMaxLength(250)
.HasColumnName("logo");
entity.Property(e => e.Password)
.HasMaxLength(100)
.HasColumnName("password");
entity.Property(e => e.Patronymic)
.HasMaxLength(100)
.HasColumnName("patronymic");
entity.Property(e => e.PositionId).HasColumnName("position_id");
entity.HasOne(d => d.Position).WithMany(p => p.Employees)
.HasForeignKey(d => d.PositionId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("employees_position_id_fkey");
});
modelBuilder.Entity<EmployeesHistory>(entity =>
{
entity.HasKey(e => e.Id).HasName("employees_history_pkey");
entity.ToTable("employees_history");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.EmployeeId).HasColumnName("employee_id");
entity.Property(e => e.LastLogin)
.HasColumnType("timestamp without time zone")
.HasColumnName("last_login");
entity.Property(e => e.SuccessLogin).HasColumnName("success_login");
entity.HasOne(d => d.Employee).WithMany(p => p.EmployeesHistories)
.HasForeignKey(d => d.EmployeeId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("employees_history_employee_id_fkey");
});
modelBuilder.Entity<Position>(entity =>
{
entity.HasKey(e => e.Id).HasName("positions_pkey");
entity.ToTable("positions");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Title)
.HasMaxLength(100)
.HasColumnName("title");
});
modelBuilder.Entity<Specialty>(entity =>
{
entity.HasKey(e => e.Id).HasName("specialties_pkey");
entity.ToTable("specialties");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Code)
.HasMaxLength(10)
.HasColumnName("code");
entity.Property(e => e.Cost).HasColumnName("cost");
entity.Property(e => e.EducationForm)
.HasMaxLength(10)
.HasColumnName("education_form");
entity.Property(e => e.Places).HasColumnName("places");
entity.Property(e => e.Title)
.HasMaxLength(100)
.HasColumnName("title");
});
modelBuilder.Entity<Statement>(entity =>
{
entity.HasKey(e => e.Id).HasName("statements_pkey");
entity.ToTable("statements");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.ApplicantCode).HasColumnName("applicant_code");
entity.Property(e => e.ApplicantSpeciality).HasColumnName("applicant_speciality");
entity.Property(e => e.Diploma).HasColumnName("diploma");
entity.Property(e => e.Passport).HasColumnName("passport");
entity.Property(e => e.PersonalNumber)
.HasMaxLength(100)
.HasColumnName("personal_number");
entity.Property(e => e.Points).HasColumnName("points");
entity.Property(e => e.SubmissionDate).HasColumnName("submission_date");
entity.Property(e => e.SubmissionTime).HasColumnName("submission_time");
entity.HasOne(d => d.ApplicantCodeNavigation).WithMany(p => p.Statements)
.HasForeignKey(d => d.ApplicantCode)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("statements_applicant_code_fkey");
entity.HasOne(d => d.ApplicantSpecialityNavigation).WithMany(p => p.Statements)
.HasForeignKey(d => d.ApplicantSpeciality)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("statements_applicant_speciality_fkey");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
namespace demko_term.Models;
public partial class Employee
{
public int Id { get; set; }
public int? PositionId { get; set; }
public string Firstname { get; set; } = null!;
public string Lastname { get; set; } = null!;
public string? Patronymic { get; set; }
public string Login { get; set; } = null!;
public string Password { get; set; } = null!;
public string? Logo { get; set; }
public virtual ICollection<EmployeesHistory> EmployeesHistories { get; set; } = new List<EmployeesHistory>();
public virtual Position? Position { get; set; }
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace demko_term.Models;
public partial class EmployeesHistory
{
public int Id { get; set; }
public int? EmployeeId { get; set; }
public DateTime? LastLogin { get; set; }
public bool? SuccessLogin { get; set; }
public virtual Employee? Employee { get; set; }
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace demko_term.Models;
public partial class Position
{
public int Id { get; set; }
public string Title { get; set; } = null!;
public virtual ICollection<Employee> Employees { get; set; } = new List<Employee>();
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
namespace demko_term.Models;
public partial class Specialty
{
public int Id { get; set; }
public string Code { get; set; } = null!;
public string Title { get; set; } = null!;
public int Places { get; set; }
public string EducationForm { get; set; } = null!;
public int Cost { get; set; }
public virtual ICollection<Statement> Statements { get; set; } = new List<Statement>();
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
namespace demko_term.Models;
public partial class Statement
{
public int Id { get; set; }
public string PersonalNumber { get; set; } = null!;
public DateOnly? SubmissionDate { get; set; }
public TimeOnly? SubmissionTime { get; set; }
public int? ApplicantCode { get; set; }
public int? ApplicantSpeciality { get; set; }
public bool? Passport { get; set; }
public bool? Diploma { get; set; }
public int? Points { get; set; }
public virtual Applicant? ApplicantCodeNavigation { get; set; }
public virtual Specialty? ApplicantSpecialityNavigation { get; set; }
}

21
demko_term/Program.cs Normal file
View File

@ -0,0 +1,21 @@
using Avalonia;
using System;
namespace demko_term;
class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
}

View File

@ -0,0 +1,30 @@
<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.VolunteerWindow"
Title="VolunteerWindow">
<DockPanel>
<Border>
<Grid>
<Grid ColumnDefinitions="Auto, 1*" VerticalAlignment="Center" Margin="10,0,0,0">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="350">
<Image Width="250" Height="350" x:Name="EmployeeImage"/>
</StackPanel>
</Grid>
<Grid ColumnDefinitions="Auto, 1*" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="350" Spacing="15">
<TextBlock x:Name="FioTextBlock" FontSize="18"/>
<TextBlock x:Name="RoleTextBlock" FontSize="14"/>
<Button x:Name="InfoSpecialtyButton" Height="80" Width="350" BorderThickness="2" Click="InfoSpecialtyButton_OnClick">
<TextBlock Text="Посмотреть информация о специальностях" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
</StackPanel>
</Grid>
</Grid>
</Border>
</DockPanel>
</Window>

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media.Imaging;
using demko_term.Models;
namespace demko_term;
public partial class VolunteerWindow : Window
{
public VolunteerWindow(Employee employee)
{
InitializeComponent();
FioTextBlock.Text = employee.Lastname + " " + employee.Firstname + " " + employee.Patronymic;
RoleTextBlock.Text = employee.Position.Title;
try
{
string absolutePath = Path.Combine(AppContext.BaseDirectory, employee.Logo);
EmployeeImage.Source = new Bitmap(absolutePath);
}
catch
{
EmployeeImage.Source = null;
}
}
private void InfoSpecialtyButton_OnClick(object? sender, RoutedEventArgs e)
{
BlankWindow formOrderWindow = new BlankWindow();
formOrderWindow.ShowDialog(this);
}
}

View 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.WorkerWindow"
Title="WorkerWindow">
<DockPanel>
<Border>
<Grid>
<Grid ColumnDefinitions="Auto, 1*" VerticalAlignment="Center" Margin="10,0,0,0">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="350">
<Image Width="250" Height="350" x:Name="EmployeeImage"/>
</StackPanel>
</Grid>
<Grid ColumnDefinitions="Auto, 1*" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="350" Spacing="15">
<TextBlock x:Name="FioTextBlock" FontSize="18"/>
<TextBlock x:Name="RoleTextBlock" FontSize="14"/>
<Button x:Name="FormReportButton" Height="80" Width="350" BorderThickness="2" Click="AcceptStatement_OnClick">
<TextBlock Text="Принять заявление" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
<Button x:Name="AcceptStatementButton" Height="80" Width="350" BorderThickness="2" Click="FormPersonalFile_OnClick">
<TextBlock Text="Сформировать личное дело" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
</StackPanel>
</Grid>
</Grid>
</Border>
</DockPanel>
</Window>

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media.Imaging;
using demko_term.Models;
namespace demko_term;
public partial class WorkerWindow : Window
{
public WorkerWindow(Employee employee)
{
InitializeComponent();
FioTextBlock.Text = employee.Lastname + " " + employee.Firstname + " " + employee.Patronymic;
RoleTextBlock.Text = employee.Position.Title;
try
{
string absolutePath = Path.Combine(AppContext.BaseDirectory, employee.Logo);
EmployeeImage.Source = new Bitmap(absolutePath);
}
catch
{
EmployeeImage.Source = null;
}
}
private void AcceptStatement_OnClick(object? sender, RoutedEventArgs e)
{
AcceptStatementWindow formOrderWindow = new AcceptStatementWindow();
formOrderWindow.ShowDialog(this);
}
private void FormPersonalFile_OnClick(object? sender, RoutedEventArgs e)
{
BlankWindow formOrderWindow = new BlankWindow();
formOrderWindow.ShowDialog(this);
}
}

18
demko_term/app.manifest Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embedded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="demko_term.Desktop"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>

BIN
demko_term/bin/.DS_Store vendored Normal file

Binary file not shown.

BIN
demko_term/bin/Debug/.DS_Store vendored Normal file

Binary file not shown.

BIN
demko_term/bin/Debug/net8.0/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More