From a9ba74c492f407e5f8edb452789755e68074d9e5 Mon Sep 17 00:00:00 2001 From: safia Date: Thu, 5 Dec 2024 12:45:41 +0400 Subject: [PATCH 1/7] =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BE=D0=B2=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormStudentProgress.Designer.cs | 14 +- .../Forms/FormSubjects.Designer.cs | 2 +- .../StudentProgress/Forms/FormSubjects.cs | 11 +- StudentProgress/StudentProgress/Program.cs | 51 ++++- .../Repositories/IConnectionString.cs | 14 ++ .../Repositories/ISubjectsRepository.cs | 7 +- .../Implementations/ConnectionString.cs | 9 + .../Implementations/GradesRepository.cs | 129 +++++++++-- .../Implementations/GroupRepository.cs | 159 ++++++++++---- .../Implementations/LecturesRepository.cs | 65 +++++- .../ProfessorsNameRepository.cs | 112 +++++++++- .../Implementations/StudentRepository.cs | 168 +++++++++++---- .../Implementations/SubjectsRepository.cs | 200 ++++++++++++++++-- .../StudentProgress/StudentProgress.csproj | 13 ++ .../StudentProgress/appsettings.json | 15 ++ .../StudentProgress/appsettings20241204.com | 125 +++++++++++ .../StudentProgress/appsettings20241205.com | 105 +++++++++ 17 files changed, 1027 insertions(+), 172 deletions(-) create mode 100644 StudentProgress/StudentProgress/Repositories/IConnectionString.cs create mode 100644 StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs create mode 100644 StudentProgress/StudentProgress/appsettings.json create mode 100644 StudentProgress/StudentProgress/appsettings20241204.com create mode 100644 StudentProgress/StudentProgress/appsettings20241205.com diff --git a/StudentProgress/StudentProgress/FormStudentProgress.Designer.cs b/StudentProgress/StudentProgress/FormStudentProgress.Designer.cs index 8790753..9295e3b 100644 --- a/StudentProgress/StudentProgress/FormStudentProgress.Designer.cs +++ b/StudentProgress/StudentProgress/FormStudentProgress.Designer.cs @@ -48,7 +48,7 @@ menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; menuStrip1.Padding = new Padding(13, 5, 0, 5); - menuStrip1.Size = new Size(915, 48); + menuStrip1.Size = new Size(915, 46); menuStrip1.TabIndex = 0; menuStrip1.Text = "menuStrip1"; // @@ -56,7 +56,7 @@ // DirectoriesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { GroupsToolStripMenuItem, StudentsToolStripMenuItem, ProfessorsToolStripMenuItem, SubjectsToolStripMenuItem }); DirectoriesToolStripMenuItem.Name = "DirectoriesToolStripMenuItem"; - DirectoriesToolStripMenuItem.Size = new Size(184, 38); + DirectoriesToolStripMenuItem.Size = new Size(184, 36); DirectoriesToolStripMenuItem.Text = "Справочники"; // // GroupsToolStripMenuItem @@ -91,27 +91,27 @@ // OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { GradesToolStripMenuItem, LecturesCountToolStripMenuItem }); OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem"; - OperationsToolStripMenuItem.Size = new Size(147, 38); + OperationsToolStripMenuItem.Size = new Size(147, 36); OperationsToolStripMenuItem.Text = "Операции"; // // GradesToolStripMenuItem // GradesToolStripMenuItem.Name = "GradesToolStripMenuItem"; - GradesToolStripMenuItem.Size = new Size(285, 44); + GradesToolStripMenuItem.Size = new Size(359, 44); GradesToolStripMenuItem.Text = "Оценки"; GradesToolStripMenuItem.Click += GradeToolStripMenuItem_Click; // // LecturesCountToolStripMenuItem // LecturesCountToolStripMenuItem.Name = "LecturesCountToolStripMenuItem"; - LecturesCountToolStripMenuItem.Size = new Size(285, 44); + LecturesCountToolStripMenuItem.Size = new Size(359, 44); LecturesCountToolStripMenuItem.Text = "Учет лекций"; LecturesCountToolStripMenuItem.Click += LecturesCountToolStripMenuItem_Click; // // ReportsToolStripMenuItem // ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem"; - ReportsToolStripMenuItem.Size = new Size(116, 38); + ReportsToolStripMenuItem.Size = new Size(116, 36); ReportsToolStripMenuItem.Text = "Отчеты"; // // FormStudentProgress @@ -126,7 +126,7 @@ Margin = new Padding(6, 7, 6, 7); Name = "FormStudentProgress"; StartPosition = FormStartPosition.CenterScreen; - Text = "Учет успеваемости студентов"; + Text = " "; menuStrip1.ResumeLayout(false); menuStrip1.PerformLayout(); ResumeLayout(false); diff --git a/StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs b/StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs index 8836a53..ef5306e 100644 --- a/StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs @@ -104,7 +104,7 @@ namespace StudentProgress.Forms Margin = new Padding(6, 6, 6, 6); Name = "FormSubjects"; Text = "Предметы"; - Load += FormSubjects__Load; + Load += FormSubjects_Load; panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); diff --git a/StudentProgress/StudentProgress/Forms/FormSubjects.cs b/StudentProgress/StudentProgress/Forms/FormSubjects.cs index c53ec9c..6c07d9c 100644 --- a/StudentProgress/StudentProgress/Forms/FormSubjects.cs +++ b/StudentProgress/StudentProgress/Forms/FormSubjects.cs @@ -2,7 +2,7 @@ using System.Windows.Forms; using StudentPerformance.Forms; using StudentProgress.Repositories; -using StudentProgress.Repositories.Implementations; +using Unity; namespace StudentProgress.Forms { @@ -10,13 +10,14 @@ namespace StudentProgress.Forms { private readonly ISubjectsRepository _subjectsRepository; - public FormSubjects(ISubjectsRepository subjectsRepository) + public FormSubjects() { InitializeComponent(); - _subjectsRepository = subjectsRepository ?? throw new ArgumentNullException(nameof(subjectsRepository)); + var container = Program.CreateContainer(); // Получаем контейнер Unity + _subjectsRepository = container.Resolve(); } - private void FormSubjects__Load(object sender, EventArgs e) + private void FormSubjects_Load(object sender, EventArgs e) { // Загрузка данных в DataGridView LoadData(); @@ -32,7 +33,7 @@ namespace StudentProgress.Forms private void buttonAdd_Click(object sender, EventArgs e) { // Логика добавления нового предмета - using (var form = new FormSubject(new SubjectsRepository())) + using (var form = new FormSubject(Program.CreateContainer().Resolve())) { if (form.ShowDialog() == DialogResult.OK) { diff --git a/StudentProgress/StudentProgress/Program.cs b/StudentProgress/StudentProgress/Program.cs index a264a2b..45f1fcb 100644 --- a/StudentProgress/StudentProgress/Program.cs +++ b/StudentProgress/StudentProgress/Program.cs @@ -1,9 +1,17 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using Serilog; +using Unity; +using Unity.Lifetime; +using Serilog.Extensions.Logging; using StudentProgress.Forms; using StudentProgress.Repositories; using StudentProgress.Repositories.Implementations; using Unity; +using Unity.Microsoft.Logging; using System; using System.Windows.Forms; +using StudentPerformance.Repositories.Implementations; namespace StudentProgress { @@ -15,15 +23,28 @@ namespace StudentProgress Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + var container = CreateContainer(); + + Application.Run(container.Resolve()); + } + + public static UnityContainer CreateContainer() + { var container = new UnityContainer(); + // + container.AddExtension(new LoggingExtension(CreateLoggerFactory())); + + // + container.RegisterType(new SingletonLifetimeManager()); + // - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); // container.RegisterType(); @@ -31,10 +52,22 @@ namespace StudentProgress container.RegisterType(); container.RegisterType(); container.RegisterType(); - container.RegisterType(); - container.RegisterType(); + container.RegisterType(); + container.RegisterType(); - Application.Run(container.Resolve()); + return container; + } + + private static LoggerFactory CreateLoggerFactory() + { + var loggerFactory = new LoggerFactory(); + loggerFactory.AddSerilog(new LoggerConfiguration() + .ReadFrom.Configuration(new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json") + .Build()) + .CreateLogger()); + return loggerFactory; } } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Repositories/IConnectionString.cs b/StudentProgress/StudentProgress/Repositories/IConnectionString.cs new file mode 100644 index 0000000..2d289e1 --- /dev/null +++ b/StudentProgress/StudentProgress/Repositories/IConnectionString.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StudentProgress.Repositories +{ + public interface IConnectionString + { + string ConnectionString { get; } + + } +} diff --git a/StudentProgress/StudentProgress/Repositories/ISubjectsRepository.cs b/StudentProgress/StudentProgress/Repositories/ISubjectsRepository.cs index d0c8d98..625111d 100644 --- a/StudentProgress/StudentProgress/Repositories/ISubjectsRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/ISubjectsRepository.cs @@ -4,7 +4,10 @@ namespace StudentProgress.Repositories; public interface ISubjectsRepository { - IEnumerable ReadSubjects(int? professorsNameId = null); void CreateSubjects_(Subjects subject); void DeleteSubjects(int id); -} \ No newline at end of file + IEnumerable ReadSubjects(int? id = null); + Subjects ReadSubjectById(int id); + void UpdateSubject(Subjects subject); +} + diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs b/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs new file mode 100644 index 0000000..8401f69 --- /dev/null +++ b/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs @@ -0,0 +1,9 @@ +using StudentProgress.Repositories; + +namespace StudentProgress.Repositories.Implementations; + +public class ConnectionString : IConnectionString +{ + string IConnectionString.ConnectionString => + "Host=localhost;Port=5432;Database=studentperformancebd;Username=postgres;Password=Ildan12345;"; +} \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/GradesRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/GradesRepository.cs index 3cb0a6e..f0cacae 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/GradesRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/GradesRepository.cs @@ -1,29 +1,120 @@ -using StudentProgress.Entities; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using StudentProgress.Entities; +using StudentProgress.Repositories; using System; using System.Collections.Generic; +using System.Data.SqlClient; -namespace StudentProgress.Repositories.Implementations; - -public class GradesRepository : IGradesRepository +namespace StudentProgress.Repositories.Implementations { - public void CreateGrade(Grades grade) + public class GradesRepository : IGradesRepository { - // Логика создания оценки - } + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; - public void DeleteGrade(int id) - { - // Логика удаления оценки по идентификатору - } + public GradesRepository(IConnectionString connectionString, ILogger logger) + { + _connectionString = connectionString; + _logger = logger; + } - public IEnumerable ReadGrades(DateTime? dateFrom = null, DateTime? dateTo = null, int? subjectsId = null, int? professorsId = null) - { - // Логика чтения оценок с возможностью фильтрации по дате, идентификатору предмета и идентификатору преподавателя - return new List(); - } + public void CreateGrade(Grades grade) + { + _logger.LogInformation("Добавление оценки"); + _logger.LogDebug("Оценка: {json}", JsonConvert.SerializeObject(grade)); + try + { + using var connection = new SqlConnection(_connectionString.ConnectionString); + var query = @" + INSERT INTO Grades (SubjectsId, ProfessorsId, Date) + VALUES (@SubjectsId, @ProfessorsId, @Date)"; + connection.Execute(query, grade); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при добавлении оценки"); + throw; + } + } - public void UpdateGrade(Grades grade) - { - // Логика обновления оценки + public void DeleteGrade(int id) + { + _logger.LogInformation("Удаление оценки"); + _logger.LogDebug("Оценка: {id}", id); + try + { + using var connection = new SqlConnection(_connectionString.ConnectionString); + var query = "DELETE FROM Grades WHERE Id = @Id"; + connection.Execute(query, new { Id = id }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении оценки"); + throw; + } + } + + public IEnumerable ReadGrades(DateTime? dateFrom = null, DateTime? dateTo = null, int? subjectsId = null, int? professorsId = null) + { + _logger.LogInformation("Получение оценок"); + try + { + using var connection = new SqlConnection(_connectionString.ConnectionString); + var query = "SELECT * FROM Grades"; + var parameters = new DynamicParameters(); + + if (dateFrom.HasValue) + { + query += " WHERE Date >= @DateFrom"; + parameters.Add("DateFrom", dateFrom.Value); + } + if (dateTo.HasValue) + { + query += " AND Date <= @DateTo"; + parameters.Add("DateTo", dateTo.Value); + } + if (subjectsId.HasValue) + { + query += " AND SubjectsId = @SubjectsId"; + parameters.Add("SubjectsId", subjectsId.Value); + } + if (professorsId.HasValue) + { + query += " AND ProfessorsId = @ProfessorsId"; + parameters.Add("ProfessorsId", professorsId.Value); + } + + var grades = connection.Query(query, parameters); + _logger.LogDebug("Полученные оценки: {json}", JsonConvert.SerializeObject(grades)); + return grades; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении оценок"); + throw; + } + } + + public void UpdateGrade(Grades grade) + { + _logger.LogInformation("Редактирование оценки"); + _logger.LogDebug("Оценка: {json}", JsonConvert.SerializeObject(grade)); + try + { + using var connection = new SqlConnection(_connectionString.ConnectionString); + var query = @" + UPDATE Grades + SET SubjectsId = @SubjectsId, ProfessorsId = @ProfessorsId, Date = @Date + WHERE Id = @Id"; + connection.Execute(query, grade); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при редактировании оценки"); + throw; + } + } } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/GroupRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/GroupRepository.cs index 0d147a2..4c6b383 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/GroupRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/GroupRepository.cs @@ -1,50 +1,127 @@ -using StudentProgress.Entities; -using System.Collections.Generic; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npgsql; +using StudentProgress.Entities; +using StudentProgress.Repositories; -namespace StudentProgress.Repositories.Implementations +namespace StudentPerformance.Repositories.Implementations; + +public class GroupRepository : IGroupRepository { - public class GroupRepository : IGroupRepository + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; + public GroupRepository(IConnectionString connectionString, ILogger logger) { - private readonly List _groups; + _connectionString = connectionString; + _logger = logger; + } - public GroupRepository() + public void CreateGroup(Group group) + { + _logger.LogInformation("Добавление объекта"); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(group)); + + try { - // Инициализация тестовых данных - _groups = new List(); + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryInsert = @"INSERT INTO Groups (NameGroup, Course, NameFaculty) +VALUES (@NameGroup, @Course, @NameFaculty)"; + connection.Execute(queryInsert, group); } - - public void CreateGroup(Group group) + catch (Exception ex) { - // Логика создания группы - _groups.Add(group); - } - - public void DeleteGroup(int id) - { - // Логика удаления группы по идентификатору - _groups.RemoveAll(g => g.Id == id); - } - - public IEnumerable ReadGroup() - { - // Логика чтения всех групп - return _groups; - } - - public Group ReadGroupById(int id) - { - // Логика чтения группы по идентификатору - return _groups.Find(g => g.Id == id); - } - - public void UpdateGroup(Group group) - { - // Логика обновления группы - var existingGroup = _groups.Find(g => g.Id == group.Id); - if (existingGroup != null) - { - existingGroup.NameGroup = group.NameGroup; - } + _logger.LogError(ex, "Ошибка при добавлении объекта"); + throw; } } -} \ No newline at end of file + + public void DeleteGroup(int id) + { + _logger.LogInformation("Удаление объекта"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryDelete = @" +DELETE FROM Groups +WHERE Id=@id"; + connection.Execute(queryDelete, new { id }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении объекта"); + throw; + } + } + + public IEnumerable ReadGroup() + { + _logger.LogInformation("Получение всех объектов"); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = "SELECT * FROM Groups"; + var groups = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}", + JsonConvert.SerializeObject(groups)); + return groups; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении объектов"); + throw; + } + } + + public Group ReadGroupById(int id) + { + _logger.LogInformation("Получение объекта по идентификатору"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = @" +SELECT * FROM Groups +WHERE Id=@id"; + var group = connection.QueryFirst(querySelect, new + { + id + }); + _logger.LogDebug("Найденный объект: {json}", + JsonConvert.SerializeObject(group)); + return group; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при поиске объекта"); + throw; + } + + } + + public void UpdateGroup(Group group) + { + _logger.LogInformation("Редактирование объекта"); + _logger.LogDebug("Объект: {json}", + JsonConvert.SerializeObject(group)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryUpdate = @" +UPDATE Groups +SET +NameGroup=@NameGroup, +Course=@Course, +NameFaculty=@NameFaculty +WHERE Id=@Id"; + connection.Execute(queryUpdate, group); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при редактировании объекта"); + throw; + } + + } +} diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/LecturesRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/LecturesRepository.cs index c7d973f..9208019 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/LecturesRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/LecturesRepository.cs @@ -1,31 +1,76 @@ -using StudentProgress.Entities; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using StudentProgress.Entities; +using StudentProgress.Repositories; +using System; using System.Collections.Generic; -using System.Linq; +using System.Data.SqlClient; namespace StudentProgress.Repositories.Implementations { public class LecturesRepository : ILecturesRepository { - private readonly List _lectures = new List(); + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; + + public LecturesRepository(IConnectionString connectionString, ILogger logger) + { + _connectionString = connectionString; + _logger = logger; + } public IEnumerable ReadLectures() { - return _lectures; + _logger.LogInformation("Получение лекций"); + try + { + using var connection = new SqlConnection(_connectionString.ConnectionString); + var query = "SELECT * FROM Lectures"; + var lectures = connection.Query(query); + _logger.LogDebug("Полученные лекции: {json}", JsonConvert.SerializeObject(lectures)); + return lectures; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении лекций"); + throw; + } } public void CreateLecture(Lectures lecture) { - int newLectureId = _lectures.Count > 0 ? _lectures.Max(l => l.LectureId) + 1 : 1; - lecture.SetLectureId(newLectureId); - _lectures.Add(lecture); + _logger.LogInformation("Добавление лекции"); + _logger.LogDebug("Лекция: {json}", JsonConvert.SerializeObject(lecture)); + try + { + using var connection = new SqlConnection(_connectionString.ConnectionString); + var query = @" + INSERT INTO Lectures (ProfessorId, Date, Auditorium) + VALUES (@ProfessorsId, @Date, @Auditorium)"; + connection.Execute(query, lecture); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при добавлении лекции"); + throw; + } } public void DeleteLecture(int lectureId) { - var lectureToRemove = _lectures.FirstOrDefault(l => l.LectureId == lectureId); - if (lectureToRemove != null) + _logger.LogInformation("Удаление лекции"); + _logger.LogDebug("Лекция: {id}", lectureId); + try { - _lectures.Remove(lectureToRemove); + using var connection = new SqlConnection(_connectionString.ConnectionString); + var query = "DELETE FROM Lectures WHERE LectureId = @LectureId"; + connection.Execute(query, new { LectureId = lectureId }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении лекции"); + throw; } } } diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsNameRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsNameRepository.cs index 1b5cbf4..66a920f 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsNameRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsNameRepository.cs @@ -1,34 +1,126 @@ -using StudentProgress.Entities; -using System.Collections.Generic; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npgsql; +using StudentProgress.Entities; +using StudentProgress.Repositories; +using System.Data.SqlClient; namespace StudentProgress.Repositories.Implementations; public class ProfessorsNameRepository : IProfessorsNameRepository { + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; + + public ProfessorsNameRepository(IConnectionString connectionString, ILogger logger) + { + _connectionString = connectionString; + _logger = logger; + } + public void CreateProfessorsName(Professors professorsName) { - // Логика создания преподавателя + _logger.LogInformation("Добавление объекта"); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(professorsName)); + + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryInsert = @"INSERT INTO ProfessorsName (FirstName, LastName, MiddleName, Classes) +VALUES (@FirstName, @LastName, @MiddleName, @Classes)"; + connection.Execute(queryInsert, professorsName); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при добавлении объекта"); + throw; + } } public void DeleteProfessorsName(int id) { - // Логика удаления преподавателя по идентификатору + _logger.LogInformation("Удаление объекта"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryDelete = @" +DELETE FROM ProfessorsName +WHERE Id=@id"; + connection.Execute(queryDelete, new { id }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении объекта"); + throw; + } } public IEnumerable ReadProfessorsName() { - // Логика чтения всех преподавателей - return new List(); + _logger.LogInformation("Получение всех объектов"); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = "SELECT * FROM ProfessorsName"; + var professorsNames = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}", + JsonConvert.SerializeObject(professorsNames)); + return professorsNames; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении объектов"); + throw; + } } public Professors ReadProfessorsNameById(int id) { - // Логика чтения преподавателя по идентификатору - return Professors.CreateEntity(id, "Unknown", "Unknown"); + _logger.LogInformation("Получение объекта по идентификатору"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = @" +SELECT * FROM ProfessorsName +WHERE Id=@id"; + var professorsName = connection.QueryFirst(querySelect, new { id }); + + _logger.LogDebug("Найденный объект: {json}", + JsonConvert.SerializeObject(professorsName)); + return professorsName; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при поиске объекта"); + throw; + } } public void UpdateProfessorsName(Professors professorsName) { - // Логика обновления преподавателя + _logger.LogInformation("Редактирование объекта"); + _logger.LogDebug("Объект: {json}", + JsonConvert.SerializeObject(professorsName)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryUpdate = @" + UPDATE ProfessorsName +SET +FirstName=@FirstName, +LastName=@LastName, +MiddleName=@MiddleName, +Classes=@Classes +WHERE Id=@Id"; + connection.Execute(queryUpdate, professorsName); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при редактировании объекта"); + throw; + } } -} \ No newline at end of file +} diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/StudentRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/StudentRepository.cs index 826e429..a0bb006 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/StudentRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/StudentRepository.cs @@ -1,56 +1,130 @@ -using StudentProgress.Entities; -using System.Collections.Generic; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npgsql; +using StudentProgress.Entities; +using StudentProgress.Repositories; +using System.Data.SqlClient; -namespace StudentProgress.Repositories.Implementations +namespace StudentPerformance.Repositories.Implementations; + +public class StudentRepository : IStudentRepository { - public class StudentRepository : IStudentRepository + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; + + public StudentRepository(IConnectionString connectionString, ILogger logger) { - private readonly List _students; + _connectionString = connectionString; + _logger = logger; + } - public StudentRepository() + public void CreateStudent(Student student) + { + _logger.LogInformation("Добавление объекта"); + _logger.LogDebug("Объект: {json}", + JsonConvert.SerializeObject(student)); + try { - // Инициализация пустого списка студентов - _students = new List(); + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryInsert = @" +INSERT INTO Student (FirstName, LastName, MiddleName, Phone, GroupID) +VALUES (@FirstName, @LastName, @MiddleName, @Phone, @GroupID)"; + connection.Execute(queryInsert, student); } - - public void CreateStudent(Student student) + catch (Exception ex) { - // Логика создания студента - _students.Add(student); - } - - public void DeleteStudent(int id) - { - // Логика удаления студента по идентификатору - _students.RemoveAll(s => s.Id == id); - } - - public Student ReadStudentById(int id) - { - // Логика чтения студента по идентификатору - return _students.Find(s => s.Id == id); - } - - public IEnumerable ReadStudents(int? groupID = null) - { - // Логика чтения всех студентов с возможностью фильтрации по идентификатору группы - if (groupID.HasValue) - { - return _students.FindAll(s => s.GroupId == groupID.Value); - } - return _students; - } - - public void UpdateStudent(Student student) - { - // Логика обновления студента - var existingStudent = _students.Find(s => s.Id == student.Id); - if (existingStudent != null) - { - existingStudent.Name = student.Name; - existingStudent.Surname = student.Surname; - existingStudent.GroupId = student.GroupId; - } + _logger.LogError(ex, "Ошибка при добавлении объекта"); + throw; } } -} \ No newline at end of file + + public void DeleteStudent(int id) + { + _logger.LogInformation("Удаление объекта"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryDelete = @" +DELETE FROM Student +WHERE Id=@id"; + connection.Execute(queryDelete, new { id }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении объекта"); + throw; + } + } + + public Student ReadStudentById(int id) + { + _logger.LogInformation("Получение объекта по идентификатору"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = @" +SELECT * FROM Student +WHERE Id=@id"; + var student = connection.QueryFirst(querySelect, new + { + id + }); + _logger.LogDebug("Найденный объект: {json}", + JsonConvert.SerializeObject(student)); + return student; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при поиске объекта"); + throw; + } + } + + public IEnumerable ReadStudents(int? groupID = null) + { + _logger.LogInformation("Получение всех объектов"); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = "SELECT * FROM Student"; + var student = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}", + JsonConvert.SerializeObject(student)); + return student; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении объектов"); + throw; + } + } + + public void UpdateStudent(Student student) + { + _logger.LogInformation("Редактирование объекта"); + _logger.LogDebug("Объект: {json}", + JsonConvert.SerializeObject(student)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryUpdate = @" +UPDATE Student +SET +FirstName=@FirstName, +LastName=@LastName, +MiddleName=@MiddleName, +Phone=@Phone, +GroupID=@GroupID +WHERE Id=@Id"; + connection.Execute(queryUpdate, student); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при редактировании объекта"); + throw; + } + } +} diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/SubjectsRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/SubjectsRepository.cs index bb88b56..5f77047 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/SubjectsRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/SubjectsRepository.cs @@ -1,28 +1,186 @@ -using StudentProgress.Entities; -using System.Collections.Generic; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npgsql; +using StudentProgress.Entities; -namespace StudentProgress.Repositories.Implementations; - -public class SubjectsRepository : ISubjectsRepository +namespace StudentProgress.Repositories.Implementations { - public void CreateSubjects(Subjects subject) + public class SubjectsRepository : ISubjectsRepository { - // Логика создания предмета - } + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; - public void CreateSubjects_(Subjects subject) - { - throw new NotImplementedException(); - } + public SubjectsRepository(IConnectionString connectionString, ILogger logger) + { + _connectionString = connectionString; + _logger = logger; + } - public void DeleteSubjects(int id) - { - // Логика удаления предмета по идентификатору - } + // Добавление нового предмета + public void CreateSubjects_(Subjects subject) + { + _logger.LogInformation("Добавление объекта"); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(subject)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + connection.Open(); + using var transaction = connection.BeginTransaction(); - public IEnumerable ReadSubjects(int? lecturerNameId = null) - { - // Логика чтения предметов с возможностью фильтрации по идентификатору преподавателя - return new List(); + var queryInsert = @" +INSERT INTO Subject (NameSubject) +VALUES (@NameSubject); +SELECT MAX(Id) FROM Subject"; + + // Выполняем запрос и получаем ID созданного предмета + var subjectId = connection.QueryFirst(queryInsert, subject, transaction); + + transaction.Commit(); + + _logger.LogInformation("Успешно добавлен объект с Id: {id}", subjectId); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при добавлении объекта"); + throw; + } + } + + // Удаление предмета по идентификатору + public void DeleteSubjects(int id) + { + _logger.LogInformation("Удаление объекта"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryDelete = @" +DELETE FROM Subject +WHERE Id=@Id"; + + var rowsAffected = connection.Execute(queryDelete, new { Id = id }); + + if (rowsAffected == 0) + { + _logger.LogWarning("Объект с Id: {id} не найден для удаления", id); + } + else + { + _logger.LogInformation("Объект с Id: {id} успешно удалён", id); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении объекта"); + throw; + } + } + + // Получение всех предметов + public IEnumerable ReadSubjects(int? id = null) + { + _logger.LogInformation("Получение объектов"); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + + if (id.HasValue) + { + // Если указан ID, возвращаем конкретный предмет + var querySelectById = @" +SELECT * FROM Subject +WHERE Id = @Id"; + + var subject = connection.Query(querySelectById, new { Id = id.Value }).ToList(); + + if (!subject.Any()) + { + _logger.LogWarning("Объект с Id: {id} не найден", id); + } + else + { + _logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(subject)); + } + + return subject; + } + else + { + // Если ID не указан, возвращаем все предметы + var querySelectAll = @"SELECT * FROM Subject"; + + var subjects = connection.Query(querySelectAll).ToList(); + _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(subjects)); + + return subjects; + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении объектов"); + throw; + } + } + + // Получение предмета по идентификатору + public Subjects ReadSubjectById(int id) + { + _logger.LogInformation("Получение объекта по идентификатору"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = @" +SELECT * FROM Subject +WHERE Id = @Id"; + + var subject = connection.QueryFirstOrDefault(querySelect, new { Id = id }); + + if (subject == null) + { + _logger.LogWarning("Объект с Id: {id} не найден", id); + } + else + { + _logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(subject)); + } + + return subject; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при поиске объекта"); + throw; + } + } + + // Обновление данных предмета + public void UpdateSubject(Subjects subject) + { + _logger.LogInformation("Редактирование объекта"); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(subject)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + connection.Open(); + using var transaction = connection.BeginTransaction(); + + var queryUpdate = @" +UPDATE Subject +SET NameSubject = @NameSubject +WHERE Id = @Id"; + + connection.Execute(queryUpdate, subject, transaction); + transaction.Commit(); + + _logger.LogInformation("Объект с Id: {id} успешно обновлен", subject.Id); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при редактировании объекта"); + throw; + } + } } -} \ No newline at end of file +} diff --git a/StudentProgress/StudentProgress/StudentProgress.csproj b/StudentProgress/StudentProgress/StudentProgress.csproj index accbdf0..df12085 100644 --- a/StudentProgress/StudentProgress/StudentProgress.csproj +++ b/StudentProgress/StudentProgress/StudentProgress.csproj @@ -9,7 +9,20 @@ + + + + + + + + + + + + + diff --git a/StudentProgress/StudentProgress/appsettings.json b/StudentProgress/StudentProgress/appsettings.json new file mode 100644 index 0000000..0258958 --- /dev/null +++ b/StudentProgress/StudentProgress/appsettings.json @@ -0,0 +1,15 @@ +{ + "Serilog": { + "Using": [ "Serilog.Sinks.File" ], + "MinimumLevel": "Debug", + "WriteTo": [ + { + "Name": "File", + "Args": { + "path": "C:\\отп\\StudentProgress\\StudentProgress\\appsettings.json", + "rollingInterval": "Day" + } + } + ] + } +} diff --git a/StudentProgress/StudentProgress/appsettings20241204.com b/StudentProgress/StudentProgress/appsettings20241204.com new file mode 100644 index 0000000..bb0380d --- /dev/null +++ b/StudentProgress/StudentProgress/appsettings20241204.com @@ -0,0 +1,125 @@ +2024-12-04 18:12:04.577 +04:00 [INF] Получение групп +2024-12-04 18:12:05.492 +04:00 [ERR] Ошибка при чтении групп +System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. + at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 +2024-12-04 18:12:33.740 +04:00 [INF] Добавление группы +2024-12-04 18:12:34.889 +04:00 [DBG] Группа: {"Id":0,"NameGroup":"vhghg"} +2024-12-04 18:12:35.068 +04:00 [ERR] Ошибка при добавлении группы +System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. + at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 29 +2024-12-04 18:12:41.544 +04:00 [INF] Получение групп +2024-12-04 18:12:41.590 +04:00 [ERR] Ошибка при чтении групп +System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. + at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 +2024-12-04 18:14:45.539 +04:00 [INF] Получение групп +2024-12-04 18:14:45.623 +04:00 [ERR] Ошибка при чтении групп +System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. + at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 +2024-12-04 18:27:30.144 +04:00 [INF] Получение групп +2024-12-04 18:27:30.580 +04:00 [ERR] Ошибка при чтении групп +System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. + at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 +2024-12-04 18:40:36.369 +04:00 [INF] Получение групп +2024-12-04 18:40:37.721 +04:00 [ERR] Ошибка при чтении групп +System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. + at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 +2024-12-04 19:09:36.613 +04:00 [INF] Получение всех объектов +2024-12-04 19:09:37.378 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.Open() + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 + Exception data: + Severity: FATAL + SqlState: 3D000 + MessageText: database "studentperformancebd" does not exist + File: postinit.c + Line: 1050 + Routine: InitPostgres +2024-12-04 19:48:23.173 +04:00 [INF] Получение всех объектов +2024-12-04 19:48:26.525 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.Open() + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 + Exception data: + Severity: FATAL + SqlState: 3D000 + MessageText: database "studentperformancebd" does not exist + File: postinit.c + Line: 1050 + Routine: InitPostgres diff --git a/StudentProgress/StudentProgress/appsettings20241205.com b/StudentProgress/StudentProgress/appsettings20241205.com new file mode 100644 index 0000000..80454e1 --- /dev/null +++ b/StudentProgress/StudentProgress/appsettings20241205.com @@ -0,0 +1,105 @@ +2024-12-05 03:52:19.883 +04:00 [INF] Получение всех объектов +2024-12-05 03:52:20.333 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.Open() + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 + Exception data: + Severity: FATAL + SqlState: 3D000 + MessageText: database "studentperformancebd" does not exist + File: postinit.c + Line: 1050 + Routine: InitPostgres +2024-12-05 03:52:31.028 +04:00 [INF] Получение оценок +2024-12-05 03:52:31.056 +04:00 [ERR] Ошибка при чтении оценок +System.ArgumentException: Keyword not supported: 'host'. + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.GradesRepository.ReadGrades(Nullable`1 dateFrom, Nullable`1 dateTo, Nullable`1 subjectsId, Nullable`1 professorsId) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GradesRepository.cs:line 64 +2024-12-05 03:52:40.306 +04:00 [INF] Получение оценок +2024-12-05 03:52:40.306 +04:00 [ERR] Ошибка при чтении оценок +System.ArgumentException: Keyword not supported: 'host'. + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.GradesRepository.ReadGrades(Nullable`1 dateFrom, Nullable`1 dateTo, Nullable`1 subjectsId, Nullable`1 professorsId) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GradesRepository.cs:line 64 +2024-12-05 03:52:50.012 +04:00 [INF] Получение преподавателей +2024-12-05 03:52:50.013 +04:00 [ERR] Ошибка при чтении преподавателей +System.ArgumentException: Keyword not supported: 'host'. + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.ProfessorsNameRepository.ReadProfessorsName() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\ProfessorsNameRepository.cs:line 64 +2024-12-05 08:57:04.261 +04:00 [INF] Получение объектов +2024-12-05 08:57:05.030 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.Open() + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentProgress.Repositories.Implementations.SubjectsRepository.ReadSubjects(Nullable`1 id) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\SubjectsRepository.cs:line 113 + Exception data: + Severity: FATAL + SqlState: 3D000 + MessageText: database "studentperformancebd" does not exist + File: postinit.c + Line: 1050 + Routine: InitPostgres +2024-12-05 12:31:25.485 +04:00 [INF] Получение всех объектов +2024-12-05 12:31:26.556 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.Open() + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 + Exception data: + Severity: FATAL + SqlState: 3D000 + MessageText: database "studentperformancebd" does not exist + File: postinit.c + Line: 1050 + Routine: InitPostgres -- 2.25.1 From a27c78524c7d44110bace5524aec5818ea4322ac Mon Sep 17 00:00:00 2001 From: safia Date: Thu, 5 Dec 2024 13:56:31 +0400 Subject: [PATCH 2/7] =?UTF-8?q?50%=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B?= =?UTF-8?q?=20=D1=81=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudentProgress/Forms/FormGrade.resx | 3 - .../Implementations/ConnectionString.cs | 2 +- .../StudentProgress/appsettings20241205.com | 419 ++++++++++++++++++ 3 files changed, 420 insertions(+), 4 deletions(-) diff --git a/StudentProgress/StudentProgress/Forms/FormGrade.resx b/StudentProgress/StudentProgress/Forms/FormGrade.resx index 831d2a4..16209fb 100644 --- a/StudentProgress/StudentProgress/Forms/FormGrade.resx +++ b/StudentProgress/StudentProgress/Forms/FormGrade.resx @@ -120,7 +120,4 @@ True - - True - \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs b/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs index 8401f69..850be20 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs @@ -5,5 +5,5 @@ namespace StudentProgress.Repositories.Implementations; public class ConnectionString : IConnectionString { string IConnectionString.ConnectionString => - "Host=localhost;Port=5432;Database=studentperformancebd;Username=postgres;Password=Ildan12345;"; + "Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=Ildan12345;"; } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/appsettings20241205.com b/StudentProgress/StudentProgress/appsettings20241205.com index 80454e1..a1e9f79 100644 --- a/StudentProgress/StudentProgress/appsettings20241205.com +++ b/StudentProgress/StudentProgress/appsettings20241205.com @@ -103,3 +103,422 @@ Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" do File: postinit.c Line: 1050 Routine: InitPostgres +2024-12-05 12:58:08.317 +04:00 [INF] Получение оценок +2024-12-05 12:58:08.808 +04:00 [ERR] Ошибка при чтении оценок +System.ArgumentException: Keyword not supported: 'host'. + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.GradesRepository.ReadGrades(Nullable`1 dateFrom, Nullable`1 dateTo, Nullable`1 subjectsId, Nullable`1 professorsId) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GradesRepository.cs:line 64 +2024-12-05 12:58:26.316 +04:00 [INF] Получение лекций +2024-12-05 12:58:26.999 +04:00 [ERR] Ошибка при чтении лекций +System.ArgumentException: Keyword not supported: 'host'. + at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) + at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) + at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) + at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) + at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) + at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) + at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) + at System.Data.SqlClient.SqlConnection..ctor(String connectionString) + at StudentProgress.Repositories.Implementations.LecturesRepository.ReadLectures() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\LecturesRepository.cs:line 28 +2024-12-05 13:06:50.514 +04:00 [INF] Получение всех объектов +2024-12-05 13:06:51.428 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 3D000: database "StudentProgress" does not exist + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlConnection.Open() + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 + Exception data: + Severity: FATAL + SqlState: 3D000 + MessageText: database "StudentProgress" does not exist + File: postinit.c + Line: 1050 + Routine: InitPostgres +2024-12-05 13:08:15.288 +04:00 [INF] Получение всех объектов +2024-12-05 13:08:16.452 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":""},{"Id":0,"NameGroup":""}] +2024-12-05 13:08:30.577 +04:00 [INF] Добавление объекта +2024-12-05 13:08:30.579 +04:00 [DBG] Объект: {"Id":0,"NameGroup":"исэбд-22"} +2024-12-05 13:08:30.724 +04:00 [ERR] Ошибка при добавлении объекта +Npgsql.PostgresException (0x80004005): 42703: column "namegroup" of relation "groups" does not exist + +POSITION: 21 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery() + at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 + at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 + at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 + at StudentPerformance.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 30 + Exception data: + Severity: ERROR + SqlState: 42703 + MessageText: column "namegroup" of relation "groups" does not exist + Position: 21 + File: parse_target.c + Line: 1070 + Routine: checkInsertTargets +2024-12-05 13:10:04.161 +04:00 [INF] Добавление объекта +2024-12-05 13:10:04.174 +04:00 [DBG] Объект: {"Id":0,"NameGroup":"22"} +2024-12-05 13:10:04.323 +04:00 [ERR] Ошибка при добавлении объекта +Npgsql.PostgresException (0x80004005): 42703: column "namegroup" of relation "groups" does not exist + +POSITION: 21 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery() + at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 + at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 + at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 + at StudentPerformance.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 30 + Exception data: + Severity: ERROR + SqlState: 42703 + MessageText: column "namegroup" of relation "groups" does not exist + Position: 21 + File: parse_target.c + Line: 1070 + Routine: checkInsertTargets +2024-12-05 13:10:16.998 +04:00 [INF] Получение всех объектов +2024-12-05 13:10:17.016 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":""},{"Id":0,"NameGroup":""}] +2024-12-05 13:16:20.215 +04:00 [INF] Получение всех объектов +2024-12-05 13:16:22.404 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] +2024-12-05 13:16:41.980 +04:00 [INF] Добавление объекта +2024-12-05 13:16:41.983 +04:00 [DBG] Объект: {"Id":0,"NameGroup":"исэбд-22"} +2024-12-05 13:16:42.208 +04:00 [ERR] Ошибка при добавлении объекта +Npgsql.PostgresException (0x80004005): 42703: column "course" of relation "groups" does not exist + +POSITION: 32 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery() + at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 + at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 + at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 + at StudentPerformance.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 30 + Exception data: + Severity: ERROR + SqlState: 42703 + MessageText: column "course" of relation "groups" does not exist + Position: 32 + File: parse_target.c + Line: 1070 + Routine: checkInsertTargets +2024-12-05 13:17:02.529 +04:00 [INF] Получение объекта по идентификатору +2024-12-05 13:17:02.530 +04:00 [DBG] Объект: 0 +2024-12-05 13:17:02.612 +04:00 [ERR] Ошибка при поиске объекта +Npgsql.PostgresException (0x80004005): 42703: column "id" does not exist + +POSITION: 31 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) + at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) + at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 + at Dapper.SqlMapper.QueryRowImpl[T](IDbConnection cnn, Row row, CommandDefinition& command, Type effectiveType) in /_/Dapper/SqlMapper.cs:line 1277 + at Dapper.SqlMapper.QueryFirst[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 836 + at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroupById(Int32 id) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 87 + Exception data: + Severity: ERROR + SqlState: 42703 + MessageText: column "id" does not exist + Position: 31 + File: parse_relation.c + Line: 3721 + Routine: errorMissingColumn +2024-12-05 13:17:05.088 +04:00 [INF] Получение всех объектов +2024-12-05 13:17:05.102 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] +2024-12-05 13:17:08.655 +04:00 [INF] Получение всех объектов +2024-12-05 13:17:08.663 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] +2024-12-05 13:17:15.051 +04:00 [INF] Удаление объекта +2024-12-05 13:17:15.053 +04:00 [DBG] Объект: 0 +2024-12-05 13:17:15.119 +04:00 [ERR] Ошибка при удалении объекта +Npgsql.PostgresException (0x80004005): 42703: column "id" does not exist + +POSITION: 29 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery() + at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 + at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 + at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 + at StudentPerformance.Repositories.Implementations.GroupRepository.DeleteGroup(Int32 id) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 49 + Exception data: + Severity: ERROR + SqlState: 42703 + MessageText: column "id" does not exist + Position: 29 + File: parse_relation.c + Line: 3721 + Routine: errorMissingColumn +2024-12-05 13:19:43.949 +04:00 [INF] Получение всех объектов +2024-12-05 13:19:46.043 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] +2024-12-05 13:20:01.938 +04:00 [INF] Добавление объекта +2024-12-05 13:20:01.942 +04:00 [DBG] Объект: {"Id":0,"NameGroup":"исэбд-22"} +2024-12-05 13:20:02.154 +04:00 [ERR] Ошибка при добавлении объекта +Npgsql.PostgresException (0x80004005): 42703: column "namefaculty" of relation "groups" does not exist + +POSITION: 40 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery() + at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 + at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 + at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 + at StudentPerformance.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 30 + Exception data: + Severity: ERROR + SqlState: 42703 + MessageText: column "namefaculty" of relation "groups" does not exist + Position: 40 + File: parse_target.c + Line: 1070 + Routine: checkInsertTargets +2024-12-05 13:20:45.534 +04:00 [INF] Получение объекта по идентификатору +2024-12-05 13:20:45.537 +04:00 [DBG] Объект: 0 +2024-12-05 13:20:45.613 +04:00 [ERR] Ошибка при поиске объекта +Npgsql.PostgresException (0x80004005): 42703: column "id" does not exist + +POSITION: 31 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) + at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) + at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 + at Dapper.SqlMapper.QueryRowImpl[T](IDbConnection cnn, Row row, CommandDefinition& command, Type effectiveType) in /_/Dapper/SqlMapper.cs:line 1277 + at Dapper.SqlMapper.QueryFirst[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 836 + at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroupById(Int32 id) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 87 + Exception data: + Severity: ERROR + SqlState: 42703 + MessageText: column "id" does not exist + Position: 31 + File: parse_relation.c + Line: 3721 + Routine: errorMissingColumn +2024-12-05 13:20:47.672 +04:00 [INF] Получение всех объектов +2024-12-05 13:20:47.694 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] +2024-12-05 13:20:52.194 +04:00 [INF] Получение всех объектов +2024-12-05 13:20:52.248 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 42P01: relation "student" does not exist + +POSITION: 15 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) + at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) + at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentPerformance.Repositories.Implementations.StudentRepository.ReadStudents(Nullable`1 groupID) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\StudentRepository.cs:line 93 + Exception data: + Severity: ERROR + SqlState: 42P01 + MessageText: relation "student" does not exist + Position: 15 + File: parse_relation.c + Line: 1452 + Routine: parserOpenTable +2024-12-05 13:21:00.660 +04:00 [INF] Получение всех объектов +2024-12-05 13:21:00.670 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] +2024-12-05 13:21:07.759 +04:00 [INF] Добавление объекта +2024-12-05 13:21:07.768 +04:00 [DBG] Объект: {"Id":0,"Name":"авава","Surname":"вваав","GroupId":0} +2024-12-05 13:21:07.812 +04:00 [ERR] Ошибка при добавлении объекта +Npgsql.PostgresException (0x80004005): 42P01: relation "student" does not exist + +POSITION: 15 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteNonQuery() + at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 + at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 + at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 + at StudentPerformance.Repositories.Implementations.StudentRepository.CreateStudent(Student student) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\StudentRepository.cs:line 33 + Exception data: + Severity: ERROR + SqlState: 42P01 + MessageText: relation "student" does not exist + Position: 15 + File: parse_relation.c + Line: 1452 + Routine: parserOpenTable +2024-12-05 13:21:19.384 +04:00 [INF] Получение всех объектов +2024-12-05 13:21:19.454 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 42P01: relation "student" does not exist + +POSITION: 15 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) + at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) + at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentPerformance.Repositories.Implementations.StudentRepository.ReadStudents(Nullable`1 groupID) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\StudentRepository.cs:line 93 + Exception data: + Severity: ERROR + SqlState: 42P01 + MessageText: relation "student" does not exist + Position: 15 + File: parse_relation.c + Line: 1452 + Routine: parserOpenTable +2024-12-05 13:21:26.154 +04:00 [INF] Получение всех объектов +2024-12-05 13:21:26.191 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 42P01: relation "professorsname" does not exist + +POSITION: 15 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) + at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) + at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentProgress.Repositories.Implementations.ProfessorsNameRepository.ReadProfessorsName() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\ProfessorsNameRepository.cs:line 67 + Exception data: + Severity: ERROR + SqlState: 42P01 + MessageText: relation "professorsname" does not exist + Position: 15 + File: parse_relation.c + Line: 1452 + Routine: parserOpenTable +2024-12-05 13:21:38.506 +04:00 [INF] Получение всех объектов +2024-12-05 13:21:38.559 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 42P01: relation "professorsname" does not exist + +POSITION: 15 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) + at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) + at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentProgress.Repositories.Implementations.ProfessorsNameRepository.ReadProfessorsName() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\ProfessorsNameRepository.cs:line 67 + Exception data: + Severity: ERROR + SqlState: 42P01 + MessageText: relation "professorsname" does not exist + Position: 15 + File: parse_relation.c + Line: 1452 + Routine: parserOpenTable +2024-12-05 13:21:49.442 +04:00 [INF] Получение всех объектов +2024-12-05 13:21:49.533 +04:00 [ERR] Ошибка при чтении объектов +Npgsql.PostgresException (0x80004005): 42P01: relation "professorsname" does not exist + +POSITION: 15 + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult() + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) + at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) + at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 + at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 + at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) + at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) + at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 + at StudentProgress.Repositories.Implementations.ProfessorsNameRepository.ReadProfessorsName() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\ProfessorsNameRepository.cs:line 67 + Exception data: + Severity: ERROR + SqlState: 42P01 + MessageText: relation "professorsname" does not exist + Position: 15 + File: parse_relation.c + Line: 1452 + Routine: parserOpenTable -- 2.25.1 From e0f64dbfae79084e8641f52c461aa37c499eea62 Mon Sep 17 00:00:00 2001 From: safia Date: Thu, 19 Dec 2024 04:14:24 +0400 Subject: [PATCH 3/7] 60 ghjwtynjd hf,jns --- .../StudentProgress/Entities/Enums/Course.cs | 11 +++++ .../Entities/Enums/DisLectE.cs | 9 ---- .../StudentProgress/Entities/Enums/Grade.cs | 12 ++--- .../Entities/Enums/TypeOfWork.cs | 10 ----- .../StudentProgress/Entities/Grades.cs | 19 ++++++-- .../StudentProgress/Entities/Group.cs | 25 +++++------ .../StudentProgress/Entities/Lectures.cs | 44 ++++++------------- .../StudentProgress/Entities/Professors.cs | 10 ++--- .../StudentProgress/Entities/Student.cs | 33 +++++++------- .../StudentProgress/Entities/Subjects.cs | 11 +++-- .../Entities/TempStudentGrades.cs | 18 ++++++++ .../Properties/Resources.Designer.cs | 32 +++++++------- 12 files changed, 121 insertions(+), 113 deletions(-) create mode 100644 StudentProgress/StudentProgress/Entities/Enums/Course.cs delete mode 100644 StudentProgress/StudentProgress/Entities/Enums/DisLectE.cs delete mode 100644 StudentProgress/StudentProgress/Entities/Enums/TypeOfWork.cs create mode 100644 StudentProgress/StudentProgress/Entities/TempStudentGrades.cs diff --git a/StudentProgress/StudentProgress/Entities/Enums/Course.cs b/StudentProgress/StudentProgress/Entities/Enums/Course.cs new file mode 100644 index 0000000..e04ffaf --- /dev/null +++ b/StudentProgress/StudentProgress/Entities/Enums/Course.cs @@ -0,0 +1,11 @@ +namespace StudentProgress.Entities.Enums; + +[Flags] +public enum Course +{ + None, + First = 1, // 1 курс + Second = 2, // 2 курс + Third = 4, // 3 курс + Fourth = 8 // 4 курс +} \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Entities/Enums/DisLectE.cs b/StudentProgress/StudentProgress/Entities/Enums/DisLectE.cs deleted file mode 100644 index 952a150..0000000 --- a/StudentProgress/StudentProgress/Entities/Enums/DisLectE.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace StudentProgress.Entities.Enums; - -public enum DisLectE -{ - None = 0, - Praktika = 1, - Lecturer = 2, - Labaratory = 3 -} \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Entities/Enums/Grade.cs b/StudentProgress/StudentProgress/Entities/Enums/Grade.cs index cdad9ee..817c5ee 100644 --- a/StudentProgress/StudentProgress/Entities/Enums/Grade.cs +++ b/StudentProgress/StudentProgress/Entities/Enums/Grade.cs @@ -8,10 +8,10 @@ namespace StudentProgress.Entities.Enums; public enum Grade { - None = 0, //пересдача - Two = 1, - Three = 2, - Four = 3, - Five = 4, - Zachet = 5 + None, + One = 1, + Two = 2, + Three = 3, + Four = 4, + Five = 5, } diff --git a/StudentProgress/StudentProgress/Entities/Enums/TypeOfWork.cs b/StudentProgress/StudentProgress/Entities/Enums/TypeOfWork.cs deleted file mode 100644 index ace312a..0000000 --- a/StudentProgress/StudentProgress/Entities/Enums/TypeOfWork.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace StudentProgress.Entities.Enums; -[Flags] -public enum TypeOfWork -{ - None = 0, //неизвестная работа - Exam = 1, - Zachet = 2, - Referat = 4, - Laba = 8, -} \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Entities/Grades.cs b/StudentProgress/StudentProgress/Entities/Grades.cs index 7d77a90..7b89070 100644 --- a/StudentProgress/StudentProgress/Entities/Grades.cs +++ b/StudentProgress/StudentProgress/Entities/Grades.cs @@ -6,15 +6,28 @@ public class Grades public int SubjectsId { get; private set; } public int ProfessorsId { get; private set; } public DateTime Date { get; private set; } - - public static Grades CreateEntity(int id, int subjectsId, int professorsId, DateTime date) + public IEnumerable StudentGrade { get; private set; } = []; + public static Grades CreateEntity(int id, int subjectsId, int professorsId, DateTime date, IEnumerable studentGrades) { return new Grades { Id = id, SubjectsId = subjectsId, ProfessorsId = professorsId, - Date = date + Date = date, + StudentGrade = studentGrades + }; + } + + public static Grades CreateEntity(TempStudentGrades tempStudentGrades, IEnumerable studentGrades) + { + return new Grades + { + Id = tempStudentGrades.Id, + SubjectsId = tempStudentGrades.SubjectsId, + ProfessorsId = tempStudentGrades.ProfessorsId, + Date = tempStudentGrades.Date, + StudentGrade = studentGrades }; } } diff --git a/StudentProgress/StudentProgress/Entities/Group.cs b/StudentProgress/StudentProgress/Entities/Group.cs index 8f88960..91ef307 100644 --- a/StudentProgress/StudentProgress/Entities/Group.cs +++ b/StudentProgress/StudentProgress/Entities/Group.cs @@ -1,17 +1,16 @@ -namespace StudentProgress.Entities -{ - public class Group - { - public int Id { get; private set; } - public string NameGroup { get; set; } = string.Empty; +namespace StudentProgress.Entities; - public static Group CreateEntity(int id, string nameGroup) +public class Group +{ + public int Id { get; private set; } + public string NameGroup { get; set; } = string.Empty; + + public static Group CreateEntity(int id, string nameGroup) + { + return new Group { - return new Group - { - Id = id, - NameGroup = nameGroup ?? string.Empty - }; - } + Id = id, + NameGroup = nameGroup ?? string.Empty + }; } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Entities/Lectures.cs b/StudentProgress/StudentProgress/Entities/Lectures.cs index 0011c5c..f52bd7f 100644 --- a/StudentProgress/StudentProgress/Entities/Lectures.cs +++ b/StudentProgress/StudentProgress/Entities/Lectures.cs @@ -1,35 +1,19 @@ -namespace StudentProgress.Entities +namespace StudentProgress.Entities; + +public class Lectures { - public class Lectures + public int Id { get; private set; } + public int ProfessorsId { get; private set; } + public DateTime Date { get; private set; } + public string Auditorium { get; private set; } = string.Empty; + public static Lectures CreateElement(int id, int professorsId, DateTime date, string auditorium) { - public int LectureId { get; private set; } - public int ProfessorsId { get; private set; } - public DateTime Date { get; private set; } - public string Auditorium { get; private set; } - - public Lectures() + return new Lectures { - Auditorium = string.Empty; // Инициализация свойства Auditorium - } - - public void SetProfessorsId(int professorsId) - { - ProfessorsId = professorsId; - } - - public void SetDate(DateTime date) - { - Date = date; - } - - public void SetLectureId(int lectureId) - { - LectureId = lectureId; - } - - public void SetAuditorium(string auditorium) - { - Auditorium = auditorium; - } + Id = id, + Date = date, + Auditorium = auditorium, + ProfessorsId = professorsId, + }; } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Entities/Professors.cs b/StudentProgress/StudentProgress/Entities/Professors.cs index 44584d4..fb964ba 100644 --- a/StudentProgress/StudentProgress/Entities/Professors.cs +++ b/StudentProgress/StudentProgress/Entities/Professors.cs @@ -3,15 +3,15 @@ public class Professors { public int Id { get; set; } - public string FirstNameProfessor { get; set; } = string.Empty; - public string SurnameProfessor { get; set; } = string.Empty; - public static Professors CreateEntity(int id, string firstName, string SurnameProfessor) + public string FirstName { get; set; } = string.Empty; + public string Surname { get; set; } = string.Empty; + public static Professors CreateEntity(int id, string firstName, string surname) { return new Professors { Id = id, - FirstNameProfessor = firstName ?? string.Empty, - SurnameProfessor = SurnameProfessor ?? string.Empty + FirstName = firstName ?? string.Empty, + Surname = surname ?? string.Empty }; } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Entities/Student.cs b/StudentProgress/StudentProgress/Entities/Student.cs index 564c195..000b6a6 100644 --- a/StudentProgress/StudentProgress/Entities/Student.cs +++ b/StudentProgress/StudentProgress/Entities/Student.cs @@ -1,21 +1,20 @@ -namespace StudentProgress.Entities -{ - public class Student - { - public int Id { get; private set; } - public string Name { get; set; } = string.Empty; - public string Surname { get; set; } = string.Empty; - public int GroupId { get; set; } +namespace StudentProgress.Entities; - public static Student CreateEntity(int id, string name, string surname, int groupId) +public class Student +{ + public int Id { get; private set; } + public string Name { get; set; } = string.Empty; + public string Surname { get; set; } = string.Empty; + public int GroupId { get; set; } + + public static Student CreateEntity(int id, string name, string surname, int groupId) + { + return new Student { - return new Student - { - Id = id, - Name = name ?? string.Empty, - Surname = surname ?? string.Empty, - GroupId = groupId - }; - } + Id = id, + Name = name ?? string.Empty, + Surname = surname ?? string.Empty, + GroupId = groupId + }; } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Entities/Subjects.cs b/StudentProgress/StudentProgress/Entities/Subjects.cs index 2e68186..30bb035 100644 --- a/StudentProgress/StudentProgress/Entities/Subjects.cs +++ b/StudentProgress/StudentProgress/Entities/Subjects.cs @@ -1,17 +1,20 @@ -namespace StudentProgress.Entities; +using Microsoft.VisualBasic.Devices; +using StudentProgress.Entities.Enums; + +namespace StudentProgress.Entities; public class Subjects { public int Id { get; private set; } public string NameSubject { get; private set; } = string.Empty; - - public static Subjects CreateEntity_(int id, string nameSubject) + public Course Course { get; private set; } + public static Subjects CreateEntity_(int id, string nameSubject, Course course) { return new Subjects { Id = id, NameSubject = nameSubject ?? string.Empty, - + Course = course }; } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Entities/TempStudentGrades.cs b/StudentProgress/StudentProgress/Entities/TempStudentGrades.cs new file mode 100644 index 0000000..c6d6b18 --- /dev/null +++ b/StudentProgress/StudentProgress/Entities/TempStudentGrades.cs @@ -0,0 +1,18 @@ +using StudentProgress.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StudentProgress.Entities; + +public class TempStudentGrades +{ + public int Id { get; private set; } + public int SubjectsId { get; private set; } + public int ProfessorsId { get; private set; } + public DateTime Date { get; private set; } + public int StudentID { get; private set; } + public Grade Grade { get; private set; } +} diff --git a/StudentProgress/StudentProgress/Properties/Resources.Designer.cs b/StudentProgress/StudentProgress/Properties/Resources.Designer.cs index 95bee35..ca5f13b 100644 --- a/StudentProgress/StudentProgress/Properties/Resources.Designer.cs +++ b/StudentProgress/StudentProgress/Properties/Resources.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace StudentProgress.Properties { /// - /// A strongly-typed resource class, for looking up localized strings, etc. + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ namespace StudentProgress.Properties { } /// - /// Returns the cached ResourceManager instance used by this class. + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ namespace StudentProgress.Properties { } /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ namespace StudentProgress.Properties { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap Add { get { @@ -71,7 +71,7 @@ namespace StudentProgress.Properties { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap BackGround { get { @@ -81,7 +81,7 @@ namespace StudentProgress.Properties { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap Del { get { @@ -91,7 +91,7 @@ namespace StudentProgress.Properties { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap Pencil { get { -- 2.25.1 From fdb6376672caeb464a88544ee3759904dcfdc38b Mon Sep 17 00:00:00 2001 From: safia Date: Thu, 19 Dec 2024 04:25:25 +0400 Subject: [PATCH 4/7] =?UTF-8?q?60=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudentProgress/Entities/Grades.cs | 12 -- .../Entities/TempStudentGrades.cs | 18 --- .../StudentProgress/Forms/FormGrade.cs | 4 +- .../Forms/FormLecturesCount.cs | 4 +- .../StudentProgress/Forms/FormProfesor.cs | 4 +- .../StudentProgress/Forms/FormProfessors.cs | 4 +- .../Forms/FormRecordLecture.cs | 4 +- StudentProgress/StudentProgress/Program.cs | 2 +- .../Repositories/IProfessorsNameRepository.cs | 13 --- .../Repositories/IProfessorsRepository.cs | 13 +++ .../Implementations/ConnectionString.cs | 2 +- .../Implementations/GradesRepository.cs | 78 ++++--------- .../Implementations/GroupRepository.cs | 16 ++- .../Implementations/LecturesRepository.cs | 15 +-- ...eRepository.cs => ProfessorsRepository.cs} | 61 +++++----- .../Implementations/StudentRepository.cs | 12 +- .../Implementations/SubjectsRepository.cs | 108 ++++-------------- 17 files changed, 119 insertions(+), 251 deletions(-) delete mode 100644 StudentProgress/StudentProgress/Entities/TempStudentGrades.cs delete mode 100644 StudentProgress/StudentProgress/Repositories/IProfessorsNameRepository.cs create mode 100644 StudentProgress/StudentProgress/Repositories/IProfessorsRepository.cs rename StudentProgress/StudentProgress/Repositories/Implementations/{ProfessorsNameRepository.cs => ProfessorsRepository.cs} (64%) diff --git a/StudentProgress/StudentProgress/Entities/Grades.cs b/StudentProgress/StudentProgress/Entities/Grades.cs index 7b89070..c9c4e58 100644 --- a/StudentProgress/StudentProgress/Entities/Grades.cs +++ b/StudentProgress/StudentProgress/Entities/Grades.cs @@ -18,16 +18,4 @@ public class Grades StudentGrade = studentGrades }; } - - public static Grades CreateEntity(TempStudentGrades tempStudentGrades, IEnumerable studentGrades) - { - return new Grades - { - Id = tempStudentGrades.Id, - SubjectsId = tempStudentGrades.SubjectsId, - ProfessorsId = tempStudentGrades.ProfessorsId, - Date = tempStudentGrades.Date, - StudentGrade = studentGrades - }; - } } diff --git a/StudentProgress/StudentProgress/Entities/TempStudentGrades.cs b/StudentProgress/StudentProgress/Entities/TempStudentGrades.cs deleted file mode 100644 index c6d6b18..0000000 --- a/StudentProgress/StudentProgress/Entities/TempStudentGrades.cs +++ /dev/null @@ -1,18 +0,0 @@ -using StudentProgress.Entities.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StudentProgress.Entities; - -public class TempStudentGrades -{ - public int Id { get; private set; } - public int SubjectsId { get; private set; } - public int ProfessorsId { get; private set; } - public DateTime Date { get; private set; } - public int StudentID { get; private set; } - public Grade Grade { get; private set; } -} diff --git a/StudentProgress/StudentProgress/Forms/FormGrade.cs b/StudentProgress/StudentProgress/Forms/FormGrade.cs index 3f43ae9..6feea54 100644 --- a/StudentProgress/StudentProgress/Forms/FormGrade.cs +++ b/StudentProgress/StudentProgress/Forms/FormGrade.cs @@ -11,11 +11,11 @@ namespace StudentProgress.Forms { private readonly IGradesRepository _gradesRepository; private readonly ISubjectsRepository _subjectsRepository; - private readonly IProfessorsNameRepository _professorsRepository; + private readonly IProfessorsRepository _professorsRepository; private readonly IStudentRepository _studentRepository; public FormGrade(IGradesRepository gradesRepository, ISubjectsRepository subjectsRepository, - IProfessorsNameRepository professorsRepository, IStudentRepository studentRepository) + IProfessorsRepository professorsRepository, IStudentRepository studentRepository) { InitializeComponent(); _gradesRepository = gradesRepository ?? throw new ArgumentNullException(nameof(gradesRepository)); diff --git a/StudentProgress/StudentProgress/Forms/FormLecturesCount.cs b/StudentProgress/StudentProgress/Forms/FormLecturesCount.cs index c9fe297..f677e16 100644 --- a/StudentProgress/StudentProgress/Forms/FormLecturesCount.cs +++ b/StudentProgress/StudentProgress/Forms/FormLecturesCount.cs @@ -9,10 +9,10 @@ namespace StudentProgress.Forms { public partial class FormLecturesCount : Form { - private readonly IProfessorsNameRepository _professorsRepository; + private readonly IProfessorsRepository _professorsRepository; private readonly ILecturesRepository _lecturesRepository; - public FormLecturesCount(IProfessorsNameRepository professorsRepository, ILecturesRepository lecturesRepository) + public FormLecturesCount(IProfessorsRepository professorsRepository, ILecturesRepository lecturesRepository) { InitializeComponent(); _professorsRepository = professorsRepository; diff --git a/StudentProgress/StudentProgress/Forms/FormProfesor.cs b/StudentProgress/StudentProgress/Forms/FormProfesor.cs index 51b5532..3a22601 100644 --- a/StudentProgress/StudentProgress/Forms/FormProfesor.cs +++ b/StudentProgress/StudentProgress/Forms/FormProfesor.cs @@ -8,7 +8,7 @@ namespace StudentProgress.Forms { public partial class FormProfessor : Form { - private readonly IProfessorsNameRepository _professorsRepository; + private readonly IProfessorsRepository _professorsRepository; private int? _professorId; public int Id @@ -34,7 +34,7 @@ namespace StudentProgress.Forms } } - public FormProfessor(IProfessorsNameRepository professorsRepository) + public FormProfessor(IProfessorsRepository professorsRepository) { InitializeComponent(); _professorsRepository = professorsRepository ?? throw new ArgumentNullException(nameof(professorsRepository)); diff --git a/StudentProgress/StudentProgress/Forms/FormProfessors.cs b/StudentProgress/StudentProgress/Forms/FormProfessors.cs index caa8a76..e404747 100644 --- a/StudentProgress/StudentProgress/Forms/FormProfessors.cs +++ b/StudentProgress/StudentProgress/Forms/FormProfessors.cs @@ -8,9 +8,9 @@ namespace StudentProgress.Forms public partial class FormProfessors : Form { private readonly IUnityContainer _container; - private readonly IProfessorsNameRepository _professorsRepository; + private readonly IProfessorsRepository _professorsRepository; - public FormProfessors(IUnityContainer container, IProfessorsNameRepository professorsRepository) + public FormProfessors(IUnityContainer container, IProfessorsRepository professorsRepository) { InitializeComponent(); _container = container ?? throw new ArgumentNullException(nameof(container)); diff --git a/StudentProgress/StudentProgress/Forms/FormRecordLecture.cs b/StudentProgress/StudentProgress/Forms/FormRecordLecture.cs index cfe2fad..be45bc4 100644 --- a/StudentProgress/StudentProgress/Forms/FormRecordLecture.cs +++ b/StudentProgress/StudentProgress/Forms/FormRecordLecture.cs @@ -7,10 +7,10 @@ namespace StudentProgress.Forms { public partial class FormRecordLecture : Form { - private readonly IProfessorsNameRepository _professorsRepository; + private readonly IProfessorsRepository _professorsRepository; private readonly ILecturesRepository _lecturesRepository; - public FormRecordLecture(IProfessorsNameRepository professorsRepository, ILecturesRepository lecturesRepository) + public FormRecordLecture(IProfessorsRepository professorsRepository, ILecturesRepository lecturesRepository) { InitializeComponent(); _professorsRepository = professorsRepository; diff --git a/StudentProgress/StudentProgress/Program.cs b/StudentProgress/StudentProgress/Program.cs index 45f1fcb..000fa72 100644 --- a/StudentProgress/StudentProgress/Program.cs +++ b/StudentProgress/StudentProgress/Program.cs @@ -42,7 +42,7 @@ namespace StudentProgress container.RegisterType(new TransientLifetimeManager()); container.RegisterType(new TransientLifetimeManager()); container.RegisterType(new TransientLifetimeManager()); - container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); container.RegisterType(new TransientLifetimeManager()); container.RegisterType(new TransientLifetimeManager()); diff --git a/StudentProgress/StudentProgress/Repositories/IProfessorsNameRepository.cs b/StudentProgress/StudentProgress/Repositories/IProfessorsNameRepository.cs deleted file mode 100644 index 672d629..0000000 --- a/StudentProgress/StudentProgress/Repositories/IProfessorsNameRepository.cs +++ /dev/null @@ -1,13 +0,0 @@ -using StudentProgress.Entities; -using System.Collections.Generic; - -namespace StudentProgress.Repositories; - -public interface IProfessorsNameRepository -{ - IEnumerable ReadProfessorsName(); - Professors ReadProfessorsNameById(int id); - void CreateProfessorsName(Professors professorsName); - void UpdateProfessorsName(Professors professorsName); - void DeleteProfessorsName(int id); -} \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Repositories/IProfessorsRepository.cs b/StudentProgress/StudentProgress/Repositories/IProfessorsRepository.cs new file mode 100644 index 0000000..d3e6b54 --- /dev/null +++ b/StudentProgress/StudentProgress/Repositories/IProfessorsRepository.cs @@ -0,0 +1,13 @@ +using StudentProgress.Entities; +using System.Collections.Generic; + +namespace StudentProgress.Repositories; + +public interface IProfessorsRepository +{ + IEnumerable ReadProfessors(); + Professors ReadProfessorsById(int id); + void CreateProfessors(Professors professors); + void UpdateProfessors(Professors professors); + void DeleteProfessors(int id); +} \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs b/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs index 850be20..d6b5363 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/ConnectionString.cs @@ -5,5 +5,5 @@ namespace StudentProgress.Repositories.Implementations; public class ConnectionString : IConnectionString { string IConnectionString.ConnectionString => - "Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=Ildan12345;"; + "Host=localhost;Port=5432;Database=OTP_sophiya;Username=postgres;Password=030405;"; } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/GradesRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/GradesRepository.cs index f0cacae..21958ab 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/GradesRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/GradesRepository.cs @@ -1,11 +1,8 @@ using Dapper; using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using Npgsql; using StudentProgress.Entities; -using StudentProgress.Repositories; -using System; -using System.Collections.Generic; -using System.Data.SqlClient; namespace StudentProgress.Repositories.Implementations { @@ -26,11 +23,28 @@ namespace StudentProgress.Repositories.Implementations _logger.LogDebug("Оценка: {json}", JsonConvert.SerializeObject(grade)); try { - using var connection = new SqlConnection(_connectionString.ConnectionString); - var query = @" + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + connection.Open(); + using var transaction = connection.BeginTransaction(); + var queryInsert = @" INSERT INTO Grades (SubjectsId, ProfessorsId, Date) - VALUES (@SubjectsId, @ProfessorsId, @Date)"; - connection.Execute(query, grade); + VALUES (@SubjectsId, @ProfessorsId, @Date); + SELECT MAX(Id) FROM Grades"; + var gradesId = + connection.QueryFirst(queryInsert, grade, transaction); + var querySubInsert = @" + INSERT INTO StudentGrades (StudentID, Grade, GradesId) + VALUES (@StudentID, @Grade, @GradesId)"; + foreach (var elem in grade.StudentGrade) + { + connection.Execute(querySubInsert, new + { + elem.StudentID, + elem.Grade, + gradesId, + }, transaction); + } + transaction.Commit(); } catch (Exception ex) { @@ -45,7 +59,7 @@ namespace StudentProgress.Repositories.Implementations _logger.LogDebug("Оценка: {id}", id); try { - using var connection = new SqlConnection(_connectionString.ConnectionString); + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var query = "DELETE FROM Grades WHERE Id = @Id"; connection.Execute(query, new { Id = id }); } @@ -61,32 +75,10 @@ namespace StudentProgress.Repositories.Implementations _logger.LogInformation("Получение оценок"); try { - using var connection = new SqlConnection(_connectionString.ConnectionString); + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var query = "SELECT * FROM Grades"; - var parameters = new DynamicParameters(); - if (dateFrom.HasValue) - { - query += " WHERE Date >= @DateFrom"; - parameters.Add("DateFrom", dateFrom.Value); - } - if (dateTo.HasValue) - { - query += " AND Date <= @DateTo"; - parameters.Add("DateTo", dateTo.Value); - } - if (subjectsId.HasValue) - { - query += " AND SubjectsId = @SubjectsId"; - parameters.Add("SubjectsId", subjectsId.Value); - } - if (professorsId.HasValue) - { - query += " AND ProfessorsId = @ProfessorsId"; - parameters.Add("ProfessorsId", professorsId.Value); - } - - var grades = connection.Query(query, parameters); + var grades = connection.Query(query); _logger.LogDebug("Полученные оценки: {json}", JsonConvert.SerializeObject(grades)); return grades; } @@ -96,25 +88,5 @@ namespace StudentProgress.Repositories.Implementations throw; } } - - public void UpdateGrade(Grades grade) - { - _logger.LogInformation("Редактирование оценки"); - _logger.LogDebug("Оценка: {json}", JsonConvert.SerializeObject(grade)); - try - { - using var connection = new SqlConnection(_connectionString.ConnectionString); - var query = @" - UPDATE Grades - SET SubjectsId = @SubjectsId, ProfessorsId = @ProfessorsId, Date = @Date - WHERE Id = @Id"; - connection.Execute(query, grade); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка при редактировании оценки"); - throw; - } - } } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/GroupRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/GroupRepository.cs index 4c6b383..6e03080 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/GroupRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/GroupRepository.cs @@ -25,8 +25,8 @@ public class GroupRepository : IGroupRepository try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var queryInsert = @"INSERT INTO Groups (NameGroup, Course, NameFaculty) -VALUES (@NameGroup, @Course, @NameFaculty)"; + var queryInsert = @"INSERT INTO ""Group"" (NameGroup) +VALUES (@NameGroup)"; connection.Execute(queryInsert, group); } catch (Exception ex) @@ -44,7 +44,7 @@ VALUES (@NameGroup, @Course, @NameFaculty)"; { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var queryDelete = @" -DELETE FROM Groups +DELETE FROM ""Group"" WHERE Id=@id"; connection.Execute(queryDelete, new { id }); } @@ -61,7 +61,7 @@ WHERE Id=@id"; try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var querySelect = "SELECT * FROM Groups"; + var querySelect = "SELECT * FROM \"Group\""; var groups = connection.Query(querySelect); _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(groups)); @@ -82,7 +82,7 @@ WHERE Id=@id"; { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var querySelect = @" -SELECT * FROM Groups +SELECT * FROM ""Group"" WHERE Id=@id"; var group = connection.QueryFirst(querySelect, new { @@ -109,11 +109,9 @@ WHERE Id=@id"; { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var queryUpdate = @" -UPDATE Groups +UPDATE ""Group"" SET -NameGroup=@NameGroup, -Course=@Course, -NameFaculty=@NameFaculty +NameGroup=@NameGroup WHERE Id=@Id"; connection.Execute(queryUpdate, group); } diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/LecturesRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/LecturesRepository.cs index 9208019..418a9ae 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/LecturesRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/LecturesRepository.cs @@ -1,11 +1,8 @@ using Dapper; using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using Npgsql; using StudentProgress.Entities; -using StudentProgress.Repositories; -using System; -using System.Collections.Generic; -using System.Data.SqlClient; namespace StudentProgress.Repositories.Implementations { @@ -25,7 +22,7 @@ namespace StudentProgress.Repositories.Implementations _logger.LogInformation("Получение лекций"); try { - using var connection = new SqlConnection(_connectionString.ConnectionString); + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var query = "SELECT * FROM Lectures"; var lectures = connection.Query(query); _logger.LogDebug("Полученные лекции: {json}", JsonConvert.SerializeObject(lectures)); @@ -44,9 +41,9 @@ namespace StudentProgress.Repositories.Implementations _logger.LogDebug("Лекция: {json}", JsonConvert.SerializeObject(lecture)); try { - using var connection = new SqlConnection(_connectionString.ConnectionString); + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var query = @" - INSERT INTO Lectures (ProfessorId, Date, Auditorium) + INSERT INTO Lectures (ProfessorsId, Date, Auditorium) VALUES (@ProfessorsId, @Date, @Auditorium)"; connection.Execute(query, lecture); } @@ -63,8 +60,8 @@ namespace StudentProgress.Repositories.Implementations _logger.LogDebug("Лекция: {id}", lectureId); try { - using var connection = new SqlConnection(_connectionString.ConnectionString); - var query = "DELETE FROM Lectures WHERE LectureId = @LectureId"; + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var query = "DELETE FROM Lectures WHERE Id = @LectureId"; connection.Execute(query, new { LectureId = lectureId }); } catch (Exception ex) diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsNameRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsRepository.cs similarity index 64% rename from StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsNameRepository.cs rename to StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsRepository.cs index 66a920f..24e2470 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsNameRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/ProfessorsRepository.cs @@ -3,33 +3,31 @@ using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Npgsql; using StudentProgress.Entities; -using StudentProgress.Repositories; -using System.Data.SqlClient; namespace StudentProgress.Repositories.Implementations; -public class ProfessorsNameRepository : IProfessorsNameRepository +public class ProfessorsRepository : IProfessorsRepository { private readonly IConnectionString _connectionString; - private readonly ILogger _logger; + private readonly ILogger _logger; - public ProfessorsNameRepository(IConnectionString connectionString, ILogger logger) + public ProfessorsRepository(IConnectionString connectionString, ILogger logger) { _connectionString = connectionString; _logger = logger; } - public void CreateProfessorsName(Professors professorsName) + public void CreateProfessors(Professors professors) { _logger.LogInformation("Добавление объекта"); - _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(professorsName)); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(professors)); try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var queryInsert = @"INSERT INTO ProfessorsName (FirstName, LastName, MiddleName, Classes) -VALUES (@FirstName, @LastName, @MiddleName, @Classes)"; - connection.Execute(queryInsert, professorsName); + var queryInsert = @"INSERT INTO Professors (FirstName, Surname) + VALUES (@FirstName, @Surname)"; + connection.Execute(queryInsert, professors); } catch (Exception ex) { @@ -38,16 +36,15 @@ VALUES (@FirstName, @LastName, @MiddleName, @Classes)"; } } - public void DeleteProfessorsName(int id) + public void DeleteProfessors(int id) { _logger.LogInformation("Удаление объекта"); _logger.LogDebug("Объект: {id}", id); try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var queryDelete = @" -DELETE FROM ProfessorsName -WHERE Id=@id"; + var queryDelete = @"DELETE FROM Professors + WHERE Id=@id"; connection.Execute(queryDelete, new { id }); } catch (Exception ex) @@ -57,17 +54,17 @@ WHERE Id=@id"; } } - public IEnumerable ReadProfessorsName() + public IEnumerable ReadProfessors() { _logger.LogInformation("Получение всех объектов"); try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var querySelect = "SELECT * FROM ProfessorsName"; - var professorsNames = connection.Query(querySelect); + var querySelect = "SELECT * FROM Professors"; + var professors = connection.Query(querySelect); _logger.LogDebug("Полученные объекты: {json}", - JsonConvert.SerializeObject(professorsNames)); - return professorsNames; + JsonConvert.SerializeObject(professors)); + return professors; } catch (Exception ex) { @@ -76,7 +73,7 @@ WHERE Id=@id"; } } - public Professors ReadProfessorsNameById(int id) + public Professors ReadProfessorsById(int id) { _logger.LogInformation("Получение объекта по идентификатору"); _logger.LogDebug("Объект: {id}", id); @@ -84,13 +81,13 @@ WHERE Id=@id"; { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var querySelect = @" -SELECT * FROM ProfessorsName -WHERE Id=@id"; - var professorsName = connection.QueryFirst(querySelect, new { id }); + SELECT * FROM Professors + WHERE Id=@id"; + var professors = connection.QueryFirst(querySelect, new { id }); _logger.LogDebug("Найденный объект: {json}", - JsonConvert.SerializeObject(professorsName)); - return professorsName; + JsonConvert.SerializeObject(professors)); + return professors; } catch (Exception ex) { @@ -99,7 +96,7 @@ WHERE Id=@id"; } } - public void UpdateProfessorsName(Professors professorsName) + public void UpdateProfessors(Professors professorsName) { _logger.LogInformation("Редактирование объекта"); _logger.LogDebug("Объект: {json}", @@ -108,13 +105,11 @@ WHERE Id=@id"; { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var queryUpdate = @" - UPDATE ProfessorsName -SET -FirstName=@FirstName, -LastName=@LastName, -MiddleName=@MiddleName, -Classes=@Classes -WHERE Id=@Id"; + UPDATE Professors + SET + FirstName=@FirstName, + Surname=@Surname + WHERE Id=@Id"; connection.Execute(queryUpdate, professorsName); } catch (Exception ex) diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/StudentRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/StudentRepository.cs index a0bb006..f5baf2b 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/StudentRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/StudentRepository.cs @@ -28,8 +28,8 @@ public class StudentRepository : IStudentRepository { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var queryInsert = @" -INSERT INTO Student (FirstName, LastName, MiddleName, Phone, GroupID) -VALUES (@FirstName, @LastName, @MiddleName, @Phone, @GroupID)"; +INSERT INTO Student (Name, Surname, GroupId) +VALUES (@Name, @Surname, @GroupId)"; connection.Execute(queryInsert, student); } catch (Exception ex) @@ -113,11 +113,9 @@ WHERE Id=@id"; var queryUpdate = @" UPDATE Student SET -FirstName=@FirstName, -LastName=@LastName, -MiddleName=@MiddleName, -Phone=@Phone, -GroupID=@GroupID +Name=@Name, +Surname=@Surname, +GroupId=@GroupId WHERE Id=@Id"; connection.Execute(queryUpdate, student); } diff --git a/StudentProgress/StudentProgress/Repositories/Implementations/SubjectsRepository.cs b/StudentProgress/StudentProgress/Repositories/Implementations/SubjectsRepository.cs index 5f77047..9465931 100644 --- a/StudentProgress/StudentProgress/Repositories/Implementations/SubjectsRepository.cs +++ b/StudentProgress/StudentProgress/Repositories/Implementations/SubjectsRepository.cs @@ -17,28 +17,17 @@ namespace StudentProgress.Repositories.Implementations _logger = logger; } - // Добавление нового предмета public void CreateSubjects_(Subjects subject) { _logger.LogInformation("Добавление объекта"); _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(subject)); + try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - connection.Open(); - using var transaction = connection.BeginTransaction(); - - var queryInsert = @" -INSERT INTO Subject (NameSubject) -VALUES (@NameSubject); -SELECT MAX(Id) FROM Subject"; - - // Выполняем запрос и получаем ID созданного предмета - var subjectId = connection.QueryFirst(queryInsert, subject, transaction); - - transaction.Commit(); - - _logger.LogInformation("Успешно добавлен объект с Id: {id}", subjectId); + var queryInsert = @"INSERT INTO Subjects (NameSubject, Course) + VALUES (@NameSubject, @Course)"; + connection.Execute(queryInsert, subject); } catch (Exception ex) { @@ -47,7 +36,6 @@ SELECT MAX(Id) FROM Subject"; } } - // Удаление предмета по идентификатору public void DeleteSubjects(int id) { _logger.LogInformation("Удаление объекта"); @@ -55,20 +43,9 @@ SELECT MAX(Id) FROM Subject"; try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var queryDelete = @" -DELETE FROM Subject -WHERE Id=@Id"; - - var rowsAffected = connection.Execute(queryDelete, new { Id = id }); - - if (rowsAffected == 0) - { - _logger.LogWarning("Объект с Id: {id} не найден для удаления", id); - } - else - { - _logger.LogInformation("Объект с Id: {id} успешно удалён", id); - } + var queryDelete = @"DELETE FROM Subjects + WHERE Id=@id"; + connection.Execute(queryDelete, new { id }); } catch (Exception ex) { @@ -77,44 +54,17 @@ WHERE Id=@Id"; } } - // Получение всех предметов public IEnumerable ReadSubjects(int? id = null) { - _logger.LogInformation("Получение объектов"); + _logger.LogInformation("Получение всех объектов"); try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - - if (id.HasValue) - { - // Если указан ID, возвращаем конкретный предмет - var querySelectById = @" -SELECT * FROM Subject -WHERE Id = @Id"; - - var subject = connection.Query(querySelectById, new { Id = id.Value }).ToList(); - - if (!subject.Any()) - { - _logger.LogWarning("Объект с Id: {id} не найден", id); - } - else - { - _logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(subject)); - } - - return subject; - } - else - { - // Если ID не указан, возвращаем все предметы - var querySelectAll = @"SELECT * FROM Subject"; - - var subjects = connection.Query(querySelectAll).ToList(); - _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(subjects)); - - return subjects; - } + var querySelect = "SELECT * FROM Subjects"; + var subjects = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}", + JsonConvert.SerializeObject(subjects)); + return subjects; } catch (Exception ex) { @@ -123,7 +73,6 @@ WHERE Id = @Id"; } } - // Получение предмета по идентификатору public Subjects ReadSubjectById(int id) { _logger.LogInformation("Получение объекта по идентификатору"); @@ -131,21 +80,11 @@ WHERE Id = @Id"; try { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); - var querySelect = @" -SELECT * FROM Subject -WHERE Id = @Id"; - - var subject = connection.QueryFirstOrDefault(querySelect, new { Id = id }); - - if (subject == null) - { - _logger.LogWarning("Объект с Id: {id} не найден", id); - } - else - { - _logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(subject)); - } - + var querySelect = @"SELECT * FROM Subjects + WHERE Id=@id"; + var subject = connection.QueryFirst(querySelect, new { id }); + _logger.LogDebug("Найденный объект: {json}", + JsonConvert.SerializeObject(subject)); return subject; } catch (Exception ex) @@ -155,7 +94,6 @@ WHERE Id = @Id"; } } - // Обновление данных предмета public void UpdateSubject(Subjects subject) { _logger.LogInformation("Редактирование объекта"); @@ -166,11 +104,11 @@ WHERE Id = @Id"; connection.Open(); using var transaction = connection.BeginTransaction(); - var queryUpdate = @" -UPDATE Subject -SET NameSubject = @NameSubject -WHERE Id = @Id"; - + var queryUpdate = @"UPDATE Subjects + SET + NameSubject = @NameSubject, + Course = @Course + WHERE Id = @Id"; connection.Execute(queryUpdate, subject, transaction); transaction.Commit(); -- 2.25.1 From eb83644996779b7285b762887be550b794330dca Mon Sep 17 00:00:00 2001 From: safia Date: Thu, 19 Dec 2024 04:34:24 +0400 Subject: [PATCH 5/7] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Forms/FormGrade.Designer.cs | 99 ++-- .../Forms/FormGrades.Designer.cs | 1 + .../Forms/FormGroup.Designer.cs | 4 +- .../Forms/FormGroups.Designer.cs | 37 +- .../Forms/FormLecturesCount.Designer.cs | 34 +- .../Forms/FormProfesor.Designer.cs | 35 +- .../Forms/FormProfessors.Designer.cs | 37 +- .../Forms/FormStudents.Designer.cs | 1 + .../Forms/FormSubject.Designer.cs | 93 ++-- StudentProgress/StudentProgress/Program.cs | 19 +- .../StudentProgress/appsettings.json | 2 +- .../StudentProgress/appsettings20241204.com | 125 ----- .../StudentProgress/appsettings20241205.com | 524 ------------------ 13 files changed, 158 insertions(+), 853 deletions(-) delete mode 100644 StudentProgress/StudentProgress/appsettings20241204.com delete mode 100644 StudentProgress/StudentProgress/appsettings20241205.com diff --git a/StudentProgress/StudentProgress/Forms/FormGrade.Designer.cs b/StudentProgress/StudentProgress/Forms/FormGrade.Designer.cs index ba4e515..38d6ba7 100644 --- a/StudentProgress/StudentProgress/Forms/FormGrade.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormGrade.Designer.cs @@ -28,7 +28,6 @@ /// private void InitializeComponent() { - label1 = new Label(); label2 = new Label(); label3 = new Label(); label4 = new Label(); @@ -37,56 +36,51 @@ dateTimePicker1 = new DateTimePicker(); comboBoxSubject = new ComboBox(); comboBoxProfessor = new ComboBox(); - checkedListBoxType = new CheckedListBox(); groupBox1 = new GroupBox(); groupBox2 = new GroupBox(); dataGridView1 = new DataGridView(); ColumnStudent = new DataGridViewComboBoxColumn(); + ColumnMark = new DataGridViewTextBoxColumn(); groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); SuspendLayout(); // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(62, 49); - label1.Name = "label1"; - label1.Size = new Size(94, 32); - label1.TabIndex = 0; - label1.Text = "Работа:"; - // // label2 // label2.AutoSize = true; - label2.Location = new Point(62, 272); + label2.Location = new Point(33, 42); + label2.Margin = new Padding(2, 0, 2, 0); label2.Name = "label2"; - label2.Size = new Size(116, 32); + label2.Size = new Size(58, 15); label2.TabIndex = 1; label2.Text = "Предмет:"; // // label3 // label3.AutoSize = true; - label3.Location = new Point(62, 370); + label3.Location = new Point(33, 90); + label3.Margin = new Padding(2, 0, 2, 0); label3.Name = "label3"; - label3.Size = new Size(191, 32); + label3.Size = new Size(95, 15); label3.TabIndex = 2; label3.Text = "Преподователь:"; // // label4 // label4.AutoSize = true; - label4.Location = new Point(62, 481); + label4.Location = new Point(33, 140); + label4.Margin = new Padding(2, 0, 2, 0); label4.Name = "label4"; - label4.Size = new Size(70, 32); + label4.Size = new Size(35, 15); label4.TabIndex = 3; label4.Text = "Дата:"; // // buttonSave // - buttonSave.Location = new Point(62, 625); + buttonSave.Location = new Point(33, 188); + buttonSave.Margin = new Padding(2, 1, 2, 1); buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(150, 46); + buttonSave.Size = new Size(81, 22); buttonSave.TabIndex = 4; buttonSave.Text = "Сохранить"; buttonSave.UseVisualStyleBackColor = true; @@ -94,9 +88,10 @@ // // buttonCancel // - buttonCancel.Location = new Point(357, 625); + buttonCancel.Location = new Point(192, 188); + buttonCancel.Margin = new Padding(2, 1, 2, 1); buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(150, 46); + buttonCancel.Size = new Size(81, 22); buttonCancel.TabIndex = 5; buttonCancel.Text = "Отмена"; buttonCancel.UseVisualStyleBackColor = true; @@ -104,40 +99,37 @@ // // dateTimePicker1 // - dateTimePicker1.Location = new Point(178, 481); + dateTimePicker1.Location = new Point(81, 134); + dateTimePicker1.Margin = new Padding(2, 1, 2, 1); dateTimePicker1.Name = "dateTimePicker1"; - dateTimePicker1.Size = new Size(400, 39); + dateTimePicker1.Size = new Size(192, 23); dateTimePicker1.TabIndex = 6; // // comboBoxSubject // comboBoxSubject.FormattingEnabled = true; - comboBoxSubject.Location = new Point(267, 272); + comboBoxSubject.Location = new Point(141, 42); + comboBoxSubject.Margin = new Padding(2, 1, 2, 1); comboBoxSubject.Name = "comboBoxSubject"; - comboBoxSubject.Size = new Size(242, 40); + comboBoxSubject.Size = new Size(132, 23); comboBoxSubject.TabIndex = 8; // // comboBoxProfessor // comboBoxProfessor.FormattingEnabled = true; - comboBoxProfessor.Location = new Point(267, 370); + comboBoxProfessor.Location = new Point(141, 87); + comboBoxProfessor.Margin = new Padding(2, 1, 2, 1); comboBoxProfessor.Name = "comboBoxProfessor"; - comboBoxProfessor.Size = new Size(242, 40); + comboBoxProfessor.Size = new Size(132, 23); comboBoxProfessor.TabIndex = 9; // - // checkedListBoxType - // - checkedListBoxType.FormattingEnabled = true; - checkedListBoxType.Location = new Point(267, 49); - checkedListBoxType.Name = "checkedListBoxType"; - checkedListBoxType.Size = new Size(240, 184); - checkedListBoxType.TabIndex = 10; - // // groupBox1 // - groupBox1.Location = new Point(680, 158); + groupBox1.Location = new Point(366, 74); + groupBox1.Margin = new Padding(2, 1, 2, 1); groupBox1.Name = "groupBox1"; - groupBox1.Size = new Size(400, 200); + groupBox1.Padding = new Padding(2, 1, 2, 1); + groupBox1.Size = new Size(215, 94); groupBox1.TabIndex = 11; groupBox1.TabStop = false; groupBox1.Text = "groupBox1"; @@ -145,11 +137,9 @@ // groupBox2 // groupBox2.Controls.Add(dataGridView1); - groupBox2.Location = new Point(627, 49); - groupBox2.Margin = new Padding(6); + groupBox2.Location = new Point(338, 23); groupBox2.Name = "groupBox2"; - groupBox2.Padding = new Padding(6); - groupBox2.Size = new Size(519, 622); + groupBox2.Size = new Size(279, 221); groupBox2.TabIndex = 12; groupBox2.TabStop = false; groupBox2.Text = "Оценка"; @@ -158,13 +148,13 @@ // dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColumnStudent }); + dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColumnStudent, ColumnMark }); dataGridView1.Dock = DockStyle.Fill; - dataGridView1.Location = new Point(6, 38); - dataGridView1.Margin = new Padding(6); + dataGridView1.Location = new Point(3, 19); dataGridView1.Name = "dataGridView1"; + dataGridView1.RowHeadersVisible = false; dataGridView1.RowHeadersWidth = 82; - dataGridView1.Size = new Size(507, 578); + dataGridView1.Size = new Size(273, 199); dataGridView1.TabIndex = 0; // // ColumnStudent @@ -173,14 +163,20 @@ ColumnStudent.MinimumWidth = 10; ColumnStudent.Name = "ColumnStudent"; // + // ColumnMark + // + ColumnMark.HeaderText = "Оценка"; + ColumnMark.Name = "ColumnMark"; + ColumnMark.Resizable = DataGridViewTriState.True; + ColumnMark.SortMode = DataGridViewColumnSortMode.NotSortable; + // // FormGrade // - AutoScaleDimensions = new SizeF(13F, 32F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1161, 779); + ClientSize = new Size(625, 273); Controls.Add(groupBox2); Controls.Add(groupBox1); - Controls.Add(checkedListBoxType); Controls.Add(comboBoxProfessor); Controls.Add(comboBoxSubject); Controls.Add(dateTimePicker1); @@ -189,10 +185,9 @@ Controls.Add(label4); Controls.Add(label3); Controls.Add(label2); - Controls.Add(label1); + Margin = new Padding(2, 1, 2, 1); Name = "FormGrade"; Text = "Оценка"; - Load += FormGrade_Load; groupBox2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ResumeLayout(false); @@ -200,8 +195,6 @@ } #endregion - - private Label label1; private Label label2; private Label label3; private Label label4; @@ -210,10 +203,10 @@ private DateTimePicker dateTimePicker1; private ComboBox comboBoxSubject; private ComboBox comboBoxProfessor; - private CheckedListBox checkedListBoxType; private GroupBox groupBox1; private GroupBox groupBox2; private DataGridView dataGridView1; private DataGridViewComboBoxColumn ColumnStudent; + private DataGridViewTextBoxColumn ColumnMark; } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Forms/FormGrades.Designer.cs b/StudentProgress/StudentProgress/Forms/FormGrades.Designer.cs index 971a6ae..0f37706 100644 --- a/StudentProgress/StudentProgress/Forms/FormGrades.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormGrades.Designer.cs @@ -82,6 +82,7 @@ dataGridView.Name = "dataGridView"; dataGridView.ReadOnly = true; dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.Size = new Size(548, 271); dataGridView.TabIndex = 1; // diff --git a/StudentProgress/StudentProgress/Forms/FormGroup.Designer.cs b/StudentProgress/StudentProgress/Forms/FormGroup.Designer.cs index a8e7978..d53d63e 100644 --- a/StudentProgress/StudentProgress/Forms/FormGroup.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormGroup.Designer.cs @@ -78,14 +78,14 @@ namespace StudentProgress.Forms buttonCancel.Text = "Отмена"; buttonCancel.UseVisualStyleBackColor = true; buttonCancel.Click += buttonCancel_Click; - + // // FormGroup // AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(644, 461); - + Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(textBoxNameGroup); diff --git a/StudentProgress/StudentProgress/Forms/FormGroups.Designer.cs b/StudentProgress/StudentProgress/Forms/FormGroups.Designer.cs index 39004b1..de2db9c 100644 --- a/StudentProgress/StudentProgress/Forms/FormGroups.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormGroups.Designer.cs @@ -41,22 +41,27 @@ namespace StudentProgress.Forms // // dataGridView // + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(26, 30); - dataGridView.Margin = new Padding(6, 7, 6, 7); + dataGridView.Location = new Point(14, 14); + dataGridView.MultiSelect = false; dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersWidth = 82; - dataGridView.Size = new Size(635, 569); + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(342, 267); dataGridView.TabIndex = 0; // // buttonAdd // buttonAdd.BackgroundImage = Properties.Resources.Add; buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; - buttonAdd.Location = new Point(28, 37); - buttonAdd.Margin = new Padding(6, 7, 6, 7); + buttonAdd.Location = new Point(15, 17); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(162, 115); + buttonAdd.Size = new Size(87, 54); buttonAdd.TabIndex = 1; buttonAdd.UseVisualStyleBackColor = true; buttonAdd.Click += buttonAdd_Click; @@ -65,10 +70,9 @@ namespace StudentProgress.Forms // buttonPencil.BackgroundImage = Properties.Resources.Pencil; buttonPencil.BackgroundImageLayout = ImageLayout.Stretch; - buttonPencil.Location = new Point(28, 224); - buttonPencil.Margin = new Padding(6, 7, 6, 7); + buttonPencil.Location = new Point(15, 105); buttonPencil.Name = "buttonPencil"; - buttonPencil.Size = new Size(162, 127); + buttonPencil.Size = new Size(87, 60); buttonPencil.TabIndex = 2; buttonPencil.UseVisualStyleBackColor = true; buttonPencil.Click += buttonPencil_Click; @@ -77,10 +81,9 @@ namespace StudentProgress.Forms // buttonDel.BackgroundImage = Properties.Resources.Del; buttonDel.BackgroundImageLayout = ImageLayout.Stretch; - buttonDel.Location = new Point(28, 390); - buttonDel.Margin = new Padding(6, 7, 6, 7); + buttonDel.Location = new Point(15, 183); buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(162, 127); + buttonDel.Size = new Size(87, 60); buttonDel.TabIndex = 3; buttonDel.UseVisualStyleBackColor = true; buttonDel.Click += buttonDel_Click; @@ -90,19 +93,19 @@ namespace StudentProgress.Forms panel1.Controls.Add(buttonAdd); panel1.Controls.Add(buttonDel); panel1.Controls.Add(buttonPencil); - panel1.Location = new Point(693, 30); + panel1.Location = new Point(373, 14); + panel1.Margin = new Padding(2, 1, 2, 1); panel1.Name = "panel1"; - panel1.Size = new Size(214, 569); + panel1.Size = new Size(115, 267); panel1.TabIndex = 4; // // FormGroups // - AutoScaleDimensions = new SizeF(13F, 32F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(919, 628); + ClientSize = new Size(495, 294); Controls.Add(panel1); Controls.Add(dataGridView); - Margin = new Padding(6, 7, 6, 7); Name = "FormGroups"; Text = "Группы"; Load += FormGroups_Load; diff --git a/StudentProgress/StudentProgress/Forms/FormLecturesCount.Designer.cs b/StudentProgress/StudentProgress/Forms/FormLecturesCount.Designer.cs index 349cc40..376186b 100644 --- a/StudentProgress/StudentProgress/Forms/FormLecturesCount.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormLecturesCount.Designer.cs @@ -38,23 +38,27 @@ // // LecturesDataGridView // + LecturesDataGridView.AllowUserToResizeColumns = false; + LecturesDataGridView.AllowUserToResizeRows = false; + LecturesDataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; LecturesDataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - LecturesDataGridView.Location = new Point(15, 16); - LecturesDataGridView.Margin = new Padding(6, 7, 6, 7); + LecturesDataGridView.Location = new Point(8, 8); + LecturesDataGridView.MultiSelect = false; LecturesDataGridView.Name = "LecturesDataGridView"; + LecturesDataGridView.RowHeadersVisible = false; LecturesDataGridView.RowHeadersWidth = 82; - LecturesDataGridView.Size = new Size(841, 459); + LecturesDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + LecturesDataGridView.Size = new Size(453, 215); LecturesDataGridView.TabIndex = 0; - LecturesDataGridView.CellContentClick += LecturesDataGridView_CellContentClick; // // buttonAdd // buttonAdd.BackgroundImage = Properties.Resources.Add; buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; - buttonAdd.Location = new Point(28, 36); - buttonAdd.Margin = new Padding(13, 17, 13, 17); + buttonAdd.Location = new Point(15, 17); + buttonAdd.Margin = new Padding(7, 8, 7, 8); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(155, 128); + buttonAdd.Size = new Size(83, 60); buttonAdd.TabIndex = 1; buttonAdd.UseVisualStyleBackColor = true; buttonAdd.Click += buttonAdd_Click; @@ -63,10 +67,10 @@ // buttonDel.BackgroundImage = Properties.Resources.Del; buttonDel.BackgroundImageLayout = ImageLayout.Stretch; - buttonDel.Location = new Point(25, 281); - buttonDel.Margin = new Padding(13, 17, 13, 17); + buttonDel.Location = new Point(13, 132); + buttonDel.Margin = new Padding(7, 8, 7, 8); buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(158, 138); + buttonDel.Size = new Size(85, 65); buttonDel.TabIndex = 2; buttonDel.UseVisualStyleBackColor = true; buttonDel.Click += buttonDel_Click; @@ -75,19 +79,19 @@ // panel1.Controls.Add(buttonAdd); panel1.Controls.Add(buttonDel); - panel1.Location = new Point(885, 16); + panel1.Location = new Point(477, 8); + panel1.Margin = new Padding(2, 1, 2, 1); panel1.Name = "panel1"; - panel1.Size = new Size(216, 452); + panel1.Size = new Size(116, 212); panel1.TabIndex = 3; // // FormLecturesCount // - AutoScaleDimensions = new SizeF(13F, 32F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1112, 493); + ClientSize = new Size(599, 231); Controls.Add(panel1); Controls.Add(LecturesDataGridView); - Margin = new Padding(6, 7, 6, 7); Name = "FormLecturesCount"; Text = "Учет лекций"; Load += FormLecturesCount_Load; diff --git a/StudentProgress/StudentProgress/Forms/FormProfesor.Designer.cs b/StudentProgress/StudentProgress/Forms/FormProfesor.Designer.cs index e7785f5..692846a 100644 --- a/StudentProgress/StudentProgress/Forms/FormProfesor.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormProfesor.Designer.cs @@ -40,26 +40,23 @@ namespace StudentProgress.Forms // // textBoxFirstName // - textBoxFirstName.Location = new Point(235, 28); - textBoxFirstName.Margin = new Padding(6, 7, 6, 7); + textBoxFirstName.Location = new Point(127, 13); textBoxFirstName.Name = "textBoxFirstName"; - textBoxFirstName.Size = new Size(252, 39); + textBoxFirstName.Size = new Size(167, 23); textBoxFirstName.TabIndex = 0; // // textBoxSurname // - textBoxSurname.Location = new Point(235, 105); - textBoxSurname.Margin = new Padding(6, 7, 6, 7); + textBoxSurname.Location = new Point(127, 49); textBoxSurname.Name = "textBoxSurname"; - textBoxSurname.Size = new Size(306, 39); + textBoxSurname.Size = new Size(167, 23); textBoxSurname.TabIndex = 1; // // buttonSave // - buttonSave.Location = new Point(53, 233); - buttonSave.Margin = new Padding(6, 7, 6, 7); + buttonSave.Location = new Point(29, 109); buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(162, 57); + buttonSave.Size = new Size(87, 27); buttonSave.TabIndex = 2; buttonSave.Text = "Сохранить"; buttonSave.UseVisualStyleBackColor = true; @@ -67,10 +64,9 @@ namespace StudentProgress.Forms // // buttonCancel // - buttonCancel.Location = new Point(286, 233); - buttonCancel.Margin = new Padding(6, 7, 6, 7); + buttonCancel.Location = new Point(154, 109); buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(162, 57); + buttonCancel.Size = new Size(87, 27); buttonCancel.TabIndex = 3; buttonCancel.Text = "Отмена"; buttonCancel.UseVisualStyleBackColor = true; @@ -79,33 +75,34 @@ namespace StudentProgress.Forms // label1 // label1.AutoSize = true; - label1.Location = new Point(53, 31); + label1.Location = new Point(29, 15); + label1.Margin = new Padding(2, 0, 2, 0); label1.Name = "label1"; - label1.Size = new Size(66, 32); + label1.Size = new Size(34, 15); label1.TabIndex = 4; label1.Text = "Имя:"; // // label2 // label2.AutoSize = true; - label2.Location = new Point(53, 105); + label2.Location = new Point(29, 49); + label2.Margin = new Padding(2, 0, 2, 0); label2.Name = "label2"; - label2.Size = new Size(113, 32); + label2.Size = new Size(58, 15); label2.TabIndex = 5; label2.Text = "Фамилия"; // // FormProfessor // - AutoScaleDimensions = new SizeF(13F, 32F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(695, 354); + ClientSize = new Size(374, 166); Controls.Add(label2); Controls.Add(label1); Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(textBoxSurname); Controls.Add(textBoxFirstName); - Margin = new Padding(6, 7, 6, 7); Name = "FormProfessor"; Text = "Преподаватель"; ResumeLayout(false); diff --git a/StudentProgress/StudentProgress/Forms/FormProfessors.Designer.cs b/StudentProgress/StudentProgress/Forms/FormProfessors.Designer.cs index 474138e..52fcf53 100644 --- a/StudentProgress/StudentProgress/Forms/FormProfessors.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormProfessors.Designer.cs @@ -39,60 +39,61 @@ namespace StudentProgress.Forms // // dataGridView // + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(26, 30); - dataGridView.Margin = new Padding(6, 7, 6, 7); + dataGridView.Location = new Point(14, 14); + dataGridView.MultiSelect = false; dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersWidth = 82; - dataGridView.Size = new Size(867, 492); + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(467, 231); dataGridView.TabIndex = 0; // // buttonAdd // - buttonAdd.BackgroundImage = StudentProgress.Properties.Resources.Add; + buttonAdd.BackgroundImage = Properties.Resources.Add; buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; - buttonAdd.Location = new Point(935, 30); - buttonAdd.Margin = new Padding(6, 7, 6, 7); + buttonAdd.Location = new Point(503, 14); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(162, 118); + buttonAdd.Size = new Size(87, 55); buttonAdd.TabIndex = 1; buttonAdd.UseVisualStyleBackColor = true; buttonAdd.Click += buttonAdd_Click; // // buttonPencil // - buttonPencil.BackgroundImage = StudentProgress.Properties.Resources.Pencil; + buttonPencil.BackgroundImage = Properties.Resources.Pencil; buttonPencil.BackgroundImageLayout = ImageLayout.Stretch; - buttonPencil.Location = new Point(935, 224); - buttonPencil.Margin = new Padding(6, 7, 6, 7); + buttonPencil.Location = new Point(503, 105); buttonPencil.Name = "buttonPencil"; - buttonPencil.Size = new Size(162, 118); + buttonPencil.Size = new Size(87, 55); buttonPencil.TabIndex = 2; buttonPencil.UseVisualStyleBackColor = true; buttonPencil.Click += buttonPencil_Click; // // buttonDel // - buttonDel.BackgroundImage = StudentProgress.Properties.Resources.Del; + buttonDel.BackgroundImage = Properties.Resources.Del; buttonDel.BackgroundImageLayout = ImageLayout.Stretch; - buttonDel.Location = new Point(935, 396); - buttonDel.Margin = new Padding(6, 7, 6, 7); + buttonDel.Location = new Point(503, 186); buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(162, 126); + buttonDel.Size = new Size(87, 59); buttonDel.TabIndex = 3; buttonDel.UseVisualStyleBackColor = true; buttonDel.Click += buttonDel_Click; // // FormProfessors // - AutoScaleDimensions = new SizeF(13F, 32F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1148, 628); + ClientSize = new Size(618, 294); Controls.Add(buttonDel); Controls.Add(buttonPencil); Controls.Add(buttonAdd); Controls.Add(dataGridView); - Margin = new Padding(6, 7, 6, 7); Name = "FormProfessors"; Text = "Преподаватели"; Load += FormProfessors_Load; diff --git a/StudentProgress/StudentProgress/Forms/FormStudents.Designer.cs b/StudentProgress/StudentProgress/Forms/FormStudents.Designer.cs index fa130c6..37be8ec 100644 --- a/StudentProgress/StudentProgress/Forms/FormStudents.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormStudents.Designer.cs @@ -95,6 +95,7 @@ dataGridView.Name = "dataGridView"; dataGridView.ReadOnly = true; dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.Size = new Size(548, 271); dataGridView.TabIndex = 1; // diff --git a/StudentProgress/StudentProgress/Forms/FormSubject.Designer.cs b/StudentProgress/StudentProgress/Forms/FormSubject.Designer.cs index 4ac615a..0fb853e 100644 --- a/StudentProgress/StudentProgress/Forms/FormSubject.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormSubject.Designer.cs @@ -20,27 +20,23 @@ namespace StudentPerformance.Forms buttonSave = new Button(); buttonCancel = new Button(); labelName = new Label(); - groupBox = new GroupBox(); - dataGridView = new DataGridView(); - ColumnLast = new DataGridViewComboBoxColumn(); - groupBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + checkedListBoxCourses = new CheckedListBox(); + groupBox1 = new GroupBox(); + groupBox1.SuspendLayout(); SuspendLayout(); // // textBoxName // - textBoxName.Location = new Point(183, 47); - textBoxName.Margin = new Padding(6, 7, 6, 7); + textBoxName.Location = new Point(99, 22); textBoxName.Name = "textBoxName"; - textBoxName.Size = new Size(343, 39); + textBoxName.Size = new Size(187, 23); textBoxName.TabIndex = 0; // // buttonSave // - buttonSave.Location = new Point(32, 579); - buttonSave.Margin = new Padding(6, 7, 6, 7); + buttonSave.Location = new Point(17, 271); buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(162, 57); + buttonSave.Size = new Size(87, 27); buttonSave.TabIndex = 1; buttonSave.Text = "Сохранить"; buttonSave.UseVisualStyleBackColor = true; @@ -48,10 +44,9 @@ namespace StudentPerformance.Forms // // buttonCancel // - buttonCancel.Location = new Point(370, 597); - buttonCancel.Margin = new Padding(6, 7, 6, 7); + buttonCancel.Location = new Point(199, 280); buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(162, 57); + buttonCancel.Size = new Size(87, 27); buttonCancel.TabIndex = 2; buttonCancel.Text = "Отмена"; buttonCancel.UseVisualStyleBackColor = true; @@ -60,67 +55,44 @@ namespace StudentPerformance.Forms // labelName // labelName.AutoSize = true; - labelName.Location = new Point(32, 47); - labelName.Margin = new Padding(6, 0, 6, 0); + labelName.Location = new Point(17, 22); labelName.Name = "labelName"; - labelName.Size = new Size(111, 32); + labelName.Size = new Size(55, 15); labelName.TabIndex = 3; labelName.Text = "Предмет"; // - // groupBox + // checkedListBoxCourses // - groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - groupBox.Controls.Add(dataGridView); - groupBox.Location = new Point(32, 111); - groupBox.Margin = new Padding(6); - groupBox.Name = "groupBox"; - groupBox.Padding = new Padding(6); - groupBox.Size = new Size(494, 435); - groupBox.TabIndex = 3; - groupBox.TabStop = false; - groupBox.Text = "Преподаватели"; + checkedListBoxCourses.Dock = DockStyle.Fill; + checkedListBoxCourses.FormattingEnabled = true; + checkedListBoxCourses.Location = new Point(3, 19); + checkedListBoxCourses.Name = "checkedListBoxCourses"; + checkedListBoxCourses.Size = new Size(263, 179); + checkedListBoxCourses.TabIndex = 4; // - // dataGridView + // groupBox1 // - dataGridView.AllowUserToDeleteRows = false; - dataGridView.AllowUserToResizeColumns = false; - dataGridView.AllowUserToResizeRows = false; - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnLast }); - dataGridView.Dock = DockStyle.Fill; - dataGridView.Location = new Point(6, 38); - dataGridView.Margin = new Padding(6); - dataGridView.MultiSelect = false; - dataGridView.Name = "dataGridView"; - dataGridView.RowHeadersVisible = false; - dataGridView.RowHeadersWidth = 82; - dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(482, 391); - dataGridView.TabIndex = 0; - // - // ColumnLast - // - ColumnLast.HeaderText = "Фамилия преподавателя"; - ColumnLast.MinimumWidth = 10; - ColumnLast.Name = "ColumnLast"; - ColumnLast.Width = 200; + groupBox1.Controls.Add(checkedListBoxCourses); + groupBox1.Location = new Point(17, 64); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new Size(269, 201); + groupBox1.TabIndex = 5; + groupBox1.TabStop = false; + groupBox1.Text = "Курсы"; // // FormSubject // - AutoScaleDimensions = new SizeF(13F, 32F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(590, 719); - Controls.Add(groupBox); + ClientSize = new Size(318, 337); + Controls.Add(groupBox1); Controls.Add(labelName); Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(textBoxName); - Margin = new Padding(6, 7, 6, 7); Name = "FormSubject"; Text = "Предметы"; - Load += FormSubject_Load; - groupBox.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + groupBox1.ResumeLayout(false); ResumeLayout(false); PerformLayout(); } @@ -129,8 +101,7 @@ namespace StudentPerformance.Forms private System.Windows.Forms.Button buttonSave; private System.Windows.Forms.Button buttonCancel; private System.Windows.Forms.Label labelName; - private GroupBox groupBox; - private DataGridView dataGridView; - private DataGridViewComboBoxColumn ColumnLast; + private CheckedListBox checkedListBoxCourses; + private GroupBox groupBox1; } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Program.cs b/StudentProgress/StudentProgress/Program.cs index 000fa72..1f402b4 100644 --- a/StudentProgress/StudentProgress/Program.cs +++ b/StudentProgress/StudentProgress/Program.cs @@ -3,14 +3,9 @@ using Microsoft.Extensions.Logging; using Serilog; using Unity; using Unity.Lifetime; -using Serilog.Extensions.Logging; -using StudentProgress.Forms; using StudentProgress.Repositories; using StudentProgress.Repositories.Implementations; -using Unity; using Unity.Microsoft.Logging; -using System; -using System.Windows.Forms; using StudentPerformance.Repositories.Implementations; namespace StudentProgress @@ -28,17 +23,14 @@ namespace StudentProgress Application.Run(container.Resolve()); } - public static UnityContainer CreateContainer() + public static IUnityContainer CreateContainer() { var container = new UnityContainer(); - // container.AddExtension(new LoggingExtension(CreateLoggerFactory())); - // container.RegisterType(new SingletonLifetimeManager()); - // container.RegisterType(new TransientLifetimeManager()); container.RegisterType(new TransientLifetimeManager()); container.RegisterType(new TransientLifetimeManager()); @@ -46,15 +38,6 @@ namespace StudentProgress container.RegisterType(new TransientLifetimeManager()); container.RegisterType(new TransientLifetimeManager()); - // - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - return container; } diff --git a/StudentProgress/StudentProgress/appsettings.json b/StudentProgress/StudentProgress/appsettings.json index 0258958..11a02b2 100644 --- a/StudentProgress/StudentProgress/appsettings.json +++ b/StudentProgress/StudentProgress/appsettings.json @@ -6,7 +6,7 @@ { "Name": "File", "Args": { - "path": "C:\\отп\\StudentProgress\\StudentProgress\\appsettings.json", + "path": "Logs/log.txt", "rollingInterval": "Day" } } diff --git a/StudentProgress/StudentProgress/appsettings20241204.com b/StudentProgress/StudentProgress/appsettings20241204.com deleted file mode 100644 index bb0380d..0000000 --- a/StudentProgress/StudentProgress/appsettings20241204.com +++ /dev/null @@ -1,125 +0,0 @@ -2024-12-04 18:12:04.577 +04:00 [INF] Получение групп -2024-12-04 18:12:05.492 +04:00 [ERR] Ошибка при чтении групп -System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. - at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 -2024-12-04 18:12:33.740 +04:00 [INF] Добавление группы -2024-12-04 18:12:34.889 +04:00 [DBG] Группа: {"Id":0,"NameGroup":"vhghg"} -2024-12-04 18:12:35.068 +04:00 [ERR] Ошибка при добавлении группы -System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. - at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 29 -2024-12-04 18:12:41.544 +04:00 [INF] Получение групп -2024-12-04 18:12:41.590 +04:00 [ERR] Ошибка при чтении групп -System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. - at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 -2024-12-04 18:14:45.539 +04:00 [INF] Получение групп -2024-12-04 18:14:45.623 +04:00 [ERR] Ошибка при чтении групп -System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. - at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 -2024-12-04 18:27:30.144 +04:00 [INF] Получение групп -2024-12-04 18:27:30.580 +04:00 [ERR] Ошибка при чтении групп -System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. - at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 -2024-12-04 18:40:36.369 +04:00 [INF] Получение групп -2024-12-04 18:40:37.721 +04:00 [ERR] Ошибка при чтении групп -System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. - at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 64 -2024-12-04 19:09:36.613 +04:00 [INF] Получение всех объектов -2024-12-04 19:09:37.378 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.Open() - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 - Exception data: - Severity: FATAL - SqlState: 3D000 - MessageText: database "studentperformancebd" does not exist - File: postinit.c - Line: 1050 - Routine: InitPostgres -2024-12-04 19:48:23.173 +04:00 [INF] Получение всех объектов -2024-12-04 19:48:26.525 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.Open() - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 - Exception data: - Severity: FATAL - SqlState: 3D000 - MessageText: database "studentperformancebd" does not exist - File: postinit.c - Line: 1050 - Routine: InitPostgres diff --git a/StudentProgress/StudentProgress/appsettings20241205.com b/StudentProgress/StudentProgress/appsettings20241205.com deleted file mode 100644 index a1e9f79..0000000 --- a/StudentProgress/StudentProgress/appsettings20241205.com +++ /dev/null @@ -1,524 +0,0 @@ -2024-12-05 03:52:19.883 +04:00 [INF] Получение всех объектов -2024-12-05 03:52:20.333 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.Open() - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 - Exception data: - Severity: FATAL - SqlState: 3D000 - MessageText: database "studentperformancebd" does not exist - File: postinit.c - Line: 1050 - Routine: InitPostgres -2024-12-05 03:52:31.028 +04:00 [INF] Получение оценок -2024-12-05 03:52:31.056 +04:00 [ERR] Ошибка при чтении оценок -System.ArgumentException: Keyword not supported: 'host'. - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.GradesRepository.ReadGrades(Nullable`1 dateFrom, Nullable`1 dateTo, Nullable`1 subjectsId, Nullable`1 professorsId) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GradesRepository.cs:line 64 -2024-12-05 03:52:40.306 +04:00 [INF] Получение оценок -2024-12-05 03:52:40.306 +04:00 [ERR] Ошибка при чтении оценок -System.ArgumentException: Keyword not supported: 'host'. - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.GradesRepository.ReadGrades(Nullable`1 dateFrom, Nullable`1 dateTo, Nullable`1 subjectsId, Nullable`1 professorsId) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GradesRepository.cs:line 64 -2024-12-05 03:52:50.012 +04:00 [INF] Получение преподавателей -2024-12-05 03:52:50.013 +04:00 [ERR] Ошибка при чтении преподавателей -System.ArgumentException: Keyword not supported: 'host'. - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.ProfessorsNameRepository.ReadProfessorsName() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\ProfessorsNameRepository.cs:line 64 -2024-12-05 08:57:04.261 +04:00 [INF] Получение объектов -2024-12-05 08:57:05.030 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.Open() - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentProgress.Repositories.Implementations.SubjectsRepository.ReadSubjects(Nullable`1 id) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\SubjectsRepository.cs:line 113 - Exception data: - Severity: FATAL - SqlState: 3D000 - MessageText: database "studentperformancebd" does not exist - File: postinit.c - Line: 1050 - Routine: InitPostgres -2024-12-05 12:31:25.485 +04:00 [INF] Получение всех объектов -2024-12-05 12:31:26.556 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 3D000: database "studentperformancebd" does not exist - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.Open() - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 - Exception data: - Severity: FATAL - SqlState: 3D000 - MessageText: database "studentperformancebd" does not exist - File: postinit.c - Line: 1050 - Routine: InitPostgres -2024-12-05 12:58:08.317 +04:00 [INF] Получение оценок -2024-12-05 12:58:08.808 +04:00 [ERR] Ошибка при чтении оценок -System.ArgumentException: Keyword not supported: 'host'. - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.GradesRepository.ReadGrades(Nullable`1 dateFrom, Nullable`1 dateTo, Nullable`1 subjectsId, Nullable`1 professorsId) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GradesRepository.cs:line 64 -2024-12-05 12:58:26.316 +04:00 [INF] Получение лекций -2024-12-05 12:58:26.999 +04:00 [ERR] Ошибка при чтении лекций -System.ArgumentException: Keyword not supported: 'host'. - at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey) - at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) - at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) - at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) - at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) - at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) - at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) - at System.Data.SqlClient.SqlConnection..ctor(String connectionString) - at StudentProgress.Repositories.Implementations.LecturesRepository.ReadLectures() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\LecturesRepository.cs:line 28 -2024-12-05 13:06:50.514 +04:00 [INF] Получение всех объектов -2024-12-05 13:06:51.428 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 3D000: database "StudentProgress" does not exist - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.Internal.NpgsqlConnector.g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.PoolingDataSource.g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlConnection.Open() - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1183 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroup() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 65 - Exception data: - Severity: FATAL - SqlState: 3D000 - MessageText: database "StudentProgress" does not exist - File: postinit.c - Line: 1050 - Routine: InitPostgres -2024-12-05 13:08:15.288 +04:00 [INF] Получение всех объектов -2024-12-05 13:08:16.452 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":""},{"Id":0,"NameGroup":""}] -2024-12-05 13:08:30.577 +04:00 [INF] Добавление объекта -2024-12-05 13:08:30.579 +04:00 [DBG] Объект: {"Id":0,"NameGroup":"исэбд-22"} -2024-12-05 13:08:30.724 +04:00 [ERR] Ошибка при добавлении объекта -Npgsql.PostgresException (0x80004005): 42703: column "namegroup" of relation "groups" does not exist - -POSITION: 21 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery() - at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 - at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 - at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 - at StudentPerformance.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 30 - Exception data: - Severity: ERROR - SqlState: 42703 - MessageText: column "namegroup" of relation "groups" does not exist - Position: 21 - File: parse_target.c - Line: 1070 - Routine: checkInsertTargets -2024-12-05 13:10:04.161 +04:00 [INF] Добавление объекта -2024-12-05 13:10:04.174 +04:00 [DBG] Объект: {"Id":0,"NameGroup":"22"} -2024-12-05 13:10:04.323 +04:00 [ERR] Ошибка при добавлении объекта -Npgsql.PostgresException (0x80004005): 42703: column "namegroup" of relation "groups" does not exist - -POSITION: 21 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery() - at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 - at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 - at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 - at StudentPerformance.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 30 - Exception data: - Severity: ERROR - SqlState: 42703 - MessageText: column "namegroup" of relation "groups" does not exist - Position: 21 - File: parse_target.c - Line: 1070 - Routine: checkInsertTargets -2024-12-05 13:10:16.998 +04:00 [INF] Получение всех объектов -2024-12-05 13:10:17.016 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":""},{"Id":0,"NameGroup":""}] -2024-12-05 13:16:20.215 +04:00 [INF] Получение всех объектов -2024-12-05 13:16:22.404 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] -2024-12-05 13:16:41.980 +04:00 [INF] Добавление объекта -2024-12-05 13:16:41.983 +04:00 [DBG] Объект: {"Id":0,"NameGroup":"исэбд-22"} -2024-12-05 13:16:42.208 +04:00 [ERR] Ошибка при добавлении объекта -Npgsql.PostgresException (0x80004005): 42703: column "course" of relation "groups" does not exist - -POSITION: 32 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery() - at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 - at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 - at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 - at StudentPerformance.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 30 - Exception data: - Severity: ERROR - SqlState: 42703 - MessageText: column "course" of relation "groups" does not exist - Position: 32 - File: parse_target.c - Line: 1070 - Routine: checkInsertTargets -2024-12-05 13:17:02.529 +04:00 [INF] Получение объекта по идентификатору -2024-12-05 13:17:02.530 +04:00 [DBG] Объект: 0 -2024-12-05 13:17:02.612 +04:00 [ERR] Ошибка при поиске объекта -Npgsql.PostgresException (0x80004005): 42703: column "id" does not exist - -POSITION: 31 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) - at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) - at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 - at Dapper.SqlMapper.QueryRowImpl[T](IDbConnection cnn, Row row, CommandDefinition& command, Type effectiveType) in /_/Dapper/SqlMapper.cs:line 1277 - at Dapper.SqlMapper.QueryFirst[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 836 - at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroupById(Int32 id) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 87 - Exception data: - Severity: ERROR - SqlState: 42703 - MessageText: column "id" does not exist - Position: 31 - File: parse_relation.c - Line: 3721 - Routine: errorMissingColumn -2024-12-05 13:17:05.088 +04:00 [INF] Получение всех объектов -2024-12-05 13:17:05.102 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] -2024-12-05 13:17:08.655 +04:00 [INF] Получение всех объектов -2024-12-05 13:17:08.663 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] -2024-12-05 13:17:15.051 +04:00 [INF] Удаление объекта -2024-12-05 13:17:15.053 +04:00 [DBG] Объект: 0 -2024-12-05 13:17:15.119 +04:00 [ERR] Ошибка при удалении объекта -Npgsql.PostgresException (0x80004005): 42703: column "id" does not exist - -POSITION: 29 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery() - at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 - at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 - at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 - at StudentPerformance.Repositories.Implementations.GroupRepository.DeleteGroup(Int32 id) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 49 - Exception data: - Severity: ERROR - SqlState: 42703 - MessageText: column "id" does not exist - Position: 29 - File: parse_relation.c - Line: 3721 - Routine: errorMissingColumn -2024-12-05 13:19:43.949 +04:00 [INF] Получение всех объектов -2024-12-05 13:19:46.043 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] -2024-12-05 13:20:01.938 +04:00 [INF] Добавление объекта -2024-12-05 13:20:01.942 +04:00 [DBG] Объект: {"Id":0,"NameGroup":"исэбд-22"} -2024-12-05 13:20:02.154 +04:00 [ERR] Ошибка при добавлении объекта -Npgsql.PostgresException (0x80004005): 42703: column "namefaculty" of relation "groups" does not exist - -POSITION: 40 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery() - at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 - at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 - at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 - at StudentPerformance.Repositories.Implementations.GroupRepository.CreateGroup(Group group) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 30 - Exception data: - Severity: ERROR - SqlState: 42703 - MessageText: column "namefaculty" of relation "groups" does not exist - Position: 40 - File: parse_target.c - Line: 1070 - Routine: checkInsertTargets -2024-12-05 13:20:45.534 +04:00 [INF] Получение объекта по идентификатору -2024-12-05 13:20:45.537 +04:00 [DBG] Объект: 0 -2024-12-05 13:20:45.613 +04:00 [ERR] Ошибка при поиске объекта -Npgsql.PostgresException (0x80004005): 42703: column "id" does not exist - -POSITION: 31 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) - at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) - at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 - at Dapper.SqlMapper.QueryRowImpl[T](IDbConnection cnn, Row row, CommandDefinition& command, Type effectiveType) in /_/Dapper/SqlMapper.cs:line 1277 - at Dapper.SqlMapper.QueryFirst[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 836 - at StudentPerformance.Repositories.Implementations.GroupRepository.ReadGroupById(Int32 id) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\GroupRepository.cs:line 87 - Exception data: - Severity: ERROR - SqlState: 42703 - MessageText: column "id" does not exist - Position: 31 - File: parse_relation.c - Line: 3721 - Routine: errorMissingColumn -2024-12-05 13:20:47.672 +04:00 [INF] Получение всех объектов -2024-12-05 13:20:47.694 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] -2024-12-05 13:20:52.194 +04:00 [INF] Получение всех объектов -2024-12-05 13:20:52.248 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 42P01: relation "student" does not exist - -POSITION: 15 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) - at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) - at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentPerformance.Repositories.Implementations.StudentRepository.ReadStudents(Nullable`1 groupID) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\StudentRepository.cs:line 93 - Exception data: - Severity: ERROR - SqlState: 42P01 - MessageText: relation "student" does not exist - Position: 15 - File: parse_relation.c - Line: 1452 - Routine: parserOpenTable -2024-12-05 13:21:00.660 +04:00 [INF] Получение всех объектов -2024-12-05 13:21:00.670 +04:00 [DBG] Полученные объекты: [{"Id":0,"NameGroup":"Группа 1"},{"Id":0,"NameGroup":"Группа 2"}] -2024-12-05 13:21:07.759 +04:00 [INF] Добавление объекта -2024-12-05 13:21:07.768 +04:00 [DBG] Объект: {"Id":0,"Name":"авава","Surname":"вваав","GroupId":0} -2024-12-05 13:21:07.812 +04:00 [ERR] Ошибка при добавлении объекта -Npgsql.PostgresException (0x80004005): 42P01: relation "student" does not exist - -POSITION: 15 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteNonQuery() - at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2965 - at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 656 - at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527 - at StudentPerformance.Repositories.Implementations.StudentRepository.CreateStudent(Student student) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\StudentRepository.cs:line 33 - Exception data: - Severity: ERROR - SqlState: 42P01 - MessageText: relation "student" does not exist - Position: 15 - File: parse_relation.c - Line: 1452 - Routine: parserOpenTable -2024-12-05 13:21:19.384 +04:00 [INF] Получение всех объектов -2024-12-05 13:21:19.454 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 42P01: relation "student" does not exist - -POSITION: 15 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) - at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) - at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentPerformance.Repositories.Implementations.StudentRepository.ReadStudents(Nullable`1 groupID) in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\StudentRepository.cs:line 93 - Exception data: - Severity: ERROR - SqlState: 42P01 - MessageText: relation "student" does not exist - Position: 15 - File: parse_relation.c - Line: 1452 - Routine: parserOpenTable -2024-12-05 13:21:26.154 +04:00 [INF] Получение всех объектов -2024-12-05 13:21:26.191 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 42P01: relation "professorsname" does not exist - -POSITION: 15 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) - at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) - at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentProgress.Repositories.Implementations.ProfessorsNameRepository.ReadProfessorsName() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\ProfessorsNameRepository.cs:line 67 - Exception data: - Severity: ERROR - SqlState: 42P01 - MessageText: relation "professorsname" does not exist - Position: 15 - File: parse_relation.c - Line: 1452 - Routine: parserOpenTable -2024-12-05 13:21:38.506 +04:00 [INF] Получение всех объектов -2024-12-05 13:21:38.559 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 42P01: relation "professorsname" does not exist - -POSITION: 15 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) - at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) - at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentProgress.Repositories.Implementations.ProfessorsNameRepository.ReadProfessorsName() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\ProfessorsNameRepository.cs:line 67 - Exception data: - Severity: ERROR - SqlState: 42P01 - MessageText: relation "professorsname" does not exist - Position: 15 - File: parse_relation.c - Line: 1452 - Routine: parserOpenTable -2024-12-05 13:21:49.442 +04:00 [INF] Получение всех объектов -2024-12-05 13:21:49.533 +04:00 [ERR] Ошибка при чтении объектов -Npgsql.PostgresException (0x80004005): 42P01: relation "professorsname" does not exist - -POSITION: 15 - at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) - at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) - at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) - at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in /_/Dapper/SqlMapper.cs:line 1156 - at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1184 - at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) - at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) - at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 815 - at StudentProgress.Repositories.Implementations.ProfessorsNameRepository.ReadProfessorsName() in C:\отп\StudentProgress\StudentProgress\Repositories\Implementations\ProfessorsNameRepository.cs:line 67 - Exception data: - Severity: ERROR - SqlState: 42P01 - MessageText: relation "professorsname" does not exist - Position: 15 - File: parse_relation.c - Line: 1452 - Routine: parserOpenTable -- 2.25.1 From 472f599a62dc468518805a151ddb4d40dc67ff0d Mon Sep 17 00:00:00 2001 From: safia Date: Thu, 19 Dec 2024 05:24:11 +0400 Subject: [PATCH 6/7] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudentProgress/Forms/FormGrade.cs | 55 ++++--------------- 1 file changed, 10 insertions(+), 45 deletions(-) diff --git a/StudentProgress/StudentProgress/Forms/FormGrade.cs b/StudentProgress/StudentProgress/Forms/FormGrade.cs index 6feea54..4b749ab 100644 --- a/StudentProgress/StudentProgress/Forms/FormGrade.cs +++ b/StudentProgress/StudentProgress/Forms/FormGrade.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; -using StudentProgress.Entities; +using StudentProgress.Entities; using StudentProgress.Entities.Enums; using StudentProgress.Repositories; @@ -18,23 +15,16 @@ namespace StudentProgress.Forms IProfessorsRepository professorsRepository, IStudentRepository studentRepository) { InitializeComponent(); + _gradesRepository = gradesRepository ?? throw new ArgumentNullException(nameof(gradesRepository)); _subjectsRepository = subjectsRepository ?? throw new ArgumentNullException(nameof(subjectsRepository)); _professorsRepository = professorsRepository ?? throw new ArgumentNullException(nameof(professorsRepository)); _studentRepository = studentRepository ?? throw new ArgumentNullException(nameof(studentRepository)); - LoadWorkTypes(); LoadSubjects(); LoadProfessors(); LoadStudents(); - } - private void LoadWorkTypes() - { - foreach (var elem in Enum.GetValues(typeof(TypeOfWork))) - { - checkedListBoxType.Items.Add(elem); - } } private void LoadSubjects() @@ -47,9 +37,9 @@ namespace StudentProgress.Forms private void LoadProfessors() { - var professors = _professorsRepository.ReadProfessorsName(); + var professors = _professorsRepository.ReadProfessors(); comboBoxProfessor.DataSource = professors; - comboBoxProfessor.DisplayMember = "FirstNameProfessor"; + comboBoxProfessor.DisplayMember = "FirstName"; comboBoxProfessor.ValueMember = "Id"; } @@ -65,11 +55,11 @@ namespace StudentProgress.Forms { try { - if (comboBoxSubject.SelectedIndex < 0 || checkedListBoxType.CheckedItems.Count == 0) + if (comboBoxSubject.SelectedIndex < 0 || dataGridView1.RowCount < 1) { throw new Exception("Имеются незаполненные поля"); } - CreateGrade(0); + _gradesRepository.CreateGrade(CreateGrade(0)); Close(); } catch (Exception ex) @@ -80,43 +70,18 @@ namespace StudentProgress.Forms private void buttonCancel_Click(object sender, EventArgs e) => Close(); - private Grades CreateGrade(int id) - { - TypeOfWork typeOfWork = TypeOfWork.None; - foreach (var elem in checkedListBoxType.CheckedItems) - { - typeOfWork |= (TypeOfWork)elem; - } - return Grades.CreateEntity(id, (int)comboBoxSubject.SelectedValue, (int)comboBoxProfessor.SelectedValue, dateTimePicker1.Value); - } + private Grades CreateGrade(int id) => Grades.CreateEntity(id, (int)comboBoxSubject.SelectedValue!, (int)comboBoxProfessor.SelectedValue!, dateTimePicker1.Value, CreateListStudentGradesFromDataGrid()); - private void FormGrade_Load(object sender, EventArgs e) - { - var columnGrade = new DataGridViewComboBoxColumn - { - Name = "ColumnGrade", - HeaderText = "Оценка", - DataSource = Enum.GetValues(typeof(Grade)) - }; - - if (dataGridView1.Columns["ColumnGrade"] != null) - { - dataGridView1.Columns.Remove("ColumnGrade"); - } - - dataGridView1.Columns.Add(columnGrade); - } - - private List CreateListFeedFeedReplenishmentsFromDataGrid() + public List CreateListStudentGradesFromDataGrid() { var list = new List(); foreach (DataGridViewRow row in dataGridView1.Rows) { - if (row.Cells["ColumnStudent"].Value == null || row.Cells["ColumnGrade"].Value == null) + if (row.Cells["ColumnStudent"].Value == null || row.Cells["ColumnMark"].Value == null) { continue; } - list.Add(StudentGrades.CreateEntity(0, Convert.ToInt32(row.Cells["ColumnStudent"].Value), (Grade)(row.Cells["ColumnGrade"].Value))); + list.Add(StudentGrades.CreateEntity(0, Convert.ToInt32(row.Cells["ColumnStudent"].Value), (Grade)Convert.ToInt32(row.Cells["ColumnMark"].Value))); } return list; } -- 2.25.1 From 88a334708bc94b89cb5eccd393e996e0a75a0980 Mon Sep 17 00:00:00 2001 From: safia <116575516+safia@users.noreply.github.com> Date: Sat, 21 Dec 2024 14:15:19 +0400 Subject: [PATCH 7/7] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudentProgress/Forms/FormSubject.cs | 57 +++++++++++- .../Forms/FormSubjects.Designer.cs | 37 +++++--- .../StudentProgress/Forms/FormSubjects.cs | 91 +++++++++++++------ .../StudentProgress/Forms/FormSubjects.resx | 4 +- 4 files changed, 142 insertions(+), 47 deletions(-) diff --git a/StudentProgress/StudentProgress/Forms/FormSubject.cs b/StudentProgress/StudentProgress/Forms/FormSubject.cs index bcea12a..e6fb092 100644 --- a/StudentProgress/StudentProgress/Forms/FormSubject.cs +++ b/StudentProgress/StudentProgress/Forms/FormSubject.cs @@ -1,4 +1,5 @@ using StudentProgress.Entities; +using StudentProgress.Entities.Enums; using StudentProgress.Repositories; using System; using System.Windows.Forms; @@ -8,11 +9,46 @@ namespace StudentPerformance.Forms public partial class FormSubject : Form { private readonly ISubjectsRepository _subjectsRepository; + private int? _subjectId; + public int Id + { + set + { + try + { + var subject = _subjectsRepository.ReadSubjectById(value); + if (subject == null) + { + throw new InvalidDataException(nameof(subject)); + } + + foreach (Course elem in Enum.GetValues(typeof(Course))) + { + if ((elem & subject.Course) != 0) + { + checkedListBoxCourses.SetItemChecked(checkedListBoxCourses.Items.IndexOf(elem), true); + } + } + textBoxName.Text = subject.NameSubject; + _subjectId = subject.Id; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } public FormSubject(ISubjectsRepository subjectsRepository) { InitializeComponent(); _subjectsRepository = subjectsRepository ?? throw new ArgumentNullException(nameof(subjectsRepository)); + + foreach (var elem in Enum.GetValues(typeof(Course))) + { + checkedListBoxCourses.Items.Add(elem); + } } private void buttonSave_Click(object sender, EventArgs e) @@ -23,9 +59,14 @@ namespace StudentPerformance.Forms { throw new Exception("Имя предмета не может быть пустым"); } - - var subject = Subjects.CreateEntity_(0, textBoxName.Text); - _subjectsRepository.CreateSubjects_(subject); + if (_subjectId.HasValue) + { + _subjectsRepository.UpdateSubject(CreateEntity(_subjectId.Value)); + } + else + { + _subjectsRepository.CreateSubjects_(CreateEntity(0)); + } Close(); } catch (Exception ex) @@ -36,9 +77,15 @@ namespace StudentPerformance.Forms private void buttonCancel_Click(object sender, EventArgs e) => Close(); - private void FormSubject_Load(object sender, EventArgs e) + private Subjects CreateEntity(int id) { - // Инициализация формы, если необходимо + Course course = Course.None; + + foreach (var elem in checkedListBoxCourses.CheckedItems) + { + course |= (Course)elem; + } + return Subjects.CreateEntity_(id, textBoxName.Text, course); } } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs b/StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs index ef5306e..cde700d 100644 --- a/StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs +++ b/StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs @@ -36,29 +36,29 @@ namespace StudentProgress.Forms buttonDel = new Button(); buttonAdd = new Button(); dataGridView = new DataGridView(); + buttonUpd = new Button(); panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); // // panel1 // + panel1.Controls.Add(buttonUpd); panel1.Controls.Add(buttonDel); panel1.Controls.Add(buttonAdd); panel1.Dock = DockStyle.Right; - panel1.Location = new Point(1018, 0); - panel1.Margin = new Padding(6, 6, 6, 6); + panel1.Location = new Point(548, 0); panel1.Name = "panel1"; - panel1.Size = new Size(139, 578); + panel1.Size = new Size(75, 271); panel1.TabIndex = 0; // // buttonDel // buttonDel.BackgroundImage = Properties.Resources.Del; buttonDel.BackgroundImageLayout = ImageLayout.Stretch; - buttonDel.Location = new Point(13, 367); - buttonDel.Margin = new Padding(6, 6, 6, 6); + buttonDel.Location = new Point(7, 172); buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(104, 113); + buttonDel.Size = new Size(56, 53); buttonDel.TabIndex = 1; buttonDel.UseVisualStyleBackColor = true; buttonDel.Click += buttonDel_Click; @@ -67,10 +67,9 @@ namespace StudentProgress.Forms // buttonAdd.BackgroundImage = Properties.Resources.Add; buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; - buttonAdd.Location = new Point(13, 73); - buttonAdd.Margin = new Padding(6, 6, 6, 6); + buttonAdd.Location = new Point(7, 34); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(104, 113); + buttonAdd.Size = new Size(56, 53); buttonAdd.TabIndex = 0; buttonAdd.UseVisualStyleBackColor = true; buttonAdd.Click += buttonAdd_Click; @@ -85,23 +84,32 @@ namespace StudentProgress.Forms dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.Dock = DockStyle.Fill; dataGridView.Location = new Point(0, 0); - dataGridView.Margin = new Padding(6, 6, 6, 6); dataGridView.MultiSelect = false; dataGridView.Name = "dataGridView"; dataGridView.ReadOnly = true; dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersWidth = 82; - dataGridView.Size = new Size(1018, 578); + dataGridView.Size = new Size(548, 271); dataGridView.TabIndex = 1; // + // buttonUpd + // + buttonUpd.BackgroundImage = Properties.Resources.Pencil; + buttonUpd.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpd.Location = new Point(7, 93); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(56, 53); + buttonUpd.TabIndex = 2; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += buttonUpd_Click; + // // FormSubjects // - AutoScaleDimensions = new SizeF(13F, 32F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1157, 578); + ClientSize = new Size(623, 271); Controls.Add(dataGridView); Controls.Add(panel1); - Margin = new Padding(6, 6, 6, 6); Name = "FormSubjects"; Text = "Предметы"; Load += FormSubjects_Load; @@ -116,5 +124,6 @@ namespace StudentProgress.Forms private DataGridView dataGridView; private Button buttonDel; private Button buttonAdd; + private Button buttonUpd; } } \ No newline at end of file diff --git a/StudentProgress/StudentProgress/Forms/FormSubjects.cs b/StudentProgress/StudentProgress/Forms/FormSubjects.cs index 6c07d9c..db5647e 100644 --- a/StudentProgress/StudentProgress/Forms/FormSubjects.cs +++ b/StudentProgress/StudentProgress/Forms/FormSubjects.cs @@ -9,50 +9,89 @@ namespace StudentProgress.Forms public partial class FormSubjects : Form { private readonly ISubjectsRepository _subjectsRepository; + private readonly IUnityContainer _container; - public FormSubjects() + public FormSubjects(IUnityContainer container, ISubjectsRepository subjectsRepository) { InitializeComponent(); - var container = Program.CreateContainer(); // Получаем контейнер Unity - _subjectsRepository = container.Resolve(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + _subjectsRepository = subjectsRepository ?? throw new ArgumentNullException(nameof(subjectsRepository)); } - private void FormSubjects_Load(object sender, EventArgs e) - { - // Загрузка данных в DataGridView - LoadData(); - } + private void FormSubjects_Load(object sender, EventArgs e) => LoadData(); private void LoadData() { - // Пример загрузки данных из репозитория - var subjects = _subjectsRepository.ReadSubjects(); - dataGridView.DataSource = subjects; + dataGridView.DataSource = _subjectsRepository.ReadSubjects(); + dataGridView.Columns["Id"].Visible = false; } - private void buttonAdd_Click(object sender, EventArgs e) { - // Логика добавления нового предмета - using (var form = new FormSubject(Program.CreateContainer().Resolve())) + try { - if (form.ShowDialog() == DialogResult.OK) - { - LoadData(); - } + _container.Resolve().ShowDialog(); + LoadData(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void buttonDel_Click(object sender, EventArgs e) { - // Логика удаления выбранного предмета - if (dataGridView.SelectedRows.Count > 0) + if (!TryGetIdentifierFromSelectedRow(out var findId)) { - var selectedSubject = dataGridView.SelectedRows[0].DataBoundItem as Entities.Subjects; - if (selectedSubject != null) - { - _subjectsRepository.DeleteSubjects(selectedSubject.Id); - LoadData(); - } + return; + } + + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _subjectsRepository.DeleteSubjects(findId); + LoadData(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + + } + + private void buttonUpd_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + LoadData(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } diff --git a/StudentProgress/StudentProgress/Forms/FormSubjects.resx b/StudentProgress/StudentProgress/Forms/FormSubjects.resx index 8b2ff64..af32865 100644 --- a/StudentProgress/StudentProgress/Forms/FormSubjects.resx +++ b/StudentProgress/StudentProgress/Forms/FormSubjects.resx @@ -1,7 +1,7 @@