Добавил время и дату в таблицу приемов

This commit is contained in:
Никита Потапов 2024-05-14 23:23:22 +04:00
parent ecdf01e662
commit 19943dd5e3
3 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,4 @@
using System.ComponentModel; namespace MedicalDatabaseContracts.Models
namespace MedicalDatabaseContracts.Models
{ {
public class Visit : AbstractModel public class Visit : AbstractModel
{ {
@ -8,5 +6,7 @@ namespace MedicalDatabaseContracts.Models
public int DoctorId { get; set; } public int DoctorId { get; set; }
public int DiagnoseId { get; set; } public int DiagnoseId { get; set; }
public string? Comment { get; set; } public string? Comment { get; set; }
public DateOnly Date { get; set; }
public TimeOnly Time { get; set; }
} }
} }

View File

@ -15,6 +15,10 @@ namespace MedicalDatabaseContracts.ViewModels
public string DoctorFIO { get; set; } = string.Empty; public string DoctorFIO { get; set; } = string.Empty;
[DisplayName("Диагноз")] [DisplayName("Диагноз")]
public string DiagnoseName { get; set; } = string.Empty; public string DiagnoseName { get; set; } = string.Empty;
[DisplayName("Дата")]
public DateOnly Date { get; set; }
[DisplayName("Время")]
public TimeOnly Time { get; set; }
} }
} }

View File

@ -19,6 +19,8 @@ namespace MedicalPostgresqlDatabase.Storages
DoctorId = Convert.ToInt32(reader.GetValue("doctor_id")), DoctorId = Convert.ToInt32(reader.GetValue("doctor_id")),
DiagnoseId = Convert.ToInt32(reader.GetValue("diagnose_id")), DiagnoseId = 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"))),
Time = TimeOnly.FromTimeSpan((TimeSpan)reader.GetValue("time")),
}; };
} }
@ -30,7 +32,9 @@ namespace MedicalPostgresqlDatabase.Storages
{ "patient_id", item.PatientId.ToString() }, { "patient_id", item.PatientId.ToString() },
{ "doctor_id", item.DoctorId.ToString() }, { "doctor_id", item.DoctorId.ToString() },
{ "diagnose_id", item.DiagnoseId.ToString() }, { "diagnose_id", item.DiagnoseId.ToString() },
{ "comment", item.Comment }, { "comment", item.Comment ?? string.Empty },
{ "date", item.Date.ToString() },
{ "time", item.Time.ToString() },
}; };
return dict; return dict;
} }