Реализовал возможность записи null значений в бд
This commit is contained in:
parent
86565351c1
commit
cbd3383e0c
@ -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);
|
||||
|
@ -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")),
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user