From 2bb8b42453731bedfeb1528fcf860f5da34d95c1 Mon Sep 17 00:00:00 2001 From: bekodeg Date: Sun, 24 Nov 2024 13:20:49 +0400 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=D1=8B=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B8=D1=85=20=D0=BC=D0=BE=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implementations/StudentRepository.cs | 2 +- Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Cop.Borovkov.Var3/Lab3.Database/Repository/Implementations/StudentRepository.cs b/Cop.Borovkov.Var3/Lab3.Database/Repository/Implementations/StudentRepository.cs index 108f8cf..da6b94a 100644 --- a/Cop.Borovkov.Var3/Lab3.Database/Repository/Implementations/StudentRepository.cs +++ b/Cop.Borovkov.Var3/Lab3.Database/Repository/Implementations/StudentRepository.cs @@ -57,7 +57,7 @@ namespace Lab3.Database.Repository.Implementations return _mapper.Map( await _context.Students .Include(s => s.StudentSessions) - .FirstOrDefaultAsync()); + .FirstOrDefaultAsync(s =>s.Id == id)); } public async Task UpdateAsync(StudentDTO studentDTO) diff --git a/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs index ba949f3..5e388a6 100644 --- a/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs +++ b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs @@ -1,13 +1,9 @@ using AutoMapper; using ComponentsLibrary.entities; using ComponentsLibrary.entities.enums; -using DocumentFormat.OpenXml.Bibliography; -using DocumentFormat.OpenXml.Drawing; -using DocumentFormat.OpenXml.Spreadsheet; using Lab3.Database.DTO; using Lab3.Database.Repository.Interfaces; using Lab3.Models; -using NPOI.OpenXml4Net.OPC.Internal; namespace Lab3.Forms { @@ -16,18 +12,21 @@ namespace Lab3.Forms private readonly IStudentRepository _studentRepository; private readonly IMapper _mapper; private readonly Func _getCreateOrUpdateForm; + private readonly CatalogForm _catalogForm; private bool _cont = false; public MainForm( IStudentRepository repository, IMapper mapper, - Func getCreateOrUpdateForm) + Func getCreateOrUpdateForm, + CatalogForm catalogForm) { _studentRepository = repository; _mapper = mapper; _getCreateOrUpdateForm = getCreateOrUpdateForm; + _catalogForm = catalogForm; InitializeComponent(); } @@ -232,16 +231,20 @@ namespace Lab3.Forms { CreateWordDocAsync(); } + else if (_cont && keyData == Keys.G) + { + _catalogForm.ShowDialog(this); + } if (keyData == Keys.A || keyData == Keys.U || keyData == Keys.D || keyData == Keys.S || keyData == Keys.T || - keyData == Keys.C) _cont = false; - //if (keyData != Keys.None && keyData != (System.Windows.Forms.Keys.ControlKey | System.Windows.Forms.Keys.Control)) cont = false; + keyData == Keys.C || + keyData == Keys.G) _cont = false; + return true; - return base.ProcessCmdKey(ref msg, keyData); } } }