Реализовал возможность записи null значений в бд
This commit is contained in:
parent
86565351c1
commit
cbd3383e0c
@ -126,7 +126,7 @@ namespace MedicalPostgresqlDatabase
|
|||||||
|
|
||||||
foreach (var key in dict.Keys)
|
foreach (var key in dict.Keys)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue($"@{key}", dict[key]);
|
cmd.Parameters.AddWithValue($"@{key}", dict[key] ?? DBNull.Value);
|
||||||
}
|
}
|
||||||
_logger.LogDebug(cmd.CommandText);
|
_logger.LogDebug(cmd.CommandText);
|
||||||
Stopwatch stopwatch = new();
|
Stopwatch stopwatch = new();
|
||||||
@ -167,7 +167,7 @@ namespace MedicalPostgresqlDatabase
|
|||||||
|
|
||||||
foreach (var key in dict.Keys)
|
foreach (var key in dict.Keys)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue($"@{key}", dict[key]);
|
cmd.Parameters.AddWithValue($"@{key}", dict[key] ?? DBNull.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogDebug(cmd.CommandText);
|
_logger.LogDebug(cmd.CommandText);
|
||||||
|
@ -17,7 +17,7 @@ namespace MedicalPostgresqlDatabase.Storages
|
|||||||
Id = Convert.ToInt32(reader.GetValue(PRIMARY_KEY_COLUMN_NAME)),
|
Id = Convert.ToInt32(reader.GetValue(PRIMARY_KEY_COLUMN_NAME)),
|
||||||
PatientId = Convert.ToInt32(reader.GetValue("patient_id")),
|
PatientId = Convert.ToInt32(reader.GetValue("patient_id")),
|
||||||
DoctorId = Convert.ToInt32(reader.GetValue("doctor_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")),
|
Comment = Convert.ToString(reader.GetValue("comment")),
|
||||||
Date = DateOnly.FromDateTime(Convert.ToDateTime(reader.GetValue("date"))),
|
Date = DateOnly.FromDateTime(Convert.ToDateTime(reader.GetValue("date"))),
|
||||||
Time = TimeOnly.FromTimeSpan((TimeSpan)reader.GetValue("time")),
|
Time = TimeOnly.FromTimeSpan((TimeSpan)reader.GetValue("time")),
|
||||||
|
@ -88,7 +88,7 @@ namespace MedicalView.Visits
|
|||||||
comboBoxDoctor.SelectedIndex = -1;
|
comboBoxDoctor.SelectedIndex = -1;
|
||||||
|
|
||||||
comboBoxDiagnose.DataSource = diagnoses;
|
comboBoxDiagnose.DataSource = diagnoses;
|
||||||
comboBoxDiagnose.SelectedIndex = diagnoses.FindIndex(x => x.Name == "Первичный прием");
|
comboBoxDiagnose.SelectedIndex = -1;
|
||||||
|
|
||||||
if (ModelId.HasValue)
|
if (ModelId.HasValue)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user