Доделал

This commit is contained in:
Bulat 2024-11-13 13:24:22 +04:00
parent 2dd759cb4a
commit b44f1e2537
57 changed files with 4351 additions and 94 deletions

View File

@ -0,0 +1,30 @@
using RegistrationPatientsPolyclinic.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities;
public class Drug // Наподобие Feed
{
public int Id { get; private set; }
public DrugName DrugName { get; private set; }
public int Grams { get; private set; }
public string Description { get; private set; } = string.Empty;
public static Drug CreateElement(int id, DrugName name, int grams, string description)
{
return new Drug
{
Id = id,
DrugName = name,
Grams = grams,
Description = description ?? string.Empty
};
}
}

View File

@ -0,0 +1,30 @@
using RegistrationPatientsPolyclinic.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities;
public class DrugMedicalHistory // Тоже самое что FeedFeedRepleshments
{
public int Id { get; private set; }
public int DrugId { get; private set; }
//public int MedicalHistoryId { get; private set; }
//public string Description { get; private set; }
public static DrugMedicalHistory CreateEntity(int id, int drugId)
{
return new DrugMedicalHistory
{
Id = id,
DrugId = drugId,
// MedicalHistoryId = medicalHistoryId,
// Description = description
};
}
}

View File

@ -10,16 +10,16 @@ namespace RegistrationPatientsPolyclinic.Entities.Enums;
// то его поле DoctorPost, то мы в него занесем только один из возможных вариантов(None, Junior, Senior, Head) // то его поле DoctorPost, то мы в него занесем только один из возможных вариантов(None, Junior, Senior, Head)
// а по атрибуту Flags позволяет хранить несколько записей // а по атрибуту Flags позволяет хранить несколько записей
// ВАЖНО!!! Чтобы в перечеслении значения были степени двойки // ВАЖНО!!! Чтобы в перечеслении значения были степени двойки
// битовое объединение
public enum Diagnosis public enum Diagnosis
{ {
None = 0, None = 0,
Flu = 1, Flu = 1, // 0001
Quinsy = 2, Quinsy = 2, // 0010
Callous = 4, Callous = 4, // 0100
Bronchitis = 8 Bronchitis = 8 // 1000
} }

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities.Enums;
[Flags]
public enum DrugName
{
None = 0,
Synopret = 1,
Pentalginum = 2,
Paracetamol = 4,
Citrine = 8,
Tonsilgon = 16
}

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities; namespace RegistrationPatientsPolyclinic.Entities;
public class MedicalHistory public class MedicalHistory // сущность пополнения, наподобие FeedReplenushment
{ {
public int Id { get; private set; } public int Id { get; private set; }
@ -15,22 +15,26 @@ public class MedicalHistory
public int DoctorId { get; private set; } public int DoctorId { get; private set; }
public Diagnosis Diagnosis { get; private set; } // public Diagnosis Diagnosis { get; private set; }
public DateTime VisitDate { get; private set; } public DateTime VisitDate { get; private set; }
public Status Status { get; private set; } // public Status Status { get; private set; }
public static MedicalHistory CreateEntity(int id, int patientId,int doctorId,Diagnosis diagnosis, int visitData, Status status) public IEnumerable<DrugMedicalHistory> DrugMedicalHistory { get; private set; } = [];
public static MedicalHistory CreateEntity(int id, int patientId,int doctorId,
IEnumerable<DrugMedicalHistory> drugMedicalHistory)
{ {
return new MedicalHistory return new MedicalHistory
{ {
Id = id, Id = id,
PatientId = patientId, PatientId = patientId,
DoctorId = doctorId, DoctorId = doctorId,
Diagnosis = diagnosis, // Diagnosis = diagnosis,
VisitDate = DateTime.Now, VisitDate = DateTime.Now,
Status = status // Status = status,
DrugMedicalHistory = drugMedicalHistory
}; };
} }
} }

View File

@ -17,9 +17,9 @@ public class Patient
public string ContactNumber { get; private set; } public string ContactNumber { get; private set; }
// ТУТ СДЕЛАЕМ СТАТИСТИЧЕСКИЙ МЕТОД // ТУТ СДЕЛАЕМ СТАТИСТИЧЕСКИЙ МЕТОД, который будет отвечать за создание объекта
public static Patient CreatePatient(int id, string firts_Name, string last_Name, string contactNumber) public static Patient CreateEntity(int id, string firts_Name, string last_Name, string contactNumber)
{ {
return new Patient return new Patient
{ {

View File

@ -1,39 +0,0 @@
namespace RegistrationPatientsPolyclinic
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
}
#endregion
}
}

View File

@ -1,10 +0,0 @@
namespace RegistrationPatientsPolyclinic
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,156 @@
namespace RegistrationPatientsPolyclinic
{
partial class FormPolyclinic
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
menuStrip = new MenuStrip();
HandBookToolStripMenuItem = new ToolStripMenuItem();
DoctorsToolStripMenuItem = new ToolStripMenuItem();
PacientToolStripMenuItem = new ToolStripMenuItem();
MedicalHistoryToolStripMenuItem = new ToolStripMenuItem();
DoctorPaymentsToolStripMenuItem = new ToolStripMenuItem();
DrugToolStripMenuItem = new ToolStripMenuItem();
OperationToolStripMenuItem = new ToolStripMenuItem();
DoctorPaymentToolStripMenuItem = new ToolStripMenuItem();
DiseaseRegistrationToolStripMenuItem = new ToolStripMenuItem();
ReportToolStripMenuItem = new ToolStripMenuItem();
menuStrip.SuspendLayout();
SuspendLayout();
//
// menuStrip
//
menuStrip.ImageScalingSize = new Size(20, 20);
menuStrip.Items.AddRange(new ToolStripItem[] { HandBookToolStripMenuItem, OperationToolStripMenuItem, ReportToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(782, 28);
menuStrip.TabIndex = 0;
menuStrip.Text = "menuStrip1";
//
// HandBookToolStripMenuItem
//
HandBookToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { DoctorsToolStripMenuItem, PacientToolStripMenuItem, MedicalHistoryToolStripMenuItem, DoctorPaymentsToolStripMenuItem, DrugToolStripMenuItem });
HandBookToolStripMenuItem.Name = "HandBookToolStripMenuItem";
HandBookToolStripMenuItem.Size = new Size(117, 24);
HandBookToolStripMenuItem.Text = "Справочники";
//
// DoctorsToolStripMenuItem
//
DoctorsToolStripMenuItem.Name = "DoctorsToolStripMenuItem";
DoctorsToolStripMenuItem.Size = new Size(248, 26);
DoctorsToolStripMenuItem.Text = "Врачи";
DoctorsToolStripMenuItem.Click += DoctorsToolStripMenuItem_Click;
//
// PacientToolStripMenuItem
//
PacientToolStripMenuItem.Name = "PacientToolStripMenuItem";
PacientToolStripMenuItem.Size = new Size(248, 26);
PacientToolStripMenuItem.Text = "Пациенты";
PacientToolStripMenuItem.Click += PacientToolStripMenuItem_Click;
//
// MedicalHistoryToolStripMenuItem
//
MedicalHistoryToolStripMenuItem.Name = "MedicalHistoryToolStripMenuItem";
MedicalHistoryToolStripMenuItem.Size = new Size(248, 26);
MedicalHistoryToolStripMenuItem.Text = "Медицинская история";
MedicalHistoryToolStripMenuItem.Click += MedicalHistoryToolStripMenuItem_Click;
//
// DoctorPaymentsToolStripMenuItem
//
DoctorPaymentsToolStripMenuItem.Name = "DoctorPaymentsToolStripMenuItem";
DoctorPaymentsToolStripMenuItem.Size = new Size(248, 26);
DoctorPaymentsToolStripMenuItem.Text = "Оплата Врачам";
DoctorPaymentsToolStripMenuItem.Click += DoctorPaymentsToolStripMenuItem_Click;
//
// DrugToolStripMenuItem
//
DrugToolStripMenuItem.Name = "DrugToolStripMenuItem";
DrugToolStripMenuItem.Size = new Size(248, 26);
DrugToolStripMenuItem.Text = "Лекарство";
DrugToolStripMenuItem.Click += DrugToolStripMenuItem_Click;
//
// OperationToolStripMenuItem
//
OperationToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { DoctorPaymentToolStripMenuItem, DiseaseRegistrationToolStripMenuItem });
OperationToolStripMenuItem.Name = "OperationToolStripMenuItem";
OperationToolStripMenuItem.Size = new Size(95, 24);
OperationToolStripMenuItem.Text = "Операции";
//
// DoctorPaymentToolStripMenuItem
//
DoctorPaymentToolStripMenuItem.Name = "DoctorPaymentToolStripMenuItem";
DoctorPaymentToolStripMenuItem.Size = new Size(186, 26);
DoctorPaymentToolStripMenuItem.Text = "Оплата врачу";
DoctorPaymentToolStripMenuItem.Click += DoctorPaymentToolStripMenuItem_Click;
//
// DiseaseRegistrationToolStripMenuItem
//
DiseaseRegistrationToolStripMenuItem.Name = "DiseaseRegistrationToolStripMenuItem";
DiseaseRegistrationToolStripMenuItem.Size = new Size(186, 26);
DiseaseRegistrationToolStripMenuItem.Text = "Учет болезни";
DiseaseRegistrationToolStripMenuItem.Click += DiseaseRegistrationToolStripMenuItem_Click;
//
// ReportToolStripMenuItem
//
ReportToolStripMenuItem.Name = "ReportToolStripMenuItem";
ReportToolStripMenuItem.Size = new Size(73, 24);
ReportToolStripMenuItem.Text = "Отчеты";
//
// FormPolyclinic
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.og_og_1643042666277656852;
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(782, 403);
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
Name = "FormPolyclinic";
StartPosition = FormStartPosition.CenterScreen;
Text = "Поликлиника";
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip;
private ToolStripMenuItem HandBookToolStripMenuItem;
private ToolStripMenuItem OperationToolStripMenuItem;
private ToolStripMenuItem DoctorsToolStripMenuItem;
private ToolStripMenuItem PacientToolStripMenuItem;
private ToolStripMenuItem MedicalHistoryToolStripMenuItem;
private ToolStripMenuItem DoctorPaymentsToolStripMenuItem;
private ToolStripMenuItem ReportToolStripMenuItem;
private ToolStripMenuItem DoctorPaymentToolStripMenuItem;
private ToolStripMenuItem DiseaseRegistrationToolStripMenuItem;
private ToolStripMenuItem DrugToolStripMenuItem;
}
}

View File

@ -0,0 +1,94 @@
using RegistrationPatientsPolyclinic.Forms;
using Unity;
namespace RegistrationPatientsPolyclinic
{
public partial class FormPolyclinic : Form
{
private readonly IUnityContainer _container;
public FormPolyclinic(IUnityContainer container)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
}
private void DoctorsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDoctors>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void PacientToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPatients>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void MedicalHistoryToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormMedicalHistories>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void DoctorPaymentsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDoctorPayments>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void DoctorPaymentToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDoctorPayment>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void DiseaseRegistrationToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void DrugToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDrug>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,141 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormDoctor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
comboBoxPost = new ComboBox();
labelFirstName = new Label();
labelLastName = new Label();
labelPost = new Label();
textBoxFirstName = new TextBox();
textBoxLastName = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// comboBoxPost
//
comboBoxPost.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxPost.FormattingEnabled = true;
comboBoxPost.Location = new Point(119, 144);
comboBoxPost.Name = "comboBoxPost";
comboBoxPost.Size = new Size(125, 28);
comboBoxPost.TabIndex = 0;
//
// labelFirstName
//
labelFirstName.AutoSize = true;
labelFirstName.Location = new Point(12, 40);
labelFirstName.Name = "labelFirstName";
labelFirstName.Size = new Size(39, 20);
labelFirstName.TabIndex = 1;
labelFirstName.Text = "Имя";
//
// labelLastName
//
labelLastName.AutoSize = true;
labelLastName.Location = new Point(12, 91);
labelLastName.Name = "labelLastName";
labelLastName.Size = new Size(73, 20);
labelLastName.TabIndex = 2;
labelLastName.Text = "Фамилия";
//
// labelPost
//
labelPost.AutoSize = true;
labelPost.Location = new Point(12, 144);
labelPost.Name = "labelPost";
labelPost.Size = new Size(86, 20);
labelPost.TabIndex = 3;
labelPost.Text = "Должность";
//
// textBoxFirstName
//
textBoxFirstName.Location = new Point(119, 40);
textBoxFirstName.Name = "textBoxFirstName";
textBoxFirstName.Size = new Size(125, 27);
textBoxFirstName.TabIndex = 4;
//
// textBoxLastName
//
textBoxLastName.Location = new Point(119, 91);
textBoxLastName.Name = "textBoxLastName";
textBoxLastName.Size = new Size(125, 27);
textBoxLastName.TabIndex = 5;
//
// buttonSave
//
buttonSave.Location = new Point(12, 230);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 7;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(150, 230);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 8;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormDoctor
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxLastName);
Controls.Add(textBoxFirstName);
Controls.Add(labelPost);
Controls.Add(labelLastName);
Controls.Add(labelFirstName);
Controls.Add(comboBoxPost);
Name = "FormDoctor";
Text = "Доктор";
ResumeLayout(false);
PerformLayout();
}
#endregion
private ComboBox comboBoxPost;
private Label labelFirstName;
private Label labelLastName;
private Label labelPost;
private TextBox textBoxFirstName;
private TextBox textBoxLastName;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,91 @@
using RegistrationPatientsPolyclinic.Entities;
using RegistrationPatientsPolyclinic.Entities.Enums;
using RegistrationPatientsPolyclinic.Repositories;
using RegistrationPatientsPolyclinic.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormDoctor : Form
{
// Понадобиться интерфейс работника
// так же будет сеттер с id
private readonly IDoctorRepository _doctorRepository;
private int? _doctorId;
public int Id
{
set
{
try
{
var doctor = _doctorRepository.ReadDoctorById(value);
if (doctor == null)
{
throw new InvalidDataException(nameof(doctor));
}
textBoxFirstName.Text = doctor.First_Name;
textBoxLastName.Text = doctor.Last_Name;
comboBoxPost.SelectedItem = doctor.DoctorPost;
_doctorId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormDoctor(IDoctorRepository doctorRepository)
{
InitializeComponent();
_doctorRepository = doctorRepository ??
throw new ArgumentNullException(nameof(doctorRepository));
comboBoxPost.DataSource = Enum.GetValues(typeof(DoctorPost)); // вытащи значение из этого перечисления, вернет массив строк, т.е. массив тпеих элементов(DoctorPost)
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) || string.IsNullOrWhiteSpace(textBoxLastName.Text) ||
comboBoxPost.SelectedIndex < 1)
{
throw new Exception("Имеется незаполненные поля");
}
if (_doctorId.HasValue)
{
_doctorRepository.UpdateDoctor(CreateDoctor(_doctorId.Value));
}
else
{
_doctorRepository.CreateDoctor(CreateDoctor(0));
}
Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Doctor CreateDoctor(int id) =>
Doctor.CreateEntity(id, textBoxFirstName.Text, textBoxLastName.Text, (DoctorPost)comboBoxPost.SelectedItem!);
}
}

View File

@ -0,0 +1,164 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormDoctorPayment
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
labelDoctor = new Label();
comboBoxDoctor = new ComboBox();
groupBox = new GroupBox();
dataGridViewPayment = new DataGridView();
ColumnMonth = new DataGridViewTextBoxColumn();
ColumnCount = new DataGridViewTextBoxColumn();
ColumnPayment = new DataGridViewTextBoxColumn();
buttonSave = new Button();
buttonCancel = new Button();
groupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewPayment).BeginInit();
SuspendLayout();
//
// labelDoctor
//
labelDoctor.AutoSize = true;
labelDoctor.Location = new Point(30, 21);
labelDoctor.Name = "labelDoctor";
labelDoctor.Size = new Size(59, 20);
labelDoctor.TabIndex = 13;
labelDoctor.Text = "Доктор";
//
// comboBoxDoctor
//
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxDoctor.FormattingEnabled = true;
comboBoxDoctor.Location = new Point(112, 21);
comboBoxDoctor.Name = "comboBoxDoctor";
comboBoxDoctor.Size = new Size(151, 28);
comboBoxDoctor.TabIndex = 12;
//
// groupBox
//
groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
groupBox.Controls.Add(dataGridViewPayment);
groupBox.Location = new Point(13, 72);
groupBox.Name = "groupBox";
groupBox.Size = new Size(610, 282);
groupBox.TabIndex = 14;
groupBox.TabStop = false;
groupBox.Text = "groupBox";
//
// dataGridViewPayment
//
dataGridViewPayment.AllowUserToResizeColumns = false;
dataGridViewPayment.AllowUserToResizeRows = false;
dataGridViewPayment.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dataGridViewPayment.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewPayment.Columns.AddRange(new DataGridViewColumn[] { ColumnMonth, ColumnCount, ColumnPayment });
dataGridViewPayment.Location = new Point(3, 23);
dataGridViewPayment.MultiSelect = false;
dataGridViewPayment.Name = "dataGridViewPayment";
dataGridViewPayment.RowHeadersVisible = false;
dataGridViewPayment.RowHeadersWidth = 51;
dataGridViewPayment.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewPayment.Size = new Size(413, 256);
dataGridViewPayment.TabIndex = 0;
//
// ColumnMonth
//
ColumnMonth.HeaderText = "Месяц";
ColumnMonth.MinimumWidth = 6;
ColumnMonth.Name = "ColumnMonth";
ColumnMonth.Resizable = DataGridViewTriState.True;
ColumnMonth.SortMode = DataGridViewColumnSortMode.NotSortable;
ColumnMonth.Width = 125;
//
// ColumnCount
//
ColumnCount.HeaderText = "Кол-во пациентов";
ColumnCount.MinimumWidth = 6;
ColumnCount.Name = "ColumnCount";
ColumnCount.Width = 125;
//
// ColumnPayment
//
ColumnPayment.HeaderText = "Оплата";
ColumnPayment.MinimumWidth = 6;
ColumnPayment.Name = "ColumnPayment";
ColumnPayment.Width = 125;
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(16, 406);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 15;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(98, 406);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 16;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// FormDoctorPayment
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(659, 471);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(groupBox);
Controls.Add(labelDoctor);
Controls.Add(comboBoxDoctor);
Name = "FormDoctorPayment";
Text = "FormDoctorPayment";
groupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewPayment).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelDoctor;
private ComboBox comboBoxDoctor;
private GroupBox groupBox;
private DataGridView dataGridViewPayment;
private Button buttonSave;
private Button buttonCancel;
private DataGridViewTextBoxColumn ColumnMonth;
private DataGridViewTextBoxColumn ColumnCount;
private DataGridViewTextBoxColumn ColumnPayment;
}
}

View File

@ -0,0 +1,82 @@
using RegistrationPatientsPolyclinic.Entities;
using RegistrationPatientsPolyclinic.Repositories;
using RegistrationPatientsPolyclinic.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormDoctorPayment : Form
{
private readonly IDoctorPaymentsRepository _doctorPaymentsRepository;
public FormDoctorPayment(IDoctorPaymentsRepository doctorPaymentsRepository, IDoctorRepository doctorRepository)
{
InitializeComponent();
_doctorPaymentsRepository = doctorPaymentsRepository ??
throw new ArgumentNullException(nameof(doctorPaymentsRepository));
comboBoxDoctor.DataSource = doctorRepository.ReadDoctors();
comboBoxDoctor.DisplayMember = "Firts_Name";
comboBoxDoctor.ValueMember = "Id";
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (dataGridViewPayment.RowCount < 1 || comboBoxDoctor.SelectedIndex < 0)
{
throw new Exception("Имеются не заполненные поля");
}
// Получаем значение из первой строки колонки ColumnMonth
string month = dataGridViewPayment.Rows[0].Cells["ColumnMonth"].Value?.ToString();
int countPatient = int.Parse(dataGridViewPayment.Rows[0].Cells["Column2"].Value?.ToString() ?? "0");
int payment = int.Parse(dataGridViewPayment.Rows[0].Cells["Column3"].Value?.ToString() ?? "0");
// Проверяем, что месяц не пустой
if (string.IsNullOrEmpty(month))
{
throw new Exception("Месяц не заполнен");
}
// Создаем элемент DoctorPayments
_doctorPaymentsRepository.CreateDoctorPayments(DoctorPayments.CreateElement(0, (int)comboBoxDoctor.SelectedValue!, month, countPatient, payment));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
private List<DoctorPayments> CreateListDoctorPaymentsFromDataGrid()
{
var list = new List<DoctorPayments>();
foreach(DataGridViewRow row in dataGridViewPayment.Rows)
{
if (row.Cells["ColumnMonth"].Value == null || row.Cells["ColumnCount"].Value == null || row.Cells["ColumnPayment"] == null)
{
continue;
}
// ДОДЕЛАТЬ!!!
list.Add(DoctorPayments.CreateElement(0, 0, row.Cells["ColumnMonth"].Value.ToString(), Convert.ToInt32(row.Cells["ColumnCount"].Value),
Convert.ToInt32(row.Cells["ColumnPayment"].Value)));
}
return list;
}
}
}

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ColumnMonth.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnPayment.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,99 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormDoctorPayments
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
buttonAdd = new Button();
dataGridView = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(622, 0);
panel1.Name = "panel1";
panel1.Size = new Size(158, 414);
panel1.TabIndex = 0;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources._5668287_middle;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(33, 46);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 66);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(622, 414);
dataGridView.TabIndex = 1;
//
// FormDoctorPayments
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(780, 414);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormDoctorPayments";
StartPosition = FormStartPosition.CenterParent;
Text = "FormDoctorPayments";
Load += FormDoctorPayments_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,59 @@
using RegistrationPatientsPolyclinic.Repositories;
using RegistrationPatientsPolyclinic.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormDoctorPayments : Form
{
private readonly IDoctorPaymentsRepository _doctorPaymentsRepository;
private readonly IUnityContainer _container;
public FormDoctorPayments(IUnityContainer container, IDoctorPaymentsRepository doctorPaymentsRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_doctorPaymentsRepository = doctorPaymentsRepository ??
throw new ArgumentNullException(nameof(doctorPaymentsRepository));
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDoctorPayment>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormDoctorPayments_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _doctorPaymentsRepository.ReadDoctorPayments();
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,127 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormDoctors
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
buttonUpd = new Button();
buttonDel = new Button();
buttonAdd = new Button();
dataGridView = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(602, 0);
panel1.Name = "panel1";
panel1.Size = new Size(150, 424);
panel1.TabIndex = 0;
//
// buttonUpd
//
buttonUpd.BackgroundImage = Properties.Resources.Снимок_экрана_2024_11_07_173309;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(28, 209);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(94, 77);
buttonUpd.TabIndex = 2;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += ButtonUpd_Click;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.del;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(28, 113);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(94, 75);
buttonDel.TabIndex = 1;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources._5668287_middle;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(28, 28);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 66);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(602, 424);
dataGridView.TabIndex = 1;
//
// FormDoctors
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(752, 424);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormDoctors";
StartPosition = FormStartPosition.CenterParent;
Text = "Докторы";
Load += FormDoctors_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonUpd;
private Button buttonDel;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,117 @@
using RegistrationPatientsPolyclinic.Repositories;
using RegistrationPatientsPolyclinic.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormDoctors : Form
{
// Здесь понадобится экземпляр IUnity контейнер через который мы будем создавать объекты FormDoctor и вызывать его
// IPatientRepository через который мы будем получать список
private readonly IUnityContainer _container;
private readonly IDoctorRepository _doctorRepository;
public FormDoctors(IUnityContainer container, IDoctorRepository doctorRepository)
{
InitializeComponent();
_container = container ?? // мы получаем через контейнер объект
throw new ArgumentNullException(nameof(container));
_doctorRepository = doctorRepository ??
throw new ArgumentNullException(nameof(doctorRepository)); ;
}
private void FormDoctors_Load(object sender, EventArgs e)
{
// метод, при загрузки формы будет прогружаться все данные
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
// отдельный метод который будет загружать в GridView
private void LoadList() => dataGridView.DataSource = _doctorRepository.ReadDoctors();
private bool TryGetIdentifierFromSelectedRow(out int id) // возвращает смог н извлечь или нет
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["id"].Value);
return true;
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDoctor>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_doctorRepository.DeleteDoctor(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormDoctor>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,141 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormDrug
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
labelName = new Label();
labelGrams = new Label();
labelDescription = new Label();
textBoxGrams = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
textBoxDescription = new TextBox();
checkedListBoxName = new CheckedListBox();
SuspendLayout();
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(25, 34);
labelName.Name = "labelName";
labelName.Size = new Size(49, 20);
labelName.TabIndex = 0;
labelName.Text = "Name";
//
// labelGrams
//
labelGrams.AutoSize = true;
labelGrams.Location = new Point(25, 91);
labelGrams.Name = "labelGrams";
labelGrams.Size = new Size(51, 20);
labelGrams.TabIndex = 1;
labelGrams.Text = "Grams";
//
// labelDescription
//
labelDescription.AutoSize = true;
labelDescription.Location = new Point(25, 142);
labelDescription.Name = "labelDescription";
labelDescription.Size = new Size(85, 20);
labelDescription.TabIndex = 2;
labelDescription.Text = "Description";
//
// textBoxGrams
//
textBoxGrams.Location = new Point(137, 88);
textBoxGrams.Name = "textBoxGrams";
textBoxGrams.Size = new Size(125, 27);
textBoxGrams.TabIndex = 4;
//
// buttonSave
//
buttonSave.Location = new Point(16, 317);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(168, 317);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отменить";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// textBoxDescription
//
textBoxDescription.Location = new Point(137, 142);
textBoxDescription.Multiline = true;
textBoxDescription.Name = "textBoxDescription";
textBoxDescription.Size = new Size(125, 123);
textBoxDescription.TabIndex = 8;
//
// checkedListBoxName
//
checkedListBoxName.FormattingEnabled = true;
checkedListBoxName.Location = new Point(137, 34);
checkedListBoxName.Name = "checkedListBoxName";
checkedListBoxName.Size = new Size(150, 26);
checkedListBoxName.TabIndex = 9;
//
// FormDrug
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(354, 450);
Controls.Add(checkedListBoxName);
Controls.Add(textBoxDescription);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxGrams);
Controls.Add(labelDescription);
Controls.Add(labelGrams);
Controls.Add(labelName);
Name = "FormDrug";
Text = "FormDrug";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelName;
private Label labelGrams;
private Label labelDescription;
private TextBox textBoxGrams;
private Button buttonSave;
private Button buttonCancel;
private TextBox textBoxDescription;
private CheckedListBox checkedListBoxName;
}
}

View File

@ -0,0 +1,108 @@
using RegistrationPatientsPolyclinic.Entities.Enums;
using RegistrationPatientsPolyclinic.Entities;
using RegistrationPatientsPolyclinic.Repositories;
using RegistrationPatientsPolyclinic.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.VisualBasic.FileIO;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormDrug : Form
{
private readonly IDrugRepository _drugRepository;
private int? _dragId;
public int Id
{
set
{
try
{
var drag = _drugRepository.ReadDrugById(value);
if (drag == null)
{
throw new InvalidDataException(nameof(drag));
}
// проходимся по всем значениям перечисления
foreach (DrugName elem in Enum.GetValues(typeof(DrugName)))
{
if ((elem & drag.DrugName) != 0)
{
checkedListBoxName.SetItemChecked(checkedListBoxName.Items.IndexOf(elem), true);
}
}
textBoxGrams.Text = drag.Grams.ToString();
textBoxDescription.Text = drag.Description;
_dragId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormDrug(IDrugRepository drugRepository)
{
InitializeComponent();
_drugRepository = drugRepository??
throw new ArgumentNullException(nameof(drugRepository));
// вытаскиваем все значения
foreach(var elem in Enum.GetValues(typeof(DrugName)))
{
checkedListBoxName.Items.Add(elem); // заполняем поэлементно значения
}
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxGrams.Text) || string.IsNullOrWhiteSpace(textBoxDescription.Text) ||
checkedListBoxName.CheckedItems.Count == 0)
{
throw new Exception("Имеется незаполненные поля");
}
if (_dragId.HasValue)
{
_drugRepository.UpdateDrug(CreateDrag(_dragId.Value));
}
else
{
_drugRepository.CreateDrug(CreateDrag(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
private Drug CreateDrag(int id)
{
DrugName drugName = DrugName.None;
foreach(var elem in checkedListBoxName.CheckedItems)
{
drugName |= (DrugName)elem;
}
return Drug.CreateElement(id, drugName, Convert.ToInt32(textBoxGrams.Text), textBoxDescription.Text);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,127 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormDrugs
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
buttonUpd = new Button();
buttonDel = new Button();
buttonAdd = new Button();
dataGridView = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(629, 0);
panel1.Name = "panel1";
panel1.Size = new Size(171, 450);
panel1.TabIndex = 0;
//
// buttonUpd
//
buttonUpd.BackgroundImage = Properties.Resources.Снимок_экрана_2024_11_07_173309;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(38, 241);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(94, 95);
buttonUpd.TabIndex = 2;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += buttonUpd_Click;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.del;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(38, 127);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(94, 86);
buttonDel.TabIndex = 1;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += buttonDel_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources._5668287_middle;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(38, 21);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 86);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(629, 450);
dataGridView.TabIndex = 1;
//
// FormDrags
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormDrags";
StartPosition = FormStartPosition.CenterParent;
Text = "FormDrags";
Load += FormDrags_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonUpd;
private Button buttonDel;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,106 @@
using RegistrationPatientsPolyclinic.Repositories;
using RegistrationPatientsPolyclinic.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using Unity;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormDrugs : Form
{
private readonly IUnityContainer _container;
private readonly IDrugRepository _dragRepository;
public FormDrugs(IUnityContainer container, IDrugRepository dragRepository)
{
InitializeComponent();
_container = container ?? // мы получаем через контейнер объект
throw new ArgumentNullException(nameof(container));
_dragRepository = dragRepository ??
throw new ArgumentNullException(nameof(dragRepository));
}
private void LoadList() => dataGridView.DataSource = _dragRepository.ReadDrug();
private void buttonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDrug>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_dragRepository.DeleteDrug(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormDoctor>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormDrags_Load(object sender, EventArgs e)
{
}
private bool TryGetIdentifierFromSelectedRow(out int id) // возвращает смог н извлечь или нет
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["id"].Value);
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,113 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormMedicalHistories
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
buttonAdd = new Button();
dataGridView = new DataGridView();
buttonDel = new Button();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(646, 0);
panel1.Name = "panel1";
panel1.Size = new Size(154, 450);
panel1.TabIndex = 0;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources._5668287_middle;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(32, 25);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 76);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(646, 450);
dataGridView.TabIndex = 1;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.del;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(32, 162);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(94, 89);
buttonDel.TabIndex = 1;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += buttonDel_Click;
//
// FormMedicalHistories
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormMedicalHistories";
StartPosition = FormStartPosition.CenterParent;
Text = "FormMedicalHistories";
Load += FormMedicalHistories_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonAdd;
private DataGridView dataGridView;
private Button buttonDel;
}
}

View File

@ -0,0 +1,92 @@
using RegistrationPatientsPolyclinic.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormMedicalHistories : Form // Посмотри на FeedingAnimals
{
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
private readonly IUnityContainer _container;
public FormMedicalHistories(IUnityContainer container, IMedicalHistoryRepository medicalHistoryRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_medicalHistoryRepository = medicalHistoryRepository ??
throw new ArgumentNullException(nameof(medicalHistoryRepository));
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormMedicalHistory>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormMedicalHistories_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _medicalHistoryRepository.ReadMedicalHistory();
private void buttonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_medicalHistoryRepository.DeletemedicalHistory(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,189 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormMedicalHistory
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
buttonSave = new Button();
buttonCancel = new Button();
comboBoxPacient = new ComboBox();
labelPacient = new Label();
groupBox1 = new GroupBox();
dataGridView = new DataGridView();
ColumnDiagnosis = new DataGridViewComboBoxColumn();
ColumnStatus = new DataGridViewComboBoxColumn();
ColumnDrug = new DataGridViewComboBoxColumn();
labelDoctor = new Label();
comboBoxDoctor = new ComboBox();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(39, 444);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom;
buttonCancel.Location = new Point(455, 444);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отменить";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// comboBoxPacient
//
comboBoxPacient.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxPacient.FormattingEnabled = true;
comboBoxPacient.Location = new Point(177, 30);
comboBoxPacient.Name = "comboBoxPacient";
comboBoxPacient.Size = new Size(151, 28);
comboBoxPacient.TabIndex = 8;
//
// labelPacient
//
labelPacient.AutoSize = true;
labelPacient.Location = new Point(21, 33);
labelPacient.Name = "labelPacient";
labelPacient.Size = new Size(69, 20);
labelPacient.TabIndex = 9;
labelPacient.Text = "Пациент";
//
// groupBox1
//
groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
groupBox1.Controls.Add(dataGridView);
groupBox1.Location = new Point(12, 151);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(817, 248);
groupBox1.TabIndex = 14;
groupBox1.TabStop = false;
groupBox1.Text = "groupBox1";
//
// dataGridView
//
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnDiagnosis, ColumnStatus, ColumnDrug });
dataGridView.Location = new Point(9, 26);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(510, 188);
dataGridView.TabIndex = 0;
//
// ColumnDiagnosis
//
ColumnDiagnosis.HeaderText = "Диагноз";
ColumnDiagnosis.MinimumWidth = 6;
ColumnDiagnosis.Name = "ColumnDiagnosis";
ColumnDiagnosis.Resizable = DataGridViewTriState.True;
ColumnDiagnosis.SortMode = DataGridViewColumnSortMode.Automatic;
ColumnDiagnosis.Width = 125;
//
// ColumnStatus
//
ColumnStatus.HeaderText = "Статус";
ColumnStatus.MinimumWidth = 6;
ColumnStatus.Name = "ColumnStatus";
ColumnStatus.Width = 125;
//
// ColumnDrug
//
ColumnDrug.HeaderText = "Лекарство";
ColumnDrug.MinimumWidth = 6;
ColumnDrug.Name = "ColumnDrug";
ColumnDrug.Resizable = DataGridViewTriState.True;
ColumnDrug.SortMode = DataGridViewColumnSortMode.Automatic;
ColumnDrug.Width = 125;
//
// labelDoctor
//
labelDoctor.AutoSize = true;
labelDoctor.Location = new Point(35, 86);
labelDoctor.Name = "labelDoctor";
labelDoctor.Size = new Size(59, 20);
labelDoctor.TabIndex = 15;
labelDoctor.Text = "Доктор";
//
// comboBoxDoctor
//
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxDoctor.FormattingEnabled = true;
comboBoxDoctor.Location = new Point(177, 86);
comboBoxDoctor.Name = "comboBoxDoctor";
comboBoxDoctor.Size = new Size(151, 28);
comboBoxDoctor.TabIndex = 16;
//
// FormMedicalHistory
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(841, 659);
Controls.Add(comboBoxDoctor);
Controls.Add(labelDoctor);
Controls.Add(groupBox1);
Controls.Add(labelPacient);
Controls.Add(comboBoxPacient);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Name = "FormMedicalHistory";
Text = "FormMedicalHistory";
groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button buttonSave;
private Button buttonCancel;
private ComboBox comboBoxPacient;
private Label labelPacient;
private GroupBox groupBox1;
private DataGridView dataGridView;
private DataGridViewComboBoxColumn ColumnDiagnosis;
private DataGridViewComboBoxColumn ColumnStatus;
private DataGridViewComboBoxColumn ColumnDrug;
private Label labelDoctor;
private ComboBox comboBoxDoctor;
}
}

View File

@ -0,0 +1,100 @@
using RegistrationPatientsPolyclinic.Entities;
using RegistrationPatientsPolyclinic.Entities.Enums;
using RegistrationPatientsPolyclinic.Repositories;
using RegistrationPatientsPolyclinic.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Markup;
using System.Xml.Linq;
using Unity;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormMedicalHistory : Form
{
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
public FormMedicalHistory(IMedicalHistoryRepository medicalHistoryRepository, IPatientRepository patientRepository,
IDoctorRepository doctorRepository, IDrugRepository drugRepository)
{
InitializeComponent();
_medicalHistoryRepository = medicalHistoryRepository ??
throw new ArgumentNullException(nameof(medicalHistoryRepository));
comboBoxPacient.DataSource = patientRepository.ReadPatient(); // передает набор всех пациентов
comboBoxPacient.DisplayMember = "First_Name"; // отображение в combobox
comboBoxPacient.ValueMember = "Id";
comboBoxDoctor.DataSource = doctorRepository.ReadDoctors();
comboBoxDoctor.DisplayMember = "First_Name";
comboBoxDoctor.ValueMember = "Id";
ColumnDrug.DataSource = drugRepository.ReadDrug();
ColumnDrug.DisplayMember = "DrugName";
ColumnDrug.ValueMember = "Id";
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (dataGridView.RowCount < 1 || comboBoxPacient.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
/*
CreateEntity(0,
Convert.ToInt32(comboBoxPacient.Text),
Convert.ToInt32(row.Cells["ColumnDoctor"].Value), (Diagnosis)row.Cells["ColumnDiagnosis"].Value,
(Status)row.Cells["ColumnStatus"].Value, ColumnDrug);
*/
_medicalHistoryRepository.CreateMedicalHistory(MedicalHistory.CreateEntity(0, (int)comboBoxPacient.SelectedValue!,
(int)comboBoxDoctor.SelectedValue!, CreateListMedicalHistoryFromDataGrid()));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
private void LoadList() => dataGridView.DataSource =
_medicalHistoryRepository.ReadMedicalHistory();
private List<DrugMedicalHistory> CreateListMedicalHistoryFromDataGrid()
{
var list = new List<DrugMedicalHistory>();
foreach (DataGridViewRow row in dataGridView.Rows)
{
if (row.Cells["ColumnDrug"].Value == null)
{
continue;
}
list.Add(DrugMedicalHistory.CreateEntity(0, Convert.ToInt32(row.Cells["ColumnDrug"].Value)));
}
return list;
}
}
}

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ColumnDiagnosis.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnDrug.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,140 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormPatient
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
labelFirstName = new Label();
textBoxName = new TextBox();
labelLastName = new Label();
textBoxLastName = new TextBox();
labelContactNumber = new Label();
textBoxContactNumber = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// labelFirstName
//
labelFirstName.AutoSize = true;
labelFirstName.Location = new Point(16, 25);
labelFirstName.Name = "labelFirstName";
labelFirstName.Size = new Size(39, 20);
labelFirstName.TabIndex = 0;
labelFirstName.Text = "Имя";
//
// textBoxName
//
textBoxName.Location = new Point(169, 25);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(125, 27);
textBoxName.TabIndex = 1;
//
// labelLastName
//
labelLastName.AutoSize = true;
labelLastName.Location = new Point(16, 82);
labelLastName.Name = "labelLastName";
labelLastName.Size = new Size(73, 20);
labelLastName.TabIndex = 2;
labelLastName.Text = "Фамилия";
//
// textBoxLastName
//
textBoxLastName.Location = new Point(169, 82);
textBoxLastName.Name = "textBoxLastName";
textBoxLastName.Size = new Size(125, 27);
textBoxLastName.TabIndex = 3;
//
// labelContactNumber
//
labelContactNumber.AutoSize = true;
labelContactNumber.Location = new Point(12, 147);
labelContactNumber.Name = "labelContactNumber";
labelContactNumber.Size = new Size(142, 20);
labelContactNumber.TabIndex = 4;
labelContactNumber.Text = "Контактный номер";
//
// textBoxContactNumber
//
textBoxContactNumber.Location = new Point(169, 144);
textBoxContactNumber.Name = "textBoxContactNumber";
textBoxContactNumber.Size = new Size(125, 27);
textBoxContactNumber.TabIndex = 5;
//
// buttonSave
//
buttonSave.Location = new Point(16, 223);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(200, 224);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 28);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormPatient
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(829, 441);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxContactNumber);
Controls.Add(labelContactNumber);
Controls.Add(textBoxLastName);
Controls.Add(labelLastName);
Controls.Add(textBoxName);
Controls.Add(labelFirstName);
Name = "FormPatient";
StartPosition = FormStartPosition.CenterParent;
Text = "Пациент";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelFirstName;
private TextBox textBoxName;
private Label labelLastName;
private TextBox textBoxLastName;
private Label labelContactNumber;
private TextBox textBoxContactNumber;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,102 @@
using RegistrationPatientsPolyclinic.Entities;
using RegistrationPatientsPolyclinic.Repositories;
using RegistrationPatientsPolyclinic.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormPatient : Form
{
// Нам для логики потребуется интерфейс IPatientRepository, мы будем его через конструктор передавать
// Когда запись будет открываться на редактирование, надо будет хранить id
// Надо будет как то id передавать (через свойства сетер)
private readonly IPatientRepository _patientRepository;
private int? _patientId;
public int Id // свойство
{
set
{
try
{
var patient = _patientRepository.ReadPatientById(value); // value - некое значение
if (patient == null) // по этому значению пытаемся найти запись в репозитории
{
throw new InvalidDataException(nameof(patient)); // если не находим выкидываем ошибку
}
// Если все норм, то пытаемся заполнить поля
textBoxName.Text = patient.Firts_Name;
textBoxLastName.Text = patient.Last_Name;
textBoxContactNumber.Text = patient.ContactNumber;
_patientId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
// Конструктор, в параметрах Ioc контейнер
// Когда мы попросим Ioc контейнер создать объект от FormPatient, он посмотрит что требуются
// такая зависимость IPatientRepository patientRepository(параметры конструктора)
// в programm.cs это подставлять
// потом создаст объект и передаст его сюда(public FormPatient(IPatientRepository patientRepository){ сюда })
public FormPatient(IPatientRepository patientRepository)
{
InitializeComponent();
_patientRepository = patientRepository ??
throw new ArgumentNullException(nameof(patientRepository));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
// проверяем что поля заполнены
if (string.IsNullOrWhiteSpace(textBoxName.Text) || string.IsNullOrWhiteSpace(textBoxLastName.Text) || string.IsNullOrWhiteSpace(textBoxContactNumber.Text))
{
throw new Exception("Имеются незаполненные поля");
}
// проверка есть ли у нас id
if (_patientId.HasValue)
{
// мы создаем запись и передаем id
_patientRepository.UpdatePatient(CreatePatient(_patientId.Value));
}
else
{
// если id нет, то мы создаем запись, с id ноль
_patientRepository.CreatPatient(CreatePatient(0));
}
// закрываем форму
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
// создаем запись
// Вызываем статичный метод Patient.CreateEntity
private Patient CreatePatient(int id) => Patient.CreateEntity(id, textBoxName.Text, textBoxLastName.Text, textBoxContactNumber.Text);
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,127 @@
namespace RegistrationPatientsPolyclinic.Forms
{
partial class FormPatients
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
buttonUpd = new Button();
buttonDel = new Button();
buttonAdd = new Button();
dataGridView = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(880, 0);
panel1.Name = "panel1";
panel1.Size = new Size(133, 451);
panel1.TabIndex = 0;
//
// buttonUpd
//
buttonUpd.BackgroundImage = Properties.Resources.Снимок_экрана_2024_11_07_173309;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(19, 178);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(94, 62);
buttonUpd.TabIndex = 2;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += ButtonUpd_Click;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.del;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(19, 92);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(94, 64);
buttonDel.TabIndex = 1;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources._5668287_middle;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(19, 12);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 63);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(880, 451);
dataGridView.TabIndex = 1;
//
// FormPatients
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1013, 451);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormPatients";
StartPosition = FormStartPosition.CenterParent;
Text = "Пациенты";
Load += FormPatients_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonUpd;
private Button buttonDel;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,117 @@
using RegistrationPatientsPolyclinic.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace RegistrationPatientsPolyclinic.Forms
{
public partial class FormPatients : Form
{
// Здесь понадобится экземпляр IUnity контейнер через который мы будем создавать объекты FormPatient и вызывать его
// IPatientRepository через который мы будем получать список
private readonly IUnityContainer _container;
private readonly IPatientRepository _pacientRepository;
public FormPatients(IUnityContainer container, IPatientRepository pacientRepository)
{
InitializeComponent();
_container = container ?? // мы получаем через контейнер объект
throw new ArgumentNullException(nameof(container));
_pacientRepository = pacientRepository ??
throw new ArgumentNullException(nameof(pacientRepository)); ;
}
private void FormPatients_Load(object sender, EventArgs e)
{
// метод, при загрузки формы будет прогружаться все данные
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
// мы получаем через container объект FormPatient и вызываем его
try
{
_container.Resolve<FormPatient>().ShowDialog();
LoadList(); // обновление списка
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
// нужно будет вытаскивать идентификатор из dataGridView
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_pacientRepository.DeletePatient(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormPatient>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
// отдельный метод который будет загружать в GridView
private void LoadList() => dataGridView.DataSource = _pacientRepository.ReadPatient();
private bool TryGetIdentifierFromSelectedRow(out int id) // возвращает смог н извлечь или нет
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["id"].Value);
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,3 +1,7 @@
using RegistrationPatientsPolyclinic.Repositories;
using RegistrationPatientsPolyclinic.Repositories.Implementations;
using Unity;
namespace RegistrationPatientsPolyclinic namespace RegistrationPatientsPolyclinic
{ {
internal static class Program internal static class Program
@ -11,7 +15,25 @@ namespace RegistrationPatientsPolyclinic
// To customize application configuration such as set high DPI settings or default font, // To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration. // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
Application.Run(new Form1()); Application.Run(CreateContainer().Resolve<FormPolyclinic>()); // Çäåñü îáúåêò áóäåò ñîçäàâàòüñÿ ÷åðåç êîíòåéíåð
}
// ïðîïèøåì îòäåëüíûé ìåòîä, â êîòîðîì áóäåò ñîçäàâàòü è ðåãåñòðèðîâàòü â çàâèñèìîñòè
// êëþ÷åâîå ñëîâî var - ïðåäíàçíà÷åíà äëÿ îáúÿâëåíèÿ ïåðåìåííûõ áåç ÿâíîãî óêàçàíèÿ èõ òèïà äàííûõ
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
// çàðåãåñòðèðóåì çàâèñèìîñòü
container.RegisterType<IPatientRepository, PatientRepository>();
container.RegisterType<IDoctorRepository, DoctorRepository>();
container.RegisterType<IDoctorPaymentsRepository, DoctorPaymentsRepository>();
container.RegisterType<IMedicalHistoryRepository, MedicalHistoryRepository>();
container.RegisterType<IDrugRepository, DrugRepository>();
container.RegisterType<IDrugMedicalHistory, DrugMedicalHistoryRepository>();
return container;
} }
} }
} }

View File

@ -0,0 +1,113 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RegistrationPatientsPolyclinic.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RegistrationPatientsPolyclinic.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap _5668287_middle {
get {
object obj = ResourceManager.GetObject("5668287-middle", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap del {
get {
object obj = ResourceManager.GetObject("del", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap og_og_1643042666277656852 {
get {
object obj = ResourceManager.GetObject("og_og_1643042666277656852", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap photo_2024_11_06_22_13_46 {
get {
object obj = ResourceManager.GetObject("photo_2024-11-06_22-13-46", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Снимок_экрана_2024_11_07_173309 {
get {
object obj = ResourceManager.GetObject("Снимок экрана 2024-11-07 173309", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="del" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\del.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="og_og_1643042666277656852" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\og_og_1643042666277656852.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="photo_2024-11-06_22-13-46" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\photo_2024-11-06_22-13-46.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="5668287-middle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\5668287-middle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Снимок экрана 2024-11-07 173309" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Снимок экрана 2024-11-07 173309.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -8,4 +8,23 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,18 @@
using RegistrationPatientsPolyclinic.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace RegistrationPatientsPolyclinic.Repositories;
public interface IDrugMedicalHistory
{
IEnumerable<DrugMedicalHistory> ReadDragMedicalHistory(int? drugId, string description); // чтение всего
void CreateDrugMedicalHistory(DrugMedicalHistory drugHistory); // создание объекта
void DeleteDrugMedicalHistory(int Id);
}

View File

@ -0,0 +1,21 @@
using RegistrationPatientsPolyclinic.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Repositories;
public interface IDrugRepository
{
IEnumerable<Drug> ReadDrug();
Drug ReadDrugById(int id);
void CreateDrug(Drug drag);
void UpdateDrug(Drug drag);
void DeleteDrug(int id);
}

View File

@ -12,5 +12,9 @@ public interface IMedicalHistoryRepository
IEnumerable<MedicalHistory> ReadMedicalHistory(DateTime? dateForm = null, DateTime? dateTo = null, int? PatientId = null, IEnumerable<MedicalHistory> ReadMedicalHistory(DateTime? dateForm = null, DateTime? dateTo = null, int? PatientId = null,
int? DoctorId = null); // по этим параметрам можно не весь список читать, а только какую то часть int? DoctorId = null); // по этим параметрам можно не весь список читать, а только какую то часть
void CreateMedicalHistory(MedicalHistory medicalHistory); // объекь будет заносится в список void CreateMedicalHistory(MedicalHistory medicalHistory); // объекь будет заносится в список
void DeletemedicalHistory(int id);
} }

View File

@ -0,0 +1,26 @@
using RegistrationPatientsPolyclinic.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Repositories.Implementations;
public class DrugMedicalHistoryRepository : IDrugMedicalHistory
{
public void CreateDrugMedicalHistory(DrugMedicalHistory drugHistory)
{
}
public void DeleteDrugMedicalHistory(int Id)
{
}
public IEnumerable<DrugMedicalHistory> ReadDragMedicalHistory(int? drugId, string description)
{
return [];
}
}

View File

@ -0,0 +1,37 @@
using RegistrationPatientsPolyclinic.Entities;
using RegistrationPatientsPolyclinic.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Repositories.Implementations;
public class DrugRepository : IDrugRepository
{
public void CreateDrug(Drug drag)
{
}
public void DeleteDrug(int id)
{
}
public IEnumerable<Drug> ReadDrug()
{
return [];
}
public Drug ReadDrugById(int id)
{
return Drug.CreateElement(0, DrugName.None, 0, string.Empty);
}
public void UpdateDrug(Drug drag)
{
}
}

View File

@ -1,4 +1,5 @@
using RegistrationPatientsPolyclinic.Entities; using RegistrationPatientsPolyclinic.Entities;
using RegistrationPatientsPolyclinic.Entities.Enums;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -11,10 +12,20 @@ public class MedicalHistoryRepository : IMedicalHistoryRepository
{ {
public void CreateMedicalHistory(MedicalHistory medicalHistory) public void CreateMedicalHistory(MedicalHistory medicalHistory)
{ {
}
public void DeletemedicalHistory(int id)
{
} }
public IEnumerable<MedicalHistory> ReadMedicalHistory(DateTime? dateForm = null, DateTime? dateTo = null, int? PatientId = null, int? DoctorId = null) public IEnumerable<MedicalHistory> ReadMedicalHistory(DateTime? dateForm = null, DateTime? dateTo = null, int? PatientId = null, int? DoctorId = null)
{ {
return []; return [];
} }
} }

View File

@ -24,7 +24,7 @@ public class PatientRepository : IPatientRepository
public Patient ReadPatientById(int id) public Patient ReadPatientById(int id)
{ {
return Patient.CreatePatient(0, string.Empty, string.Empty, string.Empty); return Patient.CreateEntity(0, string.Empty, string.Empty, string.Empty);
} }
public void UpdatePatient(Patient patient) public void UpdatePatient(Patient patient)

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB