Добавил названия колонок для моделей

This commit is contained in:
Никита Потапов 2024-05-08 02:06:28 +04:00
parent 69d271b9a2
commit 4173a05542
9 changed files with 71 additions and 9 deletions

View File

@ -1,7 +1,10 @@
namespace MedicalDatabaseContracts.Models
using System.ComponentModel;
namespace MedicalDatabaseContracts.Models
{
public class AbstractModel
{
[DisplayName("ID")]
public int Id { get; set; }
}
}

View File

@ -1,10 +1,16 @@
namespace MedicalDatabaseContracts.Models
using System.ComponentModel;
namespace MedicalDatabaseContracts.Models
{
public class AbstractPersonModel : AbstractModel
{
[DisplayName("Имя")]
public string Name { get; set; } = string.Empty;
[DisplayName("Фамилия")]
public string Surname { get; set; } = string.Empty;
[DisplayName("Отчество")]
public string? Patronymic { get; set; }
[DisplayName("Телефон")]
public string PhoneNumber { get; set; } = string.Empty;
}
}

View File

@ -1,7 +1,10 @@
namespace MedicalDatabaseContracts.Models
using System.ComponentModel;
namespace MedicalDatabaseContracts.Models
{
public class Diagnose : AbstractModel
{
[DisplayName("Название")]
public string Name { get; set; } = string.Empty;
}
}

View File

@ -1,10 +1,16 @@
namespace MedicalDatabaseContracts.Models
using System.ComponentModel;
namespace MedicalDatabaseContracts.Models
{
public class Patient : AbstractPersonModel
{
[DisplayName("Пол")]
public char Gender { get; set; }
[DisplayName("Дата рождения")]
public DateOnly Birthday { get; set; }
[DisplayName("Вес, кг")]
public int Weight { get; set; }
[DisplayName("Рост, см")]
public int Height { get; set; }
}
}

View File

@ -1,9 +1,14 @@
namespace MedicalDatabaseContracts.Models
using System.ComponentModel;
namespace MedicalDatabaseContracts.Models
{
public class Specialization : AbstractModel
{
[DisplayName("Название")]
public string Name { get; set; } = string.Empty;
[DisplayName("Педиатрия")]
public bool IsPediatric { get; set; }
[DisplayName("Терапия")]
public bool IsTherapeutic { get; set; }
}
}

View File

@ -1,10 +1,13 @@
namespace MedicalDatabaseContracts.Models
using System.ComponentModel;
namespace MedicalDatabaseContracts.Models
{
public class Visit : AbstractModel
{
public int PatientId { get; set; }
public int DoctorId { get; set; }
public int DiagnoseId { get; set; }
[DisplayName("Комментарий")]
public string? Comment { get; set; }
}
}

View File

@ -34,8 +34,11 @@
добавитьToolStripMenuItem = new ToolStripMenuItem();
изменитьToolStripMenuItem = new ToolStripMenuItem();
удалитьToolStripMenuItem = new ToolStripMenuItem();
statusStrip = new StatusStrip();
toolStripStatusLabel = new ToolStripStatusLabel();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip.SuspendLayout();
statusStrip.SuspendLayout();
SuspendLayout();
//
// dataGridView
@ -68,7 +71,7 @@
обновитьToolStripMenuItem.Name = "обновитьToolStripMenuItem";
обновитьToolStripMenuItem.Size = new Size(92, 24);
обновитьToolStripMenuItem.Text = "Обновить";
обновитьToolStripMenuItem.Click += this.RefreshToolStripMenuItem_Click;
обновитьToolStripMenuItem.Click += RefreshToolStripMenuItem_Click;
//
// добавитьToolStripMenuItem
//
@ -88,11 +91,27 @@
удалитьToolStripMenuItem.Size = new Size(79, 24);
удалитьToolStripMenuItem.Text = "Удалить";
//
// statusStrip
//
statusStrip.ImageScalingSize = new Size(20, 20);
statusStrip.Items.AddRange(new ToolStripItem[] { toolStripStatusLabel });
statusStrip.Location = new Point(0, 428);
statusStrip.Name = "statusStrip";
statusStrip.Size = new Size(800, 22);
statusStrip.TabIndex = 5;
statusStrip.Text = "statusStrip1";
//
// toolStripStatusLabel
//
toolStripStatusLabel.Name = "toolStripStatusLabel";
toolStripStatusLabel.Size = new Size(0, 16);
//
// FormDiagnoses
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(statusStrip);
Controls.Add(dataGridView);
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
@ -102,6 +121,8 @@
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
statusStrip.ResumeLayout(false);
statusStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
@ -113,5 +134,7 @@
private ToolStripMenuItem добавитьToolStripMenuItem;
private ToolStripMenuItem изменитьToolStripMenuItem;
private ToolStripMenuItem удалитьToolStripMenuItem;
private StatusStrip statusStrip;
private ToolStripStatusLabel toolStripStatusLabel;
}
}

View File

@ -27,18 +27,28 @@ namespace MedicalView
private void LoadData()
{
SetStatusStripText("Загрузка диагнозов...");
try
{
var diagnoses = _diagnosesStorage.GetAll();
dataGridView.DataSource = diagnoses;
var items = _diagnosesStorage.GetAll();
dataGridView.DataSource = items;
dataGridView.Columns["Id"].Visible = false;
_logger.LogInformation("Список диагнозов загружен успешно");
SetStatusStripText($"Готово. Загружено записей: {items.Count}");
}
catch (Exception ex)
{
string errorMessage = "Ошибка загрузки списка диагнозов";
_logger.LogError(string.Join(", ", errorMessage, $"\"{ex.Message}\""));
MessageBox.Show(string.Join("\n\n", errorMessage, $"{ex.Message}"), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
SetStatusStripText($"Ошибка загрузки");
}
}
private void SetStatusStripText(string text)
{
toolStripStatusLabel.Text = text;
}
}
}

View File

@ -120,4 +120,7 @@
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>145, 17</value>
</metadata>
</root>