Compare commits

...

4 Commits

73 changed files with 5364 additions and 77 deletions

View File

@ -0,0 +1,17 @@
namespace ProjectPolyclinic.Entities;
public class Diagnosis
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public static Diagnosis CreateDiagnosis(int id, string name)
{
return new Diagnosis
{
Id = id,
Name = name,
};
}
}

View File

@ -0,0 +1,25 @@
using ProjectPolyclinic.Entities.Enums;
namespace ProjectPolyclinic.Entities;
public class Doctor
{
public int Id { get; private set; }
public string FirstName { get; private set; } = string.Empty;
public string LastName { get; private set; } = string.Empty;
public DoctorSpeciality DoctorSpeciality { get; private set; }
public static Doctor CreateEntity(int id, string first, string last, DoctorSpeciality doctorSpeciality)
{
return new Doctor
{
Id = id,
FirstName = first ?? string.Empty,
LastName = last ?? string.Empty,
DoctorSpeciality = doctorSpeciality
};
}
}

View File

@ -0,0 +1,16 @@
namespace ProjectPolyclinic.Entities.Enums;
public enum DoctorSpeciality
{
None = 0,
Cardiologist = 1,
Neurologist = 2,
Dermatologist = 3,
Surgeon = 4,
Pediatrician = 5
}

View File

@ -0,0 +1,7 @@
namespace ProjectPolyclinic.Entities.Enums;
public enum MedicinesStatement
{
Recieved = 1,
Decreased = 2
}

View File

@ -0,0 +1,17 @@
namespace ProjectPolyclinic.Entities.Enums;
[Flags]
public enum MedicinesType
{
None = 0,
Antihypertensive = 1,
Sedative = 2,
Antihistamines = 4,
Analgesics = 8,
Antipyretics = 16
}

View File

@ -0,0 +1,22 @@
using ProjectPolyclinic.Entities.Enums;
namespace ProjectPolyclinic.Entities;
public class Medicines
{
public int Id { get; private set; }
public MedicinesType MedicinesType { get; private set; }
public string Name { get; private set; } = string.Empty;
public static Medicines CreateEntity(int id, MedicinesType medicinesType, string name)
{
return new Medicines
{
Id = id,
MedicinesType = medicinesType,
Name = name ?? string.Empty,
};
}
}

View File

@ -0,0 +1,25 @@
using ProjectPolyclinic.Entities.Enums;
namespace ProjectPolyclinic.Entities;
public class MedicinesMoving
{
public int Id { get; private set; }
public int MedicinesId { get; private set; }
public DateTime Date { get; private set; }
public IEnumerable<MedicinesStatement> MedicinesStatement { get; private set; } = [];
public static MedicinesMoving CreateOperation(int id, int medicinesId, DateTime date, IEnumerable<MedicinesStatement> medicinesStatement)
{
return new MedicinesMoving
{
Id = id,
MedicinesId = medicinesId,
Date = date,
MedicinesStatement = medicinesStatement
};
}
}

View File

@ -0,0 +1,23 @@
namespace ProjectPolyclinic.Entities;
public class MedicinesVisit
{
public int Id { get; private set; }
public int VisitId { get; private set; }
public int MedicinesId { get; private set; }
public int Quantity { get; private set; }
public static MedicinesVisit CreateElement(int id, int visitId, int medicinesId, int quantity)
{
return new MedicinesVisit
{
Id = id,
VisitId = visitId,
MedicinesId = medicinesId,
Quantity = quantity
};
}
}

View File

@ -0,0 +1,24 @@
namespace ProjectPolyclinic.Entities;
public class Patient
{
public int ID { get; private set; }
public string FirstName { get; private set; }
public string LastName { get; private set; }
public DateTime BirthDate { get; private set; }
public string Address { get; private set; }
public int MedicalCardNumber { get; private set; }
public static Patient CreateEntity(int id, string firstName, string lastName, DateTime birthDate, string address, int medicalCardNumber)
{
return new Patient
{
ID = id,
FirstName = firstName,
LastName = lastName,
BirthDate = birthDate,
Address = address,
MedicalCardNumber = medicalCardNumber
};
}
}

View File

@ -0,0 +1,30 @@
namespace ProjectPolyclinic.Entities;
public class Visit
{
public int Id { get; private set; }
public DateTime Date { get; private set; }
public int DiagnosisId { get; private set; }
public int PatientId { get; private set; }
public int DoctorId { get; private set; }
public IEnumerable<MedicinesVisit> MedicinesVisits { get; private set; } = [];
public static Visit CreateOperation(int id, DateTime date, int diagnosisId, int patientId, int doctorId, IEnumerable<MedicinesVisit> medicinesVisits)
{
return new Visit
{
Id = id,
Date = DateTime.Now,
DiagnosisId = diagnosisId,
PatientId = patientId,
DoctorId = doctorId,
MedicinesVisits = medicinesVisits
};
}
}

View File

