Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
f995cae743 | |||
441b9a1443 | |||
36ae53c017 | |||
e195fc1d6c | |||
c03c1c3e5c | |||
0f718e3c87 | |||
b35480e955 | |||
a56d1f3a43 | |||
6cd38e0439 | |||
f1c0b4e0ff |
26
ProjectPolyclinic/ProjectPolyclinic/Entities/Doctor.cs
Normal file
26
ProjectPolyclinic/ProjectPolyclinic/Entities/Doctor.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using ProjectPolyclinic.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities;
|
||||
|
||||
public class Doctor
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string First_Name { get; private set; } = string.Empty;
|
||||
public string Last_Name { get; private set; } = string.Empty;
|
||||
public Specialization Specialization { get; private set; }
|
||||
public static Doctor CreateEntity(int id, string first_Name, string last_Name, Specialization specialization)
|
||||
{
|
||||
return new Doctor
|
||||
{
|
||||
Id = id,
|
||||
First_Name = first_Name ?? string.Empty,
|
||||
Last_Name = last_Name ?? string.Empty,
|
||||
Specialization = specialization
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities.Enums;
|
||||
[Flags]
|
||||
public enum DiagnosisName
|
||||
{
|
||||
None = 0,
|
||||
Flu = 1,
|
||||
Fracture = 2,
|
||||
Asthma = 4,
|
||||
SkinInfection = 8,
|
||||
HeartDisease = 16
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities.Enums;
|
||||
|
||||
[Flags]
|
||||
public enum MedicinesType
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Aspirin = 1,
|
||||
|
||||
Ibuprofen = 2,
|
||||
|
||||
Synopret = 4,
|
||||
|
||||
Pentalginum = 8,
|
||||
|
||||
Paracetamol= 16
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities.Enums;
|
||||
|
||||
public enum Specialization
|
||||
{
|
||||
None = 0,
|
||||
GeneralPractitioner = 1, // Терапевт - Грипп
|
||||
Surgeon = 2, // Хирург - Перелом
|
||||
Pediatrician = 3, // Педиатр - Астма
|
||||
Dermatologist = 4, // Дерматолог - Кожная инфекция
|
||||
Cardiologist = 5
|
||||
}
|
26
ProjectPolyclinic/ProjectPolyclinic/Entities/Medication.cs
Normal file
26
ProjectPolyclinic/ProjectPolyclinic/Entities/Medication.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using ProjectPolyclinic.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities;
|
||||
|
||||
public class Medication
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public MedicinesType MedicinesType { get; private set; }
|
||||
public string Dosing { get; private set; } = string.Empty;
|
||||
public string Description { get; private set; } = string.Empty;
|
||||
public static Medication CreateEntity(int id,MedicinesType medicinesType,string dosing, string description)
|
||||
{
|
||||
return new Medication
|
||||
{
|
||||
Id = id,
|
||||
MedicinesType = medicinesType,
|
||||
Dosing = dosing ?? string.Empty,
|
||||
Description = description ?? string.Empty,
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities;
|
||||
|
||||
public class Medicines_Visiting
|
||||
{
|
||||
public int MedicinesId { get; private set; }
|
||||
public int VisitingId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
public static Medicines_Visiting CreateElement(int medicinesId, int visitingId, int count)
|
||||
{
|
||||
return new Medicines_Visiting
|
||||
{
|
||||
MedicinesId = medicinesId,
|
||||
VisitingId = visitingId,
|
||||
Count = count
|
||||
};
|
||||
}
|
||||
|
||||
}
|
26
ProjectPolyclinic/ProjectPolyclinic/Entities/Patient.cs
Normal file
26
ProjectPolyclinic/ProjectPolyclinic/Entities/Patient.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities
|
||||
{
|
||||
public class Patient
|
||||
{
|
||||
public int Id { get;private set; }
|
||||
public string First_Name { get; private set; } = string.Empty;
|
||||
public string Last_Name { get; private set; } = string.Empty;
|
||||
public string ContactNumber { get; private set; } = string.Empty;
|
||||
public static Patient CreateEntity(int id, string first_Name, string last_Name, string contactNumber)
|
||||
{
|
||||
return new Patient
|
||||
{
|
||||
Id = id,
|
||||
First_Name = first_Name,
|
||||
Last_Name = last_Name,
|
||||
ContactNumber = contactNumber
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities
|
||||
{
|
||||
public class ProfessionalDevelopment
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int DoctorId { get; private set; }
|
||||
public DateTime ProfessionalDevelopmentTime { get; private set; }
|
||||
//public string Description { get; private set; } = string.Empty;
|
||||
public static ProfessionalDevelopment CreateOperation(int id, int doctorId, DateTime professionalDevelopmentTime)
|
||||
{
|
||||
return new ProfessionalDevelopment
|
||||
{
|
||||
Id = id,
|
||||
DoctorId = doctorId,
|
||||
ProfessionalDevelopmentTime = professionalDevelopmentTime,
|
||||
// Description = description ?? string.Empty
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using ProjectPolyclinic.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities;
|
||||
|
||||
public class TempMedicines_Visiting
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int DoctorId { get; private set; }
|
||||
public int PatientId { get; private set; }
|
||||
public DiagnosisName DiagnosisName { get; private set; }
|
||||
public DateTime VisitingTime { get; private set; }
|
||||
public int VisitingId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
public int MedicinesId { get; private set; }
|
||||
}
|
46
ProjectPolyclinic/ProjectPolyclinic/Entities/Visiting.cs
Normal file
46
ProjectPolyclinic/ProjectPolyclinic/Entities/Visiting.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using ProjectPolyclinic.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Entities;
|
||||
|
||||
public class Visiting
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int DoctorId { get; private set; }
|
||||
public int PatientId { get; private set; }
|
||||
public DiagnosisName DiagnosisName { get; private set; }
|
||||
public DateTime VisitingTime { get; private set; }
|
||||
public IEnumerable<Medicines_Visiting> Medicines
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = [];
|
||||
public static Visiting CreateOperation(int id, int doctorId, int patientId, DiagnosisName diagnosisName, DateTime visitingTime, IEnumerable<Medicines_Visiting> medicines)
|
||||
{
|
||||
return new Visiting
|
||||
{
|
||||
Id = id,
|
||||
DoctorId = doctorId,
|
||||
PatientId = patientId,
|
||||
DiagnosisName = diagnosisName,
|
||||
VisitingTime = DateTime.Now,
|
||||
Medicines = medicines
|
||||
};
|
||||
}
|
||||
public static Visiting CreateOperation(TempMedicines_Visiting tempMedicines_Visiting, IEnumerable<Medicines_Visiting> medicines)
|
||||
{
|
||||
return new Visiting
|
||||
{
|
||||
Id = tempMedicines_Visiting.Id,
|
||||
DoctorId = tempMedicines_Visiting.DoctorId,
|
||||
PatientId = tempMedicines_Visiting.PatientId,
|
||||
DiagnosisName = tempMedicines_Visiting.DiagnosisName,
|
||||
VisitingTime = tempMedicines_Visiting.VisitingTime,
|
||||
Medicines = medicines
|
||||
};
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace ProjectPolyclinic
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
168
ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.Designer.cs
generated
Normal file
168
ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.Designer.cs
generated
Normal file
@ -0,0 +1,168 @@
|
||||
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();
|
||||
DoctorsToolStripMenuItem = new ToolStripMenuItem();
|
||||
MedicinesToolStripMenuItem = new ToolStripMenuItem();
|
||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||
VisitingsToolStripMenuItem = new ToolStripMenuItem();
|
||||
ProfessionalDevelopmentsToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
directoryReportToolStripMenuItem = new ToolStripMenuItem();
|
||||
visitingReportToolStripMenuItem = new ToolStripMenuItem();
|
||||
повышениеКвалификацииToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(784, 24);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { пациентыToolStripMenuItem, DoctorsToolStripMenuItem, MedicinesToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// пациентыToolStripMenuItem
|
||||
//
|
||||
пациентыToolStripMenuItem.Name = "пациентыToolStripMenuItem";
|
||||
пациентыToolStripMenuItem.Size = new Size(152, 22);
|
||||
пациентыToolStripMenuItem.Text = "Пациенты";
|
||||
пациентыToolStripMenuItem.Click += PatientsToolStripMenuItem_Click;
|
||||
//
|
||||
// DoctorsToolStripMenuItem
|
||||
//
|
||||
DoctorsToolStripMenuItem.Name = "DoctorsToolStripMenuItem";
|
||||
DoctorsToolStripMenuItem.Size = new Size(152, 22);
|
||||
DoctorsToolStripMenuItem.Text = "Врачи";
|
||||
DoctorsToolStripMenuItem.Click += DoctorsToolStripMenuItem_Click;
|
||||
//
|
||||
// MedicinesToolStripMenuItem
|
||||
//
|
||||
MedicinesToolStripMenuItem.Name = "MedicinesToolStripMenuItem";
|
||||
MedicinesToolStripMenuItem.Size = new Size(152, 22);
|
||||
MedicinesToolStripMenuItem.Text = "Медикаменты";
|
||||
MedicinesToolStripMenuItem.Click += MedicinesToolStripMenuItem_Click;
|
||||
//
|
||||
// операцииToolStripMenuItem
|
||||
//
|
||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { VisitingsToolStripMenuItem, ProfessionalDevelopmentsToolStripMenuItem });
|
||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
||||
операцииToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// VisitingsToolStripMenuItem
|
||||
//
|
||||
VisitingsToolStripMenuItem.Name = "VisitingsToolStripMenuItem";
|
||||
VisitingsToolStripMenuItem.Size = new Size(226, 22);
|
||||
VisitingsToolStripMenuItem.Text = "Визиты";
|
||||
VisitingsToolStripMenuItem.Click += VisitingsToolStripMenuItem_Click;
|
||||
//
|
||||
// ProfessionalDevelopmentsToolStripMenuItem
|
||||
//
|
||||
ProfessionalDevelopmentsToolStripMenuItem.Name = "ProfessionalDevelopmentsToolStripMenuItem";
|
||||
ProfessionalDevelopmentsToolStripMenuItem.Size = new Size(226, 22);
|
||||
ProfessionalDevelopmentsToolStripMenuItem.Text = "Повышение квалификации";
|
||||
ProfessionalDevelopmentsToolStripMenuItem.Click += ProfessionalDevelopmentsToolStripMenuItem_Click;
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { directoryReportToolStripMenuItem, visitingReportToolStripMenuItem, повышениеКвалификацииToolStripMenuItem });
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// directoryReportToolStripMenuItem
|
||||
//
|
||||
directoryReportToolStripMenuItem.Name = "directoryReportToolStripMenuItem";
|
||||
directoryReportToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.W;
|
||||
directoryReportToolStripMenuItem.Size = new Size(280, 22);
|
||||
directoryReportToolStripMenuItem.Text = "Документ со справочниками";
|
||||
directoryReportToolStripMenuItem.Click += DirectoryReportToolStripMenuItem_Click;
|
||||
//
|
||||
// visitingReportToolStripMenuItem
|
||||
//
|
||||
visitingReportToolStripMenuItem.Name = "visitingReportToolStripMenuItem";
|
||||
visitingReportToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.E;
|
||||
visitingReportToolStripMenuItem.Size = new Size(280, 22);
|
||||
visitingReportToolStripMenuItem.Text = "Движение визитов";
|
||||
visitingReportToolStripMenuItem.Click += VisitingReportToolStripMenuItem_Click;
|
||||
//
|
||||
// повышениеКвалификацииToolStripMenuItem
|
||||
//
|
||||
повышениеКвалификацииToolStripMenuItem.Name = "повышениеКвалификацииToolStripMenuItem";
|
||||
повышениеКвалификацииToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.P;
|
||||
повышениеКвалификацииToolStripMenuItem.Size = new Size(280, 22);
|
||||
повышениеКвалификацииToolStripMenuItem.Text = "Повышение квалификации";
|
||||
повышениеКвалификацииToolStripMenuItem.Click += ProfessionalDevelopmentDistributionToolStripMenuItem_Click;
|
||||
//
|
||||
// FormPolyclinic
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackgroundImage = Properties.Resources.поликлиника;
|
||||
BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ClientSize = new Size(784, 411);
|
||||
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 DoctorsToolStripMenuItem;
|
||||
private ToolStripMenuItem MedicinesToolStripMenuItem;
|
||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||
private ToolStripMenuItem VisitingsToolStripMenuItem;
|
||||
private ToolStripMenuItem ProfessionalDevelopmentsToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem directoryReportToolStripMenuItem;
|
||||
private ToolStripMenuItem visitingReportToolStripMenuItem;
|
||||
private ToolStripMenuItem повышениеКвалификацииToolStripMenuItem;
|
||||
}
|
||||
}
|
122
ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.cs
Normal file
122
ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.cs
Normal file
@ -0,0 +1,122 @@
|
||||
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 MedicinesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormMedicines>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void VisitingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormVisitings>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ProfessionalDevelopmentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormProfessional_developments>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void DirectoryReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDirectoryReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void VisitingReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormVisitingReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProfessionalDevelopmentDistributionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormProfessionalDevelopmentDistributionReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.resx
Normal file
123
ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
101
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDirectoryReport.Designer.cs
generated
Normal file
101
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDirectoryReport.Designer.cs
generated
Normal file
@ -0,0 +1,101 @@
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
partial class FormDirectoryReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
checkBoxDoctors = new CheckBox();
|
||||
checkBoxPatients = new CheckBox();
|
||||
checkBoxMedicines = new CheckBox();
|
||||
buttonBuild = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// checkBoxDoctors
|
||||
//
|
||||
checkBoxDoctors.AutoSize = true;
|
||||
checkBoxDoctors.Location = new Point(51, 47);
|
||||
checkBoxDoctors.Name = "checkBoxDoctors";
|
||||
checkBoxDoctors.Size = new Size(60, 19);
|
||||
checkBoxDoctors.TabIndex = 0;
|
||||
checkBoxDoctors.Text = "Врачи";
|
||||
checkBoxDoctors.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxPatients
|
||||
//
|
||||
checkBoxPatients.AutoSize = true;
|
||||
checkBoxPatients.Location = new Point(51, 85);
|
||||
checkBoxPatients.Name = "checkBoxPatients";
|
||||
checkBoxPatients.Size = new Size(82, 19);
|
||||
checkBoxPatients.TabIndex = 1;
|
||||
checkBoxPatients.Text = "Пациенты";
|
||||
checkBoxPatients.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxMedicines
|
||||
//
|
||||
checkBoxMedicines.AutoSize = true;
|
||||
checkBoxMedicines.Location = new Point(51, 119);
|
||||
checkBoxMedicines.Name = "checkBoxMedicines";
|
||||
checkBoxMedicines.Size = new Size(104, 19);
|
||||
checkBoxMedicines.TabIndex = 2;
|
||||
checkBoxMedicines.Text = "Медикаменты";
|
||||
checkBoxMedicines.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonBuild
|
||||
//
|
||||
buttonBuild.BackColor = SystemColors.Control;
|
||||
buttonBuild.Location = new Point(238, 83);
|
||||
buttonBuild.Name = "buttonBuild";
|
||||
buttonBuild.Size = new Size(101, 23);
|
||||
buttonBuild.TabIndex = 3;
|
||||
buttonBuild.Text = "Сформировать";
|
||||
buttonBuild.UseVisualStyleBackColor = false;
|
||||
buttonBuild.Click += ButtonBuild_Click;
|
||||
//
|
||||
// FormDirectoryReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(385, 170);
|
||||
Controls.Add(buttonBuild);
|
||||
Controls.Add(checkBoxMedicines);
|
||||
Controls.Add(checkBoxPatients);
|
||||
Controls.Add(checkBoxDoctors);
|
||||
Name = "FormDirectoryReport";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Выгрузка справочников";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckBox checkBoxDoctors;
|
||||
private CheckBox checkBoxPatients;
|
||||
private CheckBox checkBoxMedicines;
|
||||
private Button buttonBuild;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
using ProjectPolyclinic.Reports;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
public partial class FormDirectoryReport : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public FormDirectoryReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void ButtonBuild_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!checkBoxDoctors.Checked &&
|
||||
!checkBoxPatients.Checked && !checkBoxMedicines.Checked)
|
||||
{
|
||||
throw new Exception("Не выбран ни один справочник для выгрузки");
|
||||
}
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Docx Files | *.docx"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
throw new Exception("Не выбран файла для отчета");
|
||||
}
|
||||
if
|
||||
(_container.Resolve<DocReport>().CreateDoc(sfd.FileName, checkBoxDoctors.Checked,
|
||||
checkBoxPatients.Checked,
|
||||
checkBoxMedicines.Checked))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch ( Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании отчета", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
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
|
||||
|
||||
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>
|
||||
@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
142
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.Designer.cs
generated
Normal file
142
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.Designer.cs
generated
Normal file
@ -0,0 +1,142 @@
|
||||
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()
|
||||
{
|
||||
comboBoxSpec = new ComboBox();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
textBoxNameDoctor = new TextBox();
|
||||
textBoxName2Doctor = new TextBox();
|
||||
button1 = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxSpec
|
||||
//
|
||||
comboBoxSpec.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSpec.FormattingEnabled = true;
|
||||
comboBoxSpec.Location = new Point(170, 96);
|
||||
comboBoxSpec.Name = "comboBoxSpec";
|
||||
comboBoxSpec.Size = new Size(159, 23);
|
||||
comboBoxSpec.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(34, 29);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(72, 15);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "Имя врача :";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(34, 69);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(99, 15);
|
||||
label2.TabIndex = 2;
|
||||
label2.Text = "Фамилия врача :";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(34, 104);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(98, 15);
|
||||
label3.TabIndex = 3;
|
||||
label3.Text = "Специальность :";
|
||||
//
|
||||
// textBoxNameDoctor
|
||||
//
|
||||
textBoxNameDoctor.Location = new Point(170, 29);
|
||||
textBoxNameDoctor.Name = "textBoxNameDoctor";
|
||||
textBoxNameDoctor.Size = new Size(159, 23);
|
||||
textBoxNameDoctor.TabIndex = 4;
|
||||
//
|
||||
// textBoxName2Doctor
|
||||
//
|
||||
textBoxName2Doctor.Location = new Point(170, 61);
|
||||
textBoxName2Doctor.Name = "textBoxName2Doctor";
|
||||
textBoxName2Doctor.Size = new Size(159, 23);
|
||||
textBoxName2Doctor.TabIndex = 5;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.Location = new Point(66, 153);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(95, 34);
|
||||
button1.TabIndex = 6;
|
||||
button1.Text = "Сохранить";
|
||||
button1.UseVisualStyleBackColor = true;
|
||||
button1.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(288, 153);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(95, 34);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormDoctor
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(460, 237);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(textBoxName2Doctor);
|
||||
Controls.Add(textBoxNameDoctor);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(comboBoxSpec);
|
||||
Name = "FormDoctor";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Врач";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxSpec;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private TextBox textBoxNameDoctor;
|
||||
private TextBox textBoxName2Doctor;
|
||||
private Button button1;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
88
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.cs
Normal file
88
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.cs
Normal file
@ -0,0 +1,88 @@
|
||||
using ProjectPolyclinic.Entities;
|
||||
using ProjectPolyclinic.Entities.Enums;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
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));
|
||||
}
|
||||
textBoxNameDoctor.Text = doctor.First_Name;
|
||||
textBoxName2Doctor.Text = doctor.Last_Name;
|
||||
comboBoxSpec.SelectedItem = doctor.Specialization;
|
||||
_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));
|
||||
comboBoxSpec.DataSource = Enum.GetValues(typeof(Specialization));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxNameDoctor.Text) ||
|
||||
string.IsNullOrWhiteSpace(textBoxName2Doctor.Text)
|
||||
||
|
||||
comboBoxSpec.SelectedIndex < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненныеполя");
|
||||
}
|
||||
if (_doctorId.HasValue)
|
||||
{
|
||||
_doctorRepository.UpdateDoctor(CreateDoctor(_doctorId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_doctorRepository.CreateDoctor(CreateDoctor(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
private Doctor CreateDoctor(int id) => Doctor.CreateEntity(id, textBoxNameDoctor.Text, textBoxName2Doctor.Text,
|
||||
(Specialization)comboBoxSpec.SelectedItem!);
|
||||
|
||||
private void FormDoctor_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.resx
Normal file
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.resx
Normal 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>
|
126
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.Designer.cs
generated
Normal file
126
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
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();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonUpd);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(674, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(126, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.минус;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(23, 148);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(80, 55);
|
||||
buttonDel.TabIndex = 2;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.карандаш;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(23, 87);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(80, 55);
|
||||
buttonUpd.TabIndex = 1;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.плюс;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(21, 26);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(80, 55);
|
||||
buttonAdd.TabIndex = 0;
|
||||
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.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(674, 450);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormDoctors
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormDoctors";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Врачи";
|
||||
Load += FormDoctors_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
114
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.cs
Normal file
114
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace 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() => dataGridViewData.DataSource =_doctorRepository.ReadDoctors();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.resx
Normal file
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.resx
Normal 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>
|
142
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedication.Designer.cs
generated
Normal file
142
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedication.Designer.cs
generated
Normal file
@ -0,0 +1,142 @@
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
partial class FormMedication
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
checkedListBoxMedicinesType = new CheckedListBox();
|
||||
textBoxDosing = new TextBox();
|
||||
richTextBoxDescription = new RichTextBox();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// checkedListBoxMedicinesType
|
||||
//
|
||||
checkedListBoxMedicinesType.FormattingEnabled = true;
|
||||
checkedListBoxMedicinesType.Location = new Point(122, 32);
|
||||
checkedListBoxMedicinesType.Name = "checkedListBoxMedicinesType";
|
||||
checkedListBoxMedicinesType.Size = new Size(150, 112);
|
||||
checkedListBoxMedicinesType.TabIndex = 0;
|
||||
//
|
||||
// textBoxDosing
|
||||
//
|
||||
textBoxDosing.Location = new Point(122, 160);
|
||||
textBoxDosing.Name = "textBoxDosing";
|
||||
textBoxDosing.Size = new Size(150, 23);
|
||||
textBoxDosing.TabIndex = 1;
|
||||
//
|
||||
// richTextBoxDescription
|
||||
//
|
||||
richTextBoxDescription.Location = new Point(122, 215);
|
||||
richTextBoxDescription.Name = "richTextBoxDescription";
|
||||
richTextBoxDescription.Size = new Size(150, 96);
|
||||
richTextBoxDescription.TabIndex = 2;
|
||||
richTextBoxDescription.Text = "";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(30, 32);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(63, 15);
|
||||
label1.TabIndex = 3;
|
||||
label1.Text = "Таблетки :";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(30, 168);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(72, 15);
|
||||
label2.TabIndex = 4;
|
||||
label2.Text = "Дозировка :";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(30, 218);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(68, 15);
|
||||
label3.TabIndex = 5;
|
||||
label3.Text = "Описание :";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(43, 349);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(86, 34);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(218, 349);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(85, 34);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormMedication
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(358, 450);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(richTextBoxDescription);
|
||||
Controls.Add(textBoxDosing);
|
||||
Controls.Add(checkedListBoxMedicinesType);
|
||||
Name = "FormMedication";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Медикамент";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckedListBox checkedListBoxMedicinesType;
|
||||
private TextBox textBoxDosing;
|
||||
private RichTextBox richTextBoxDescription;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
107
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedication.cs
Normal file
107
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedication.cs
Normal file
@ -0,0 +1,107 @@
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
using ProjectPolyclinic.Entities;
|
||||
using ProjectPolyclinic.Entities.Enums;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
public partial class FormMedication : Form
|
||||
{
|
||||
private readonly IMedicationRepository _medicationRepository;
|
||||
private int? _medicationId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var medication = _medicationRepository.ReadMedicationById(value);
|
||||
if (medication == null)
|
||||
{
|
||||
throw new
|
||||
InvalidDataException(nameof(medication));
|
||||
}
|
||||
foreach (MedicinesType elem in
|
||||
Enum.GetValues(typeof(MedicinesType)))
|
||||
{
|
||||
if ((elem & medication.MedicinesType) != 0)
|
||||
{
|
||||
checkedListBoxMedicinesType.SetItemChecked(checkedListBoxMedicinesType.Items.IndexOf(
|
||||
elem), true);
|
||||
}
|
||||
}
|
||||
textBoxDosing.Text = medication.Dosing;
|
||||
richTextBoxDescription.Text = medication.Description;
|
||||
_medicationId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при полученииданных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormMedication(IMedicationRepository medicationRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_medicationRepository = medicationRepository ?? throw new ArgumentNullException(nameof(medicationRepository));
|
||||
foreach (var elem in Enum.GetValues(typeof(MedicinesType)))
|
||||
{
|
||||
checkedListBoxMedicinesType.Items.Add(elem);
|
||||
}
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxDosing.Text) ||
|
||||
string.IsNullOrWhiteSpace(richTextBoxDescription.Text) ||
|
||||
checkedListBoxMedicinesType.CheckedItems.Count == 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_medicationId.HasValue)
|
||||
{
|
||||
_medicationRepository.UpdateMedication(CreateMedication(_medicationId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_medicationRepository.CreateMedication(CreateMedication(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
private Medication CreateMedication(int id)
|
||||
{
|
||||
MedicinesType medicinesType = MedicinesType.None;
|
||||
foreach (var elem in checkedListBoxMedicinesType.CheckedItems)
|
||||
{
|
||||
medicinesType |= (MedicinesType)elem;
|
||||
}
|
||||
return Medication.CreateEntity(id, medicinesType, textBoxDosing.Text,
|
||||
richTextBoxDescription.Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedication.resx
Normal file
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedication.resx
Normal 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>
|
126
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicines.Designer.cs
generated
Normal file
126
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicines.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
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();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonUpd);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(671, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(129, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.минус;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(31, 157);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(75, 58);
|
||||
buttonDel.TabIndex = 2;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.карандаш;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(31, 90);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(75, 61);
|
||||
buttonUpd.TabIndex = 1;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.плюс;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(31, 26);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 58);
|
||||
buttonAdd.TabIndex = 0;
|
||||
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.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(671, 450);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormMedicines
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormMedicines";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Медикаменты";
|
||||
Load += FormMedicines_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
115
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicines.cs
Normal file
115
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicines.cs
Normal file
@ -0,0 +1,115 @@
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
public partial class FormMedicines : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IMedicationRepository _medicationRepository;
|
||||
public FormMedicines(IUnityContainer container, IMedicationRepository medicationRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_medicationRepository = medicationRepository ?? throw new ArgumentNullException(nameof(medicationRepository));
|
||||
}
|
||||
|
||||
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<FormMedication>().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<FormMedication>();
|
||||
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
|
||||
{
|
||||
_medicationRepository.DeleteMedication(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridViewData.DataSource = _medicationRepository.ReadMedicines();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id =
|
||||
Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicines.resx
Normal file
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicines.resx
Normal 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>
|
140
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.Designer.cs
generated
Normal file
140
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.Designer.cs
generated
Normal file
@ -0,0 +1,140 @@
|
||||
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();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
textBoxNamePatient = new TextBox();
|
||||
textBoxName2Patient = new TextBox();
|
||||
textBoxNumberPatient = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(40, 37);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(91, 15);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Имя пациента :";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(40, 78);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(118, 15);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Фамилия пациента :";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(40, 116);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(105, 15);
|
||||
label3.TabIndex = 2;
|
||||
label3.Text = "Номер пациента :";
|
||||
//
|
||||
// textBoxNamePatient
|
||||
//
|
||||
textBoxNamePatient.Location = new Point(176, 37);
|
||||
textBoxNamePatient.Name = "textBoxNamePatient";
|
||||
textBoxNamePatient.Size = new Size(203, 23);
|
||||
textBoxNamePatient.TabIndex = 3;
|
||||
//
|
||||
// textBoxName2Patient
|
||||
//
|
||||
textBoxName2Patient.Location = new Point(176, 70);
|
||||
textBoxName2Patient.Name = "textBoxName2Patient";
|
||||
textBoxName2Patient.Size = new Size(203, 23);
|
||||
textBoxName2Patient.TabIndex = 4;
|
||||
//
|
||||
// textBoxNumberPatient
|
||||
//
|
||||
textBoxNumberPatient.Location = new Point(176, 113);
|
||||
textBoxNumberPatient.Name = "textBoxNumberPatient";
|
||||
textBoxNumberPatient.Size = new Size(203, 23);
|
||||
textBoxNumberPatient.TabIndex = 5;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(56, 176);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(112, 36);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(230, 176);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(104, 36);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormPatient
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(425, 250);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxNumberPatient);
|
||||
Controls.Add(textBoxName2Patient);
|
||||
Controls.Add(textBoxNamePatient);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Name = "FormPatient";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Пациент";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private TextBox textBoxNamePatient;
|
||||
private TextBox textBoxName2Patient;
|
||||
private TextBox textBoxNumberPatient;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
79
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.cs
Normal file
79
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.cs
Normal file
@ -0,0 +1,79 @@
|
||||
using ProjectPolyclinic.Entities;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
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));
|
||||
|
||||
}
|
||||
textBoxNamePatient.Text = patient.First_Name;
|
||||
textBoxName2Patient.Text = patient.Last_Name;
|
||||
textBoxNumberPatient.Text = patient.ContactNumber;
|
||||
_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));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxNamePatient.Text) || string.IsNullOrWhiteSpace(textBoxName2Patient.Text) || string.IsNullOrWhiteSpace(textBoxNumberPatient.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_patientId.HasValue)
|
||||
{
|
||||
_patientRepository.UpdatePatient(CreatePatient(_patientId.Value));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_patientRepository.CreatePatient(CreatePatient(0));
|
||||
}
|
||||
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) => Patient.CreateEntity(id, textBoxNamePatient.Text, textBoxName2Patient.Text, textBoxNumberPatient.Text);
|
||||
}
|
||||
}
|
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.resx
Normal file
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.resx
Normal 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>
|
126
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.Designer.cs
generated
Normal file
126
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
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();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonUpd);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(667, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(139, 506);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.минус;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(23, 173);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(104, 71);
|
||||
buttonDel.TabIndex = 2;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.карандаш;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(23, 90);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(104, 77);
|
||||
buttonUpd.TabIndex = 1;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.плюс;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(23, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(104, 72);
|
||||
buttonAdd.TabIndex = 0;
|
||||
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.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(667, 506);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormPatients
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(806, 506);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormPatients";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Пациенты";
|
||||
Load += FormPatients_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
116
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.cs
Normal file
116
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.cs
Normal file
@ -0,0 +1,116 @@
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace 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() => dataGridViewData.DataSource = _patientRepository.ReadPatients();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id =
|
||||
Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.resx
Normal file
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.resx
Normal 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>
|
122
ProjectPolyclinic/ProjectPolyclinic/Forms/FormProfessionalDevelopment.Designer.cs
generated
Normal file
122
ProjectPolyclinic/ProjectPolyclinic/Forms/FormProfessionalDevelopment.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
partial class FormProfessionalDevelopment
|
||||
{
|
||||
/// <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();
|
||||
label2 = new Label();
|
||||
comboBoxDoctor = new ComboBox();
|
||||
dateTimePickerProfessionalDevelopmentDate = new DateTimePicker();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(45, 37);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(40, 15);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Врач :";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(45, 96);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(38, 15);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Дата :";
|
||||
//
|
||||
// comboBoxDoctor
|
||||
//
|
||||
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDoctor.FormattingEnabled = true;
|
||||
comboBoxDoctor.Location = new Point(144, 32);
|
||||
comboBoxDoctor.Name = "comboBoxDoctor";
|
||||
comboBoxDoctor.Size = new Size(138, 23);
|
||||
comboBoxDoctor.TabIndex = 3;
|
||||
//
|
||||
// dateTimePickerProfessionalDevelopmentDate
|
||||
//
|
||||
dateTimePickerProfessionalDevelopmentDate.Location = new Point(144, 96);
|
||||
dateTimePickerProfessionalDevelopmentDate.Name = "dateTimePickerProfessionalDevelopmentDate";
|
||||
dateTimePickerProfessionalDevelopmentDate.Size = new Size(200, 23);
|
||||
dateTimePickerProfessionalDevelopmentDate.TabIndex = 4;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonSave.Location = new Point(45, 134);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(84, 38);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(211, 134);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(87, 38);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormProfessionalDevelopment
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(368, 184);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(dateTimePickerProfessionalDevelopmentDate);
|
||||
Controls.Add(comboBoxDoctor);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Name = "FormProfessionalDevelopment";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Повышение квалификации врача";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private ComboBox comboBoxDoctor;
|
||||
private DateTimePicker dateTimePickerProfessionalDevelopmentDate;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
using ProjectPolyclinic.Entities;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
public partial class FormProfessionalDevelopment : Form
|
||||
{
|
||||
private readonly IProfessionalDevelopmentRepository _professionalDevelopmentRepository;
|
||||
|
||||
public FormProfessionalDevelopment(IProfessionalDevelopmentRepository professionalDevelopmentRepository, IDoctorRepository doctorRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_professionalDevelopmentRepository = professionalDevelopmentRepository ??
|
||||
throw new ArgumentNullException(nameof(professionalDevelopmentRepository));
|
||||
comboBoxDoctor.DataSource = doctorRepository.ReadDoctors();
|
||||
comboBoxDoctor.DisplayMember = "FirstName";
|
||||
comboBoxDoctor.ValueMember = "Id";
|
||||
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxDoctor.SelectedIndex < 0 )
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_professionalDevelopmentRepository.CreateProfessionalDevelopment(ProfessionalDevelopment.CreateOperation(
|
||||
0,
|
||||
(int)comboBoxDoctor.SelectedValue!,
|
||||
dateTimePickerProfessionalDevelopmentDate.Value));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
}
|
||||
}
|
@ -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>
|
108
ProjectPolyclinic/ProjectPolyclinic/Forms/FormProfessionalDevelopmentDistributionReport.Designer.cs
generated
Normal file
108
ProjectPolyclinic/ProjectPolyclinic/Forms/FormProfessionalDevelopmentDistributionReport.Designer.cs
generated
Normal file
@ -0,0 +1,108 @@
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
partial class FormProfessionalDevelopmentDistributionReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
buttonSelectFileName = new Button();
|
||||
labelFileName = new Label();
|
||||
labelDate = new Label();
|
||||
buttonCreate = new Button();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonSelectFileName
|
||||
//
|
||||
buttonSelectFileName.Location = new Point(46, 28);
|
||||
buttonSelectFileName.Name = "buttonSelectFileName";
|
||||
buttonSelectFileName.Size = new Size(75, 23);
|
||||
buttonSelectFileName.TabIndex = 0;
|
||||
buttonSelectFileName.Text = "Выбрать";
|
||||
buttonSelectFileName.UseVisualStyleBackColor = true;
|
||||
buttonSelectFileName.Click += ButtonSelectFileName_Click;
|
||||
//
|
||||
// labelFileName
|
||||
//
|
||||
labelFileName.AutoSize = true;
|
||||
labelFileName.Location = new Point(152, 32);
|
||||
labelFileName.Name = "labelFileName";
|
||||
labelFileName.Size = new Size(36, 15);
|
||||
labelFileName.TabIndex = 1;
|
||||
labelFileName.Text = "Файл";
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(46, 79);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(38, 15);
|
||||
labelDate.TabIndex = 2;
|
||||
labelDate.Text = "Дата :";
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Location = new Point(113, 133);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(101, 23);
|
||||
buttonCreate.TabIndex = 3;
|
||||
buttonCreate.Text = "Сформировать";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += ButtonCreate_Click;
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(113, 79);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(200, 23);
|
||||
dateTimePicker.TabIndex = 4;
|
||||
//
|
||||
// FormProfessionalDevelopmentDistributionReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(349, 178);
|
||||
Controls.Add(dateTimePicker);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(labelFileName);
|
||||
Controls.Add(buttonSelectFileName);
|
||||
Name = "FormProfessionalDevelopmentDistributionReport";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Повышение квалификации";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonSelectFileName;
|
||||
private Label labelFileName;
|
||||
private Label labelDate;
|
||||
private Button buttonCreate;
|
||||
private DateTimePicker dateTimePicker;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
using ProjectPolyclinic.Reports;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
public partial class FormProfessionalDevelopmentDistributionReport : Form
|
||||
{
|
||||
private string _fileName = string.Empty;
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormProfessionalDevelopmentDistributionReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void ButtonSelectFileName_Click(object sender, EventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Pdf Files | *.pdf"
|
||||
};
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_fileName = sfd.FileName;
|
||||
labelFileName.Text = Path.GetFileName(_fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_fileName))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла для отчета");
|
||||
}
|
||||
if
|
||||
(_container.Resolve<ChartReport>().CreateChart(_fileName, dateTimePicker.Value))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании очета",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
98
ProjectPolyclinic/ProjectPolyclinic/Forms/FormProfessionalDevelopments.Designer.cs
generated
Normal file
98
ProjectPolyclinic/ProjectPolyclinic/Forms/FormProfessionalDevelopments.Designer.cs
generated
Normal file
@ -0,0 +1,98 @@
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
partial class FormProfessional_developments
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(654, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(146, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.плюс;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(35, 38);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(80, 58);
|
||||
buttonAdd.TabIndex = 0;
|
||||
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.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(654, 450);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormProfessional_developments
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormProfessional_developments";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Повышение квалификации врачей";
|
||||
Load += FormProfessionalDevelopments_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using ProjectPolyclinic.Repositories.Implementations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
public partial class FormProfessional_developments : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IProfessionalDevelopmentRepository _professionalDevelopmentRepository;
|
||||
public FormProfessional_developments(IUnityContainer container, IProfessionalDevelopmentRepository professionalDevelopmentRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_professionalDevelopmentRepository = professionalDevelopmentRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(professionalDevelopmentRepository));
|
||||
}
|
||||
|
||||
private void FormProfessionalDevelopments_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<FormProfessionalDevelopment>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridViewData.DataSource = _professionalDevelopmentRepository.ReadProfessionalDevelopment();
|
||||
|
||||
}
|
||||
}
|
@ -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>
|
218
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisiting.Designer.cs
generated
Normal file
218
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisiting.Designer.cs
generated
Normal file
@ -0,0 +1,218 @@
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
partial class FormVisiting
|
||||
{
|
||||
/// <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();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
checkedListBoxDiagnosisName = new CheckedListBox();
|
||||
comboBoxDoctor = new ComboBox();
|
||||
comboBoxPatient = new ComboBox();
|
||||
dateTimePickerVisiting = new DateTimePicker();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
dataGridViewMedicines = new DataGridView();
|
||||
ColumnMedicines = new DataGridViewComboBoxColumn();
|
||||
ColumnCount = new DataGridViewTextBoxColumn();
|
||||
groupBoxMedicines = new GroupBox();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMedicines).BeginInit();
|
||||
groupBoxMedicines.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(34, 35);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(40, 15);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Врач :";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(34, 88);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(60, 15);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Пациент :";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(34, 140);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(58, 15);
|
||||
label3.TabIndex = 2;
|
||||
label3.Text = "Диагноз :";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(34, 255);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(38, 15);
|
||||
label4.TabIndex = 3;
|
||||
label4.Text = "Дата :";
|
||||
//
|
||||
// checkedListBoxDiagnosisName
|
||||
//
|
||||
checkedListBoxDiagnosisName.FormattingEnabled = true;
|
||||
checkedListBoxDiagnosisName.Location = new Point(124, 140);
|
||||
checkedListBoxDiagnosisName.Name = "checkedListBoxDiagnosisName";
|
||||
checkedListBoxDiagnosisName.Size = new Size(145, 94);
|
||||
checkedListBoxDiagnosisName.TabIndex = 4;
|
||||
//
|
||||
// comboBoxDoctor
|
||||
//
|
||||
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDoctor.FormattingEnabled = true;
|
||||
comboBoxDoctor.Location = new Point(123, 35);
|
||||
comboBoxDoctor.Name = "comboBoxDoctor";
|
||||
comboBoxDoctor.Size = new Size(146, 23);
|
||||
comboBoxDoctor.TabIndex = 5;
|
||||
//
|
||||
// comboBoxPatient
|
||||
//
|
||||
comboBoxPatient.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxPatient.FormattingEnabled = true;
|
||||
comboBoxPatient.Location = new Point(124, 86);
|
||||
comboBoxPatient.Name = "comboBoxPatient";
|
||||
comboBoxPatient.Size = new Size(145, 23);
|
||||
comboBoxPatient.TabIndex = 6;
|
||||
//
|
||||
// dateTimePickerVisiting
|
||||
//
|
||||
dateTimePickerVisiting.Enabled = false;
|
||||
dateTimePickerVisiting.Location = new Point(128, 250);
|
||||
dateTimePickerVisiting.Name = "dateTimePickerVisiting";
|
||||
dateTimePickerVisiting.Size = new Size(200, 23);
|
||||
dateTimePickerVisiting.TabIndex = 7;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonSave.Location = new Point(81, 457);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(119, 34);
|
||||
buttonSave.TabIndex = 8;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(491, 457);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(135, 34);
|
||||
buttonCancel.TabIndex = 9;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// dataGridViewMedicines
|
||||
//
|
||||
dataGridViewMedicines.AllowUserToResizeColumns = false;
|
||||
dataGridViewMedicines.AllowUserToResizeRows = false;
|
||||
dataGridViewMedicines.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dataGridViewMedicines.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewMedicines.Columns.AddRange(new DataGridViewColumn[] { ColumnMedicines, ColumnCount });
|
||||
dataGridViewMedicines.Location = new Point(20, 22);
|
||||
dataGridViewMedicines.MultiSelect = false;
|
||||
dataGridViewMedicines.Name = "dataGridViewMedicines";
|
||||
dataGridViewMedicines.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewMedicines.Size = new Size(272, 329);
|
||||
dataGridViewMedicines.TabIndex = 10;
|
||||
//
|
||||
// ColumnMedicines
|
||||
//
|
||||
ColumnMedicines.HeaderText = "Медикаменты";
|
||||
ColumnMedicines.Name = "ColumnMedicines";
|
||||
//
|
||||
// ColumnCount
|
||||
//
|
||||
ColumnCount.HeaderText = "Количество";
|
||||
ColumnCount.Name = "ColumnCount";
|
||||
//
|
||||
// groupBoxMedicines
|
||||
//
|
||||
groupBoxMedicines.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
groupBoxMedicines.Controls.Add(dataGridViewMedicines);
|
||||
groupBoxMedicines.Location = new Point(334, 35);
|
||||
groupBoxMedicines.Name = "groupBoxMedicines";
|
||||
groupBoxMedicines.Size = new Size(315, 369);
|
||||
groupBoxMedicines.TabIndex = 11;
|
||||
groupBoxMedicines.TabStop = false;
|
||||
groupBoxMedicines.Text = "Медикаменты";
|
||||
//
|
||||
// FormVisiting
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(733, 567);
|
||||
Controls.Add(groupBoxMedicines);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(dateTimePickerVisiting);
|
||||
Controls.Add(comboBoxPatient);
|
||||
Controls.Add(comboBoxDoctor);
|
||||
Controls.Add(checkedListBoxDiagnosisName);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Name = "FormVisiting";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Визит";
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMedicines).EndInit();
|
||||
groupBoxMedicines.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private CheckedListBox checkedListBoxDiagnosisName;
|
||||
private ComboBox comboBoxDoctor;
|
||||
private ComboBox comboBoxPatient;
|
||||
private DateTimePicker dateTimePickerVisiting;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private DataGridView dataGridViewMedicines;
|
||||
private GroupBox groupBoxMedicines;
|
||||
private DataGridViewComboBoxColumn ColumnMedicines;
|
||||
private DataGridViewTextBoxColumn ColumnCount;
|
||||
}
|
||||
}
|
93
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisiting.cs
Normal file
93
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisiting.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using ProjectPolyclinic.Entities;
|
||||
using ProjectPolyclinic.Entities.Enums;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
public partial class FormVisiting : Form
|
||||
{
|
||||
private readonly IVisitingRepository _visitingRepository;
|
||||
public FormVisiting(IVisitingRepository visitingRepository, IDoctorRepository doctorRepository, IPatientRepository patientRepository, IMedicationRepository medicationRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_visitingRepository = visitingRepository ?? throw new ArgumentNullException(nameof(visitingRepository));
|
||||
comboBoxDoctor.DataSource =
|
||||
doctorRepository.ReadDoctors();
|
||||
comboBoxDoctor.DisplayMember = "FirstName";
|
||||
comboBoxDoctor.ValueMember = "Id";
|
||||
comboBoxPatient.DataSource = patientRepository.ReadPatients();
|
||||
comboBoxPatient.DisplayMember = "FirstName";
|
||||
comboBoxPatient.ValueMember = "Id";
|
||||
foreach (var elem in Enum.GetValues(typeof(DiagnosisName)))
|
||||
{
|
||||
checkedListBoxDiagnosisName.Items.Add(elem);
|
||||
}
|
||||
ColumnMedicines.DataSource = medicationRepository.ReadMedicines();
|
||||
ColumnMedicines.DisplayMember = "MedicinesType";
|
||||
ColumnMedicines.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxDoctor.SelectedIndex < 0 ||
|
||||
comboBoxPatient.SelectedIndex < 0 ||
|
||||
checkedListBoxDiagnosisName.CheckedItems.Count == 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
DiagnosisName diagnosisName = DiagnosisName.None;
|
||||
foreach (var elem in checkedListBoxDiagnosisName.CheckedItems)
|
||||
{
|
||||
diagnosisName |= (DiagnosisName)elem;
|
||||
}
|
||||
_visitingRepository.CreateVisiting(Visiting.CreateOperation(
|
||||
0,
|
||||
(int)comboBoxDoctor.SelectedValue!,
|
||||
(int)comboBoxPatient.SelectedValue!,
|
||||
diagnosisName,
|
||||
dateTimePickerVisiting.Value, CreateListMedicines_VisitingFromDataGrid()));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private List<Medicines_Visiting> CreateListMedicines_VisitingFromDataGrid()
|
||||
{
|
||||
var list = new List<Medicines_Visiting>();
|
||||
foreach (DataGridViewRow row in dataGridViewMedicines.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnMedicines"].Value == null ||
|
||||
row.Cells["ColumnCount"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(Medicines_Visiting.CreateElement(0,
|
||||
Convert.ToInt32(row.Cells["ColumnMedicines"].Value),
|
||||
Convert.ToInt32(row.Cells["ColumnCount"].Value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
126
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisiting.resx
Normal file
126
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisiting.resx
Normal 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="ColumnMedicines.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
165
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisitingReport.Designer.cs
generated
Normal file
165
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisitingReport.Designer.cs
generated
Normal file
@ -0,0 +1,165 @@
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
partial class FormVisitingReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dateTimePickerDateBegin = new DateTimePicker();
|
||||
dateTimePickerDateEnd = new DateTimePicker();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
comboBoxDoctor = new ComboBox();
|
||||
textBoxFilePath = new TextBox();
|
||||
buttonSelectFilePath = new Button();
|
||||
buttonMakeReport = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dateTimePickerDateBegin
|
||||
//
|
||||
dateTimePickerDateBegin.Location = new Point(126, 101);
|
||||
dateTimePickerDateBegin.Name = "dateTimePickerDateBegin";
|
||||
dateTimePickerDateBegin.Size = new Size(200, 23);
|
||||
dateTimePickerDateBegin.TabIndex = 0;
|
||||
//
|
||||
// dateTimePickerDateEnd
|
||||
//
|
||||
dateTimePickerDateEnd.Location = new Point(126, 134);
|
||||
dateTimePickerDateEnd.Name = "dateTimePickerDateEnd";
|
||||
dateTimePickerDateEnd.Size = new Size(200, 23);
|
||||
dateTimePickerDateEnd.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(35, 32);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(87, 15);
|
||||
label1.TabIndex = 2;
|
||||
label1.Text = "Путь до файла";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(35, 68);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(47, 15);
|
||||
label2.TabIndex = 3;
|
||||
label2.Text = "Доктор";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(35, 101);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(74, 15);
|
||||
label3.TabIndex = 4;
|
||||
label3.Text = "Дата начала";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(35, 134);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(68, 15);
|
||||
label4.TabIndex = 5;
|
||||
label4.Text = "Дата конца";
|
||||
//
|
||||
// comboBoxDoctor
|
||||
//
|
||||
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDoctor.FormattingEnabled = true;
|
||||
comboBoxDoctor.Location = new Point(126, 68);
|
||||
comboBoxDoctor.Name = "comboBoxDoctor";
|
||||
comboBoxDoctor.Size = new Size(200, 23);
|
||||
comboBoxDoctor.TabIndex = 6;
|
||||
//
|
||||
// textBoxFilePath
|
||||
//
|
||||
textBoxFilePath.Location = new Point(126, 32);
|
||||
textBoxFilePath.Name = "textBoxFilePath";
|
||||
textBoxFilePath.ReadOnly = true;
|
||||
textBoxFilePath.Size = new Size(165, 23);
|
||||
textBoxFilePath.TabIndex = 7;
|
||||
//
|
||||
// buttonSelectFilePath
|
||||
//
|
||||
buttonSelectFilePath.Location = new Point(297, 32);
|
||||
buttonSelectFilePath.Name = "buttonSelectFilePath";
|
||||
buttonSelectFilePath.Size = new Size(29, 23);
|
||||
buttonSelectFilePath.TabIndex = 8;
|
||||
buttonSelectFilePath.Text = "..";
|
||||
buttonSelectFilePath.UseVisualStyleBackColor = true;
|
||||
buttonSelectFilePath.Click += ButtonSelectFilePath_Click;
|
||||
//
|
||||
// buttonMakeReport
|
||||
//
|
||||
buttonMakeReport.Location = new Point(138, 180);
|
||||
buttonMakeReport.Name = "buttonMakeReport";
|
||||
buttonMakeReport.Size = new Size(114, 23);
|
||||
buttonMakeReport.TabIndex = 9;
|
||||
buttonMakeReport.Text = "Сформировать";
|
||||
buttonMakeReport.UseVisualStyleBackColor = true;
|
||||
buttonMakeReport.Click += ButtonMakeReport_Click;
|
||||
//
|
||||
// FormVisitingReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(447, 236);
|
||||
Controls.Add(buttonMakeReport);
|
||||
Controls.Add(buttonSelectFilePath);
|
||||
Controls.Add(textBoxFilePath);
|
||||
Controls.Add(comboBoxDoctor);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(dateTimePickerDateEnd);
|
||||
Controls.Add(dateTimePickerDateBegin);
|
||||
Name = "FormVisitingReport";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Отчет по визитам";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DateTimePicker dateTimePickerDateBegin;
|
||||
private DateTimePicker dateTimePickerDateEnd;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private ComboBox comboBoxDoctor;
|
||||
private TextBox textBoxFilePath;
|
||||
private Button buttonSelectFilePath;
|
||||
private Button buttonMakeReport;
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
using ProjectPolyclinic.Reports;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
public partial class FormVisitingReport : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormVisitingReport(IUnityContainer container, IDoctorRepository doctorRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
comboBoxDoctor.DataSource = doctorRepository.ReadDoctors();
|
||||
comboBoxDoctor.DisplayMember = "FirstName";
|
||||
comboBoxDoctor.ValueMember = "Id";
|
||||
|
||||
}
|
||||
|
||||
private void ButtonSelectFilePath_Click(object sender, EventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Excel Files | *.xlsx"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
textBoxFilePath.Text = sfd.FileName;
|
||||
}
|
||||
|
||||
private void ButtonMakeReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxFilePath.Text))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла для отчета");
|
||||
}
|
||||
if (comboBoxDoctor.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Не выбран доктор");
|
||||
}
|
||||
if (dateTimePickerDateEnd.Value <=
|
||||
dateTimePickerDateBegin.Value)
|
||||
{
|
||||
throw new Exception("Дата начала должна быть раньше даты окончания");
|
||||
}
|
||||
if
|
||||
(_container.Resolve<TableReport>().CreateTable(textBoxFilePath.Text,
|
||||
(int)comboBoxDoctor.SelectedValue!,
|
||||
dateTimePickerDateBegin.Value, dateTimePickerDateEnd.Value))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании отчета",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
112
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisitings.Designer.cs
generated
Normal file
112
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisitings.Designer.cs
generated
Normal file
@ -0,0 +1,112 @@
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
partial class FormVisitings
|
||||
{
|
||||
/// <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();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(673, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(127, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.минус;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(27, 133);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(75, 62);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.плюс;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(27, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 62);
|
||||
buttonAdd.TabIndex = 0;
|
||||
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.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(673, 450);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormVisitings
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormVisitings";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Визиты";
|
||||
Load += FormVisitings_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
96
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisitings.cs
Normal file
96
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisitings.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectPolyclinic.Forms
|
||||
{
|
||||
public partial class FormVisitings : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IVisitingRepository _visitingRepository;
|
||||
public FormVisitings(IUnityContainer container, IVisitingRepository visitingRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_visitingRepository = visitingRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(visitingRepository));
|
||||
}
|
||||
|
||||
private void FormVisitings_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<FormVisiting>().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
|
||||
{
|
||||
_visitingRepository.DeleteVisiting(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void LoadList() => dataGridViewData.DataSource = _visitingRepository.ReadVisiting();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id =
|
||||
Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisitings.resx
Normal file
120
ProjectPolyclinic/ProjectPolyclinic/Forms/FormVisitings.resx
Normal 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>
|
@ -1,3 +1,11 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using ProjectPolyclinic.Repositories.Implementations;
|
||||
using Serilog;
|
||||
using Unity;
|
||||
using Unity.Lifetime;
|
||||
using Unity.Microsoft.Logging;
|
||||
namespace ProjectPolyclinic
|
||||
{
|
||||
internal static class Program
|
||||
@ -11,7 +19,29 @@ namespace ProjectPolyclinic
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(CreateContainer().Resolve <FormPolyclinic>());
|
||||
}
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
container.AddExtension(new LoggingExtension(CreateLoggerFactory()));
|
||||
container.RegisterType<IPatientRepository, PatientRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IVisitingRepository, VisitingRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IMedicationRepository, MedicationRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IProfessionalDevelopmentRepository, ProfessionalDevelopmentRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IDoctorRepository, DoctorRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IConnectionString, ConnectionString>(new TransientLifetimeManager());
|
||||
return container;
|
||||
}
|
||||
private static LoggerFactory CreateLoggerFactory()
|
||||
{
|
||||
var loggerFactory = new LoggerFactory();
|
||||
loggerFactory.AddSerilog(new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build())
|
||||
.CreateLogger());
|
||||
return loggerFactory;
|
||||
}
|
||||
}
|
||||
}
|
@ -8,4 +8,42 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Npgsql" Version="9.0.1" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||
<PackageReference Include="Serilog" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||
</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>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
103
ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.Designer.cs
generated
Normal file
103
ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 карандаш {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("карандаш", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap минус {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("минус", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap плюс {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("плюс", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap поликлиника {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("поликлиника", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.resx
Normal file
133
ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.resx
Normal 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="поликлиника" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\поликлиника.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="карандаш" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\карандаш.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="плюс" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\плюс.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="минус" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\минус.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
52
ProjectPolyclinic/ProjectPolyclinic/Reports/ChartReport.cs
Normal file
52
ProjectPolyclinic/ProjectPolyclinic/Reports/ChartReport.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Reports;
|
||||
|
||||
internal class ChartReport
|
||||
{
|
||||
private readonly IProfessionalDevelopmentRepository _professionalDevelopmentRepository;
|
||||
//private readonly IDoctorRepository _doctorRepository;
|
||||
private readonly ILogger<ChartReport> _logger;
|
||||
public ChartReport(IProfessionalDevelopmentRepository professionalDevelopmentRepository,
|
||||
IDoctorRepository doctorRepository,
|
||||
ILogger<ChartReport> logger)
|
||||
{
|
||||
_professionalDevelopmentRepository = professionalDevelopmentRepository ??
|
||||
throw new ArgumentNullException(nameof(professionalDevelopmentRepository));
|
||||
//_doctorRepository = doctorRepository ??
|
||||
// throw new ArgumentNullException(nameof(doctorRepository));
|
||||
_logger = logger ??
|
||||
throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
public bool CreateChart(string filePath, DateTime dateTime)
|
||||
{
|
||||
try
|
||||
{
|
||||
new PdfBuilder(filePath)
|
||||
.AddHeader("Повышение квалификации врачей")
|
||||
.AddPieChart("Количество повышений квалификации врачей", GetData(dateTime))
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private List<(string Caption, double Value)> GetData(DateTime dateTime)
|
||||
{
|
||||
return _professionalDevelopmentRepository
|
||||
.ReadProfessionalDevelopment()
|
||||
.Where(x => x.ProfessionalDevelopmentTime.Date == dateTime.Date)
|
||||
.GroupBy(x => x.DoctorId, (key, group) => new { Id = key, Count = group.Count() })
|
||||
.Select(x => (x.Id.ToString(), (double)x.Count))
|
||||
.ToList();
|
||||
}
|
||||
}
|
84
ProjectPolyclinic/ProjectPolyclinic/Reports/DocReport.cs
Normal file
84
ProjectPolyclinic/ProjectPolyclinic/Reports/DocReport.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Reports;
|
||||
|
||||
internal class DocReport
|
||||
{
|
||||
private readonly IDoctorRepository _doctorRepository;
|
||||
private readonly IPatientRepository _patientRepository;
|
||||
private readonly IMedicationRepository _medicationRepository;
|
||||
private readonly ILogger<DocReport> _logger;
|
||||
|
||||
public DocReport(IDoctorRepository doctorRepository,IPatientRepository patientRepository,IMedicationRepository medicationRepository, ILogger<DocReport> logger)
|
||||
{
|
||||
_doctorRepository = doctorRepository ?? throw new ArgumentNullException(nameof(doctorRepository));
|
||||
_patientRepository = patientRepository ?? throw new ArgumentNullException(nameof(patientRepository));
|
||||
_medicationRepository = medicationRepository ?? throw new ArgumentNullException(nameof(medicationRepository));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
|
||||
}
|
||||
public bool CreateDoc(string filePath, bool includeDoctors, bool includePatients, bool includeMedicines)
|
||||
{
|
||||
try
|
||||
{
|
||||
var builder = new WordBuilder(filePath)
|
||||
.AddHeader("Документ со справочниками");
|
||||
if (includeDoctors)
|
||||
{
|
||||
builder.AddParagraph("Врачи")
|
||||
.AddTable([2400, 2400, 2400],
|
||||
GetDoctors());
|
||||
}
|
||||
if (includePatients)
|
||||
{
|
||||
builder.AddParagraph("Пациенты")
|
||||
.AddTable([2400, 2400, 2400], GetPatients());
|
||||
}
|
||||
if (includeMedicines)
|
||||
{
|
||||
builder.AddParagraph("Медикаменты")
|
||||
.AddTable([2400, 2400, 2400], GetMedicines());
|
||||
}
|
||||
builder.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private List<string[]> GetDoctors()
|
||||
{
|
||||
return [
|
||||
["Имя доктора", "Фамилия доктора", "Специализация"],
|
||||
.. _doctorRepository
|
||||
.ReadDoctors()
|
||||
.Select(x => new string[] { x.First_Name, x.Last_Name, x.Specialization.ToString()}),
|
||||
];
|
||||
}
|
||||
private List<string[]> GetPatients()
|
||||
{
|
||||
return [
|
||||
["Имя пациента ", "Фамилия пациента", "Контактный номер"],
|
||||
.. _patientRepository
|
||||
.ReadPatients()
|
||||
.Select(x => new string[] { x.First_Name, x.Last_Name, x.ContactNumber.ToString()}),
|
||||
];
|
||||
}
|
||||
private List<string[]> GetMedicines()
|
||||
{
|
||||
return [
|
||||
["Тип таблетки ", "Доза", "Описание"],
|
||||
.. _medicationRepository
|
||||
.ReadMedicines()
|
||||
.Select(x => new string[] { x.MedicinesType.ToString(), x.Dosing, x.Description}),
|
||||
];
|
||||
}
|
||||
}
|
323
ProjectPolyclinic/ProjectPolyclinic/Reports/ExcelBuilder.cs
Normal file
323
ProjectPolyclinic/ProjectPolyclinic/Reports/ExcelBuilder.cs
Normal file
@ -0,0 +1,323 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Reports;
|
||||
|
||||
internal class ExcelBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly SheetData _sheetData;
|
||||
private readonly MergeCells _mergeCells;
|
||||
private readonly Columns _columns;
|
||||
private uint _rowIndex = 0;
|
||||
public ExcelBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
_filePath = filePath;
|
||||
_sheetData = new SheetData();
|
||||
_mergeCells = new MergeCells();
|
||||
_columns = new Columns();
|
||||
_rowIndex = 1;
|
||||
}
|
||||
public ExcelBuilder AddHeader(string header, int startIndex, int count)
|
||||
{
|
||||
CreateCell(startIndex, _rowIndex, header,StyleIndex.BoldTextWithoutBorder);
|
||||
for (int i = startIndex + 1; i < startIndex + count; ++i)
|
||||
{
|
||||
CreateCell(i, _rowIndex, "",
|
||||
StyleIndex.SimpleTextWithoutBorder);
|
||||
}
|
||||
_mergeCells.Append(new MergeCell()
|
||||
{
|
||||
Reference =
|
||||
new
|
||||
StringValue($"{GetExcelColumnName(startIndex)}{_rowIndex}:{GetExcelColumnName(startIndex + count - 1)}{_rowIndex}")
|
||||
});
|
||||
_rowIndex++;
|
||||
return this;
|
||||
}
|
||||
public ExcelBuilder AddParagraph(string text, int columnIndex)
|
||||
{
|
||||
CreateCell(columnIndex, _rowIndex++, text,StyleIndex.SimpleTextWithoutBorder);
|
||||
return this;
|
||||
}
|
||||
public ExcelBuilder AddTable(int[] columnsWidths, List<string[]> data)
|
||||
{
|
||||
if (columnsWidths == null || columnsWidths.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(columnsWidths));
|
||||
}
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
if (data.Any(x => x.Length != columnsWidths.Length))
|
||||
{
|
||||
throw new InvalidOperationException("widths.Length !=data.Length");
|
||||
}
|
||||
uint counter = 1;
|
||||
int coef = 2;
|
||||
_columns.Append(columnsWidths.Select(x => new Column
|
||||
{
|
||||
Min = counter,
|
||||
Max = counter++,
|
||||
Width = x * coef,
|
||||
CustomWidth = true
|
||||
}));
|
||||
for (var j = 0; j < data.First().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.First()[j],
|
||||
StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
_rowIndex++;
|
||||
for (var i = 1; i < data.Count - 1; ++i)
|
||||
{
|
||||
for (var j = 0; j < data[i].Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data[i][j],
|
||||
StyleIndex.SimpleTextWithBorder);
|
||||
}
|
||||
_rowIndex++;
|
||||
}
|
||||
for (var j = 0; j < data.Last().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.Last()[j],
|
||||
StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
_rowIndex++;
|
||||
return this;
|
||||
}
|
||||
public void Build()
|
||||
{
|
||||
using var spreadsheetDocument = SpreadsheetDocument.Create(_filePath,
|
||||
SpreadsheetDocumentType.Workbook);
|
||||
var workbookpart = spreadsheetDocument.AddWorkbookPart();
|
||||
GenerateStyle(workbookpart);
|
||||
workbookpart.Workbook = new Workbook();
|
||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet();
|
||||
if (_columns.HasChildren)
|
||||
{
|
||||
worksheetPart.Worksheet.Append(_columns);
|
||||
}
|
||||
worksheetPart.Worksheet.Append(_sheetData);
|
||||
var sheets =
|
||||
spreadsheetDocument.WorkbookPart!.Workbook.AppendChild(new Sheets());
|
||||
var sheet = new Sheet()
|
||||
{
|
||||
Id =
|
||||
spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист 1"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
if (_mergeCells.HasChildren)
|
||||
{
|
||||
worksheetPart.Worksheet.InsertAfter(_mergeCells,
|
||||
worksheetPart.Worksheet.Elements<SheetData>().First());
|
||||
}
|
||||
}
|
||||
private static void GenerateStyle(WorkbookPart workbookPart)
|
||||
{
|
||||
var workbookStylesPart =
|
||||
workbookPart.AddNewPart<WorkbookStylesPart>();
|
||||
workbookStylesPart.Stylesheet = new Stylesheet();
|
||||
var fonts = new Fonts()
|
||||
{
|
||||
Count = 2,
|
||||
KnownFonts =
|
||||
BooleanValue.FromBoolean(true)
|
||||
};
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize() { Val = 11 },
|
||||
FontName = new FontName() { Val = "Calibri" },
|
||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||
FontScheme = new FontScheme()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||
}
|
||||
});
|
||||
// TODO добавить шрифт с жирным
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize() { Val = 11 },
|
||||
FontName = new FontName() { Val = "Calibri" },
|
||||
Bold = new Bold(),
|
||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||
FontScheme = new FontScheme()
|
||||
{
|
||||
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(fonts);
|
||||
// Default Fill
|
||||
var fills = new Fills() { Count = 1 };
|
||||
fills.Append(new Fill
|
||||
{
|
||||
PatternFill = new PatternFill()
|
||||
{
|
||||
PatternType = new
|
||||
EnumValue<PatternValues>(PatternValues.None)
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(fills);
|
||||
// Default Border
|
||||
var borders = new Borders() { Count = 2 };
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder(),
|
||||
RightBorder = new RightBorder(),
|
||||
TopBorder = new TopBorder(),
|
||||
BottomBorder = new BottomBorder(),
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
// TODO добавить настройку с границами
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder() { Style = BorderStyleValues.Medium },
|
||||
RightBorder = new RightBorder() { Style = BorderStyleValues.Medium },
|
||||
TopBorder = new TopBorder() { Style = BorderStyleValues.Medium },
|
||||
BottomBorder = new BottomBorder() { Style = BorderStyleValues.Medium },
|
||||
DiagonalBorder = new DiagonalBorder() { Style = BorderStyleValues.Medium },
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(borders);
|
||||
// Default cell format and a date cell format
|
||||
var cellFormats = new CellFormats() { Count = 4 };
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 0,
|
||||
BorderId = 0,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
// TODO дополнить форматы
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 1,
|
||||
FormatId = 0,
|
||||
FontId = 0,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 2,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 0,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 3,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
||||
|
||||
}
|
||||
private enum StyleIndex
|
||||
{
|
||||
SimpleTextWithoutBorder = 0,
|
||||
SimpleTextWithBorder = 1,
|
||||
BoldTextWithoutBorder = 2,
|
||||
BoldTextWithBorder = 3,
|
||||
}
|
||||
private void CreateCell(int columnIndex, uint rowIndex, string text,
|
||||
StyleIndex styleIndex)
|
||||
{
|
||||
var columnName = GetExcelColumnName(columnIndex);
|
||||
var cellReference = columnName + rowIndex;
|
||||
var row = _sheetData.Elements<Row>().FirstOrDefault(r => r.RowIndex!
|
||||
== rowIndex);
|
||||
if (row == null)
|
||||
{
|
||||
row = new Row() { RowIndex = rowIndex };
|
||||
_sheetData.Append(row);
|
||||
}
|
||||
var newCell = row.Elements<Cell>()
|
||||
.FirstOrDefault(c => c.CellReference != null &&
|
||||
c.CellReference.Value == columnName + rowIndex);
|
||||
if (newCell == null)
|
||||
{
|
||||
Cell? refCell = null;
|
||||
foreach (Cell cell in row.Elements<Cell>())
|
||||
{
|
||||
if (cell.CellReference?.Value != null &&
|
||||
cell.CellReference.Value.Length == cellReference.Length)
|
||||
{
|
||||
if (string.Compare(cell.CellReference.Value,
|
||||
cellReference, true) > 0)
|
||||
{
|
||||
refCell = cell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
newCell = new Cell() { CellReference = cellReference };
|
||||
row.InsertBefore(newCell, refCell);
|
||||
}
|
||||
newCell.CellValue = new CellValue(text);
|
||||
newCell.DataType = CellValues.String;
|
||||
newCell.StyleIndex = (uint)styleIndex;
|
||||
}
|
||||
private static string GetExcelColumnName(int columnNumber)
|
||||
{
|
||||
columnNumber += 1;
|
||||
int dividend = columnNumber;
|
||||
string columnName = string.Empty;
|
||||
int modulo;
|
||||
while (dividend > 0)
|
||||
{
|
||||
modulo = (dividend - 1) % 26;
|
||||
columnName = Convert.ToChar(65 + modulo).ToString() +
|
||||
columnName;
|
||||
dividend = (dividend - modulo) / 26;
|
||||
}
|
||||
return columnName;
|
||||
}
|
||||
|
||||
}
|
||||
|
91
ProjectPolyclinic/ProjectPolyclinic/Reports/PdfBuilder.cs
Normal file
91
ProjectPolyclinic/ProjectPolyclinic/Reports/PdfBuilder.cs
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Shapes.Charts;
|
||||
using MigraDoc.Rendering;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Color = MigraDoc.DocumentObjectModel.Color;
|
||||
|
||||
namespace ProjectPolyclinic.Reports;
|
||||
|
||||
internal class PdfBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly Document _document;
|
||||
public PdfBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
_filePath = filePath;
|
||||
_document = new Document();
|
||||
DefineStyles();
|
||||
}
|
||||
public PdfBuilder AddHeader(string header)
|
||||
{
|
||||
_document.AddSection().AddParagraph(header, "NormalBold");
|
||||
return this;
|
||||
}
|
||||
public PdfBuilder AddPieChart(string title, List<(string Caption, double Value)> data)
|
||||
{
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
var chart = new Chart(ChartType.Pie2D);
|
||||
var series = chart.SeriesCollection.AddSeries();
|
||||
series.Add(data.Select(x => x.Value).ToArray());
|
||||
|
||||
var xseries = chart.XValues.AddXSeries();
|
||||
xseries.Add(data.Select(x => x.Caption).ToArray());
|
||||
|
||||
chart.DataLabel.Type = DataLabelType.Percent;
|
||||
chart.DataLabel.Position = DataLabelPosition.OutsideEnd;
|
||||
|
||||
chart.Width = Unit.FromCentimeter(16);
|
||||
chart.Height = Unit.FromCentimeter(12);
|
||||
|
||||
chart.TopArea.AddParagraph(title);
|
||||
|
||||
chart.XAxis.MajorTickMark = TickMarkType.Outside;
|
||||
|
||||
chart.YAxis.MajorTickMark = TickMarkType.Outside;
|
||||
chart.YAxis.HasMajorGridlines = true;
|
||||
|
||||
chart.PlotArea.LineFormat.Width = 1;
|
||||
chart.PlotArea.LineFormat.Visible = true;
|
||||
|
||||
chart.TopArea.AddLegend();
|
||||
|
||||
_document.LastSection.Add(chart);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = _document
|
||||
};
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(_filePath);
|
||||
}
|
||||
private void DefineStyles()
|
||||
{
|
||||
var headerStyle = _document.AddStyle("NormalBold", "Normal");
|
||||
headerStyle.Font.Bold = true;
|
||||
headerStyle.Font.Size = 14;
|
||||
headerStyle.Font.Color = Colors.DeepPink;
|
||||
}
|
||||
}
|
||||
|
||||
|
93
ProjectPolyclinic/ProjectPolyclinic/Reports/TableReport.cs
Normal file
93
ProjectPolyclinic/ProjectPolyclinic/Reports/TableReport.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectPolyclinic.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Reports;
|
||||
|
||||
internal class TableReport
|
||||
{
|
||||
private readonly IDoctorRepository _doctorRepository;
|
||||
private readonly IVisitingRepository _visitingRepository;
|
||||
private readonly IMedicationRepository _medicationRepository;
|
||||
|
||||
private readonly ILogger<TableReport> _logger;
|
||||
internal static readonly string[] item = ["Визит","Доктор", "Дата", "Количество визитов","Количество медикаментов"];
|
||||
public TableReport(IDoctorRepository doctorRepository, IVisitingRepository visitingRepository, IMedicationRepository medicationRepository, ILogger<TableReport> logger)
|
||||
{
|
||||
_doctorRepository = doctorRepository ?? throw new ArgumentNullException(nameof(doctorRepository));
|
||||
_visitingRepository = visitingRepository ?? throw new ArgumentNullException(nameof(visitingRepository));
|
||||
_medicationRepository = medicationRepository ?? throw new ArgumentNullException(nameof(medicationRepository));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public bool CreateTable(string filePath, int doctorId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = GetData(doctorId, startDate, endDate);
|
||||
new ExcelBuilder(filePath)
|
||||
.AddHeader("Сводка по движению визитов", 0, 2)
|
||||
.AddParagraph("за период", 0)
|
||||
.AddTable([10, 10,15, 15,15], data)
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private List<string[]> GetData(int doctorId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
/*var visits = _visitingRepository.ReadVisiting()
|
||||
.Where(x => x.VisitingTime >= startDate && x.VisitingTime <= endDate && x.DoctorId == doctorId)
|
||||
.Select(x => new
|
||||
{
|
||||
DoctorName = $"{_doctorRepository.ReadDoctorById(x.DoctorId)?.First_Name} {_doctorRepository.ReadDoctorById(x.DoctorId)?.Last_Name}",
|
||||
Date = x.VisitingTime
|
||||
})
|
||||
.OrderBy(x => x.Date)
|
||||
.ToList();
|
||||
|
||||
|
||||
var result = new List<string[]> { item }
|
||||
.Union(visits.Select(x => new string[]
|
||||
{
|
||||
x.DoctorName,
|
||||
x.Date.ToString("g"),
|
||||
"1"
|
||||
}))
|
||||
.Union([["Всего", " ", visits.Count().ToString()]])
|
||||
.ToList();
|
||||
|
||||
|
||||
return result;*/
|
||||
var data = _visitingRepository
|
||||
.ReadVisiting()
|
||||
.Where(x => x.VisitingTime >= startDate && x.VisitingTime <= endDate && x.DoctorId == doctorId)
|
||||
.Select(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.DoctorId,
|
||||
Date = x.VisitingTime,
|
||||
CountOfVisits = 1,
|
||||
Medication = x.Medicines.Sum(m => m.Count)
|
||||
})
|
||||
.OrderBy(x => x.Date);
|
||||
return
|
||||
new List<string[]>() { item }
|
||||
.Union(
|
||||
data
|
||||
.Select(x => new string[] { x.Id.ToString(), x.DoctorId.ToString(), x.Date.ToString(), x.CountOfVisits.ToString() ?? string.Empty, x.Medication.ToString() ?? string.Empty }))
|
||||
.Union(
|
||||
[["Всего ", "","", data.Sum(x => x.CountOfVisits).ToString(), data.Sum(x => x.Medication).ToString()]])
|
||||
|
||||
.ToList();
|
||||
}
|
||||
}
|
103
ProjectPolyclinic/ProjectPolyclinic/Reports/WordBuilder.cs
Normal file
103
ProjectPolyclinic/ProjectPolyclinic/Reports/WordBuilder.cs
Normal file
@ -0,0 +1,103 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Reports;
|
||||
|
||||
internal class WordBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly Document _document;
|
||||
private readonly Body _body;
|
||||
public WordBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
_filePath = filePath;
|
||||
_document = new Document();
|
||||
_body = _document.AppendChild(new Body());
|
||||
}
|
||||
public WordBuilder AddHeader(string header)
|
||||
{
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
run.AppendChild(new RunProperties(new Bold()));
|
||||
run.AppendChild(new Text(header));
|
||||
return this;
|
||||
|
||||
}
|
||||
public WordBuilder AddParagraph(string text)
|
||||
{
|
||||
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
run.AppendChild(new Text(text));
|
||||
|
||||
return this;
|
||||
|
||||
}
|
||||
public WordBuilder AddTable(int[] widths, List<string[]> data)
|
||||
{
|
||||
if (widths == null || widths.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(widths));
|
||||
}
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
if (data.Any(x => x.Length != widths.Length))
|
||||
{
|
||||
throw new InvalidOperationException("widths.Length !=data.Length");
|
||||
}
|
||||
var table = new Table();
|
||||
table.AppendChild(new TableProperties(
|
||||
new TableBorders(
|
||||
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 12 },
|
||||
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 12 },
|
||||
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 12 },
|
||||
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 12 },
|
||||
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 12 },
|
||||
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 12 })));
|
||||
|
||||
// Заголовок
|
||||
var tr = new TableRow();
|
||||
for (var j = 0; j < widths.Length; ++j)
|
||||
{
|
||||
tr.Append(new TableCell(
|
||||
new TableCellProperties(new TableCellWidth()
|
||||
{
|
||||
Width =
|
||||
widths[j].ToString()
|
||||
}),
|
||||
new Paragraph(new Run(new RunProperties(new Bold()), new
|
||||
Text(data.First()[j])))));
|
||||
}
|
||||
table.Append(tr);
|
||||
// Данные
|
||||
table.Append(data.Skip(1).Select(x =>
|
||||
new TableRow(x.Select(y => new TableCell(new Paragraph(new
|
||||
Run(new Text(y))))))));
|
||||
_body.Append(table);
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
using var wordDocument = WordprocessingDocument.Create(_filePath,WordprocessingDocumentType.Document);
|
||||
var mainPart = wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = _document;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories;
|
||||
|
||||
public interface IConnectionString
|
||||
{
|
||||
public string ConnectionString { get; }
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using ProjectPolyclinic.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories
|
||||
{
|
||||
public interface IDoctorRepository
|
||||
{
|
||||
IEnumerable<Doctor> ReadDoctors();
|
||||
Doctor ReadDoctorById(int id);
|
||||
void CreateDoctor(Doctor doctor);
|
||||
void UpdateDoctor(Doctor doctor);
|
||||
void DeleteDoctor(int id);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using ProjectPolyclinic.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories
|
||||
{
|
||||
public interface IMedicationRepository
|
||||
{
|
||||
IEnumerable<Medication> ReadMedicines();
|
||||
Medication ReadMedicationById(int id);
|
||||
void CreateMedication(Medication medication);
|
||||
void UpdateMedication(Medication medication);
|
||||
void DeleteMedication(int id);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using ProjectPolyclinic.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories
|
||||
{
|
||||
public interface IPatientRepository
|
||||
{
|
||||
IEnumerable<Patient> ReadPatients();
|
||||
Patient ReadPatientById(int id);
|
||||
void CreatePatient(Patient patient);
|
||||
void UpdatePatient(Patient patient);
|
||||
void DeletePatient(int id);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using ProjectPolyclinic.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories
|
||||
{
|
||||
public interface IProfessionalDevelopmentRepository
|
||||
{
|
||||
IEnumerable<ProfessionalDevelopment> ReadProfessionalDevelopment(DateTime? dateForm = null, DateTime? dateTo = null, int? doctorId = null, int? Id = null);
|
||||
void CreateProfessionalDevelopment(ProfessionalDevelopment professionalDevelopment);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using ProjectPolyclinic.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories
|
||||
{
|
||||
public interface IVisitingRepository
|
||||
{
|
||||
IEnumerable<Visiting> ReadVisiting(DateTime? dateForm = null, DateTime? dateTo = null, int? patientId = null, int? doctorId = null,int ? visitingId = null);
|
||||
void CreateVisiting(Visiting visiting);
|
||||
void DeleteVisiting(int id);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories.Implementations;
|
||||
|
||||
public class ConnectionString : IConnectionString
|
||||
{
|
||||
string IConnectionString.ConnectionString =>
|
||||
"Server=localhost, 5432;Database=polyclinic1;Uid=postgres;Password=12345678;";
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProjectPolyclinic.Entities;
|
||||
using ProjectPolyclinic.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories.Implementations
|
||||
{
|
||||
public class DoctorRepository:IDoctorRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<DoctorRepository> _logger;
|
||||
public DoctorRepository(IConnectionString connectionString, ILogger<DoctorRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
public void CreateDoctor(Doctor doctor)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(doctor));
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"INSERT INTO Doctors (First_Name, Last_Name, Specialization)
|
||||
VALUES (@First_Name, @Last_Name, @Specialization)";
|
||||
connection.Execute(queryInsert, doctor);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public void UpdateDoctor(Doctor doctor)
|
||||
{
|
||||
_logger.LogInformation("Редактирование объекта");
|
||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(doctor));
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"UPDATE Doctors SET
|
||||
First_Name = @First_Name,
|
||||
Last_Name = @Last_Name,
|
||||
Specialization= @Specialization
|
||||
WHERE Id=@id";
|
||||
connection.Execute(queryUpdate, doctor);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public void DeleteDoctor(int id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM Doctors WHERE ID=@id";
|
||||
connection.Execute(queryDelete, new { id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public Doctor ReadDoctorById(int id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM Doctors WHERE Id=@id";
|
||||
var doctor = connection.QueryFirst<Doctor>(querySelect, new
|
||||
{
|
||||
id
|
||||
});
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonConvert.SerializeObject(doctor));
|
||||
return doctor;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public IEnumerable<Doctor> ReadDoctors()
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM Doctors";
|
||||
var doctors = connection.Query<Doctor>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(doctors));
|
||||
return doctors;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProjectPolyclinic.Entities;
|
||||
using ProjectPolyclinic.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories.Implementations
|
||||
{
|
||||
public class MedicationRepository:IMedicationRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<MedicationRepository> _logger;
|
||||
public MedicationRepository(IConnectionString connectionString, ILogger<MedicationRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
public void CreateMedication(Medication medication)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(medication));
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"INSERT INTO Medicines (MedicinesType, Dosing, Description)
|
||||
VALUES (@MedicinesType, @Dosing, @Description)";
|
||||
connection.Execute(queryInsert, medication);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public void UpdateMedication(Medication medication)
|
||||
{
|
||||
_logger.LogInformation("Редактирование объекта");
|
||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(medication));
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"UPDATE Medicines SET
|
||||
MedicinesType = @MedicinesType,
|
||||
Dosing = @Dosing,
|
||||
Description= @Description
|
||||
WHERE Id=@id";
|
||||
connection.Execute(queryUpdate, medication);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public void DeleteMedication(int id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM Medicines WHERE ID=@id";
|
||||
connection.Execute(queryDelete, new { id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public Medication ReadMedicationById(int id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM Medicines WHERE Id=@id";
|
||||
var medication = connection.QueryFirst<Medication>(querySelect, new
|
||||
{
|
||||
id
|
||||
});
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonConvert.SerializeObject(medication));
|
||||
return medication;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public IEnumerable<Medication> ReadMedicines()
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM Medicines";
|
||||
var medicines = connection.Query<Medication>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(medicines));
|
||||
return medicines;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProjectPolyclinic.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories.Implementations
|
||||
{
|
||||
public class PatientRepository:IPatientRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<PatientRepository> _logger;
|
||||
public PatientRepository(IConnectionString connectionString, ILogger<PatientRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
public void CreatePatient(Patient patient)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(patient));
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"INSERT INTO Patients (First_Name, Last_Name, ContactNumber)
|
||||
VALUES (@First_Name, @Last_Name, @ContactNumber)";
|
||||
connection.Execute(queryInsert, patient);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public void UpdatePatient(Patient patient)
|
||||
{
|
||||
_logger.LogInformation("Редактирование объекта");
|
||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(patient));
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"UPDATE Patients SET
|
||||
First_Name = @First_Name,
|
||||
Last_Name = @Last_Name,
|
||||
ContactNumber = @ContactNumber
|
||||
WHERE Id=@id";
|
||||
connection.Execute(queryUpdate, patient);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public void DeletePatient(int id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM Patients WHERE ID=@id";
|
||||
connection.Execute(queryDelete, new { id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public Patient ReadPatientById(int id)
|
||||
{
|
||||
_logger.LogInformation("Получение объекта по идентификатору");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM Patients WHERE Id=@id";
|
||||
var patient = connection.QueryFirst<Patient>(querySelect, new
|
||||
{
|
||||
id
|
||||
});
|
||||
_logger.LogDebug("Найденный объект: {json}",
|
||||
JsonConvert.SerializeObject(patient));
|
||||
return patient;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public IEnumerable<Patient> ReadPatients()
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM Patients";
|
||||
var patients = connection.Query<Patient>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(patients));
|
||||
return patients;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProjectPolyclinic.Entities;
|
||||
using Serilog.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories.Implementations
|
||||
{
|
||||
public class ProfessionalDevelopmentRepository:IProfessionalDevelopmentRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<ProfessionalDevelopmentRepository> _logger;
|
||||
public ProfessionalDevelopmentRepository(IConnectionString connectionString,ILogger<ProfessionalDevelopmentRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void CreateProfessionalDevelopment(ProfessionalDevelopment professionalDevelopment)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonConvert.SerializeObject(professionalDevelopment));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"
|
||||
INSERT INTO ProfessionalDevelopments (DoctorId, ProfessionalDevelopmentTime)
|
||||
VALUES (@DoctorId, @ProfessionalDevelopmentTime)";
|
||||
connection.Execute(queryInsert, professionalDevelopment);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<ProfessionalDevelopment> ReadProfessionalDevelopment(DateTime? dateForm = null, DateTime? dateTo = null, int? doctorId = null, int? Id = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM ProfessionalDevelopments";
|
||||
var professionalDevelopments =
|
||||
connection.Query<ProfessionalDevelopment>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(professionalDevelopments));
|
||||
return professionalDevelopments;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProjectPolyclinic.Entities;
|
||||
using Serilog.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectPolyclinic.Repositories.Implementations
|
||||
{
|
||||
public class VisitingRepository:IVisitingRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<VisitingRepository> _logger;
|
||||
|
||||
public VisitingRepository(IConnectionString connectionString,ILogger<VisitingRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void CreateVisiting(Visiting visiting)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}",
|
||||
JsonConvert.SerializeObject(visiting));
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connection.Open();
|
||||
using var transaction = connection.BeginTransaction();
|
||||
var queryInsert = @"
|
||||
INSERT INTO Visitings (DoctorId, PatientId,DiagnosisName,VisitingTime)
|
||||
VALUES (@DoctorId, @PatientId, @DiagnosisName,@VisitingTime );
|
||||
SELECT MAX(Id) FROM Visitings";
|
||||
var visitingId = connection.QueryFirst<int>(queryInsert, visiting, transaction);
|
||||
var querySubInsert = @"
|
||||
INSERT INTO Medicines_Visiting (MedicinesId, VisitingId, Count)
|
||||
VALUES (@MedicinesId,@VisitingId, @Count)";
|
||||
foreach (var elem in visiting.Medicines)
|
||||
{
|
||||
connection.Execute(querySubInsert, new
|
||||
{
|
||||
visitingId,
|
||||
elem.MedicinesId,
|
||||
elem.Count
|
||||
}, transaction);
|
||||
}
|
||||
transaction.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void DeleteVisiting(int id)
|
||||
{
|
||||
_logger.LogInformation("Удаление объекта");
|
||||
_logger.LogDebug("Объект: {id}", id);
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"
|
||||
DELETE FROM Visitings
|
||||
WHERE Id=@id";
|
||||
connection.Execute(queryDelete, new { id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Visiting> ReadVisiting(DateTime? dateForm = null, DateTime? dateTo = null, int? patientId = null, int? doctorId = null,int ? visitingId = null)
|
||||
{
|
||||
/*_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM Visitings";
|
||||
var visitings =
|
||||
connection.Query<Visiting>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(visitings));
|
||||
return visitings;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}*/
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT v.*, mv.MedicinesId, mv.Count
|
||||
FROM Visitings v
|
||||
LEFT JOIN Medicines_Visiting mv ON v.Id = mv.VisitingId";
|
||||
|
||||
var visitings = connection.Query<TempMedicines_Visiting>(querySelect);
|
||||
|
||||
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(visitings));
|
||||
|
||||
return visitings.GroupBy(x => x.Id, y => y,
|
||||
(key, value) => Visiting.CreateOperation(value.First(),
|
||||
value.Select(z => Medicines_Visiting.CreateElement(z.MedicinesId, z.VisitingId, z.Count)))).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
ProjectPolyclinic/ProjectPolyclinic/Resources/карандаш.jpg
Normal file
BIN
ProjectPolyclinic/ProjectPolyclinic/Resources/карандаш.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
BIN
ProjectPolyclinic/ProjectPolyclinic/Resources/минус.png
Normal file
BIN
ProjectPolyclinic/ProjectPolyclinic/Resources/минус.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 425 KiB |
BIN
ProjectPolyclinic/ProjectPolyclinic/Resources/плюс.png
Normal file
BIN
ProjectPolyclinic/ProjectPolyclinic/Resources/плюс.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
BIN
ProjectPolyclinic/ProjectPolyclinic/Resources/поликлиника.png
Normal file
BIN
ProjectPolyclinic/ProjectPolyclinic/Resources/поликлиника.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 90 KiB |
15
ProjectPolyclinic/ProjectPolyclinic/appsettings.json
Normal file
15
ProjectPolyclinic/ProjectPolyclinic/appsettings.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"Using": [ "Serilog.Sinks.File" ],
|
||||
"MinimumLevel": "Debug",
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/polyclinic_log.txt",
|
||||
"rollingInterval": "Day"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user