From cbd3383e0c9084bc8ff5b716d6c76a8b5a4fe767 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Thu, 16 May 2024 22:45:48 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BB=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B8?= =?UTF-8?q?=20null=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=B2=20=D0=B1=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MedicalPostgresqlDatabase/AbstractPostgresqlStorage.cs | 4 ++-- Medical/MedicalPostgresqlDatabase/Storages/VisitStorage.cs | 2 +- Medical/MedicalView/Visits/FormVisit.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Medical/MedicalPostgresqlDatabase/AbstractPostgresqlStorage.cs b/Medical/MedicalPostgresqlDatabase/AbstractPostgresqlStorage.cs index 6c352a5..3535edc 100644 --- a/Medical/MedicalPostgresqlDatabase/AbstractPostgresqlStorage.cs +++ b/Medical/MedicalPostgresqlDatabase/AbstractPostgresqlStorage.cs @@ -126,7 +126,7 @@ namespace MedicalPostgresqlDatabase foreach (var key in dict.Keys) { - cmd.Parameters.AddWithValue($"@{key}", dict[key]); + cmd.Parameters.AddWithValue($"@{key}", dict[key] ?? DBNull.Value); } _logger.LogDebug(cmd.CommandText); Stopwatch stopwatch = new(); @@ -167,7 +167,7 @@ namespace MedicalPostgresqlDatabase foreach (var key in dict.Keys) { - cmd.Parameters.AddWithValue($"@{key}", dict[key]); + cmd.Parameters.AddWithValue($"@{key}", dict[key] ?? DBNull.Value); } _logger.LogDebug(cmd.CommandText); diff --git a/Medical/MedicalPostgresqlDatabase/Storages/VisitStorage.cs b/Medical/MedicalPostgresqlDatabase/Storages/VisitStorage.cs index e3877f2..2ff77f1 100644 --- a/Medical/MedicalPostgresqlDatabase/Storages/VisitStorage.cs +++ b/Medical/MedicalPostgresqlDatabase/Storages/VisitStorage.cs @@ -17,7 +17,7 @@ namespace MedicalPostgresqlDatabase.Storages Id = Convert.ToInt32(reader.GetValue(PRIMARY_KEY_COLUMN_NAME)), PatientId = Convert.ToInt32(reader.GetValue("patient_id")), DoctorId = Convert.ToInt32(reader.GetValue("doctor_id")), - DiagnoseId = Convert.ToInt32(reader.GetValue("diagnose_id")), + DiagnoseId = reader.GetValue("diagnose_id") is DBNull ? null : Convert.ToInt32(reader.GetValue("diagnose_id")), Comment = Convert.ToString(reader.GetValue("comment")), Date = DateOnly.FromDateTime(Convert.ToDateTime(reader.GetValue("date"))), Time = TimeOnly.FromTimeSpan((TimeSpan)reader.GetValue("time")), diff --git a/Medical/MedicalView/Visits/FormVisit.cs b/Medical/MedicalView/Visits/FormVisit.cs index ede12fb..b9aab61 100644 --- a/Medical/MedicalView/Visits/FormVisit.cs +++ b/Medical/MedicalView/Visits/FormVisit.cs @@ -88,7 +88,7 @@ namespace MedicalView.Visits comboBoxDoctor.SelectedIndex = -1; comboBoxDiagnose.DataSource = diagnoses; - comboBoxDiagnose.SelectedIndex = diagnoses.FindIndex(x => x.Name == "Первичный прием"); + comboBoxDiagnose.SelectedIndex = -1; if (ModelId.HasValue) {