@ -1,39 +0,0 @@
namespace ProjectPolyclinic
{
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 ProjectPolyclinic
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,147 @@
namespace ProjectPolyclinic
{
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()
{
menuStrip1 = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
врачиToolStripMenuItem = new ToolStripMenuItem();
пациентыToolStripMenuItem = new ToolStripMenuItem();
диагнозыToolStripMenuItem = new ToolStripMenuItem();
медикаментыToolStripMenuItem = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem();
записьНаПриемToolStripMenuItem = new ToolStripMenuItem();
перемещениеЛекарствToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(987, 28);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { врачиToolStripMenuItem, пациентыToolStripMenuItem, диагнозыToolStripMenuItem, медикаментыToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники";
//
// врачиToolStripMenuItem
//
врачиToolStripMenuItem.Name = рачиToolStripMenuItem";
врачиToolStripMenuItem.Size = new Size(224, 26);
врачиToolStripMenuItem.Text = "Врачи";
врачиToolStripMenuItem.Click += DoctorsToolStripMenuItem_Click;
//
// пациентыToolStripMenuItem
//
пациентыToolStripMenuItem.Name = "пациентыToolStripMenuItem";
пациентыToolStripMenuItem.Size = new Size(224, 26);
пациентыToolStripMenuItem.Text = "Пациенты";
пациентыToolStripMenuItem.Click += PatientsToolStripMenuItem_Click;
//
// диагнозыToolStripMenuItem
//
диагнозыToolStripMenuItem.Name = "диагнозыToolStripMenuItem";
диагнозыToolStripMenuItem.Size = new Size(224, 26);
диагнозыToolStripMenuItem.Text = "Диагнозы";
диагнозыToolStripMenuItem.Click += DiagnosesToolStripMenuItem_Click;
//
// медикаментыToolStripMenuItem
//
медикаментыToolStripMenuItem.Name = едикаментыToolStripMenuItem";
медикаментыToolStripMenuItem.Size = new Size(224, 26);
медикаментыToolStripMenuItem.Text = "Медикаменты";
медикаментыToolStripMenuItem.Click += MedicinesToolStripMenuItem_Click;
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { записьНаПриемToolStripMenuItem, перемещениеЛекарствToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(95, 24);
операцииToolStripMenuItem.Text = "Операции";
//
// записьНаПриемToolStripMenuItem
//
записьНаПриемToolStripMenuItem.Name = аписьНаПриемToolStripMenuItem";
записьНаПриемToolStripMenuItem.Size = new Size(258, 26);
записьНаПриемToolStripMenuItem.Text = "Запись на прием";
записьНаПриемToolStripMenuItem.Click += VisitsToolStripMenuItem_Click;
//
// перемещениеЛекарствToolStripMenuItem
//
перемещениеЛекарствToolStripMenuItem.Name = "перемещениеЛекарствToolStripMenuItem";
перемещениеЛекарствToolStripMenuItem.Size = new Size(258, 26);
перемещениеЛекарствToolStripMenuItem.Text = "Перемещение лекарств";
перемещениеЛекарствToolStripMenuItem.Click += MedicinesMovingsToolStripMenuItem_Click;
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(73, 24);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// FormPolyclinic
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.c516ff9163fefeaa5974fc7c8855cd02;
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(987, 499);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Name = "FormPolyclinic";
StartPosition = FormStartPosition.CenterScreen;
Text = "Поликлиника";
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem врачиToolStripMenuItem;
private ToolStripMenuItem пациентыToolStripMenuItem;
private ToolStripMenuItem диагнозыToolStripMenuItem;
private ToolStripMenuItem медикаментыToolStripMenuItem;
private ToolStripMenuItem операцииToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem;
private ToolStripMenuItem записьНаПриемToolStripMenuItem;
private ToolStripMenuItem перемещениеЛекарствToolStripMenuItem;
}
}

View File

@ -0,0 +1,88 @@
using ProjectPolyclinic.Forms;
using Unity;
namespace ProjectPolyclinic
{
public partial class FormPolyclinic : Form
{
private readonly IUnityContainer _container;
public FormPolyclinic(IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void PatientsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPatients>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
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 VisitsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormVisits>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void MedicinesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormMedicines>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void MedicinesMovingsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormMedicinesMovings>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void DiagnosesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDiagnoses>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -0,0 +1,126 @@
<?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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>58</value>
</metadata>
</root>

View File

@ -0,0 +1,122 @@
namespace ProjectPolyclinic.Forms
{
partial class FormDiagnoses
{
/// <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();
DataGridViewDiagnoses = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)DataGridViewDiagnoses).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(590, 0);
panel1.Name = "panel1";
panel1.Size = new Size(210, 450);
panel1.TabIndex = 0;
//
// buttonUpd
//
buttonUpd.BackgroundImage = Properties.Resources.kisspng_computer_icons_transparency_image_editing_symbol_manage_svg_png_icon_free_download_171_77_onli_5d28d47b0152b7_3749987215629569230054;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(56, 286);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(116, 105);
buttonUpd.TabIndex = 2;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += buttonUpd_Click;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.trash_bin_circle_background_icon_free_vector;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(56, 153);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(116, 104);
buttonDel.TabIndex = 1;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += buttonDel_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add1;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(56, 26);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(116, 91);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// DataGridViewDiagnoses
//
DataGridViewDiagnoses.AllowUserToAddRows = false;
DataGridViewDiagnoses.AllowUserToDeleteRows = false;
DataGridViewDiagnoses.AllowUserToResizeColumns = false;
DataGridViewDiagnoses.AllowUserToResizeRows = false;
DataGridViewDiagnoses.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridViewDiagnoses.Dock = DockStyle.Fill;
DataGridViewDiagnoses.Location = new Point(0, 0);
DataGridViewDiagnoses.Name = "DataGridViewDiagnoses";
DataGridViewDiagnoses.ReadOnly = true;
DataGridViewDiagnoses.RowHeadersWidth = 51;
DataGridViewDiagnoses.Size = new Size(590, 450);
DataGridViewDiagnoses.TabIndex = 1;
//
// FormDiagnoses
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(DataGridViewDiagnoses);
Controls.Add(panel1);
Name = "FormDiagnoses";
Text = "Дигнозы";
Load += FormDiagnoses_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)DataGridViewDiagnoses).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonUpd;
private Button buttonDel;
private Button buttonAdd;
private DataGridView DataGridViewDiagnoses;
}
}

View File

@ -0,0 +1,107 @@
using ProjectPolyclinic.Repositories;
using Unity;
namespace ProjectPolyclinic.Forms
{
public partial class FormDiagnoses : Form
{
private readonly IUnityContainer _container;
private readonly IDiagnosisRepository _diagnosisRepository;
public FormDiagnoses(IUnityContainer container, IDiagnosisRepository diagnosisRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_diagnosisRepository = diagnosisRepository ?? throw new ArgumentNullException(nameof(diagnosisRepository));
}
private void FormDiagnoses_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)
{
try
{
_container.Resolve<FormDiagnosis>().ShowDialog();
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<FormDiagnosis>();
form.Id = findId;
form.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
{
_diagnosisRepository.DeleteDiagnosis(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList()
{
try
{
DataGridViewDiagnoses.DataSource = _diagnosisRepository.ReadDiagnosis();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке списка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (DataGridViewDiagnoses.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(DataGridViewDiagnoses.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->

View File

@ -0,0 +1,95 @@
namespace ProjectPolyclinic.Forms
{
partial class FormDiagnosis
{
/// <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();
textBoxName = new TextBox();
label1 = new Label();
SuspendLayout();
//
// buttonSave
//
buttonSave.Location = new Point(21, 166);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(139, 64);
buttonSave.TabIndex = 0;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(182, 166);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(150, 64);
buttonCancel.TabIndex = 1;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// textBoxName
//
textBoxName.Location = new Point(21, 75);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(311, 27);
textBoxName.TabIndex = 2;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(104, 35);
label1.Name = "label1";
label1.Size = new Size(148, 20);
label1.TabIndex = 3;
label1.Text = "Название диагноза:";
//
// FormDiagnosis
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(344, 289);
Controls.Add(label1);
Controls.Add(textBoxName);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Name = "FormDiagnosis";
Text = "Диагноз";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button buttonSave;
private Button buttonCancel;
private TextBox textBoxName;
private Label label1;
}
}

View File

@ -0,0 +1,68 @@
using ProjectPolyclinic.Entities;
using ProjectPolyclinic.Repositories;
namespace ProjectPolyclinic.Forms
{
public partial class FormDiagnosis : Form
{
private readonly IDiagnosisRepository _diagnosisRepository;
private int? _diagnosisId;
public int Id
{
set
{
try
{
var diagnosis = _diagnosisRepository.ReadDiagnosisById(value);
if (diagnosis == null)
{
throw new InvalidDataException(nameof(diagnosis));
}
textBoxName.Text = diagnosis.Name;
_diagnosisId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormDiagnosis(IDiagnosisRepository diagnosisRepository)
{
InitializeComponent();
_diagnosisRepository = diagnosisRepository ?? throw new ArgumentNullException(nameof(diagnosisRepository));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxName.Text))
{
throw new Exception("Поле 'Название диагноза' должно быть заполнено.");
}
else
{
_diagnosisRepository.CreateDiagnosis(CreateDiagnosis(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Diagnosis CreateDiagnosis(int id)
{
return Diagnosis.CreateDiagnosis(id, textBoxName.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,144 @@
namespace ProjectPolyclinic.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()
{
comboBoxSpecialty = new ComboBox();
label1 = new Label();
label2 = new Label();
label3 = new Label();
textBoxFirstName = new TextBox();
textBoxLastName = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// comboBoxSpecialty
//
comboBoxSpecialty.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSpecialty.FormattingEnabled = true;
comboBoxSpecialty.Location = new Point(137, 157);
comboBoxSpecialty.Name = "comboBoxSpecialty";
comboBoxSpecialty.Size = new Size(196, 28);
comboBoxSpecialty.TabIndex = 0;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 20);
label1.Name = "label1";
label1.Size = new Size(42, 20);
label1.TabIndex = 1;
label1.Text = "Имя:";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(12, 89);
label2.Name = "label2";
label2.Size = new Size(76, 20);
label2.TabIndex = 2;
label2.Text = "Фамилия:";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(12, 157);
label3.Name = "label3";
label3.Size = new Size(119, 20);
label3.TabIndex = 3;
label3.Text = "Специальность:";
//
// textBoxFirstName
//
textBoxFirstName.Location = new Point(115, 20);
textBoxFirstName.Name = "textBoxFirstName";
textBoxFirstName.Size = new Size(218, 27);
textBoxFirstName.TabIndex = 4;
//
// textBoxLastName
//
textBoxLastName.Location = new Point(115, 89);
textBoxLastName.Name = "textBoxLastName";
textBoxLastName.Size = new Size(218, 27);
textBoxLastName.TabIndex = 5;
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(12, 211);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(141, 48);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(183, 211);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(150, 48);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormDoctor
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(362, 290);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxLastName);
Controls.Add(textBoxFirstName);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(comboBoxSpecialty);
Name = "FormDoctor";
StartPosition = FormStartPosition.CenterParent;
Text = "Доктор";
ResumeLayout(false);
PerformLayout();
}
#endregion
private ComboBox comboBoxSpecialty;
private Label label1;
private Label label2;
private Label label3;
private TextBox textBoxFirstName;
private TextBox textBoxLastName;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,76 @@
using ProjectPolyclinic.Entities;
using ProjectPolyclinic.Entities.Enums;
using ProjectPolyclinic.Repositories;
namespace ProjectPolyclinic.Forms
{
public partial class FormDoctor : Form
{
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.FirstName;
textBoxLastName.Text = doctor.LastName;
comboBoxSpecialty.SelectedItem = doctor.DoctorSpeciality;
_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));
comboBoxSpecialty.DataSource = Enum.GetValues(typeof(DoctorSpeciality));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) ||
string.IsNullOrWhiteSpace(textBoxLastName.Text) ||
comboBoxSpecialty.SelectedIndex < 0)
{
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, (DoctorSpeciality)comboBoxSpecialty.SelectedItem!);
}
}

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,130 @@
namespace ProjectPolyclinic.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();
DataGridViewDoctors = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)DataGridViewDoctors).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(603, 0);
panel1.Name = "panel1";
panel1.Size = new Size(197, 450);
panel1.TabIndex = 0;
//
// buttonUpd
//
buttonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonUpd.BackgroundImage = Properties.Resources.kisspng_computer_icons_transparency_image_editing_symbol_manage_svg_png_icon_free_download_171_77_onli_5d28d47b0152b7_3749987215629569230054;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(38, 261);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(119, 101);
buttonUpd.TabIndex = 2;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += buttonUpd_Click;
//
// buttonDel
//
buttonDel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonDel.BackgroundImage = Properties.Resources.trash_bin_circle_background_icon_free_vector;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(38, 135);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(119, 100);
buttonDel.TabIndex = 1;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += buttonDel_Click;
//
// buttonAdd
//
buttonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add1;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(38, 12);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(119, 94);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// DataGridViewDoctors
//
DataGridViewDoctors.AllowUserToAddRows = false;
DataGridViewDoctors.AllowUserToDeleteRows = false;
DataGridViewDoctors.AllowUserToResizeColumns = false;
DataGridViewDoctors.AllowUserToResizeRows = false;
DataGridViewDoctors.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
DataGridViewDoctors.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridViewDoctors.Dock = DockStyle.Fill;
DataGridViewDoctors.Location = new Point(0, 0);
DataGridViewDoctors.MultiSelect = false;
DataGridViewDoctors.Name = "DataGridViewDoctors";
DataGridViewDoctors.ReadOnly = true;
DataGridViewDoctors.RowHeadersVisible = false;
DataGridViewDoctors.RowHeadersWidth = 51;
DataGridViewDoctors.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
DataGridViewDoctors.Size = new Size(603, 450);
DataGridViewDoctors.TabIndex = 1;
//
// FormDoctors
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(DataGridViewDoctors);
Controls.Add(panel1);
Name = "FormDoctors";
StartPosition = FormStartPosition.CenterParent;
Text = "Доктора";
Load += FormDoctors_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)DataGridViewDoctors).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private DataGridView DataGridViewDoctors;
private Button buttonUpd;
private Button buttonDel;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,107 @@
using ProjectPolyclinic.Repositories;
using Unity;
namespace ProjectPolyclinic.Forms
{
public partial class FormDoctors : Form
{
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);
}
}
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 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 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 LoadList()
{
try
{
DataGridViewDoctors.DataSource = _doctorRepository.ReadDoctor();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке списка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (DataGridViewDoctors.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(DataGridViewDoctors.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,121 @@
namespace ProjectPolyclinic.Forms
{
partial class FormMedicine
{
/// <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();
checkedListBoxMedicinesType = new CheckedListBox();
label1 = new Label();
label2 = new Label();
textBoxName = new TextBox();
SuspendLayout();
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(17, 237);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(130, 87);
buttonSave.TabIndex = 0;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(236, 237);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(141, 87);
buttonCancel.TabIndex = 1;
buttonCancel.Text = "Отменить";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// checkedListBoxMedicinesType
//
checkedListBoxMedicinesType.FormattingEnabled = true;
checkedListBoxMedicinesType.Location = new Point(155, 30);
checkedListBoxMedicinesType.Name = "checkedListBoxMedicinesType";
checkedListBoxMedicinesType.Size = new Size(233, 114);
checkedListBoxMedicinesType.TabIndex = 2;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(17, 30);
label1.Name = "label1";
label1.Size = new Size(111, 20);
label1.TabIndex = 3;
label1.Text = "Вид лекарства:";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(17, 181);
label2.Name = "label2";
label2.Size = new Size(80, 20);
label2.TabIndex = 4;
label2.Text = "Название:";
//
// textBoxName
//
textBoxName.Location = new Point(155, 181);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(233, 27);
textBoxName.TabIndex = 5;
//
// FormMedicine
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(398, 346);
Controls.Add(textBoxName);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(checkedListBoxMedicinesType);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Name = "FormMedicine";
StartPosition = FormStartPosition.CenterParent;
Text = "Лекарство";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button buttonSave;
private Button buttonCancel;
private CheckedListBox checkedListBoxMedicinesType;
private Label label1;
private Label label2;
private TextBox textBoxName;
}
}

View File

@ -0,0 +1,97 @@
using ProjectPolyclinic.Entities.Enums;
using ProjectPolyclinic.Entities;
using ProjectPolyclinic.Repositories;
namespace ProjectPolyclinic.Forms
{
public partial class FormMedicine : Form
{
private readonly IMedicinesRepository _medicinesRepository;
private int? _medicineId;
public int Id
{
set
{
try
{
var medicine = _medicinesRepository.ReadMedicinesById(value);
if (medicine == null)
{
throw new InvalidDataException(nameof(medicine));
}
foreach (MedicinesType elem in Enum.GetValues(typeof(MedicinesType)))
{
if ((elem & medicine.MedicinesType) != 0)
{
checkedListBoxMedicinesType.SetItemChecked(
checkedListBoxMedicinesType.Items.IndexOf(elem), true);
}
}
textBoxName.Text = medicine.Name;
_medicineId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormMedicine(IMedicinesRepository medicinesRepository)
{
InitializeComponent();
_medicinesRepository = medicinesRepository ?? throw new ArgumentNullException(nameof(medicinesRepository));
foreach (var elem in Enum.GetValues(typeof(MedicinesType)))
{
checkedListBoxMedicinesType.Items.Add(elem);
}
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
checkedListBoxMedicinesType.CheckedItems.Count == 0)
{
throw new Exception("Имеются незаполненные поля");
}
if (_medicineId.HasValue)
{
_medicinesRepository.UpdateMedicines(CreateMedicine(_medicineId.Value));
}
else
{
_medicinesRepository.CreateMedicines(CreateMedicine(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Medicines CreateMedicine(int id)
{
MedicinesType medicineType = MedicinesType.None;
foreach (var elem in checkedListBoxMedicinesType.CheckedItems)
{
medicineType |= (MedicinesType)elem;
}
return Medicines.CreateEntity(id, medicineType, textBoxName.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,128 @@
namespace ProjectPolyclinic.Forms
{
partial class FormMedicines
{
/// <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();
DataGridViewMedicines = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)DataGridViewMedicines).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(565, 0);
panel1.Name = "panel1";
panel1.Size = new Size(181, 424);
panel1.TabIndex = 0;
//
// buttonUpd
//
buttonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonUpd.BackgroundImage = Properties.Resources.kisspng_computer_icons_transparency_image_editing_symbol_manage_svg_png_icon_free_download_171_77_onli_5d28d47b0152b7_3749987215629569230054;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(30, 277);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(118, 105);
buttonUpd.TabIndex = 2;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += buttonUpd_Click;
//
// buttonDel
//
buttonDel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonDel.BackgroundImage = Properties.Resources.trash_bin_circle_background_icon_free_vector;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(30, 155);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(118, 85);
buttonDel.TabIndex = 1;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += buttonDel_Click;
//
// buttonAdd
//
buttonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAdd.AutoSize = true;
buttonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add1;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(30, 34);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(118, 86);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// DataGridViewMedicines
//
DataGridViewMedicines.AllowUserToAddRows = false;
DataGridViewMedicines.AllowUserToDeleteRows = false;
DataGridViewMedicines.AllowUserToResizeColumns = false;
DataGridViewMedicines.AllowUserToResizeRows = false;
DataGridViewMedicines.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridViewMedicines.Dock = DockStyle.Fill;
DataGridViewMedicines.Location = new Point(0, 0);
DataGridViewMedicines.Name = "DataGridViewMedicines";
DataGridViewMedicines.ReadOnly = true;
DataGridViewMedicines.RowHeadersWidth = 51;
DataGridViewMedicines.Size = new Size(565, 424);
DataGridViewMedicines.TabIndex = 1;
//
// FormMedicines
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(746, 424);
Controls.Add(DataGridViewMedicines);
Controls.Add(panel1);
Name = "FormMedicines";
StartPosition = FormStartPosition.CenterParent;
Text = "Лекарства";
Load += FormMedicines_Load;
panel1.ResumeLayout(false);
panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)DataGridViewMedicines).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private DataGridView DataGridViewMedicines;
private Button buttonUpd;
private Button buttonDel;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,107 @@
using ProjectPolyclinic.Repositories;
using Unity;
namespace ProjectPolyclinic.Forms
{
public partial class FormMedicines : Form
{
private readonly IUnityContainer _container;
private readonly IMedicinesRepository _medicinesRepository;
public FormMedicines(IUnityContainer container, IMedicinesRepository medicinesRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_medicinesRepository = medicinesRepository ?? throw new ArgumentNullException(nameof(medicinesRepository));
}
private void FormMedicines_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)
{
try
{
_container.Resolve<FormMedicine>().ShowDialog();
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<FormMedicine>();
form.Id = findId;
form.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
{
_medicinesRepository.DeleteMedicines(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList()
{
try
{
DataGridViewMedicines.DataSource = _medicinesRepository.ReadMedicines();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке списка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (DataGridViewMedicines.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(DataGridViewMedicines.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,144 @@
namespace ProjectPolyclinic.Forms
{
partial class FormMedicinesMoving
{
/// <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()
{
DateTimePickerData = new DateTimePicker();
label1 = new Label();
buttonSave = new Button();
buttonCancel = new Button();
comboBoxName = new ComboBox();
label2 = new Label();
label3 = new Label();
comboBoxMedicinesStatement = new ComboBox();
SuspendLayout();
//
// DateTimePickerData
//
DateTimePickerData.Location = new Point(164, 24);
DateTimePickerData.Name = "DateTimePickerData";
DateTimePickerData.Size = new Size(245, 27);
DateTimePickerData.TabIndex = 0;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 24);
label1.Name = "label1";
label1.Size = new Size(44, 20);
label1.TabIndex = 1;
label1.Text = "Дата:";
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(18, 239);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(119, 53);
buttonSave.TabIndex = 2;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(282, 239);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(127, 53);
buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отменить";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// comboBoxName
//
comboBoxName.FormattingEnabled = true;
comboBoxName.Location = new Point(164, 88);
comboBoxName.Name = "comboBoxName";
comboBoxName.Size = new Size(245, 28);
comboBoxName.TabIndex = 4;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(5, 91);
label2.Name = "label2";
label2.Size = new Size(153, 20);
label2.TabIndex = 5;
label2.Text = "Название лекарства:";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(5, 170);
label3.Name = "label3";
label3.Size = new Size(83, 20);
label3.TabIndex = 6;
label3.Text = "Операция:";
//
// comboBoxMedicinesStatement
//
comboBoxMedicinesStatement.FormattingEnabled = true;
comboBoxMedicinesStatement.Location = new Point(164, 170);
comboBoxMedicinesStatement.Name = "comboBoxMedicinesStatement";
comboBoxMedicinesStatement.Size = new Size(245, 28);
comboBoxMedicinesStatement.TabIndex = 7;
//
// FormMedicinesMoving
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(421, 320);
Controls.Add(comboBoxMedicinesStatement);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(comboBoxName);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(label1);
Controls.Add(DateTimePickerData);
Name = "FormMedicinesMoving";
StartPosition = FormStartPosition.CenterParent;
Text = "Перемещение лекарств";
ResumeLayout(false);
PerformLayout();
}
#endregion
private DateTimePicker DateTimePickerData;
private Label label1;
private Button buttonSave;
private Button buttonCancel;
private ComboBox comboBoxName;
private Label label2;
private Label label3;
private ComboBox comboBoxMedicinesStatement;
}
}

View File

@ -0,0 +1,96 @@
using ProjectPolyclinic.Entities.Enums;
using ProjectPolyclinic.Entities;
using ProjectPolyclinic.Repositories;
namespace ProjectPolyclinic.Forms
{
public partial class FormMedicinesMoving : Form
{
private readonly IMedicinesMovingRepository _medicinesMovingRepository;
private readonly IMedicinesRepository _medicinesRepository;
private int? _operationId;
public int Id
{
set
{
try
{
var medicinesMoving = _medicinesMovingRepository
.ReadMedicinesMovings()
.FirstOrDefault(m => m.Id == value);
if (medicinesMoving == null)
{
throw new InvalidOperationException("Операция с указанным идентификатором не найдена.");
}
DateTimePickerData.Value = medicinesMoving.Date;
comboBoxName.SelectedValue = medicinesMoving.MedicinesId;
comboBoxMedicinesStatement.SelectedValue = medicinesMoving.MedicinesStatement.FirstOrDefault();
_operationId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
public FormMedicinesMoving(
IMedicinesMovingRepository medicinesMovingRepository,
IMedicinesRepository medicinesRepository)
{
InitializeComponent();
_medicinesMovingRepository = medicinesMovingRepository ?? throw new ArgumentNullException(nameof(medicinesMovingRepository));
_medicinesRepository = medicinesRepository ?? throw new ArgumentNullException(nameof(medicinesRepository));
comboBoxName.DataSource = _medicinesRepository.ReadMedicines();
comboBoxName.DisplayMember = "Name";
comboBoxName.ValueMember = "Id";
comboBoxMedicinesStatement.DataSource = Enum.GetValues(typeof(MedicinesStatement));
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxName.SelectedIndex < 0 || comboBoxMedicinesStatement.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля.");
}
if (!DateTime.TryParse(DateTimePickerData.Text, out var operationDate))
{
throw new Exception("Неверный формат даты.");
}
if (_operationId.HasValue)
{
_medicinesMovingRepository.DeleteMedicinesMoving(_operationId.Value);
}
_medicinesMovingRepository.CreateMedicinesMoving(MedicinesMoving.CreateOperation(
_operationId ?? 0,
(int)comboBoxName.SelectedValue!,
operationDate,
new List<MedicinesStatement> { (MedicinesStatement)comboBoxMedicinesStatement.SelectedItem! }
));
MessageBox.Show("Операция успешно сохранена!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
}
}

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,125 @@
namespace ProjectPolyclinic.Forms
{
partial class FormMedicinesMovings
{
/// <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();
DataGridViewMedicinesMovings = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)DataGridViewMedicinesMovings).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(466, 0);
panel1.Name = "panel1";
panel1.Size = new Size(186, 356);
panel1.TabIndex = 0;
//
// buttonUpd
//
buttonUpd.BackgroundImage = Properties.Resources.kisspng_computer_icons_transparency_image_editing_symbol_manage_svg_png_icon_free_download_171_77_onli_5d28d47b0152b7_3749987215629569230054;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(24, 247);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(133, 97);
buttonUpd.TabIndex = 2;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += ButtonUpd_Click;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.trash_bin_circle_background_icon_free_vector;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(24, 132);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(133, 94);
buttonDel.TabIndex = 1;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add1;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(24, 12);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(133, 98);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// DataGridViewMedicinesMovings
//
DataGridViewMedicinesMovings.AllowUserToAddRows = false;
DataGridViewMedicinesMovings.AllowUserToDeleteRows = false;
DataGridViewMedicinesMovings.AllowUserToResizeColumns = false;
DataGridViewMedicinesMovings.AllowUserToResizeRows = false;
DataGridViewMedicinesMovings.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
DataGridViewMedicinesMovings.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridViewMedicinesMovings.Dock = DockStyle.Fill;
DataGridViewMedicinesMovings.Location = new Point(0, 0);
DataGridViewMedicinesMovings.MultiSelect = false;
DataGridViewMedicinesMovings.Name = "DataGridViewMedicinesMovings";
DataGridViewMedicinesMovings.ReadOnly = true;
DataGridViewMedicinesMovings.RowHeadersWidth = 51;
DataGridViewMedicinesMovings.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
DataGridViewMedicinesMovings.Size = new Size(466, 356);
DataGridViewMedicinesMovings.TabIndex = 1;
//
// FormMedicinesMovings
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(652, 356);
Controls.Add(DataGridViewMedicinesMovings);
Controls.Add(panel1);
Name = "FormMedicinesMovings";
Text = "Перемещения лекарств";
Load += FormMedicinesMovings_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)DataGridViewMedicinesMovings).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private DataGridView DataGridViewMedicinesMovings;
private Button buttonUpd;
private Button buttonDel;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,107 @@
using ProjectPolyclinic.Repositories;
using Unity;
namespace ProjectPolyclinic.Forms
{
public partial class FormMedicinesMovings : Form
{
private readonly IUnityContainer _container;
private readonly IMedicinesMovingRepository _medicinesMovingRepository;
public FormMedicinesMovings(IUnityContainer container, IMedicinesMovingRepository medicinesMovingRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_medicinesMovingRepository = medicinesMovingRepository ?? throw new ArgumentNullException(nameof(medicinesMovingRepository));
}
private void FormMedicinesMovings_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)
{
try
{
_container.Resolve<FormMedicinesMoving>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var movingId))
{
return;
}
try
{
var form = _container.Resolve<FormMedicinesMoving>();
form.Id = movingId;
form.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 movingId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_medicinesMovingRepository.DeleteMedicinesMoving(movingId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList()
{
try
{
DataGridViewMedicinesMovings.DataSource = _medicinesMovingRepository.ReadMedicinesMovings();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке списка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (DataGridViewMedicinesMovings.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(DataGridViewMedicinesMovings.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,188 @@
namespace ProjectPolyclinic.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()
{
label1 = new Label();
textBoxFirstName = new TextBox();
label2 = new Label();
textBoxLastName = new TextBox();
label3 = new Label();
textBoxAddress = new TextBox();
label4 = new Label();
label5 = new Label();
textBoxMedicalCardNumber = new MaskedTextBox();
button1 = new Button();
button2 = new Button();
DateTimePickerDate = new DateTimePicker();
SuspendLayout();
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(30, 33);
label1.Name = "label1";
label1.Size = new Size(42, 20);
label1.TabIndex = 0;
label1.Text = "Имя:";
//
// textBoxFirstName
//
textBoxFirstName.Location = new Point(103, 30);
textBoxFirstName.Name = "textBoxFirstName";
textBoxFirstName.Size = new Size(235, 27);
textBoxFirstName.TabIndex = 1;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(18, 119);
label2.Name = "label2";
label2.Size = new Size(76, 20);
label2.TabIndex = 2;
label2.Text = "Фамилия:";
//
// textBoxLastName
//
textBoxLastName.Location = new Point(125, 116);
textBoxLastName.Name = "textBoxLastName";
textBoxLastName.Size = new Size(213, 27);
textBoxLastName.TabIndex = 3;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(12, 199);
label3.Name = "label3";
label3.Size = new Size(119, 20);
label3.TabIndex = 4;
label3.Text = "Дата рождения:";
//
// textBoxAddress
//
textBoxAddress.Location = new Point(75, 270);
textBoxAddress.Name = "textBoxAddress";
textBoxAddress.Size = new Size(263, 27);
textBoxAddress.TabIndex = 6;
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(18, 273);
label4.Name = "label4";
label4.Size = new Size(51, 20);
label4.TabIndex = 7;
label4.Text = "Адрес";
//
// label5
//
label5.AutoSize = true;
label5.Location = new Point(18, 345);
label5.Name = "label5";
label5.Size = new Size(135, 20);
label5.TabIndex = 8;
label5.Text = "Номер мед.карты:";
//
// textBoxMedicalCardNumber
//
textBoxMedicalCardNumber.Location = new Point(171, 338);
textBoxMedicalCardNumber.Mask = "00000";
textBoxMedicalCardNumber.Name = "textBoxMedicalCardNumber";
textBoxMedicalCardNumber.Size = new Size(104, 27);
textBoxMedicalCardNumber.TabIndex = 10;
textBoxMedicalCardNumber.ValidatingType = typeof(int);
//
// button1
//
button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
button1.Location = new Point(18, 397);
button1.Name = "button1";
button1.Size = new Size(114, 41);
button1.TabIndex = 11;
button1.Text = "Сохранить";
button1.UseVisualStyleBackColor = true;
button1.Click += ButtonSave_Click;
//
// button2
//
button2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
button2.Location = new Point(221, 397);
button2.Name = "button2";
button2.Size = new Size(117, 41);
button2.TabIndex = 12;
button2.Text = "Отмена";
button2.UseVisualStyleBackColor = true;
button2.Click += ButtonCancel_Click;
//
// DateTimePickerDate
//
DateTimePickerDate.Location = new Point(137, 194);
DateTimePickerDate.Name = "DateTimePickerDate";
DateTimePickerDate.Size = new Size(201, 27);
DateTimePickerDate.TabIndex = 13;
//
// FormPatient
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(350, 463);
Controls.Add(DateTimePickerDate);
Controls.Add(button2);
Controls.Add(button1);
Controls.Add(textBoxMedicalCardNumber);
Controls.Add(label5);
Controls.Add(label4);
Controls.Add(textBoxAddress);
Controls.Add(label3);
Controls.Add(textBoxLastName);
Controls.Add(label2);
Controls.Add(textBoxFirstName);
Controls.Add(label1);
Name = "FormPatient";
StartPosition = FormStartPosition.CenterParent;
Text = "Пациент";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label label1;
private TextBox textBoxFirstName;
private Label label2;
private TextBox textBoxLastName;
private Label label3;
private TextBox textBoxAddress;
private Label label4;
private Label label5;
private MaskedTextBox textBoxMedicalCardNumber;
private Button button1;
private Button button2;
private DateTimePicker DateTimePickerDate;
}
}

View File

@ -0,0 +1,87 @@
using ProjectPolyclinic.Entities;
using ProjectPolyclinic.Repositories;
namespace ProjectPolyclinic.Forms
{
public partial class FormPatient : Form
{
private readonly IPatientRepository _patientRepository;
private int? _patientId;
public int Id
{
set
{
try
{
var patient = _patientRepository.ReadPatientById(value);
if (patient == null)
{
throw new InvalidDataException(nameof(patient));
}
textBoxFirstName.Text = patient.FirstName;
textBoxLastName.Text = patient.LastName;
DateTimePickerDate.Value = patient.BirthDate;
textBoxAddress.Text = patient.Address;
textBoxMedicalCardNumber.Text = patient.MedicalCardNumber.ToString();
_patientId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormPatient(IPatientRepository patientRepository)
{
InitializeComponent();
_patientRepository = patientRepository ?? throw new ArgumentNullException(nameof(patientRepository));
DateTimePickerDate.MaxDate = DateTime.Today;
DateTimePickerDate.MinDate = new DateTime(1900, 1, 1);
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) ||
string.IsNullOrWhiteSpace(textBoxLastName.Text) ||
string.IsNullOrWhiteSpace(textBoxAddress.Text) ||
string.IsNullOrWhiteSpace(textBoxMedicalCardNumber.Text))
{
throw new Exception("Имеются незаполненные поля");
}
var birthDate = DateTimePickerDate.Value;
if (_patientId.HasValue)
{
_patientRepository.UpdatePatient(CreatePatient(_patientId.Value, birthDate));
}
else
{
_patientRepository.CreatePatient(CreatePatient(0, birthDate));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Patient CreatePatient(int id, DateTime birthDate) => Patient.CreateEntity(
id,
textBoxFirstName.Text,
textBoxLastName.Text,
birthDate,
textBoxAddress.Text,
int.Parse(textBoxMedicalCardNumber.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,156 @@
namespace ProjectPolyclinic.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();
dataGridViewData = new DataGridView();
DataGridViewPatients = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
((System.ComponentModel.ISupportInitialize)DataGridViewPatients).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(ButtonUpd);
panel1.Controls.Add(ButtonDel);
panel1.Controls.Add(ButtonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(564, 0);
panel1.Name = "panel1";
panel1.Size = new Size(178, 450);
panel1.TabIndex = 0;
//
// ButtonUpd
//
ButtonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonUpd.BackgroundImage = Properties.Resources.kisspng_computer_icons_transparency_image_editing_symbol_manage_svg_png_icon_free_download_171_77_onli_5d28d47b0152b7_3749987215629569230054;
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonUpd.Location = new Point(29, 283);
ButtonUpd.Name = "ButtonUpd";
ButtonUpd.Size = new Size(124, 101);
ButtonUpd.TabIndex = 2;
ButtonUpd.UseVisualStyleBackColor = true;
ButtonUpd.Click += ButtonUpd_Click;
//
// ButtonDel
//
ButtonDel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonDel.BackColor = SystemColors.ControlLight;
ButtonDel.BackgroundImage = Properties.Resources.trash_bin_circle_background_icon_free_vector;
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
ButtonDel.Location = new Point(29, 160);
ButtonDel.Name = "ButtonDel";
ButtonDel.Size = new Size(124, 98);
ButtonDel.TabIndex = 1;
ButtonDel.UseVisualStyleBackColor = false;
ButtonDel.Click += ButtonDel_Click;
//
// ButtonAdd
//
ButtonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add1;
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonAdd.Location = new Point(29, 40);
ButtonAdd.Name = "ButtonAdd";
ButtonAdd.Size = new Size(124, 91);
ButtonAdd.TabIndex = 0;
ButtonAdd.TextAlign = ContentAlignment.BottomLeft;
ButtonAdd.UseVisualStyleBackColor = true;
ButtonAdd.Click += ButtonAdd_Click;
//
// dataGridViewData
//
dataGridViewData.AllowUserToAddRows = false;
dataGridViewData.AllowUserToDeleteRows = false;
dataGridViewData.AllowUserToResizeColumns = false;
dataGridViewData.AllowUserToResizeRows = false;
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewData.Dock = DockStyle.Fill;
dataGridViewData.Location = new Point(0, 0);
dataGridViewData.MultiSelect = false;
dataGridViewData.Name = "dataGridViewData";
dataGridViewData.ReadOnly = true;
dataGridViewData.RowHeadersVisible = false;
dataGridViewData.RowHeadersWidth = 51;
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewData.Size = new Size(564, 450);
dataGridViewData.TabIndex = 1;
//
// DataGridViewPatients
//
DataGridViewPatients.AllowUserToAddRows = false;
DataGridViewPatients.AllowUserToDeleteRows = false;
DataGridViewPatients.AllowUserToResizeColumns = false;
DataGridViewPatients.AllowUserToResizeRows = false;
DataGridViewPatients.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
DataGridViewPatients.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridViewPatients.Dock = DockStyle.Fill;
DataGridViewPatients.Location = new Point(0, 0);
DataGridViewPatients.MultiSelect = false;
DataGridViewPatients.Name = "DataGridViewPatients";
DataGridViewPatients.ReadOnly = true;
DataGridViewPatients.RowHeadersVisible = false;
DataGridViewPatients.RowHeadersWidth = 51;
DataGridViewPatients.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
DataGridViewPatients.Size = new Size(564, 450);
DataGridViewPatients.TabIndex = 2;
//
// FormPatients
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(742, 450);
Controls.Add(DataGridViewPatients);
Controls.Add(dataGridViewData);
Controls.Add(panel1);
Name = "FormPatients";
StartPosition = FormStartPosition.CenterParent;
Text = "Пациенты";
Load += FormPatients_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
((System.ComponentModel.ISupportInitialize)DataGridViewPatients).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button ButtonUpd;
private Button ButtonDel;
private Button ButtonAdd;
private DataGridView dataGridViewData;
private DataGridView DataGridViewPatients;
}
}

View File

@ -0,0 +1,108 @@
using ProjectPolyclinic.Repositories;
using Unity;
namespace ProjectPolyclinic.Forms
{
public partial class FormPatients : Form
{
private readonly IUnityContainer _container;
private readonly IPatientRepository _patientRepository;
public FormPatients(IUnityContainer container, IPatientRepository patientRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_patientRepository = patientRepository ?? throw new ArgumentNullException(nameof(patientRepository));
}
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)
{
try
{
_container.Resolve<FormPatient>().ShowDialog();
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);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_patientRepository.DeletePatient(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList()
{
try
{
DataGridViewPatients.DataSource = _patientRepository.ReadPatient();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке списка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (DataGridViewPatients.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(DataGridViewPatients.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,221 @@
namespace ProjectPolyclinic.Forms
{
partial class FormVisit
{
/// <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()
{
DateTimePickerData = new DateTimePicker();
label1 = new Label();
label2 = new Label();
label3 = new Label();
comboBoxDiagnosis = new ComboBox();
comboBoxPatient = new ComboBox();
comboBoxDoctor = new ComboBox();
label4 = new Label();
buttonSave = new Button();
buttonCancel = new Button();
groupBoxMedicines = new GroupBox();
DataGridViewMedicines = new DataGridView();
ColumnMedicine = new DataGridViewComboBoxColumn();
ColumnQuantity = new DataGridViewTextBoxColumn();
groupBoxMedicines.SuspendLayout();
((System.ComponentModel.ISupportInitialize)DataGridViewMedicines).BeginInit();
SuspendLayout();
//
// DateTimePickerData
//
DateTimePickerData.Location = new Point(132, 24);
DateTimePickerData.Name = "DateTimePickerData";
DateTimePickerData.Size = new Size(250, 27);
DateTimePickerData.TabIndex = 0;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 24);
label1.Name = "label1";
label1.Size = new Size(41, 20);
label1.TabIndex = 1;
label1.Text = "Дата";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(12, 103);
label2.Name = "label2";
label2.Size = new Size(67, 20);
label2.TabIndex = 2;
label2.Text = "Диагноз";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(12, 186);
label3.Name = "label3";
label3.Size = new Size(69, 20);
label3.TabIndex = 3;
label3.Text = "Пациент";
//
// comboBoxDiagnosis
//
comboBoxDiagnosis.FormattingEnabled = true;
comboBoxDiagnosis.Location = new Point(132, 103);
comboBoxDiagnosis.Name = "comboBoxDiagnosis";
comboBoxDiagnosis.Size = new Size(250, 28);
comboBoxDiagnosis.TabIndex = 4;
//
// comboBoxPatient
//
comboBoxPatient.FormattingEnabled = true;
comboBoxPatient.Location = new Point(132, 186);
comboBoxPatient.Name = "comboBoxPatient";
comboBoxPatient.Size = new Size(250, 28);
comboBoxPatient.TabIndex = 5;
//
// comboBoxDoctor
//
comboBoxDoctor.FormattingEnabled = true;
comboBoxDoctor.Location = new Point(132, 271);
comboBoxDoctor.Name = "comboBoxDoctor";
comboBoxDoctor.Size = new Size(250, 28);
comboBoxDoctor.TabIndex = 6;
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(12, 279);
label4.Name = "label4";
label4.Size = new Size(43, 20);
label4.TabIndex = 7;
label4.Text = "Врач";
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(12, 580);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(156, 52);
buttonSave.TabIndex = 8;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(220, 580);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(162, 52);
buttonCancel.TabIndex = 9;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// groupBoxMedicines
//
groupBoxMedicines.Controls.Add(DataGridViewMedicines);
groupBoxMedicines.Location = new Point(12, 358);
groupBoxMedicines.Name = "groupBoxMedicines";
groupBoxMedicines.Size = new Size(370, 197);
groupBoxMedicines.TabIndex = 10;
groupBoxMedicines.TabStop = false;
groupBoxMedicines.Text = "Лекарства";
//
// DataGridViewMedicines
//
DataGridViewMedicines.AllowUserToResizeColumns = false;
DataGridViewMedicines.AllowUserToResizeRows = false;
DataGridViewMedicines.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
DataGridViewMedicines.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
DataGridViewMedicines.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridViewMedicines.Columns.AddRange(new DataGridViewColumn[] { ColumnMedicine, ColumnQuantity });
DataGridViewMedicines.Location = new Point(3, 23);
DataGridViewMedicines.MultiSelect = false;
DataGridViewMedicines.Name = "DataGridViewMedicines";
DataGridViewMedicines.RowHeadersVisible = false;
DataGridViewMedicines.RowHeadersWidth = 51;
DataGridViewMedicines.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
DataGridViewMedicines.Size = new Size(364, 171);
DataGridViewMedicines.TabIndex = 0;
//
// ColumnMedicine
//
ColumnMedicine.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumnMedicine.HeaderText = "Лекарство";
ColumnMedicine.MinimumWidth = 6;
ColumnMedicine.Name = "ColumnMedicine";
//
// ColumnQuantity
//
ColumnQuantity.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumnQuantity.HeaderText = "Количество";
ColumnQuantity.MinimumWidth = 6;
ColumnQuantity.Name = "ColumnQuantity";
//
// FormVisit
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(410, 660);
Controls.Add(groupBoxMedicines);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(label4);
Controls.Add(comboBoxDoctor);
Controls.Add(comboBoxPatient);
Controls.Add(comboBoxDiagnosis);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(DateTimePickerData);
Name = "FormVisit";
StartPosition = FormStartPosition.CenterParent;
Text = "Запись на прием";
groupBoxMedicines.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)DataGridViewMedicines).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private DateTimePicker DateTimePickerData;
private Label label1;
private Label label2;
private Label label3;
private ComboBox comboBoxDiagnosis;
private ComboBox comboBoxPatient;
private ComboBox comboBoxDoctor;
private Label label4;
private Button buttonSave;
private Button buttonCancel;
private GroupBox groupBoxMedicines;
private DataGridView DataGridViewMedicines;
private DataGridViewComboBoxColumn ColumnMedicine;
private DataGridViewTextBoxColumn ColumnQuantity;
}
}

View File

@ -0,0 +1,152 @@
using ProjectPolyclinic.Entities;
using ProjectPolyclinic.Repositories;
using System.Data;
namespace ProjectPolyclinic.Forms
{
public partial class FormVisit : Form
{
private readonly IVisitRepository _visitRepository;
private readonly IDiagnosisRepository _diagnosisRepository;
private readonly IPatientRepository _patientRepository;
private readonly IDoctorRepository _doctorRepository;
private readonly IMedicinesRepository _medicinesRepository;
private int? _visitId;
public int Id
{
set
{
try
{
var visitList = _visitRepository.ReadVisit(date: null, diagnosisId: null, patientId: null, doctorId: null)
.Where(v => v.Id == value).ToList();
var visit = visitList.FirstOrDefault();
if (visit == null)
{
throw new InvalidOperationException("Визит с указанным идентификатором не найден.");
}
DateTimePickerData.Value = visit.Date;
comboBoxDiagnosis.SelectedValue = visit.DiagnosisId;
comboBoxPatient.SelectedValue = visit.PatientId;
comboBoxDoctor.SelectedValue = visit.DoctorId;
DataGridViewMedicines.Rows.Clear();
foreach (var medicineVisit in visit.MedicinesVisits)
{
DataGridViewMedicines.Rows.Add(
medicineVisit.MedicinesId,
medicineVisit.Quantity
);
}
_visitId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
public FormVisit(
IVisitRepository visitRepository,
IDiagnosisRepository diagnosisRepository,
IPatientRepository patientRepository,
IDoctorRepository doctorRepository,
IMedicinesRepository medicinesRepository)
{
InitializeComponent();
_visitRepository = visitRepository ?? throw new ArgumentNullException(nameof(visitRepository));
_diagnosisRepository = diagnosisRepository ?? throw new ArgumentNullException(nameof(diagnosisRepository));
_patientRepository = patientRepository ?? throw new ArgumentNullException(nameof(patientRepository));
_doctorRepository = doctorRepository ?? throw new ArgumentNullException(nameof(doctorRepository));
_medicinesRepository = medicinesRepository ?? throw new ArgumentNullException(nameof(medicinesRepository));
comboBoxDiagnosis.DataSource = _diagnosisRepository.ReadDiagnosis();
comboBoxDiagnosis.DisplayMember = "Name";
comboBoxDiagnosis.ValueMember = "Id";
comboBoxPatient.DataSource = _patientRepository.ReadPatient();
comboBoxPatient.DisplayMember = "Name";
comboBoxPatient.ValueMember = "Id";
comboBoxDoctor.DataSource = _doctorRepository.ReadDoctor();
comboBoxDoctor.DisplayMember = "Name";
comboBoxDoctor.ValueMember = "Id";
ColumnMedicine.DataSource = _medicinesRepository.ReadMedicines();
ColumnMedicine.DisplayMember = "Name";
ColumnMedicine.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxDiagnosis.SelectedIndex < 0 ||
comboBoxPatient.SelectedIndex < 0 ||
comboBoxDoctor.SelectedIndex < 0 ||
DataGridViewMedicines.RowCount < 1)
{
throw new Exception("Имеются незаполненные поля.");
}
if (!DateTime.TryParse(DateTimePickerData.Text, out var visitDate))
{
throw new Exception("Неверный формат даты.");
}
if (_visitId.HasValue)
{
_visitRepository.DeleteVisit(_visitId.Value);
}
_visitRepository.CreateVisit(Visit.CreateOperation(
_visitId ?? 0,
visitDate,
(int)comboBoxDiagnosis.SelectedValue!,
(int)comboBoxPatient.SelectedValue!,
(int)comboBoxDoctor.SelectedValue!,
CreateListMedicinesVisitsFromDataGrid()
));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private List<MedicinesVisit> CreateListMedicinesVisitsFromDataGrid()
{
var list = new List<MedicinesVisit>();
foreach (DataGridViewRow row in DataGridViewMedicines.Rows)
{
if (row.Cells["ColumnMedicine"].Value == null ||
row.Cells["ColumnQuantity"].Value == null)
{
continue;
}
list.Add(MedicinesVisit.CreateElement(
0,
_visitId ?? 0,
Convert.ToInt32(row.Cells["ColumnMedicine"].Value),
Convert.ToInt32(row.Cells["ColumnQuantity"].Value)
));
}
return list;
}
}
}

View File

@ -0,0 +1,132 @@
<?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="ColumnMedicine.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnQuantity.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnMedicine.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnQuantity.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,126 @@
namespace ProjectPolyclinic.Forms
{
partial class FormVisits
{
/// <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();
DataGridViewVisits = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)DataGridViewVisits).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(513, 0);
panel1.Name = "panel1";
panel1.Size = new Size(201, 443);
panel1.TabIndex = 0;
//
// buttonUpd
//
buttonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonUpd.BackgroundImage = Properties.Resources.kisspng_computer_icons_transparency_image_editing_symbol_manage_svg_png_icon_free_download_171_77_onli_5d28d47b0152b7_3749987215629569230054;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(31, 282);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(146, 114);
buttonUpd.TabIndex = 2;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += ButtonUpd_Click;
//
// buttonDel
//
buttonDel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonDel.BackgroundImage = Properties.Resources.trash_bin_circle_background_icon_free_vector;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(31, 151);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(146, 109);
buttonDel.TabIndex = 1;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_Click;
//
// buttonAdd
//
buttonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add1;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(31, 22);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(146, 112);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// DataGridViewVisits
//
DataGridViewVisits.AllowUserToAddRows = false;
DataGridViewVisits.AllowUserToDeleteRows = false;
DataGridViewVisits.AllowUserToResizeColumns = false;
DataGridViewVisits.AllowUserToResizeRows = false;
DataGridViewVisits.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridViewVisits.Dock = DockStyle.Fill;
DataGridViewVisits.Location = new Point(0, 0);
DataGridViewVisits.Name = "DataGridViewVisits";
DataGridViewVisits.ReadOnly = true;
DataGridViewVisits.RowHeadersWidth = 51;
DataGridViewVisits.Size = new Size(513, 443);
DataGridViewVisits.TabIndex = 1;
//
// FormVisits
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(714, 443);
Controls.Add(DataGridViewVisits);
Controls.Add(panel1);
Name = "FormVisits";
StartPosition = FormStartPosition.CenterParent;
Text = "Записи на прием";
Load += FormVisits_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)DataGridViewVisits).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonUpd;
private Button buttonDel;
private Button buttonAdd;
private DataGridView DataGridViewVisits;
}
}

View File

@ -0,0 +1,107 @@
using ProjectPolyclinic.Repositories;
using Unity;
namespace ProjectPolyclinic.Forms
{
public partial class FormVisits : Form
{
private readonly IUnityContainer _container;
private readonly IVisitRepository _visitRepository;
public FormVisits(IUnityContainer container, IVisitRepository visitRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_visitRepository = visitRepository ?? throw new ArgumentNullException(nameof(visitRepository));
}
private void FormVisits_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)
{
try
{
_container.Resolve<FormVisit>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var visitId))
{
return;
}
try
{
var form = _container.Resolve<FormVisit>();
form.Id = visitId;
form.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 visitId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_visitRepository.DeleteVisit(visitId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList()
{
try
{
DataGridViewVisits.DataSource = _visitRepository.ReadVisit();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке списка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (DataGridViewVisits.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(DataGridViewVisits.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 ProjectPolyclinic.Repositories;
using ProjectPolyclinic.Repositories.Implementations;
using Unity;
namespace ProjectPolyclinic namespace ProjectPolyclinic
{ {
internal static class Program internal static class Program
@ -11,7 +15,21 @@ namespace ProjectPolyclinic
// 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>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IDiagnosisRepository, DiagnosisRepository>();
container.RegisterType<IDoctorRepository, DoctorRepository>();
container.RegisterType<IMedicinesRepository, MedicinesRepository>();
container.RegisterType<IPatientRepository, PatientRepository>();
container.RegisterType<IVisitRepository, VisitRepository>();
container.RegisterType<IMedicinesMovingRepository, MedicinesMovingRepository>();
return container;
} }
} }
} }

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,104 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectPolyclinic.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("ProjectPolyclinic.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 c516ff9163fefeaa5974fc7c8855cd02 {
get {
object obj = ResourceManager.GetObject("c516ff9163fefeaa5974fc7c8855cd02", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Fairytale_button_add1 {
get {
object obj = ResourceManager.GetObject("Fairytale_button_add1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap kisspng_computer_icons_transparency_image_editing_symbol_manage_svg_png_icon_free_download_171_77_onli_5d28d47b0152b7_3749987215629569230054 {
get {
object obj = ResourceManager.GetObject("kisspng-computer-icons-transparency-image-editing-symbol-manage-svg-png-icon-free" +
"-download-171-77-onli-5d28d47b0152b7.3749987215629569230054", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap trash_bin_circle_background_icon_free_vector {
get {
object obj = ResourceManager.GetObject("trash-bin-circle-background-icon-free-vector", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,133 @@
<?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="c516ff9163fefeaa5974fc7c8855cd02" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\c516ff9163fefeaa5974fc7c8855cd02.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Fairytale_button_add1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Fairytale_button_add.svg.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="trash-bin-circle-background-icon-free-vector" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\trash-bin-circle-background-icon-free-vector.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="kisspng-computer-icons-transparency-image-editing-symbol-manage-svg-png-icon-free-download-171-77-onli-5d28d47b0152b7.3749987215629569230054" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\kisspng-computer-icons-transparency-image-editing-symbol-manage-svg-png-icon-free-download-171-77-onli-5d28d47b0152b7.3749987215629569230054.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,16 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories;
public interface IDiagnosisRepository
{
IEnumerable<Diagnosis> ReadDiagnosis();
Diagnosis ReadDiagnosisById(int id);
void CreateDiagnosis(Diagnosis diagnosis);
void UpdaterDiagnosis(Diagnosis diagnosis);
void DeleteDiagnosis(int id);
}

View File

@ -0,0 +1,16 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories;
public interface IDoctorRepository
{
IEnumerable<Doctor> ReadDoctor();
Doctor ReadDoctorById(int id);
void CreateDoctor(Doctor doctor);
void UpdateDoctor(Doctor doctor);
void DeleteDoctor(int id);
}

View File

@ -0,0 +1,14 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories;
public interface IMedicinesMovingRepository
{
void CreateMedicinesMoving(MedicinesMoving medicinesMoving);
IEnumerable<MedicinesMoving> ReadMedicinesMovings(int? medicinesId = null, DateTime? date = null);
void UpdateMedicinesMoving(MedicinesMoving medicinesMoving);
void DeleteMedicinesMoving(int id);
}

View File

@ -0,0 +1,16 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories;
public interface IMedicinesRepository
{
IEnumerable<Medicines> ReadMedicines();
Medicines ReadMedicinesById(int id);
void CreateMedicines(Medicines medicines);
void UpdateMedicines(Medicines medicines);
void DeleteMedicines(int id);
}

View File

@ -0,0 +1,16 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories;
public interface IPatientRepository
{
IEnumerable<Patient> ReadPatient();
Patient ReadPatientById(int id);
void CreatePatient(Patient patient);
void UpdatePatient(Patient patient);
void DeletePatient(int id);
}

View File

@ -0,0 +1,12 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories;
public interface IVisitRepository
{
IEnumerable<Visit> ReadVisit(DateTime? date = null, int? diagnosisId = null, int? patientId = null, int? doctorId = null);
void CreateVisit(Visit visit);
void DeleteVisit(int id);
}

View File

@ -0,0 +1,28 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories.Implementations;
public class DiagnosisRepository : IDiagnosisRepository
{
public void CreateDiagnosis(Diagnosis diagnosis)
{
}
public void DeleteDiagnosis(int id)
{
}
public IEnumerable<Diagnosis> ReadDiagnosis()
{
return [];
}
public Diagnosis ReadDiagnosisById(int id)
{
return Diagnosis.CreateDiagnosis(0, string.Empty);
}
public void UpdaterDiagnosis(Diagnosis diagnosis)
{
}
}

View File

@ -0,0 +1,29 @@
using ProjectPolyclinic.Entities;
using ProjectPolyclinic.Entities.Enums;
namespace ProjectPolyclinic.Repositories.Implementations;
public class DoctorRepository : IDoctorRepository
{
public void CreateDoctor(Doctor doctor)
{
}
public void DeleteDoctor(int id)
{
}
public IEnumerable<Doctor> ReadDoctor()
{
return [];
}
public Doctor ReadDoctorById(int id)
{
return Doctor.CreateEntity(0, string.Empty, string.Empty, DoctorSpeciality.None);
}
public void UpdateDoctor(Doctor doctor)
{
}
}

View File

@ -0,0 +1,23 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories.Implementations;
public class MedicinesMovingRepository : IMedicinesMovingRepository
{
public void CreateMedicinesMoving(MedicinesMoving medicinesMoving)
{
}
public IEnumerable<MedicinesMoving> ReadMedicinesMovings(int? medicinesId = null, DateTime? date = null)
{
return [];
}
public void UpdateMedicinesMoving(MedicinesMoving medicinesMoving)
{
}
public void DeleteMedicinesMoving(int id)
{
}
}

View File

@ -0,0 +1,29 @@
using ProjectPolyclinic.Entities;
using ProjectPolyclinic.Entities.Enums;
namespace ProjectPolyclinic.Repositories.Implementations;
public class MedicinesRepository : IMedicinesRepository
{
public void CreateMedicines(Medicines medicines)
{
}
public void DeleteMedicines(int id)
{
}
public IEnumerable<Medicines> ReadMedicines()
{
return [];
}
public Medicines ReadMedicinesById(int id)
{
return Medicines.CreateEntity(0, MedicinesType.None, string.Empty);
}
public void UpdateMedicines(Medicines medicines)
{
}
}

View File

@ -0,0 +1,28 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories.Implementations;
public class PatientRepository : IPatientRepository
{
public void CreatePatient(Patient patient)
{
}
public void DeletePatient(int id)
{
}
public IEnumerable<Patient> ReadPatient()
{
return [];
}
public Patient ReadPatientById(int id)
{
return Patient.CreateEntity(0, string.Empty, string.Empty, DateTime.Now, string.Empty, 0);
}
public void UpdatePatient(Patient patient)
{
}
}

View File

@ -0,0 +1,19 @@
using ProjectPolyclinic.Entities;
namespace ProjectPolyclinic.Repositories.Implementations;
public class VisitRepository : IVisitRepository
{
public void CreateVisit(Visit visit)
{
}
public void DeleteVisit(int id)
{
}
public IEnumerable<Visit> ReadVisit(DateTime? date = null, int? diagnosisId = null, int? patientId = null, int? doctorId = null)
{
return [];
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -1,2 +0,0 @@
# PIbd-22_Smolin_D.S._Polyclinic

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB