Pibd-22_Lyakhov_T_I_Lab2_Simple #3
@ -61,6 +61,7 @@
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Enabled = false;
|
||||
dateTimePicker.Location = new Point(13, 163);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(250, 27);
|
||||
|
@ -47,7 +47,7 @@ namespace StudentProgressRecord.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dataGridView.RowCount < 1 || comboBoxTeacher.SelectedIndex < 0 || comboBoxSubject.SelectedIndex < 0)
|
||||
if (dataGridView.RowCount < 2 || comboBoxTeacher.SelectedIndex < 0 || comboBoxSubject.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненые поля");
|
||||
}
|
||||
|
@ -61,7 +61,24 @@ namespace StudentProgressRecord.RepositoryImp
|
||||
|
||||
public Subject ReadSubjectById(long id)
|
||||
{
|
||||
return Subject.CreateEntity(0, string.Empty, Direction.None);
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.GetConnectionString());
|
||||
var querySelect = @"
|
||||
SELECT * FROM Subject
|
||||
WHERE Id=@id";
|
||||
var obj = connection.QueryFirst<Subject>(querySelect, new { id });
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonConvert.SerializeObject(obj));
|
||||
return obj;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Subject> ReadSubjects()
|
||||
|
Loading…
Reference in New Issue
Block a user