Compare commits
No commits in common. "LabWork_3" and "main" have entirely different histories.
@ -1,37 +0,0 @@
|
|||||||
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 int Room { get; private set; }
|
|
||||||
|
|
||||||
public Specialization Specialization { get; private set; }
|
|
||||||
|
|
||||||
public SpecializationLevel SpecializationLevel { get; private set; }
|
|
||||||
|
|
||||||
public static Doctor CreateEntity(int id, string first_Name, string last_Name, int room, Specialization specialization, SpecializationLevel specializationLevel)
|
|
||||||
{
|
|
||||||
return new Doctor
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
First_Name = first_Name ?? string.Empty,
|
|
||||||
Last_Name = last_Name ?? string.Empty,
|
|
||||||
Room = room,
|
|
||||||
Specialization = specialization,
|
|
||||||
SpecializationLevel = specializationLevel
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Entities;
|
|
||||||
|
|
||||||
public class DoctorPay
|
|
||||||
{
|
|
||||||
|
|
||||||
public int Id { get; private set; }
|
|
||||||
|
|
||||||
public int IdDoctor { get; private set; }
|
|
||||||
|
|
||||||
public string Month { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public int Count_Patient { get; private set; }
|
|
||||||
|
|
||||||
public int Payment { get; private set; }
|
|
||||||
|
|
||||||
public static DoctorPay CreateElement(int id, int idDoctor, string month, int count_patient, int payment)
|
|
||||||
{
|
|
||||||
return new DoctorPay
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
IdDoctor = idDoctor,
|
|
||||||
Month = month,
|
|
||||||
Count_Patient = count_patient,
|
|
||||||
Payment = payment
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
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 Drug
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
|
|
||||||
public DrugsNames drugsNames { get; private set; }
|
|
||||||
|
|
||||||
public int Grams { get; private set; }
|
|
||||||
|
|
||||||
public string Description { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public static Drug CreateElement(int id, DrugsNames name, int grams, string description)
|
|
||||||
{
|
|
||||||
return new Drug
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
drugsNames = name,
|
|
||||||
Grams = grams,
|
|
||||||
Description = description ?? string.Empty
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Entities;
|
|
||||||
|
|
||||||
public class DrugMedHistory
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
|
|
||||||
public int DrugId { get; private set; }
|
|
||||||
|
|
||||||
public int MedicalHistoryId { get; private set; }
|
|
||||||
|
|
||||||
public int Count { get; private set; }
|
|
||||||
|
|
||||||
public static DrugMedHistory CreateEntity(int id, int drugId, int medicalHistoryId, int count)
|
|
||||||
{
|
|
||||||
return new DrugMedHistory
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
DrugId = drugId,
|
|
||||||
MedicalHistoryId = medicalHistoryId,
|
|
||||||
Count = count
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Entities.Enums;
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
public enum DrugsNames
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
|
|
||||||
Paracetamol = 1,
|
|
||||||
|
|
||||||
Ibuprofen = 2,
|
|
||||||
|
|
||||||
Aspirin = 4,
|
|
||||||
|
|
||||||
Antibiotic = 8,
|
|
||||||
|
|
||||||
Antihistamine = 16,
|
|
||||||
|
|
||||||
Insulin = 32,
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
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,
|
|
||||||
|
|
||||||
Therapist = 1,
|
|
||||||
|
|
||||||
Surgeon = 2,
|
|
||||||
|
|
||||||
Cardiolog = 3,
|
|
||||||
|
|
||||||
Ortoped = 4,
|
|
||||||
|
|
||||||
Nevrolog = 5,
|
|
||||||
|
|
||||||
Pediatr = 6
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Entities.Enums;
|
|
||||||
|
|
||||||
public enum SpecializationLevel
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
|
|
||||||
Intern = 1,
|
|
||||||
|
|
||||||
Doctor = 2,
|
|
||||||
|
|
||||||
Senior_doctor = 3,
|
|
||||||
|
|
||||||
Professor = 4
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Entities.Enums;
|
|
||||||
|
|
||||||
|
|
||||||
public enum Status
|
|
||||||
{
|
|
||||||
none = 0,
|
|
||||||
|
|
||||||
Sick= 1,
|
|
||||||
|
|
||||||
Heal = 2
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
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 MedicalHistory
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
|
|
||||||
public int PatientId { get; private set; }
|
|
||||||
|
|
||||||
public int DoctorId { get; private set; }
|
|
||||||
|
|
||||||
public DateTime VisitDate { get; private set; }
|
|
||||||
|
|
||||||
public Status Status { get; private set; }
|
|
||||||
|
|
||||||
public IEnumerable<DrugMedHistory> DrugMedHistory { get; private set; } = [];
|
|
||||||
|
|
||||||
public static MedicalHistory CreateEntity(int id, int patientId,
|
|
||||||
Status status, int doctorId, IEnumerable<DrugMedHistory> drugMedHistory)
|
|
||||||
{
|
|
||||||
return new MedicalHistory
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
PatientId = patientId,
|
|
||||||
DoctorId = doctorId,
|
|
||||||
VisitDate = DateTime.Now,
|
|
||||||
Status = status,
|
|
||||||
DrugMedHistory = drugMedHistory
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static MedicalHistory CreateEntity(TempMedicalHistory tempMedicalHistory,
|
|
||||||
IEnumerable<DrugMedHistory> drugMedHistory)
|
|
||||||
{
|
|
||||||
return new MedicalHistory
|
|
||||||
{
|
|
||||||
Id = tempMedicalHistory.Id,
|
|
||||||
PatientId = tempMedicalHistory.PatientId,
|
|
||||||
DoctorId = tempMedicalHistory.DoctorId,
|
|
||||||
VisitDate = tempMedicalHistory.VisitDate,
|
|
||||||
Status = (Status)tempMedicalHistory.Status,
|
|
||||||
DrugMedHistory = drugMedHistory
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
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 Address { 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 Address, string contactNumber)
|
|
||||||
{
|
|
||||||
return new Patient
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
First_Name = first_Name,
|
|
||||||
Last_Name = last_Name,
|
|
||||||
Address = Address,
|
|
||||||
ContactNumber = contactNumber
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Entities;
|
|
||||||
public class TempMedicalHistory
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public int PatientId { get; set; }
|
|
||||||
public int DoctorId { get; set; }
|
|
||||||
public DateTime VisitDate { get; set; }
|
|
||||||
public int Status { get; set; }
|
|
||||||
public int DrugId { get; set; }
|
|
||||||
public int Count { get; set; }
|
|
||||||
}
|
|
||||||
|
|
39
ProjectPolyclinic/ProjectPolyclinic/Form1.Designer.cs
generated
Normal file
39
ProjectPolyclinic/ProjectPolyclinic/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
10
ProjectPolyclinic/ProjectPolyclinic/Form1.cs
Normal file
10
ProjectPolyclinic/ProjectPolyclinic/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace ProjectPolyclinic
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,169 +0,0 @@
|
|||||||
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();
|
|
||||||
DoctorsToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
PacientsToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
DrugsToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
MedHistoryToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
DoctorPayToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
otchetsToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
DirectoryReportToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
DoctorPayReportToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
DrugCountToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
menuStrip1.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// menuStrip1
|
|
||||||
//
|
|
||||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, otchetsToolStripMenuItem });
|
|
||||||
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[] { DoctorsToolStripMenuItem, PacientsToolStripMenuItem, DrugsToolStripMenuItem });
|
|
||||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
|
||||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
|
||||||
справочникиToolStripMenuItem.Text = "Справочники";
|
|
||||||
//
|
|
||||||
// DoctorsToolStripMenuItem
|
|
||||||
//
|
|
||||||
DoctorsToolStripMenuItem.Name = "DoctorsToolStripMenuItem";
|
|
||||||
DoctorsToolStripMenuItem.Size = new Size(130, 22);
|
|
||||||
DoctorsToolStripMenuItem.Text = "Врачи";
|
|
||||||
DoctorsToolStripMenuItem.Click += DoctorsToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// PacientsToolStripMenuItem
|
|
||||||
//
|
|
||||||
PacientsToolStripMenuItem.Name = "PacientsToolStripMenuItem";
|
|
||||||
PacientsToolStripMenuItem.Size = new Size(130, 22);
|
|
||||||
PacientsToolStripMenuItem.Text = "Пациенты";
|
|
||||||
PacientsToolStripMenuItem.Click += PacientsToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// DrugsToolStripMenuItem
|
|
||||||
//
|
|
||||||
DrugsToolStripMenuItem.Name = "DrugsToolStripMenuItem";
|
|
||||||
DrugsToolStripMenuItem.Size = new Size(130, 22);
|
|
||||||
DrugsToolStripMenuItem.Text = "Лекарства";
|
|
||||||
DrugsToolStripMenuItem.Click += DrugsToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// операцииToolStripMenuItem
|
|
||||||
//
|
|
||||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { MedHistoryToolStripMenuItem, DoctorPayToolStripMenuItem });
|
|
||||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
|
||||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
|
||||||
операцииToolStripMenuItem.Text = "Операции";
|
|
||||||
//
|
|
||||||
// MedHistoryToolStripMenuItem
|
|
||||||
//
|
|
||||||
MedHistoryToolStripMenuItem.Name = "MedHistoryToolStripMenuItem";
|
|
||||||
MedHistoryToolStripMenuItem.Size = new Size(162, 22);
|
|
||||||
MedHistoryToolStripMenuItem.Text = "Учет мед. карты";
|
|
||||||
MedHistoryToolStripMenuItem.Click += MedHistoryToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// DoctorPayToolStripMenuItem
|
|
||||||
//
|
|
||||||
DoctorPayToolStripMenuItem.Name = "DoctorPayToolStripMenuItem";
|
|
||||||
DoctorPayToolStripMenuItem.Size = new Size(162, 22);
|
|
||||||
DoctorPayToolStripMenuItem.Text = "Оплата врачу";
|
|
||||||
DoctorPayToolStripMenuItem.Click += DoctorPayToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// otchetsToolStripMenuItem
|
|
||||||
//
|
|
||||||
otchetsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { DirectoryReportToolStripMenuItem, DoctorPayReportToolStripMenuItem, DrugCountToolStripMenuItem });
|
|
||||||
otchetsToolStripMenuItem.Name = "otchetsToolStripMenuItem";
|
|
||||||
otchetsToolStripMenuItem.Size = new Size(60, 20);
|
|
||||||
otchetsToolStripMenuItem.Text = "Отчеты";
|
|
||||||
//
|
|
||||||
// DirectoryReportToolStripMenuItem
|
|
||||||
//
|
|
||||||
DirectoryReportToolStripMenuItem.Name = "DirectoryReportToolStripMenuItem";
|
|
||||||
DirectoryReportToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.W;
|
|
||||||
DirectoryReportToolStripMenuItem.Size = new Size(280, 22);
|
|
||||||
DirectoryReportToolStripMenuItem.Text = "Документ со справочниками";
|
|
||||||
DirectoryReportToolStripMenuItem.Click += DirectoryReportToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// DoctorPayReportToolStripMenuItem
|
|
||||||
//
|
|
||||||
DoctorPayReportToolStripMenuItem.Name = "DoctorPayReportToolStripMenuItem";
|
|
||||||
DoctorPayReportToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.E;
|
|
||||||
DoctorPayReportToolStripMenuItem.Size = new Size(280, 22);
|
|
||||||
DoctorPayReportToolStripMenuItem.Text = "Оплаты врачам";
|
|
||||||
DoctorPayReportToolStripMenuItem.Click += DoctorPayReportToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// DrugCountToolStripMenuItem
|
|
||||||
//
|
|
||||||
DrugCountToolStripMenuItem.Name = "DrugCountToolStripMenuItem";
|
|
||||||
DrugCountToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.P;
|
|
||||||
DrugCountToolStripMenuItem.Size = new Size(280, 22);
|
|
||||||
DrugCountToolStripMenuItem.Text = "Распределение лекарств";
|
|
||||||
DrugCountToolStripMenuItem.Click += DrugCountToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// FormPolyclinic
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
BackgroundImage = Properties.Resources.polyclinicfon;
|
|
||||||
BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ClientSize = new Size(784, 411);
|
|
||||||
Controls.Add(menuStrip1);
|
|
||||||
DoubleBuffered = true;
|
|
||||||
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 DoctorsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem PacientsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem DrugsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem MedHistoryToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem otchetsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem DoctorPayToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem DirectoryReportToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem DoctorPayReportToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem DrugCountToolStripMenuItem;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,125 +0,0 @@
|
|||||||
using ProjectPolyclinic.Forms;
|
|
||||||
using System.ComponentModel;
|
|
||||||
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 DoctorsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormDoctors>().ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PacientsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormPatients>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrugsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormDrugs>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MedHistoryToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormMedicalHistories>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DoctorPayToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormDoctorPayments>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DirectoryReporToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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 DoctorPayReportToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormDoctorPayReport>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrugCountToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<DrugsCountReport>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,108 +0,0 @@
|
|||||||
namespace ProjectPolyclinic.Forms
|
|
||||||
{
|
|
||||||
partial class DrugsCountReport
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
dateTimePicker = new DateTimePicker();
|
|
||||||
labelDate = new Label();
|
|
||||||
labelFileName = new Label();
|
|
||||||
buttonSelectFileName = new Button();
|
|
||||||
buttonBuild = new Button();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dateTimePicker
|
|
||||||
//
|
|
||||||
dateTimePicker.Location = new Point(87, 83);
|
|
||||||
dateTimePicker.Name = "dateTimePicker";
|
|
||||||
dateTimePicker.Size = new Size(200, 23);
|
|
||||||
dateTimePicker.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// labelDate
|
|
||||||
//
|
|
||||||
labelDate.AutoSize = true;
|
|
||||||
labelDate.Location = new Point(35, 86);
|
|
||||||
labelDate.Name = "labelDate";
|
|
||||||
labelDate.Size = new Size(32, 15);
|
|
||||||
labelDate.TabIndex = 5;
|
|
||||||
labelDate.Text = "Дата";
|
|
||||||
//
|
|
||||||
// labelFileName
|
|
||||||
//
|
|
||||||
labelFileName.AutoSize = true;
|
|
||||||
labelFileName.Location = new Point(116, 26);
|
|
||||||
labelFileName.Name = "labelFileName";
|
|
||||||
labelFileName.Size = new Size(36, 15);
|
|
||||||
labelFileName.TabIndex = 7;
|
|
||||||
labelFileName.Text = "Файл";
|
|
||||||
//
|
|
||||||
// buttonSelectFileName
|
|
||||||
//
|
|
||||||
buttonSelectFileName.Location = new Point(35, 22);
|
|
||||||
buttonSelectFileName.Name = "buttonSelectFileName";
|
|
||||||
buttonSelectFileName.Size = new Size(75, 23);
|
|
||||||
buttonSelectFileName.TabIndex = 6;
|
|
||||||
buttonSelectFileName.Text = "Выбрать";
|
|
||||||
buttonSelectFileName.UseVisualStyleBackColor = true;
|
|
||||||
buttonSelectFileName.Click += buttonSelectFileName_Click;
|
|
||||||
//
|
|
||||||
// buttonBuild
|
|
||||||
//
|
|
||||||
buttonBuild.Location = new Point(35, 145);
|
|
||||||
buttonBuild.Name = "buttonBuild";
|
|
||||||
buttonBuild.Size = new Size(238, 48);
|
|
||||||
buttonBuild.TabIndex = 8;
|
|
||||||
buttonBuild.Text = "Сформировать";
|
|
||||||
buttonBuild.UseVisualStyleBackColor = true;
|
|
||||||
buttonBuild.Click += buttonBuild_Click;
|
|
||||||
//
|
|
||||||
// DrugsCountReport
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(314, 207);
|
|
||||||
Controls.Add(buttonBuild);
|
|
||||||
Controls.Add(labelFileName);
|
|
||||||
Controls.Add(buttonSelectFileName);
|
|
||||||
Controls.Add(labelDate);
|
|
||||||
Controls.Add(dateTimePicker);
|
|
||||||
Name = "DrugsCountReport";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Распределение лекарств";
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DateTimePicker dateTimePicker;
|
|
||||||
private Label labelDate;
|
|
||||||
private Label labelFileName;
|
|
||||||
private Button buttonSelectFileName;
|
|
||||||
private Button buttonBuild;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
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 DrugsCountReport : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private string _fileName = string.Empty;
|
|
||||||
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
|
|
||||||
public DrugsCountReport(IUnityContainer container)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ??
|
|
||||||
throw new ArgumentNullException(nameof(container));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonBuild_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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
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();
|
|
||||||
checkBoxDrugs = new CheckBox();
|
|
||||||
buttonBuild = new Button();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// checkBoxDoctors
|
|
||||||
//
|
|
||||||
checkBoxDoctors.AutoSize = true;
|
|
||||||
checkBoxDoctors.Location = new Point(12, 12);
|
|
||||||
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(12, 49);
|
|
||||||
checkBoxPatients.Name = "checkBoxPatients";
|
|
||||||
checkBoxPatients.Size = new Size(82, 19);
|
|
||||||
checkBoxPatients.TabIndex = 1;
|
|
||||||
checkBoxPatients.Text = "Пациенты";
|
|
||||||
checkBoxPatients.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// checkBoxDrugs
|
|
||||||
//
|
|
||||||
checkBoxDrugs.AutoSize = true;
|
|
||||||
checkBoxDrugs.Location = new Point(12, 90);
|
|
||||||
checkBoxDrugs.Name = "checkBoxDrugs";
|
|
||||||
checkBoxDrugs.Size = new Size(82, 19);
|
|
||||||
checkBoxDrugs.TabIndex = 2;
|
|
||||||
checkBoxDrugs.Text = "Лекарства";
|
|
||||||
checkBoxDrugs.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonBuild
|
|
||||||
//
|
|
||||||
buttonBuild.Location = new Point(178, 22);
|
|
||||||
buttonBuild.Name = "buttonBuild";
|
|
||||||
buttonBuild.Size = new Size(172, 71);
|
|
||||||
buttonBuild.TabIndex = 3;
|
|
||||||
buttonBuild.Text = "Сформировать";
|
|
||||||
buttonBuild.UseVisualStyleBackColor = true;
|
|
||||||
buttonBuild.Click += buttonBuild_Click;
|
|
||||||
//
|
|
||||||
// FormDirectoryReport
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(375, 127);
|
|
||||||
Controls.Add(buttonBuild);
|
|
||||||
Controls.Add(checkBoxDrugs);
|
|
||||||
Controls.Add(checkBoxPatients);
|
|
||||||
Controls.Add(checkBoxDoctors);
|
|
||||||
Name = "FormDirectoryReport";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Выгрузка справочников";
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private CheckBox checkBoxDoctors;
|
|
||||||
private CheckBox checkBoxPatients;
|
|
||||||
private CheckBox checkBoxDrugs;
|
|
||||||
private Button buttonBuild;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
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 && !checkBoxDrugs.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, checkBoxDrugs.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,120 +0,0 @@
|
|||||||
<?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,192 +0,0 @@
|
|||||||
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()
|
|
||||||
{
|
|
||||||
labelFirstName = new Label();
|
|
||||||
labelLastName = new Label();
|
|
||||||
labelSpecializationLevel = new Label();
|
|
||||||
labelRoom = new Label();
|
|
||||||
labelSpecialization = new Label();
|
|
||||||
buttonSave = new Button();
|
|
||||||
buttonCancel = new Button();
|
|
||||||
textBoxFirstName = new TextBox();
|
|
||||||
textBoxLastName = new TextBox();
|
|
||||||
comboBoxSpecialization = new ComboBox();
|
|
||||||
comboBoxSpecializationLevel = new ComboBox();
|
|
||||||
numericUpDownRoom = new NumericUpDown();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownRoom).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelFirstName
|
|
||||||
//
|
|
||||||
labelFirstName.AutoSize = true;
|
|
||||||
labelFirstName.Location = new Point(27, 34);
|
|
||||||
labelFirstName.Name = "labelFirstName";
|
|
||||||
labelFirstName.Size = new Size(31, 15);
|
|
||||||
labelFirstName.TabIndex = 0;
|
|
||||||
labelFirstName.Text = "Имя";
|
|
||||||
//
|
|
||||||
// labelLastName
|
|
||||||
//
|
|
||||||
labelLastName.AutoSize = true;
|
|
||||||
labelLastName.Location = new Point(27, 82);
|
|
||||||
labelLastName.Name = "labelLastName";
|
|
||||||
labelLastName.Size = new Size(58, 15);
|
|
||||||
labelLastName.TabIndex = 1;
|
|
||||||
labelLastName.Text = "Фамилия";
|
|
||||||
//
|
|
||||||
// labelSpecializationLevel
|
|
||||||
//
|
|
||||||
labelSpecializationLevel.AutoSize = true;
|
|
||||||
labelSpecializationLevel.Location = new Point(27, 233);
|
|
||||||
labelSpecializationLevel.Name = "labelSpecializationLevel";
|
|
||||||
labelSpecializationLevel.Size = new Size(69, 15);
|
|
||||||
labelSpecializationLevel.TabIndex = 2;
|
|
||||||
labelSpecializationLevel.Text = "Должность";
|
|
||||||
//
|
|
||||||
// labelRoom
|
|
||||||
//
|
|
||||||
labelRoom.AutoSize = true;
|
|
||||||
labelRoom.Location = new Point(27, 130);
|
|
||||||
labelRoom.Name = "labelRoom";
|
|
||||||
labelRoom.Size = new Size(52, 15);
|
|
||||||
labelRoom.TabIndex = 3;
|
|
||||||
labelRoom.Text = "Кабинет";
|
|
||||||
//
|
|
||||||
// labelSpecialization
|
|
||||||
//
|
|
||||||
labelSpecialization.AutoSize = true;
|
|
||||||
labelSpecialization.Location = new Point(27, 181);
|
|
||||||
labelSpecialization.Name = "labelSpecialization";
|
|
||||||
labelSpecialization.Size = new Size(93, 15);
|
|
||||||
labelSpecialization.TabIndex = 4;
|
|
||||||
labelSpecialization.Text = "Специализация";
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
buttonSave.Location = new Point(27, 288);
|
|
||||||
buttonSave.Name = "buttonSave";
|
|
||||||
buttonSave.Size = new Size(93, 29);
|
|
||||||
buttonSave.TabIndex = 5;
|
|
||||||
buttonSave.Text = "Сохранить";
|
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
buttonSave.Click += buttonSave_Click;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new Point(152, 288);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new Size(93, 29);
|
|
||||||
buttonCancel.TabIndex = 6;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// textBoxFirstName
|
|
||||||
//
|
|
||||||
textBoxFirstName.Location = new Point(152, 31);
|
|
||||||
textBoxFirstName.Name = "textBoxFirstName";
|
|
||||||
textBoxFirstName.Size = new Size(121, 23);
|
|
||||||
textBoxFirstName.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// textBoxLastName
|
|
||||||
//
|
|
||||||
textBoxLastName.Location = new Point(152, 79);
|
|
||||||
textBoxLastName.Name = "textBoxLastName";
|
|
||||||
textBoxLastName.Size = new Size(121, 23);
|
|
||||||
textBoxLastName.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// comboBoxSpecialization
|
|
||||||
//
|
|
||||||
comboBoxSpecialization.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxSpecialization.FormattingEnabled = true;
|
|
||||||
comboBoxSpecialization.Location = new Point(152, 178);
|
|
||||||
comboBoxSpecialization.Name = "comboBoxSpecialization";
|
|
||||||
comboBoxSpecialization.Size = new Size(121, 23);
|
|
||||||
comboBoxSpecialization.TabIndex = 10;
|
|
||||||
//
|
|
||||||
// comboBoxSpecializationLevel
|
|
||||||
//
|
|
||||||
comboBoxSpecializationLevel.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxSpecializationLevel.FormattingEnabled = true;
|
|
||||||
comboBoxSpecializationLevel.Location = new Point(152, 230);
|
|
||||||
comboBoxSpecializationLevel.Name = "comboBoxSpecializationLevel";
|
|
||||||
comboBoxSpecializationLevel.Size = new Size(121, 23);
|
|
||||||
comboBoxSpecializationLevel.TabIndex = 11;
|
|
||||||
//
|
|
||||||
// numericUpDownRoom
|
|
||||||
//
|
|
||||||
numericUpDownRoom.Location = new Point(152, 128);
|
|
||||||
numericUpDownRoom.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
|
||||||
numericUpDownRoom.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
|
||||||
numericUpDownRoom.Name = "numericUpDownRoom";
|
|
||||||
numericUpDownRoom.Size = new Size(121, 23);
|
|
||||||
numericUpDownRoom.TabIndex = 12;
|
|
||||||
numericUpDownRoom.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
|
||||||
//
|
|
||||||
// FormDoctor
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(307, 337);
|
|
||||||
Controls.Add(numericUpDownRoom);
|
|
||||||
Controls.Add(comboBoxSpecializationLevel);
|
|
||||||
Controls.Add(comboBoxSpecialization);
|
|
||||||
Controls.Add(textBoxLastName);
|
|
||||||
Controls.Add(textBoxFirstName);
|
|
||||||
Controls.Add(buttonCancel);
|
|
||||||
Controls.Add(buttonSave);
|
|
||||||
Controls.Add(labelSpecialization);
|
|
||||||
Controls.Add(labelRoom);
|
|
||||||
Controls.Add(labelSpecializationLevel);
|
|
||||||
Controls.Add(labelLastName);
|
|
||||||
Controls.Add(labelFirstName);
|
|
||||||
Name = "FormDoctor";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Врач";
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownRoom).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelFirstName;
|
|
||||||
private Label labelLastName;
|
|
||||||
private Label labelSpecializationLevel;
|
|
||||||
private Label labelRoom;
|
|
||||||
private Label labelSpecialization;
|
|
||||||
private Button buttonSave;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private TextBox textBoxFirstName;
|
|
||||||
private TextBox textBoxLastName;
|
|
||||||
private ComboBox comboBoxSpecialization;
|
|
||||||
private ComboBox comboBoxSpecializationLevel;
|
|
||||||
private NumericUpDown numericUpDownRoom;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
using ProjectPolyclinic.Entities;
|
|
||||||
using ProjectPolyclinic.Entities.Enums;
|
|
||||||
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.Numerics;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Forms
|
|
||||||
{
|
|
||||||
public partial class FormDoctor : Form
|
|
||||||
{
|
|
||||||
public FormDoctor(IDoctorRepository doctorRepository)
|
|
||||||
{
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
_doctorRepository = doctorRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(doctorRepository));
|
|
||||||
|
|
||||||
comboBoxSpecialization.DataSource = Enum.GetValues(typeof(Specialization));
|
|
||||||
|
|
||||||
comboBoxSpecializationLevel.DataSource = Enum.GetValues(typeof(SpecializationLevel));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly IDoctorRepository _doctorRepository;
|
|
||||||
|
|
||||||
private int? _doctorId;
|
|
||||||
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_doctorId = value;
|
|
||||||
var doctor = _doctorRepository.ReadDoctorById(value);
|
|
||||||
if (doctor == null)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException(nameof(doctor));
|
|
||||||
}
|
|
||||||
|
|
||||||
textBoxFirstName.Text = doctor.First_Name;
|
|
||||||
textBoxLastName.Text = doctor.Last_Name;
|
|
||||||
numericUpDownRoom.Value = doctor.Room;
|
|
||||||
comboBoxSpecialization.SelectedItem = doctor.Specialization;
|
|
||||||
comboBoxSpecializationLevel.SelectedItem = doctor.SpecializationLevel;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) ||
|
|
||||||
string.IsNullOrWhiteSpace(textBoxLastName.Text) ||
|
|
||||||
numericUpDownRoom.Value < 1 ||
|
|
||||||
comboBoxSpecialization.SelectedItem == null ||
|
|
||||||
comboBoxSpecializationLevel.SelectedItem == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются незаполненные поля");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_doctorId.HasValue)
|
|
||||||
{
|
|
||||||
_doctorRepository.UpdateDoctor(CreateDoctor(_doctorId.Value));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_doctorRepository.CreateDoctor(CreateDoctor(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
|
|
||||||
private Doctor CreateDoctor(int id) =>
|
|
||||||
Doctor.CreateEntity(id,
|
|
||||||
textBoxFirstName.Text, textBoxLastName.Text,
|
|
||||||
(int)numericUpDownRoom.Value,
|
|
||||||
(Specialization)comboBoxSpecialization.SelectedItem!,
|
|
||||||
(SpecializationLevel)comboBoxSpecializationLevel.SelectedItem!);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,172 +0,0 @@
|
|||||||
namespace ProjectPolyclinic.Forms
|
|
||||||
{
|
|
||||||
partial class FormDoctorPayment
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
labelDoctor = new Label();
|
|
||||||
buttonCancel = new Button();
|
|
||||||
buttonSave = new Button();
|
|
||||||
comboBoxDoctor = new ComboBox();
|
|
||||||
label4 = new Label();
|
|
||||||
dateTimePicker = new DateTimePicker();
|
|
||||||
label1 = new Label();
|
|
||||||
label2 = new Label();
|
|
||||||
numericCount = new NumericUpDown();
|
|
||||||
numericPay = new NumericUpDown();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericCount).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericPay).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelDoctor
|
|
||||||
//
|
|
||||||
labelDoctor.AutoSize = true;
|
|
||||||
labelDoctor.Location = new Point(31, 32);
|
|
||||||
labelDoctor.Name = "labelDoctor";
|
|
||||||
labelDoctor.Size = new Size(34, 15);
|
|
||||||
labelDoctor.TabIndex = 0;
|
|
||||||
labelDoctor.Text = "Врач";
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new Point(210, 228);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new Size(93, 29);
|
|
||||||
buttonCancel.TabIndex = 11;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
buttonSave.Location = new Point(31, 228);
|
|
||||||
buttonSave.Name = "buttonSave";
|
|
||||||
buttonSave.Size = new Size(93, 29);
|
|
||||||
buttonSave.TabIndex = 10;
|
|
||||||
buttonSave.Text = "Сохранить";
|
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
buttonSave.Click += buttonSave_Click;
|
|
||||||
//
|
|
||||||
// comboBoxDoctor
|
|
||||||
//
|
|
||||||
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxDoctor.FormattingEnabled = true;
|
|
||||||
comboBoxDoctor.Location = new Point(169, 30);
|
|
||||||
comboBoxDoctor.Name = "comboBoxDoctor";
|
|
||||||
comboBoxDoctor.Size = new Size(134, 23);
|
|
||||||
comboBoxDoctor.TabIndex = 12;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
label4.AutoSize = true;
|
|
||||||
label4.Location = new Point(31, 74);
|
|
||||||
label4.Name = "label4";
|
|
||||||
label4.Size = new Size(43, 15);
|
|
||||||
label4.TabIndex = 17;
|
|
||||||
label4.Text = "Месяц";
|
|
||||||
//
|
|
||||||
// dateTimePicker
|
|
||||||
//
|
|
||||||
dateTimePicker.CustomFormat = "MMMM yyyy";
|
|
||||||
dateTimePicker.Format = DateTimePickerFormat.Custom;
|
|
||||||
dateTimePicker.Location = new Point(169, 70);
|
|
||||||
dateTimePicker.Margin = new Padding(3, 2, 3, 2);
|
|
||||||
dateTimePicker.Name = "dateTimePicker";
|
|
||||||
dateTimePicker.Size = new Size(134, 23);
|
|
||||||
dateTimePicker.TabIndex = 22;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(31, 116);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(113, 15);
|
|
||||||
label1.TabIndex = 23;
|
|
||||||
label1.Text = "Кол-во посещений";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(31, 153);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(47, 15);
|
|
||||||
label2.TabIndex = 24;
|
|
||||||
label2.Text = "Оплата";
|
|
||||||
//
|
|
||||||
// numericCount
|
|
||||||
//
|
|
||||||
numericCount.Location = new Point(169, 114);
|
|
||||||
numericCount.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
|
|
||||||
numericCount.Name = "numericCount";
|
|
||||||
numericCount.Size = new Size(134, 23);
|
|
||||||
numericCount.TabIndex = 27;
|
|
||||||
//
|
|
||||||
// numericPay
|
|
||||||
//
|
|
||||||
numericPay.Location = new Point(169, 151);
|
|
||||||
numericPay.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
|
|
||||||
numericPay.Name = "numericPay";
|
|
||||||
numericPay.Size = new Size(134, 23);
|
|
||||||
numericPay.TabIndex = 28;
|
|
||||||
//
|
|
||||||
// FormDoctorPayment
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(324, 272);
|
|
||||||
Controls.Add(numericPay);
|
|
||||||
Controls.Add(numericCount);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(label1);
|
|
||||||
Controls.Add(dateTimePicker);
|
|
||||||
Controls.Add(label4);
|
|
||||||
Controls.Add(comboBoxDoctor);
|
|
||||||
Controls.Add(buttonCancel);
|
|
||||||
Controls.Add(buttonSave);
|
|
||||||
Controls.Add(labelDoctor);
|
|
||||||
Name = "FormDoctorPayment";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Оплата врачу";
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericCount).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericPay).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelDoctor;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Button buttonSave;
|
|
||||||
private ComboBox comboBoxDoctor;
|
|
||||||
private Label label4;
|
|
||||||
private DateTimePicker dateTimePicker;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private NumericUpDown numericCount;
|
|
||||||
private NumericUpDown numericPay;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
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;
|
|
||||||
using System.Windows.Forms.VisualStyles;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Forms;
|
|
||||||
|
|
||||||
public partial class FormDoctorPayment : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IDoctorPayRepository _doctorPayRepository;
|
|
||||||
|
|
||||||
public FormDoctorPayment(IDoctorPayRepository doctorPayRepository,
|
|
||||||
IDoctorRepository doctorRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_doctorPayRepository = doctorPayRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(doctorPayRepository));
|
|
||||||
|
|
||||||
comboBoxDoctor.DataSource = doctorRepository.ReadDoctors();
|
|
||||||
comboBoxDoctor.DisplayMember = "Last_Name";
|
|
||||||
comboBoxDoctor.ValueMember = "Id";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (comboBoxDoctor.SelectedIndex < 0)
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются незаполненные поля.");
|
|
||||||
}
|
|
||||||
|
|
||||||
int doctorId = (int)comboBoxDoctor.SelectedValue!;
|
|
||||||
string month = dateTimePicker.Value.ToString("yyyy-MM");
|
|
||||||
int patientCount = (int)numericCount.Value;
|
|
||||||
int payment = (int)numericPay.Value;
|
|
||||||
|
|
||||||
var doctorPay = DoctorPay.CreateElement(0, doctorId, month, patientCount, payment);
|
|
||||||
_doctorPayRepository.CreateDoctorPayments(doctorPay);
|
|
||||||
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,95 +0,0 @@
|
|||||||
namespace ProjectPolyclinic.Forms
|
|
||||||
{
|
|
||||||
partial class FormDoctorPayments
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
panel1 = new Panel();
|
|
||||||
buttonAdd = new Button();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(buttonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(661, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(139, 390);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
buttonAdd.BackgroundImage = Properties.Resources.buttonAdd;
|
|
||||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonAdd.Location = new Point(32, 29);
|
|
||||||
buttonAdd.Name = "buttonAdd";
|
|
||||||
buttonAdd.Size = new Size(75, 70);
|
|
||||||
buttonAdd.TabIndex = 0;
|
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonAdd.Click += buttonAdd_Click;
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.AllowUserToResizeColumns = false;
|
|
||||||
dataGridView.AllowUserToResizeRows = false;
|
|
||||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Dock = DockStyle.Fill;
|
|
||||||
dataGridView.Location = new Point(0, 0);
|
|
||||||
dataGridView.MultiSelect = false;
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersVisible = false;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(661, 390);
|
|
||||||
dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// FormDoctorPayments
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 390);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "FormDoctorPayments";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = " Оплаты врачам";
|
|
||||||
Load += FormDoctorPayments_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
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 FormDoctorPayments : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
private readonly IDoctorPayRepository _doctorPayRepository;
|
|
||||||
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
|
|
||||||
|
|
||||||
public FormDoctorPayments(IUnityContainer container, IDoctorPayRepository doctorPayRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ??
|
|
||||||
throw new ArgumentNullException(nameof(container));
|
|
||||||
_doctorPayRepository = doctorPayRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(doctorPayRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void FormDoctorPayments_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void LoadList() => dataGridView.DataSource = _doctorPayRepository.ReadDoctorPayments();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormDoctorPayment>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,123 +0,0 @@
|
|||||||
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();
|
|
||||||
buttonUpdate = new Button();
|
|
||||||
buttonDel = new Button();
|
|
||||||
buttonAdd = new Button();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(buttonUpdate);
|
|
||||||
panel1.Controls.Add(buttonDel);
|
|
||||||
panel1.Controls.Add(buttonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(661, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(139, 373);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonUpdate
|
|
||||||
//
|
|
||||||
buttonUpdate.BackgroundImage = Properties.Resources.buttonUpdate;
|
|
||||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonUpdate.Location = new Point(32, 241);
|
|
||||||
buttonUpdate.Name = "buttonUpdate";
|
|
||||||
buttonUpdate.Size = new Size(75, 70);
|
|
||||||
buttonUpdate.TabIndex = 2;
|
|
||||||
buttonUpdate.UseVisualStyleBackColor = true;
|
|
||||||
buttonUpdate.Click += buttonUpdate_Click;
|
|
||||||
//
|
|
||||||
// buttonDel
|
|
||||||
//
|
|
||||||
buttonDel.BackgroundImage = Properties.Resources.buttonDel;
|
|
||||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonDel.Location = new Point(32, 134);
|
|
||||||
buttonDel.Name = "buttonDel";
|
|
||||||
buttonDel.Size = new Size(75, 70);
|
|
||||||
buttonDel.TabIndex = 1;
|
|
||||||
buttonDel.UseVisualStyleBackColor = true;
|
|
||||||
buttonDel.Click += buttonDel_Click;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
buttonAdd.BackgroundImage = Properties.Resources.buttonAdd;
|
|
||||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonAdd.Location = new Point(32, 29);
|
|
||||||
buttonAdd.Name = "buttonAdd";
|
|
||||||
buttonAdd.Size = new Size(75, 70);
|
|
||||||
buttonAdd.TabIndex = 0;
|
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonAdd.Click += buttonAdd_Click;
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.AllowUserToResizeColumns = false;
|
|
||||||
dataGridView.AllowUserToResizeRows = false;
|
|
||||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Dock = DockStyle.Fill;
|
|
||||||
dataGridView.Location = new Point(0, 0);
|
|
||||||
dataGridView.MultiSelect = false;
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersVisible = false;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(661, 373);
|
|
||||||
dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// FormDoctors
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 373);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "FormDoctors";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Врачи";
|
|
||||||
Load += FormDoctors_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button buttonUpdate;
|
|
||||||
private Button buttonDel;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
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 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 LoadList() => dataGridView.DataSource = _doctorRepository.ReadDoctors();
|
|
||||||
|
|
||||||
|
|
||||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
if (dataGridView.SelectedRows.Count < 1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["id"].Value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormDoctor>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_doctorRepository.DeleteDoctor(findId);
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonUpdate_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,150 +0,0 @@
|
|||||||
namespace ProjectPolyclinic.Forms
|
|
||||||
{
|
|
||||||
partial class FormDrug
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
buttonCancel = new Button();
|
|
||||||
buttonSave = new Button();
|
|
||||||
labelName = new Label();
|
|
||||||
labelGrams = new Label();
|
|
||||||
labelDescription = new Label();
|
|
||||||
checkedListBoxName = new CheckedListBox();
|
|
||||||
textBoxDescription = new TextBox();
|
|
||||||
numericGrams = new NumericUpDown();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericGrams).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new Point(202, 403);
|
|
||||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new Size(106, 39);
|
|
||||||
buttonCancel.TabIndex = 8;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
buttonSave.Location = new Point(43, 403);
|
|
||||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
buttonSave.Name = "buttonSave";
|
|
||||||
buttonSave.Size = new Size(106, 39);
|
|
||||||
buttonSave.TabIndex = 7;
|
|
||||||
buttonSave.Text = "Сохранить";
|
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
buttonSave.Click += buttonSave_Click;
|
|
||||||
//
|
|
||||||
// labelName
|
|
||||||
//
|
|
||||||
labelName.AutoSize = true;
|
|
||||||
labelName.Location = new Point(43, 59);
|
|
||||||
labelName.Name = "labelName";
|
|
||||||
labelName.Size = new Size(77, 20);
|
|
||||||
labelName.TabIndex = 9;
|
|
||||||
labelName.Text = "Название";
|
|
||||||
//
|
|
||||||
// labelGrams
|
|
||||||
//
|
|
||||||
labelGrams.AutoSize = true;
|
|
||||||
labelGrams.Location = new Point(43, 251);
|
|
||||||
labelGrams.Name = "labelGrams";
|
|
||||||
labelGrams.Size = new Size(76, 20);
|
|
||||||
labelGrams.TabIndex = 10;
|
|
||||||
labelGrams.Text = "Грамовка";
|
|
||||||
//
|
|
||||||
// labelDescription
|
|
||||||
//
|
|
||||||
labelDescription.AutoSize = true;
|
|
||||||
labelDescription.Location = new Point(43, 315);
|
|
||||||
labelDescription.Name = "labelDescription";
|
|
||||||
labelDescription.Size = new Size(57, 20);
|
|
||||||
labelDescription.TabIndex = 11;
|
|
||||||
labelDescription.Text = "Рецепт";
|
|
||||||
//
|
|
||||||
// checkedListBoxName
|
|
||||||
//
|
|
||||||
checkedListBoxName.FormattingEnabled = true;
|
|
||||||
checkedListBoxName.Location = new Point(155, 59);
|
|
||||||
checkedListBoxName.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
checkedListBoxName.Name = "checkedListBoxName";
|
|
||||||
checkedListBoxName.Size = new Size(183, 114);
|
|
||||||
checkedListBoxName.TabIndex = 12;
|
|
||||||
//
|
|
||||||
// textBoxDescription
|
|
||||||
//
|
|
||||||
textBoxDescription.Location = new Point(155, 311);
|
|
||||||
textBoxDescription.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
textBoxDescription.Name = "textBoxDescription";
|
|
||||||
textBoxDescription.Size = new Size(183, 27);
|
|
||||||
textBoxDescription.TabIndex = 14;
|
|
||||||
//
|
|
||||||
// numericGrams
|
|
||||||
//
|
|
||||||
numericGrams.Location = new Point(155, 249);
|
|
||||||
numericGrams.Maximum = new decimal(new int[] { 10000, 0, 0, 0 });
|
|
||||||
numericGrams.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
|
||||||
numericGrams.Name = "numericGrams";
|
|
||||||
numericGrams.Size = new Size(183, 27);
|
|
||||||
numericGrams.TabIndex = 15;
|
|
||||||
numericGrams.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
|
||||||
//
|
|
||||||
// FormDrug
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(353, 476);
|
|
||||||
Controls.Add(numericGrams);
|
|
||||||
Controls.Add(textBoxDescription);
|
|
||||||
Controls.Add(checkedListBoxName);
|
|
||||||
Controls.Add(labelDescription);
|
|
||||||
Controls.Add(labelGrams);
|
|
||||||
Controls.Add(labelName);
|
|
||||||
Controls.Add(buttonCancel);
|
|
||||||
Controls.Add(buttonSave);
|
|
||||||
Margin = new Padding(3, 4, 3, 4);
|
|
||||||
Name = "FormDrug";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Лекарство";
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericGrams).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Button buttonSave;
|
|
||||||
private Label labelName;
|
|
||||||
private Label labelGrams;
|
|
||||||
private Label labelDescription;
|
|
||||||
private CheckedListBox checkedListBoxName;
|
|
||||||
private TextBox textBoxDescription;
|
|
||||||
private NumericUpDown numericGrams;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,111 +0,0 @@
|
|||||||
using ProjectPolyclinic.Entities.Enums;
|
|
||||||
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 FormDrug : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IDrugRepository _drugRepository;
|
|
||||||
|
|
||||||
private int? _dragId;
|
|
||||||
|
|
||||||
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var drag = _drugRepository.ReadDrugById(value);
|
|
||||||
if (drag == null)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException(nameof(drag));
|
|
||||||
}
|
|
||||||
foreach (DrugsNames elem in Enum.GetValues(typeof(DrugsNames)))
|
|
||||||
{
|
|
||||||
if ((elem & drag.drugsNames) != 0)
|
|
||||||
{
|
|
||||||
checkedListBoxName.SetItemChecked(checkedListBoxName.Items.IndexOf(elem), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
numericGrams.Text = drag.Grams.ToString();
|
|
||||||
textBoxDescription.Text = drag.Description;
|
|
||||||
_dragId = value;
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public FormDrug(IDrugRepository drugRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_drugRepository = drugRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(drugRepository));
|
|
||||||
foreach (var elem in Enum.GetValues(typeof(DrugsNames)))
|
|
||||||
{
|
|
||||||
checkedListBoxName.Items.Add(elem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(textBoxDescription.Text) ||
|
|
||||||
checkedListBoxName.CheckedItems.Count == 0)
|
|
||||||
{
|
|
||||||
throw new Exception("Имеется незаполненные поля");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_dragId.HasValue)
|
|
||||||
{
|
|
||||||
_drugRepository.UpdateDrug(CreateDrag(_dragId.Value));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_drugRepository.CreateDrug(CreateDrag(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
|
|
||||||
|
|
||||||
private Drug CreateDrag(int id)
|
|
||||||
{
|
|
||||||
DrugsNames drugName = DrugsNames.None;
|
|
||||||
|
|
||||||
foreach (var elem in checkedListBoxName.CheckedItems)
|
|
||||||
{
|
|
||||||
drugName |= (DrugsNames)elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Drug.CreateElement(id, drugName, (int)numericGrams.Value, textBoxDescription.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,123 +0,0 @@
|
|||||||
namespace ProjectPolyclinic.Forms
|
|
||||||
{
|
|
||||||
partial class FormDrugs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
panel1 = new Panel();
|
|
||||||
buttonUpdate = new Button();
|
|
||||||
buttonDel = new Button();
|
|
||||||
buttonAdd = new Button();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(buttonUpdate);
|
|
||||||
panel1.Controls.Add(buttonDel);
|
|
||||||
panel1.Controls.Add(buttonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(661, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(139, 390);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonUpdate
|
|
||||||
//
|
|
||||||
buttonUpdate.BackgroundImage = Properties.Resources.buttonUpdate;
|
|
||||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonUpdate.Location = new Point(32, 241);
|
|
||||||
buttonUpdate.Name = "buttonUpdate";
|
|
||||||
buttonUpdate.Size = new Size(75, 70);
|
|
||||||
buttonUpdate.TabIndex = 2;
|
|
||||||
buttonUpdate.UseVisualStyleBackColor = true;
|
|
||||||
buttonUpdate.Click += buttonUpdate_Click;
|
|
||||||
//
|
|
||||||
// buttonDel
|
|
||||||
//
|
|
||||||
buttonDel.BackgroundImage = Properties.Resources.buttonDel;
|
|
||||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonDel.Location = new Point(32, 134);
|
|
||||||
buttonDel.Name = "buttonDel";
|
|
||||||
buttonDel.Size = new Size(75, 70);
|
|
||||||
buttonDel.TabIndex = 1;
|
|
||||||
buttonDel.UseVisualStyleBackColor = true;
|
|
||||||
buttonDel.Click += buttonDel_Click;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
buttonAdd.BackgroundImage = Properties.Resources.buttonAdd;
|
|
||||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonAdd.Location = new Point(32, 29);
|
|
||||||
buttonAdd.Name = "buttonAdd";
|
|
||||||
buttonAdd.Size = new Size(75, 70);
|
|
||||||
buttonAdd.TabIndex = 0;
|
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonAdd.Click += buttonAdd_Click;
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.AllowUserToResizeColumns = false;
|
|
||||||
dataGridView.AllowUserToResizeRows = false;
|
|
||||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Dock = DockStyle.Fill;
|
|
||||||
dataGridView.Location = new Point(0, 0);
|
|
||||||
dataGridView.MultiSelect = false;
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersVisible = false;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(661, 390);
|
|
||||||
dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// FormDrugs
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 390);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "FormDrugs";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Лекарства";
|
|
||||||
Load += FormDrugs_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button buttonUpdate;
|
|
||||||
private Button buttonDel;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
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 FormDrugs : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
|
|
||||||
private readonly IDrugRepository _dragRepository;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FormDrugs(IUnityContainer container, IDrugRepository dragRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ??
|
|
||||||
throw new ArgumentNullException(nameof(container));
|
|
||||||
_dragRepository = dragRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(dragRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void FormDrugs_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void LoadList() => dataGridView.DataSource = _dragRepository.ReadDrug();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormDrug>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_dragRepository.DeleteDrug(findId);
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonUpdate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var form = _container.Resolve<FormDrug>();
|
|
||||||
form.Id = findId;
|
|
||||||
form.ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
if (dataGridView.SelectedRows.Count < 1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["id"].Value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,109 +0,0 @@
|
|||||||
namespace ProjectPolyclinic.Forms
|
|
||||||
{
|
|
||||||
partial class FormMedicalHistories
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
panel1 = new Panel();
|
|
||||||
buttonDel = new Button();
|
|
||||||
buttonAdd = new Button();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(buttonDel);
|
|
||||||
panel1.Controls.Add(buttonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(661, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(139, 390);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonDel
|
|
||||||
//
|
|
||||||
buttonDel.BackgroundImage = Properties.Resources.buttonDel;
|
|
||||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonDel.Location = new Point(32, 134);
|
|
||||||
buttonDel.Name = "buttonDel";
|
|
||||||
buttonDel.Size = new Size(75, 70);
|
|
||||||
buttonDel.TabIndex = 1;
|
|
||||||
buttonDel.UseVisualStyleBackColor = true;
|
|
||||||
buttonDel.Click += buttonDel_Click;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
buttonAdd.BackgroundImage = Properties.Resources.buttonAdd;
|
|
||||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonAdd.Location = new Point(32, 29);
|
|
||||||
buttonAdd.Name = "buttonAdd";
|
|
||||||
buttonAdd.Size = new Size(75, 70);
|
|
||||||
buttonAdd.TabIndex = 0;
|
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonAdd.Click += buttonAdd_Click;
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.AllowUserToResizeColumns = false;
|
|
||||||
dataGridView.AllowUserToResizeRows = false;
|
|
||||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Dock = DockStyle.Fill;
|
|
||||||
dataGridView.Location = new Point(0, 0);
|
|
||||||
dataGridView.MultiSelect = false;
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersVisible = false;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(661, 390);
|
|
||||||
dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// FormMedicalHistories
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 390);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "FormMedicalHistories";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = " Медицинские истории";
|
|
||||||
Load += FormMedicalHistories_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button buttonDel;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
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 FormMedicalHistories : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
|
||||||
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FormMedicalHistories(IUnityContainer container, IMedicalHistoryRepository medicalHistoryRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ??
|
|
||||||
throw new ArgumentNullException(nameof(container));
|
|
||||||
_medicalHistoryRepository = medicalHistoryRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(medicalHistoryRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void FormMedicalHistories_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void LoadList() => dataGridView.DataSource = _medicalHistoryRepository.ReadMedicalHistory();
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormMedicalHistory>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
|
||||||
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_medicalHistoryRepository.DeletemedicalHistory(findId);
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
if (dataGridView.SelectedRows.Count < 1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
id =
|
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,207 +0,0 @@
|
|||||||
namespace ProjectPolyclinic.Forms
|
|
||||||
{
|
|
||||||
partial class FormMedicalHistory
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
labelPacientName = new Label();
|
|
||||||
labelDoctorName = new Label();
|
|
||||||
comboBoxPacient = new ComboBox();
|
|
||||||
comboBoxDoctor = new ComboBox();
|
|
||||||
groupBox = new GroupBox();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
label = new Label();
|
|
||||||
comboBoxStatus = new ComboBox();
|
|
||||||
buttonCancel = new Button();
|
|
||||||
buttonSave = new Button();
|
|
||||||
ColumnDrug = new DataGridViewComboBoxColumn();
|
|
||||||
ColumnCount = new DataGridViewTextBoxColumn();
|
|
||||||
groupBox.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelPacientName
|
|
||||||
//
|
|
||||||
labelPacientName.AutoSize = true;
|
|
||||||
labelPacientName.Location = new Point(34, 48);
|
|
||||||
labelPacientName.Name = "labelPacientName";
|
|
||||||
labelPacientName.Size = new Size(69, 20);
|
|
||||||
labelPacientName.TabIndex = 0;
|
|
||||||
labelPacientName.Text = "Пациент";
|
|
||||||
//
|
|
||||||
// labelDoctorName
|
|
||||||
//
|
|
||||||
labelDoctorName.AutoSize = true;
|
|
||||||
labelDoctorName.Location = new Point(34, 117);
|
|
||||||
labelDoctorName.Name = "labelDoctorName";
|
|
||||||
labelDoctorName.Size = new Size(59, 20);
|
|
||||||
labelDoctorName.TabIndex = 1;
|
|
||||||
labelDoctorName.Text = "Доктор";
|
|
||||||
//
|
|
||||||
// comboBoxPacient
|
|
||||||
//
|
|
||||||
comboBoxPacient.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxPacient.FormattingEnabled = true;
|
|
||||||
comboBoxPacient.Location = new Point(147, 44);
|
|
||||||
comboBoxPacient.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
comboBoxPacient.Name = "comboBoxPacient";
|
|
||||||
comboBoxPacient.Size = new Size(151, 28);
|
|
||||||
comboBoxPacient.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// comboBoxDoctor
|
|
||||||
//
|
|
||||||
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxDoctor.FormattingEnabled = true;
|
|
||||||
comboBoxDoctor.Location = new Point(147, 113);
|
|
||||||
comboBoxDoctor.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
comboBoxDoctor.Name = "comboBoxDoctor";
|
|
||||||
comboBoxDoctor.Size = new Size(151, 28);
|
|
||||||
comboBoxDoctor.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// groupBox
|
|
||||||
//
|
|
||||||
groupBox.Controls.Add(dataGridView);
|
|
||||||
groupBox.Location = new Point(34, 233);
|
|
||||||
groupBox.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
groupBox.Name = "groupBox";
|
|
||||||
groupBox.Padding = new Padding(3, 4, 3, 4);
|
|
||||||
groupBox.Size = new Size(269, 329);
|
|
||||||
groupBox.TabIndex = 4;
|
|
||||||
groupBox.TabStop = false;
|
|
||||||
groupBox.Text = "groupBox";
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.AllowUserToResizeColumns = false;
|
|
||||||
dataGridView.AllowUserToResizeRows = false;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnDrug, ColumnCount });
|
|
||||||
dataGridView.Dock = DockStyle.Fill;
|
|
||||||
dataGridView.Location = new Point(3, 24);
|
|
||||||
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
dataGridView.MultiSelect = false;
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersVisible = false;
|
|
||||||
dataGridView.RowHeadersWidth = 51;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(263, 301);
|
|
||||||
dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// label
|
|
||||||
//
|
|
||||||
label.AutoSize = true;
|
|
||||||
label.Location = new Point(34, 185);
|
|
||||||
label.Name = "label";
|
|
||||||
label.Size = new Size(52, 20);
|
|
||||||
label.TabIndex = 5;
|
|
||||||
label.Text = "Статус";
|
|
||||||
//
|
|
||||||
// comboBoxStatus
|
|
||||||
//
|
|
||||||
comboBoxStatus.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxStatus.FormattingEnabled = true;
|
|
||||||
comboBoxStatus.Location = new Point(147, 181);
|
|
||||||
comboBoxStatus.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
comboBoxStatus.Name = "comboBoxStatus";
|
|
||||||
comboBoxStatus.Size = new Size(151, 28);
|
|
||||||
comboBoxStatus.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new Point(193, 692);
|
|
||||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new Size(106, 39);
|
|
||||||
buttonCancel.TabIndex = 10;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
buttonSave.Location = new Point(34, 692);
|
|
||||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
buttonSave.Name = "buttonSave";
|
|
||||||
buttonSave.Size = new Size(106, 39);
|
|
||||||
buttonSave.TabIndex = 9;
|
|
||||||
buttonSave.Text = "Сохранить";
|
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
buttonSave.Click += buttonSave_Click;
|
|
||||||
//
|
|
||||||
// ColumnDrug
|
|
||||||
//
|
|
||||||
ColumnDrug.HeaderText = "Лекарство";
|
|
||||||
ColumnDrug.MinimumWidth = 6;
|
|
||||||
ColumnDrug.Name = "ColumnDrug";
|
|
||||||
ColumnDrug.Width = 125;
|
|
||||||
//
|
|
||||||
// ColumnCount
|
|
||||||
//
|
|
||||||
ColumnCount.HeaderText = "Количество";
|
|
||||||
ColumnCount.MinimumWidth = 6;
|
|
||||||
ColumnCount.Name = "ColumnCount";
|
|
||||||
ColumnCount.Width = 125;
|
|
||||||
//
|
|
||||||
// FormMedicalHistory
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(325, 765);
|
|
||||||
Controls.Add(buttonCancel);
|
|
||||||
Controls.Add(buttonSave);
|
|
||||||
Controls.Add(comboBoxStatus);
|
|
||||||
Controls.Add(label);
|
|
||||||
Controls.Add(groupBox);
|
|
||||||
Controls.Add(comboBoxDoctor);
|
|
||||||
Controls.Add(comboBoxPacient);
|
|
||||||
Controls.Add(labelDoctorName);
|
|
||||||
Controls.Add(labelPacientName);
|
|
||||||
Margin = new Padding(3, 4, 3, 4);
|
|
||||||
Name = "FormMedicalHistory";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Медицинская история";
|
|
||||||
groupBox.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelPacientName;
|
|
||||||
private Label labelDoctorName;
|
|
||||||
private ComboBox comboBoxPacient;
|
|
||||||
private ComboBox comboBoxDoctor;
|
|
||||||
private GroupBox groupBox;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Label label;
|
|
||||||
private ComboBox comboBoxStatus;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Button buttonSave;
|
|
||||||
private DataGridViewComboBoxColumn ColumnDrug;
|
|
||||||
private DataGridViewTextBoxColumn ColumnCount;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
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;
|
|
||||||
using System.Windows.Forms.VisualStyles;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Forms;
|
|
||||||
|
|
||||||
public partial class FormMedicalHistory : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
|
||||||
|
|
||||||
public FormMedicalHistory(
|
|
||||||
IMedicalHistoryRepository medicalHistoryRepository,
|
|
||||||
IPatientRepository patientRepository,
|
|
||||||
IDoctorRepository doctorRepository,
|
|
||||||
IDrugRepository drugRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
comboBoxStatus.DataSource = Enum.GetValues(typeof(Status));
|
|
||||||
|
|
||||||
_medicalHistoryRepository = medicalHistoryRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(medicalHistoryRepository));
|
|
||||||
|
|
||||||
comboBoxPacient.DataSource = patientRepository.ReadPatient();
|
|
||||||
comboBoxPacient.DisplayMember = "First_Name";
|
|
||||||
comboBoxPacient.ValueMember = "Id";
|
|
||||||
|
|
||||||
comboBoxDoctor.DataSource = doctorRepository.ReadDoctors();
|
|
||||||
comboBoxDoctor.DisplayMember = "Last_Name";
|
|
||||||
comboBoxDoctor.ValueMember = "Id";
|
|
||||||
|
|
||||||
ColumnDrug.DataSource = drugRepository.ReadDrug();
|
|
||||||
ColumnDrug.DisplayMember = "DrugsNames";
|
|
||||||
ColumnDrug.ValueMember = "Id";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (dataGridView.RowCount < 1 || comboBoxPacient.SelectedIndex < 0 || comboBoxStatus.SelectedIndex < 0)
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются незаполненные поля.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var medicalHistory = MedicalHistory.CreateEntity(
|
|
||||||
0,
|
|
||||||
(int)comboBoxPacient.SelectedValue!,
|
|
||||||
(Status)comboBoxStatus.SelectedItem!,
|
|
||||||
(int)comboBoxDoctor.SelectedValue!,
|
|
||||||
CreateListMedicalHistoryFromDataGrid()
|
|
||||||
);
|
|
||||||
|
|
||||||
_medicalHistoryRepository.CreateMedicalHistory(medicalHistory);
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
|
|
||||||
private List<DrugMedHistory> CreateListMedicalHistoryFromDataGrid()
|
|
||||||
{
|
|
||||||
var list = new List<DrugMedHistory>();
|
|
||||||
|
|
||||||
foreach (DataGridViewRow row in dataGridView.Rows)
|
|
||||||
{
|
|
||||||
if (row.Cells["ColumnDrug"].Value == null || row.Cells["ColumnCount"].Value == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
list.Add(DrugMedHistory.CreateEntity(0, Convert.ToInt32(row.Cells["ColumnDrug"].Value), 0,
|
|
||||||
Convert.ToInt32(row.Cells["ColumnCount"].Value)));
|
|
||||||
|
|
||||||
}
|
|
||||||
return list
|
|
||||||
.GroupBy(x => x.DrugId, x => x.Count, (drugId, counts) =>
|
|
||||||
DrugMedHistory.CreateEntity(0, drugId, 0, counts.Sum()))
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,126 +0,0 @@
|
|||||||
<?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="ColumnDrug.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>
|
|
@ -1,161 +0,0 @@
|
|||||||
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()
|
|
||||||
{
|
|
||||||
labelFirstName = new Label();
|
|
||||||
labelLastName = new Label();
|
|
||||||
labelAdress = new Label();
|
|
||||||
labelNumPhone = new Label();
|
|
||||||
textBoxFirstName = new TextBox();
|
|
||||||
textBoxLastName = new TextBox();
|
|
||||||
textBoxAdress = new TextBox();
|
|
||||||
textBoxNumPhone = new TextBox();
|
|
||||||
buttonCancel = new Button();
|
|
||||||
buttonSave = new Button();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelFirstName
|
|
||||||
//
|
|
||||||
labelFirstName.AutoSize = true;
|
|
||||||
labelFirstName.Location = new Point(34, 36);
|
|
||||||
labelFirstName.Name = "labelFirstName";
|
|
||||||
labelFirstName.Size = new Size(31, 15);
|
|
||||||
labelFirstName.TabIndex = 0;
|
|
||||||
labelFirstName.Text = "Имя";
|
|
||||||
//
|
|
||||||
// labelLastName
|
|
||||||
//
|
|
||||||
labelLastName.AutoSize = true;
|
|
||||||
labelLastName.Location = new Point(34, 89);
|
|
||||||
labelLastName.Name = "labelLastName";
|
|
||||||
labelLastName.Size = new Size(58, 15);
|
|
||||||
labelLastName.TabIndex = 1;
|
|
||||||
labelLastName.Text = "Фамилия";
|
|
||||||
//
|
|
||||||
// labelAdress
|
|
||||||
//
|
|
||||||
labelAdress.AutoSize = true;
|
|
||||||
labelAdress.Location = new Point(34, 143);
|
|
||||||
labelAdress.Name = "labelAdress";
|
|
||||||
labelAdress.Size = new Size(46, 15);
|
|
||||||
labelAdress.TabIndex = 2;
|
|
||||||
labelAdress.Text = "Адресс";
|
|
||||||
//
|
|
||||||
// labelNumPhone
|
|
||||||
//
|
|
||||||
labelNumPhone.AutoSize = true;
|
|
||||||
labelNumPhone.Location = new Point(34, 195);
|
|
||||||
labelNumPhone.Name = "labelNumPhone";
|
|
||||||
labelNumPhone.Size = new Size(101, 15);
|
|
||||||
labelNumPhone.TabIndex = 3;
|
|
||||||
labelNumPhone.Text = "Номер телефона";
|
|
||||||
//
|
|
||||||
// textBoxFirstName
|
|
||||||
//
|
|
||||||
textBoxFirstName.Location = new Point(179, 33);
|
|
||||||
textBoxFirstName.Name = "textBoxFirstName";
|
|
||||||
textBoxFirstName.Size = new Size(207, 23);
|
|
||||||
textBoxFirstName.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// textBoxLastName
|
|
||||||
//
|
|
||||||
textBoxLastName.Location = new Point(179, 81);
|
|
||||||
textBoxLastName.Name = "textBoxLastName";
|
|
||||||
textBoxLastName.Size = new Size(207, 23);
|
|
||||||
textBoxLastName.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// textBoxAdress
|
|
||||||
//
|
|
||||||
textBoxAdress.Location = new Point(179, 140);
|
|
||||||
textBoxAdress.Name = "textBoxAdress";
|
|
||||||
textBoxAdress.Size = new Size(207, 23);
|
|
||||||
textBoxAdress.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// textBoxNumPhone
|
|
||||||
//
|
|
||||||
textBoxNumPhone.Location = new Point(179, 192);
|
|
||||||
textBoxNumPhone.Name = "textBoxNumPhone";
|
|
||||||
textBoxNumPhone.Size = new Size(207, 23);
|
|
||||||
textBoxNumPhone.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new Point(159, 306);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new Size(93, 29);
|
|
||||||
buttonCancel.TabIndex = 9;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
buttonSave.Location = new Point(34, 306);
|
|
||||||
buttonSave.Name = "buttonSave";
|
|
||||||
buttonSave.Size = new Size(93, 29);
|
|
||||||
buttonSave.TabIndex = 8;
|
|
||||||
buttonSave.Text = "Сохранить";
|
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
buttonSave.Click += buttonSave_Click;
|
|
||||||
//
|
|
||||||
// FormPatient
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(405, 347);
|
|
||||||
Controls.Add(buttonCancel);
|
|
||||||
Controls.Add(buttonSave);
|
|
||||||
Controls.Add(textBoxNumPhone);
|
|
||||||
Controls.Add(textBoxAdress);
|
|
||||||
Controls.Add(textBoxLastName);
|
|
||||||
Controls.Add(textBoxFirstName);
|
|
||||||
Controls.Add(labelNumPhone);
|
|
||||||
Controls.Add(labelAdress);
|
|
||||||
Controls.Add(labelLastName);
|
|
||||||
Controls.Add(labelFirstName);
|
|
||||||
Name = "FormPatient";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Пациент";
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelFirstName;
|
|
||||||
private Label labelLastName;
|
|
||||||
private Label labelAdress;
|
|
||||||
private Label labelNumPhone;
|
|
||||||
private TextBox textBoxFirstName;
|
|
||||||
private TextBox textBoxLastName;
|
|
||||||
private TextBox textBoxAdress;
|
|
||||||
private TextBox textBoxNumPhone;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Button buttonSave;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
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 FormPatient(IPatientRepository patientRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_patientRepository = patientRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(patientRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var patient = _patientRepository.ReadPatientById(value);
|
|
||||||
if (patient == null)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException(nameof(patient));
|
|
||||||
}
|
|
||||||
textBoxFirstName.Text = patient.First_Name;
|
|
||||||
textBoxLastName.Text = patient.Last_Name;
|
|
||||||
textBoxAdress.Text = patient.Address;
|
|
||||||
textBoxNumPhone.Text = patient.ContactNumber;
|
|
||||||
_patientId = value;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) || string.IsNullOrWhiteSpace(textBoxLastName.Text) || string.IsNullOrWhiteSpace(textBoxNumPhone.Text)
|
|
||||||
|| string.IsNullOrWhiteSpace(textBoxAdress.Text))
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются незаполненные поля");
|
|
||||||
}
|
|
||||||
if (_patientId.HasValue)
|
|
||||||
{
|
|
||||||
_patientRepository.UpdatePatient(CreatePatient(_patientId.Value));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_patientRepository.CreatPatient(CreatePatient(0));
|
|
||||||
}
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
|
|
||||||
|
|
||||||
private Patient CreatePatient(int id) => Patient.CreateEntity(id, textBoxFirstName.Text, textBoxLastName.Text, textBoxAdress.Text, textBoxNumPhone.Text);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,123 +0,0 @@
|
|||||||
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();
|
|
||||||
buttonUpdate = new Button();
|
|
||||||
buttonDel = new Button();
|
|
||||||
buttonAdd = new Button();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(buttonUpdate);
|
|
||||||
panel1.Controls.Add(buttonDel);
|
|
||||||
panel1.Controls.Add(buttonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(661, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(139, 390);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonUpdate
|
|
||||||
//
|
|
||||||
buttonUpdate.BackgroundImage = Properties.Resources.buttonUpdate;
|
|
||||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonUpdate.Location = new Point(32, 241);
|
|
||||||
buttonUpdate.Name = "buttonUpdate";
|
|
||||||
buttonUpdate.Size = new Size(75, 70);
|
|
||||||
buttonUpdate.TabIndex = 2;
|
|
||||||
buttonUpdate.UseVisualStyleBackColor = true;
|
|
||||||
buttonUpdate.Click += buttonUpdate_Click;
|
|
||||||
//
|
|
||||||
// buttonDel
|
|
||||||
//
|
|
||||||
buttonDel.BackgroundImage = Properties.Resources.buttonDel;
|
|
||||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonDel.Location = new Point(32, 134);
|
|
||||||
buttonDel.Name = "buttonDel";
|
|
||||||
buttonDel.Size = new Size(75, 70);
|
|
||||||
buttonDel.TabIndex = 1;
|
|
||||||
buttonDel.UseVisualStyleBackColor = true;
|
|
||||||
buttonDel.Click += buttonDel_Click;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
buttonAdd.BackgroundImage = Properties.Resources.buttonAdd;
|
|
||||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonAdd.Location = new Point(32, 29);
|
|
||||||
buttonAdd.Name = "buttonAdd";
|
|
||||||
buttonAdd.Size = new Size(75, 70);
|
|
||||||
buttonAdd.TabIndex = 0;
|
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonAdd.Click += buttonAdd_Click;
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.AllowUserToResizeColumns = false;
|
|
||||||
dataGridView.AllowUserToResizeRows = false;
|
|
||||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Dock = DockStyle.Fill;
|
|
||||||
dataGridView.Location = new Point(0, 0);
|
|
||||||
dataGridView.MultiSelect = false;
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersVisible = false;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(661, 390);
|
|
||||||
dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// FormPatients
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 390);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "FormPatients";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = " Пациенты";
|
|
||||||
Load += FormDoctors_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button buttonUpdate;
|
|
||||||
private Button buttonDel;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,124 +0,0 @@
|
|||||||
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 FormPatients : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
|
|
||||||
private readonly IPatientRepository _pacientRepository;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FormPatients(IUnityContainer container, IPatientRepository pacientRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ??
|
|
||||||
throw new ArgumentNullException(nameof(container));
|
|
||||||
_pacientRepository = pacientRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(pacientRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void FormDoctors_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void LoadList() => dataGridView.DataSource = _pacientRepository.ReadPatient();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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 buttonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_pacientRepository.DeletePatient(findId);
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonUpdate_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 bool TryGetIdentifierFromSelectedRow(out int id)
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
if (dataGridView.SelectedRows.Count < 1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["id"].Value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,170 +0,0 @@
|
|||||||
namespace ProjectPolyclinic.Forms
|
|
||||||
{
|
|
||||||
partial class FormDoctorPayReport
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
buttonBuild = new Button();
|
|
||||||
textBoxFilePath = new TextBox();
|
|
||||||
buttonSelectFilePath = new Button();
|
|
||||||
comboBoxDoctor = new ComboBox();
|
|
||||||
dateTimePickerDateEnd = new DateTimePicker();
|
|
||||||
dateTimePickerDateBegin = new DateTimePicker();
|
|
||||||
labelDateEnd = new Label();
|
|
||||||
labelDateStart = new Label();
|
|
||||||
labelAthlete = new Label();
|
|
||||||
labelFilePath = new Label();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// buttonBuild
|
|
||||||
//
|
|
||||||
buttonBuild.Location = new Point(104, 230);
|
|
||||||
buttonBuild.Name = "buttonBuild";
|
|
||||||
buttonBuild.Size = new Size(144, 45);
|
|
||||||
buttonBuild.TabIndex = 4;
|
|
||||||
buttonBuild.Text = "Сформировать";
|
|
||||||
buttonBuild.UseVisualStyleBackColor = true;
|
|
||||||
buttonBuild.Click += buttonBuild_Click;
|
|
||||||
//
|
|
||||||
// textBoxFilePath
|
|
||||||
//
|
|
||||||
textBoxFilePath.Location = new Point(144, 26);
|
|
||||||
textBoxFilePath.Name = "textBoxFilePath";
|
|
||||||
textBoxFilePath.ReadOnly = true;
|
|
||||||
textBoxFilePath.Size = new Size(165, 23);
|
|
||||||
textBoxFilePath.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// buttonSelectFilePath
|
|
||||||
//
|
|
||||||
buttonSelectFilePath.Location = new Point(315, 27);
|
|
||||||
buttonSelectFilePath.Name = "buttonSelectFilePath";
|
|
||||||
buttonSelectFilePath.Size = new Size(22, 22);
|
|
||||||
buttonSelectFilePath.TabIndex = 9;
|
|
||||||
buttonSelectFilePath.Text = "..";
|
|
||||||
buttonSelectFilePath.UseVisualStyleBackColor = true;
|
|
||||||
buttonSelectFilePath.Click += buttonSelectFilePath_Click;
|
|
||||||
//
|
|
||||||
// comboBoxDoctor
|
|
||||||
//
|
|
||||||
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxDoctor.FormattingEnabled = true;
|
|
||||||
comboBoxDoctor.Location = new Point(144, 71);
|
|
||||||
comboBoxDoctor.Name = "comboBoxDoctor";
|
|
||||||
comboBoxDoctor.Size = new Size(193, 23);
|
|
||||||
comboBoxDoctor.TabIndex = 10;
|
|
||||||
//
|
|
||||||
// dateTimePickerDateEnd
|
|
||||||
//
|
|
||||||
dateTimePickerDateEnd.CustomFormat = "MMMM yyyy";
|
|
||||||
dateTimePickerDateEnd.Format = DateTimePickerFormat.Custom;
|
|
||||||
dateTimePickerDateEnd.Location = new Point(144, 163);
|
|
||||||
dateTimePickerDateEnd.Margin = new Padding(3, 2, 3, 2);
|
|
||||||
dateTimePickerDateEnd.Name = "dateTimePickerDateEnd";
|
|
||||||
dateTimePickerDateEnd.Size = new Size(193, 23);
|
|
||||||
dateTimePickerDateEnd.TabIndex = 23;
|
|
||||||
//
|
|
||||||
// dateTimePickerDateBegin
|
|
||||||
//
|
|
||||||
dateTimePickerDateBegin.CustomFormat = "MMMM yyyy";
|
|
||||||
dateTimePickerDateBegin.Format = DateTimePickerFormat.Custom;
|
|
||||||
dateTimePickerDateBegin.Location = new Point(144, 117);
|
|
||||||
dateTimePickerDateBegin.Margin = new Padding(3, 2, 3, 2);
|
|
||||||
dateTimePickerDateBegin.Name = "dateTimePickerDateBegin";
|
|
||||||
dateTimePickerDateBegin.Size = new Size(193, 23);
|
|
||||||
dateTimePickerDateBegin.TabIndex = 24;
|
|
||||||
//
|
|
||||||
// labelDateEnd
|
|
||||||
//
|
|
||||||
labelDateEnd.AutoSize = true;
|
|
||||||
labelDateEnd.Location = new Point(12, 169);
|
|
||||||
labelDateEnd.Name = "labelDateEnd";
|
|
||||||
labelDateEnd.Size = new Size(79, 15);
|
|
||||||
labelDateEnd.TabIndex = 28;
|
|
||||||
labelDateEnd.Text = "Месяц конца";
|
|
||||||
//
|
|
||||||
// labelDateStart
|
|
||||||
//
|
|
||||||
labelDateStart.AutoSize = true;
|
|
||||||
labelDateStart.Location = new Point(12, 123);
|
|
||||||
labelDateStart.Name = "labelDateStart";
|
|
||||||
labelDateStart.Size = new Size(85, 15);
|
|
||||||
labelDateStart.TabIndex = 27;
|
|
||||||
labelDateStart.Text = "Месяц начала";
|
|
||||||
//
|
|
||||||
// labelAthlete
|
|
||||||
//
|
|
||||||
labelAthlete.AutoSize = true;
|
|
||||||
labelAthlete.Location = new Point(12, 74);
|
|
||||||
labelAthlete.Name = "labelAthlete";
|
|
||||||
labelAthlete.Size = new Size(34, 15);
|
|
||||||
labelAthlete.TabIndex = 26;
|
|
||||||
labelAthlete.Text = "Врач";
|
|
||||||
//
|
|
||||||
// labelFilePath
|
|
||||||
//
|
|
||||||
labelFilePath.AutoSize = true;
|
|
||||||
labelFilePath.Location = new Point(12, 29);
|
|
||||||
labelFilePath.Name = "labelFilePath";
|
|
||||||
labelFilePath.Size = new Size(87, 15);
|
|
||||||
labelFilePath.TabIndex = 25;
|
|
||||||
labelFilePath.Text = "Путь до файла";
|
|
||||||
//
|
|
||||||
// FormDoctorPayReport
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(369, 295);
|
|
||||||
Controls.Add(labelDateEnd);
|
|
||||||
Controls.Add(labelDateStart);
|
|
||||||
Controls.Add(labelAthlete);
|
|
||||||
Controls.Add(labelFilePath);
|
|
||||||
Controls.Add(dateTimePickerDateBegin);
|
|
||||||
Controls.Add(dateTimePickerDateEnd);
|
|
||||||
Controls.Add(comboBoxDoctor);
|
|
||||||
Controls.Add(buttonSelectFilePath);
|
|
||||||
Controls.Add(textBoxFilePath);
|
|
||||||
Controls.Add(buttonBuild);
|
|
||||||
Name = "FormDoctorPayReport";
|
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
|
||||||
Text = "Отчет по работе врача";
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
private Button buttonBuild;
|
|
||||||
private TextBox textBoxFilePath;
|
|
||||||
private Button buttonSelectFilePath;
|
|
||||||
private ComboBox comboBoxDoctor;
|
|
||||||
private DateTimePicker dateTimePickerDateEnd;
|
|
||||||
private DateTimePicker dateTimePickerDateBegin;
|
|
||||||
private Label labelDateEnd;
|
|
||||||
private Label labelDateStart;
|
|
||||||
private Label labelAthlete;
|
|
||||||
private Label labelFilePath;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
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 FormDoctorPayReport : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
|
|
||||||
public FormDoctorPayReport(IUnityContainer container, IDoctorRepository doctorRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ??
|
|
||||||
throw new ArgumentNullException(nameof(container));
|
|
||||||
|
|
||||||
comboBoxDoctor.DataSource = doctorRepository.ReadDoctors();
|
|
||||||
comboBoxDoctor.DisplayMember = "Last_Name";
|
|
||||||
comboBoxDoctor.ValueMember = "Id";
|
|
||||||
}
|
|
||||||
private void buttonBuild_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("Дата начала должна быть раньше даты окончания");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Приведение дат к началу и концу месяца
|
|
||||||
var startDate = new DateTime(dateTimePickerDateBegin.Value.Year, dateTimePickerDateBegin.Value.Month, 1);
|
|
||||||
var endDate = new DateTime(dateTimePickerDateEnd.Value.Year, dateTimePickerDateEnd.Value.Month, 1).AddMonths(1).AddDays(-1);
|
|
||||||
|
|
||||||
if (_container.Resolve<TableReport>().CreateTable(
|
|
||||||
textBoxFilePath.Text,
|
|
||||||
(int)comboBoxDoctor.SelectedValue!,
|
|
||||||
startDate,
|
|
||||||
endDate))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Документ сформирован", "Формирование документа",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Возникли ошибки при формировании документа. Подробности в логах", "Формирование документа",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при создании отчета",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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,11 +1,3 @@
|
|||||||
using ProjectPolyclinic.Repositories.Implementations;
|
|
||||||
using ProjectPolyclinic.Repositories;
|
|
||||||
using Unity;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Serilog;
|
|
||||||
using Unity.Microsoft.Logging;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic
|
namespace ProjectPolyclinic
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -19,37 +11,7 @@ namespace ProjectPolyclinic
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(CreateContainer().Resolve<FormPolyclinic>());
|
Application.Run(new Form1());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IUnityContainer CreateContainer()
|
|
||||||
{
|
|
||||||
var container = new UnityContainer();
|
|
||||||
|
|
||||||
container.AddExtension(new LoggingExtension(CreateLoggerFactory()));
|
|
||||||
|
|
||||||
container.RegisterType<IPatientRepository, PatientRepository>();
|
|
||||||
container.RegisterType<IDoctorRepository, DoctorRepository>();
|
|
||||||
container.RegisterType<IDoctorPayRepository, DoctorPayRepository>();
|
|
||||||
container.RegisterType<IMedicalHistoryRepository, MedicalHistoryRepository>();
|
|
||||||
container.RegisterType<IDrugRepository, DrugRepository>();
|
|
||||||
|
|
||||||
container.RegisterType<IConnectionString, ConnectionString>();
|
|
||||||
|
|
||||||
return container;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static LoggerFactory CreateLoggerFactory()
|
|
||||||
{
|
|
||||||
var loggerFactory = new LoggerFactory();
|
|
||||||
loggerFactory.AddSerilog(new LoggerConfiguration()
|
|
||||||
.ReadFrom.Configuration(new ConfigurationBuilder()
|
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
|
||||||
.AddJsonFile("appsettings.json")
|
|
||||||
.Build())
|
|
||||||
.CreateLogger());
|
|
||||||
return loggerFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,54 +8,4 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</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="Forms\FormDrugs.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Forms\FormDoctorPayments.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Forms\FormMedicalHistories.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Forms\FormPatients.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<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>
|
</Project>
|
@ -1,103 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <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 buttonAdd {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("buttonAdd", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap buttonDel {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("buttonDel", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap buttonUpdate {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("buttonUpdate", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap polyclinicfon {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("polyclinicfon", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
<?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="polyclinicfon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\polyclinicfon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="buttonDel" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\buttonDel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="buttonAdd" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\buttonAdd.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="buttonUpdate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\buttonUpdate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
@ -1,64 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using ProjectPolyclinic.Reports;
|
|
||||||
using ProjectPolyclinic.Repositories;
|
|
||||||
|
|
||||||
public class ChartReport
|
|
||||||
{
|
|
||||||
private readonly IMedicalHistoryRepository _historyRepository;
|
|
||||||
|
|
||||||
private readonly ILogger<ChartReport> _logger;
|
|
||||||
|
|
||||||
public ChartReport(IMedicalHistoryRepository historyRepository, ILogger<ChartReport> logger)
|
|
||||||
{
|
|
||||||
_historyRepository = historyRepository ?? throw new ArgumentNullException(nameof(IMedicalHistoryRepository));
|
|
||||||
_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)
|
|
||||||
{
|
|
||||||
var medicalHistories = _historyRepository.ReadMedicalHistory(null, null, null, null);
|
|
||||||
|
|
||||||
var filteredHistories = medicalHistories
|
|
||||||
.Where(mh => mh.VisitDate.Date == dateTime.Date)
|
|
||||||
.Where(mh => mh.DrugMedHistory != null && mh.DrugMedHistory.Any())
|
|
||||||
.ToList();
|
|
||||||
var groupedData = filteredHistories
|
|
||||||
.GroupBy(
|
|
||||||
mh => mh.DoctorId,
|
|
||||||
(key, group) => new
|
|
||||||
{
|
|
||||||
DoctorId = key,
|
|
||||||
TotalDrugs = group
|
|
||||||
.SelectMany(mh => mh.DrugMedHistory)
|
|
||||||
.Sum(dmh => dmh.Count)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.ToList();
|
|
||||||
var result = groupedData
|
|
||||||
.Select(x => (x.DoctorId.ToString(), (double)x.TotalDrugs))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,97 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using ProjectPolyclinic.Repositories;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Reports;
|
|
||||||
|
|
||||||
public class DocReport
|
|
||||||
{
|
|
||||||
private readonly IDoctorRepository _doctorRepository;
|
|
||||||
|
|
||||||
private readonly IPatientRepository _patientRepository;
|
|
||||||
|
|
||||||
private readonly IDrugRepository _drugRepository;
|
|
||||||
|
|
||||||
private readonly ILogger<DocReport> _logger;
|
|
||||||
|
|
||||||
public DocReport(IDoctorRepository doctorRepository,
|
|
||||||
IPatientRepository patientRepository, IDrugRepository drugRepository, ILogger<DocReport> logger)
|
|
||||||
{
|
|
||||||
_doctorRepository = doctorRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(doctorRepository));
|
|
||||||
|
|
||||||
_patientRepository = patientRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(patientRepository));
|
|
||||||
|
|
||||||
_drugRepository = drugRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(drugRepository));
|
|
||||||
|
|
||||||
_logger = logger ??
|
|
||||||
throw new ArgumentNullException(nameof(logger));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public bool CreateDoc(string filePath, bool includeDoctors, bool includePatients, bool includeDrugs)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var worldBuilder = new WordBuilder(filePath).AddHeader("Документ со справочниками");
|
|
||||||
|
|
||||||
if (includeDoctors)
|
|
||||||
{
|
|
||||||
worldBuilder.AddParagraph("Врачи").AddTable([2400, 2400, 2000, 2000, 2000], GetDoctors());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (includePatients)
|
|
||||||
{
|
|
||||||
worldBuilder.AddParagraph("Пациенты").AddTable([2400, 2400, 2400, 2400], GetPatients());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (includeDrugs)
|
|
||||||
{
|
|
||||||
worldBuilder.AddParagraph("Лекарства").AddTable([2400, 2400, 2400], GetDrugs());
|
|
||||||
}
|
|
||||||
|
|
||||||
worldBuilder.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.Room.ToString(), x.Specialization.ToString(), x.SpecializationLevel.ToString()}),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<string[]> GetPatients()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
["Имя", "Фамилия", "Адресс", "Номер телефона"],
|
|
||||||
.. _patientRepository
|
|
||||||
.ReadPatient()
|
|
||||||
.Select(x => new string[]
|
|
||||||
{x.First_Name, x.Last_Name, x.Address, x.ContactNumber}),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<string[]> GetDrugs()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
["Список лекарств", "Грамовка", "Рецепт"],
|
|
||||||
.. _drugRepository
|
|
||||||
.ReadDrug()
|
|
||||||
.Select(x => new string[]
|
|
||||||
{x.drugsNames.ToString(), x.Grams.ToString(), x.Description}),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,327 +0,0 @@
|
|||||||
using DocumentFormat.OpenXml;
|
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Reports;
|
|
||||||
|
|
||||||
public 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.BoldTextWithoutBorder);
|
|
||||||
}
|
|
||||||
|
|
||||||
_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)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
|
||||||
{
|
|
||||||
FontSize = new FontSize() { Val = 11 },
|
|
||||||
FontName = new FontName() { Val = "Calibri" },
|
|
||||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
|
||||||
Bold = new Bold(),
|
|
||||||
FontScheme = new FontScheme()
|
|
||||||
{
|
|
||||||
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
workbookStylesPart.Stylesheet.Append(fonts);
|
|
||||||
|
|
||||||
var fills = new Fills() { Count = 1 };
|
|
||||||
fills.Append(new Fill
|
|
||||||
{
|
|
||||||
PatternFill = new PatternFill()
|
|
||||||
{
|
|
||||||
PatternType = new EnumValue<PatternValues>(PatternValues.None)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
workbookStylesPart.Stylesheet.Append(fills);
|
|
||||||
|
|
||||||
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()
|
|
||||||
});
|
|
||||||
borders.Append(new Border
|
|
||||||
{
|
|
||||||
LeftBorder = new LeftBorder { Style = BorderStyleValues.Thin },
|
|
||||||
RightBorder = new RightBorder { Style = BorderStyleValues.Thin },
|
|
||||||
TopBorder = new TopBorder { Style = BorderStyleValues.Thin },
|
|
||||||
BottomBorder = new BottomBorder { Style = BorderStyleValues.Thin },
|
|
||||||
DiagonalBorder = new DiagonalBorder()
|
|
||||||
});
|
|
||||||
workbookStylesPart.Stylesheet.Append(borders);
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
});
|
|
||||||
cellFormats.Append(new CellFormat
|
|
||||||
{
|
|
||||||
NumberFormatId = 0,
|
|
||||||
FormatId = 0,
|
|
||||||
FontId = 1,
|
|
||||||
BorderId = 1,
|
|
||||||
FillId = 0,
|
|
||||||
Alignment = new Alignment()
|
|
||||||
{
|
|
||||||
Horizontal = HorizontalAlignmentValues.Left,
|
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
|
||||||
WrapText = true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
cellFormats.Append(new CellFormat
|
|
||||||
{
|
|
||||||
NumberFormatId = 0,
|
|
||||||
FormatId = 0,
|
|
||||||
FontId = 0,
|
|
||||||
BorderId = 1,
|
|
||||||
FillId = 0,
|
|
||||||
Alignment = new Alignment()
|
|
||||||
{
|
|
||||||
Horizontal = HorizontalAlignmentValues.Left,
|
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
|
||||||
WrapText = true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
cellFormats.Append(new CellFormat
|
|
||||||
{
|
|
||||||
NumberFormatId = 0,
|
|
||||||
FormatId = 0,
|
|
||||||
FontId = 1,
|
|
||||||
BorderId = 0,
|
|
||||||
FillId = 0,
|
|
||||||
Alignment = new Alignment()
|
|
||||||
{
|
|
||||||
Horizontal = HorizontalAlignmentValues.Left,
|
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
|
||||||
WrapText = true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum StyleIndex
|
|
||||||
{
|
|
||||||
SimpleTextWithoutBorder = 0,
|
|
||||||
BoldTextWithBorder = 1,
|
|
||||||
SimpleTextWithBorder = 2,
|
|
||||||
BoldTextWithoutBorder = 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
using MigraDoc.DocumentObjectModel;
|
|
||||||
using MigraDoc.DocumentObjectModel.Shapes.Charts;
|
|
||||||
using MigraDoc.Rendering;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Reports;
|
|
||||||
|
|
||||||
public 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.Styles.AddStyle("NormalBold", "Normal");
|
|
||||||
headerStyle.Font.Bold = true;
|
|
||||||
headerStyle.Font.Size = 16;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,141 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using ProjectPolyclinic.Repositories;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Reports;
|
|
||||||
|
|
||||||
public class TableReport
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
|
||||||
|
|
||||||
private readonly IDoctorPayRepository _doctorPayRepository;
|
|
||||||
|
|
||||||
private readonly ILogger<TableReport> _logger;
|
|
||||||
|
|
||||||
internal static readonly string[] item = ["Id врача", "Дата", "Количество пациентов", "Выплаты"];
|
|
||||||
|
|
||||||
public TableReport(IDoctorPayRepository doctorPayRepository,
|
|
||||||
IMedicalHistoryRepository medicalHistoryRepository, ILogger<TableReport> logger)
|
|
||||||
{
|
|
||||||
_doctorPayRepository = doctorPayRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(IDoctorPayRepository));
|
|
||||||
|
|
||||||
_medicalHistoryRepository = medicalHistoryRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(IMedicalHistoryRepository));
|
|
||||||
|
|
||||||
|
|
||||||
_logger = logger ??
|
|
||||||
throw new ArgumentNullException(nameof(logger));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public bool CreateTable(string filePath, int doctorId, DateTime startDate, DateTime endDate)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Приведение дат к началу и концу месяцев
|
|
||||||
var startOfMonth = new DateTime(startDate.Year, startDate.Month, 1);
|
|
||||||
var endOfMonth = new DateTime(endDate.Year, endDate.Month, 1).AddMonths(1).AddDays(-1);
|
|
||||||
|
|
||||||
var excelBuilder = new ExcelBuilder(filePath)
|
|
||||||
.AddHeader("Сводка по оплате", 0, 3)
|
|
||||||
.AddParagraph($"За период с {startOfMonth:MM.yyyy} по {endOfMonth:MM.yyyy}", 0)
|
|
||||||
.AddParagraph($"Id врача: {doctorId}", 0)
|
|
||||||
.AddTable(new[] { 25, 25, 25 }, GetData(doctorId, startOfMonth, endOfMonth));
|
|
||||||
|
|
||||||
excelBuilder.AddParagraph("", 0);
|
|
||||||
|
|
||||||
excelBuilder
|
|
||||||
.AddHeader("Назначенные лекарства", 0, 2)
|
|
||||||
.AddTable(new[] { 25, 25 }, GetDrugData(doctorId, startOfMonth, endOfMonth));
|
|
||||||
|
|
||||||
excelBuilder.Build();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<string[]> GetData(int doctorId, DateTime startOfMonth, DateTime endOfMonth)
|
|
||||||
{
|
|
||||||
var data = _doctorPayRepository
|
|
||||||
.ReadDoctorPayments()
|
|
||||||
.Where(x =>
|
|
||||||
{
|
|
||||||
var paymentMonth = DateTime.ParseExact(x.Month, "yyyy-MM", System.Globalization.CultureInfo.InvariantCulture);
|
|
||||||
return paymentMonth >= startOfMonth && paymentMonth <= endOfMonth && x.IdDoctor == doctorId;
|
|
||||||
})
|
|
||||||
.Select(x => new
|
|
||||||
{
|
|
||||||
Date = DateTime.ParseExact(x.Month, "yyyy-MM", System.Globalization.CultureInfo.InvariantCulture),
|
|
||||||
CountOfPatients = x.Count_Patient,
|
|
||||||
Payments = x.Payment
|
|
||||||
})
|
|
||||||
.OrderBy(x => x.Date);
|
|
||||||
|
|
||||||
var result = new List<string[]>
|
|
||||||
{
|
|
||||||
new[] { "Дата", "Количество пациентов", "Выплаты" }
|
|
||||||
}
|
|
||||||
.Union(data.Select(x => new string[]
|
|
||||||
{
|
|
||||||
x.Date.ToString("MMMM yyyy"),
|
|
||||||
x.CountOfPatients.ToString(),
|
|
||||||
x.Payments.ToString()
|
|
||||||
}))
|
|
||||||
.Union(new[]
|
|
||||||
{
|
|
||||||
new string[]
|
|
||||||
{
|
|
||||||
"Всего",
|
|
||||||
data.Sum(x => x.CountOfPatients).ToString(),
|
|
||||||
data.Sum(x => x.Payments).ToString()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<string[]> GetDrugData(int doctorId, DateTime startOfMonth, DateTime endOfMonth)
|
|
||||||
{
|
|
||||||
var medicalHistories = _medicalHistoryRepository
|
|
||||||
.ReadMedicalHistory(startOfMonth, endOfMonth, null, doctorId)
|
|
||||||
.Where(mh => mh.DoctorId == doctorId && mh.VisitDate >= startOfMonth && mh.VisitDate <= endOfMonth)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var result = new List<string[]>
|
|
||||||
{
|
|
||||||
new[] { "Дата", "Назначенные лекарства" }
|
|
||||||
};
|
|
||||||
|
|
||||||
var sortedDrugData = medicalHistories
|
|
||||||
.Where(mh => mh.DrugMedHistory != null && mh.DrugMedHistory.Any())
|
|
||||||
.SelectMany(mh => mh.DrugMedHistory.Select(drug => new
|
|
||||||
{
|
|
||||||
Date = mh.VisitDate,
|
|
||||||
Count = drug.Count
|
|
||||||
}))
|
|
||||||
.OrderBy(x => x.Date)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
result.AddRange(sortedDrugData
|
|
||||||
.Select(item => new string[]
|
|
||||||
{
|
|
||||||
item.Date.ToString("dd.MM.yyyy"),
|
|
||||||
item.Count.ToString()
|
|
||||||
}));
|
|
||||||
|
|
||||||
var totalDrugs = sortedDrugData.Sum(x => x.Count);
|
|
||||||
|
|
||||||
result.Add(new[] { "Всего", totalDrugs.ToString() });
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
using DocumentFormat.OpenXml.Packaging;
|
|
||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
|
||||||
using DocumentFormat.OpenXml;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Reports;
|
|
||||||
|
|
||||||
public 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());
|
|
||||||
|
|
||||||
var runProperties = run.AppendChild(new RunProperties());
|
|
||||||
runProperties.AppendChild(new Bold());
|
|
||||||
|
|
||||||
run.AppendChild(new Text(header));
|
|
||||||
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 WordBuilder AddParagraph(string text)
|
|
||||||
{
|
|
||||||
var paragraph = _body.AppendChild(new Paragraph());
|
|
||||||
var run = paragraph.AppendChild(new Run());
|
|
||||||
run.AppendChild(new Text(text));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Build()
|
|
||||||
{
|
|
||||||
using var wordDocument = WordprocessingDocument.Create(_filePath,
|
|
||||||
WordprocessingDocumentType.Document);
|
|
||||||
var mainPart = wordDocument.AddMainDocumentPart();
|
|
||||||
mainPart.Document = _document;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using ProjectPolyclinic.Entities;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Repositories;
|
|
||||||
|
|
||||||
public interface IDoctorPayRepository
|
|
||||||
{
|
|
||||||
IEnumerable<DoctorPay> ReadDoctorPayments();
|
|
||||||
|
|
||||||
void CreateDoctorPayments(DoctorPay doctorPayments);
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
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);
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
using ProjectPolyclinic.Entities;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Repositories;
|
|
||||||
|
|
||||||
public interface IDrugRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Drug> ReadDrug();
|
|
||||||
|
|
||||||
Drug ReadDrugById(int id);
|
|
||||||
|
|
||||||
void CreateDrug(Drug drag);
|
|
||||||
|
|
||||||
void UpdateDrug(Drug drag);
|
|
||||||
|
|
||||||
void DeleteDrug(int id);
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
using ProjectPolyclinic.Entities;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Repositories;
|
|
||||||
|
|
||||||
public interface IMedicalHistoryRepository
|
|
||||||
{
|
|
||||||
IEnumerable<MedicalHistory> ReadMedicalHistory(DateTime? dateForm = null, DateTime? dateTo = null, int? DoctorId = null, int? PatientId = null);
|
|
||||||
|
|
||||||
void CreateMedicalHistory(MedicalHistory medicalHistory);
|
|
||||||
|
|
||||||
void DeletemedicalHistory(int id);
|
|
||||||
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
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> ReadPatient();
|
|
||||||
|
|
||||||
Patient ReadPatientById(int id);
|
|
||||||
|
|
||||||
void CreatPatient(Patient patient);
|
|
||||||
|
|
||||||
void UpdatePatient(Patient patient);
|
|
||||||
|
|
||||||
void DeletePatient(int id);
|
|
||||||
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace ProjectPolyclinic.Repositories.Implementations;
|
|
||||||
|
|
||||||
public class ConnectionString : IConnectionString
|
|
||||||
{
|
|
||||||
|
|
||||||
string IConnectionString.ConnectionString =>
|
|
||||||
"Server=localhost, Port=5432;Database=polyclinicotp;User Id=postgres;Password=postgres;";
|
|
||||||
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
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 DoctorPayRepository : IDoctorPayRepository
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
private readonly IConnectionString _connectionString;
|
|
||||||
private readonly ILogger<DoctorPayRepository> _logger;
|
|
||||||
|
|
||||||
public DoctorPayRepository(IConnectionString connectionString, ILogger<DoctorPayRepository> logger)
|
|
||||||
{
|
|
||||||
_connectionString = connectionString;
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void CreateDoctorPayments(DoctorPay doctorPayments)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
|
|
||||||
|
|
||||||
var query = @"
|
|
||||||
INSERT INTO doctor_pay (IdDoctor, Month, Count_Patient, Payment)
|
|
||||||
VALUES (@DoctorId, @Month, @CountPatient, @Payment)";
|
|
||||||
|
|
||||||
connection.Execute(query, new
|
|
||||||
{
|
|
||||||
DoctorId = doctorPayments.IdDoctor,
|
|
||||||
Month = doctorPayments.Month,
|
|
||||||
CountPatient = doctorPayments.Count_Patient,
|
|
||||||
Payment = doctorPayments.Payment
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при создании записи о платеже врачу");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<DoctorPay> ReadDoctorPayments()
|
|
||||||
{
|
|
||||||
|
|
||||||
_logger.LogInformation("Получение всех объектов");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new
|
|
||||||
NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
var querySelect = "SELECT * FROM doctor_pay";
|
|
||||||
var professionalDevelopments =
|
|
||||||
connection.Query<DoctorPay>(querySelect);
|
|
||||||
_logger.LogDebug("Полученные объекты: {json}",
|
|
||||||
JsonConvert.SerializeObject(professionalDevelopments));
|
|
||||||
return professionalDevelopments;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,153 +0,0 @@
|
|||||||
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
|
|
||||||
{
|
|
||||||
var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
var queryInsert = @"
|
|
||||||
INSERT INTO Doctors (first_name, last_name, room, specialization, specializationlevel)
|
|
||||||
VALUES (@First_Name, @Last_Name, @Room, @Specialization, @SpecializationLevel)";
|
|
||||||
|
|
||||||
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 existingDoctor = connection.QueryFirstOrDefault<Doctor>("SELECT * FROM Doctors WHERE id = @Id", new { doctor.Id });
|
|
||||||
if (existingDoctor == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Запись с Id={Id} не найдена.", doctor.Id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var queryUpdate = @"
|
|
||||||
UPDATE Doctors
|
|
||||||
SET first_name = @First_Name,
|
|
||||||
last_name = @Last_Name,
|
|
||||||
room = @Room,
|
|
||||||
specialization = @Specialization,
|
|
||||||
specializationlevel = @SpecializationLevel
|
|
||||||
WHERE id = @Id";
|
|
||||||
|
|
||||||
var affectedRows = connection.Execute(queryUpdate, doctor);
|
|
||||||
|
|
||||||
if (affectedRows == 0)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Обновление не выполнено. Id={Id}.", doctor.Id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Запись успешно обновлена.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при обновлении объекта");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void DeleteDoctor(int id)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Удаление объекта");
|
|
||||||
_logger.LogDebug("Объект: {id}", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,131 +0,0 @@
|
|||||||
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;
|
|
||||||
using Unity;
|
|
||||||
|
|
||||||
namespace ProjectPolyclinic.Repositories.Implementations;
|
|
||||||
|
|
||||||
public class DrugRepository : IDrugRepository
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IConnectionString _connectionString;
|
|
||||||
private readonly ILogger<DrugRepository> _logger;
|
|
||||||
|
|
||||||
|
|
||||||
public DrugRepository(IConnectionString connectionString, ILogger<DrugRepository> logger)
|
|
||||||
{
|
|
||||||
_connectionString = connectionString;
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void CreateDrug(Drug drug)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Добавление объекта");
|
|
||||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(drug));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
var queryInsert = @"
|
|
||||||
INSERT INTO drugs (DrugsNames, grams, Description)
|
|
||||||
VALUES (@DrugsNames, @Grams, @Description)";
|
|
||||||
|
|
||||||
connection.Execute(queryInsert, drug);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteDrug(int id)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Удаление объекта");
|
|
||||||
_logger.LogDebug("Объект: {id}", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
var queryDelete = @"DELETE FROM drugs WHERE ID=@id";
|
|
||||||
connection.Execute(queryDelete, new { id });
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Drug> ReadDrug()
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение всех объектов");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
var querySelect = "SELECT * FROM drugs";
|
|
||||||
var drugs = connection.Query<Drug>(querySelect);
|
|
||||||
_logger.LogDebug("Полученные объекты: {json}",
|
|
||||||
JsonConvert.SerializeObject(drugs));
|
|
||||||
return drugs;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Drug ReadDrugById(int id)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение объекта по идентификатору");
|
|
||||||
_logger.LogDebug("Объект: {id}", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
var querySelect = @"SELECT * FROM drugs WHERE Id=@id";
|
|
||||||
var drug = connection.QueryFirst<Drug>(querySelect, new
|
|
||||||
{
|
|
||||||
id
|
|
||||||
});
|
|
||||||
_logger.LogDebug("Найденный объект: {json}",
|
|
||||||
JsonConvert.SerializeObject(drug));
|
|
||||||
return drug;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при поиске объекта");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateDrug(Drug drug)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Редактирование объекта");
|
|
||||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(drug));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
var queryUpdate = @"UPDATE drugs SET
|
|
||||||
DrugsNames = @DrugsNames,
|
|
||||||
grams = @Grams,
|
|
||||||
Description= @Description
|
|
||||||
WHERE Id=@id";
|
|
||||||
connection.Execute(queryUpdate, drug);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
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 MedicalHistoryRepository : IMedicalHistoryRepository
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IConnectionString _connectionString;
|
|
||||||
private readonly ILogger<MedicalHistoryRepository> _logger;
|
|
||||||
|
|
||||||
public MedicalHistoryRepository(IConnectionString connectionString, ILogger<MedicalHistoryRepository> logger)
|
|
||||||
{
|
|
||||||
_connectionString = connectionString;
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateMedicalHistory(MedicalHistory medicalHistory)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
connection.Open();
|
|
||||||
|
|
||||||
using var transaction = connection.BeginTransaction();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var queryInsertHistory = @"
|
|
||||||
INSERT INTO medical_history (PatientId, DoctorId, VisitDate, Status)
|
|
||||||
VALUES (@PatientId, @DoctorId, @VisitDate, @Status)
|
|
||||||
RETURNING id;";
|
|
||||||
var historyId = connection.ExecuteScalar<int>(queryInsertHistory, new
|
|
||||||
{
|
|
||||||
medicalHistory.PatientId,
|
|
||||||
medicalHistory.DoctorId,
|
|
||||||
medicalHistory.VisitDate,
|
|
||||||
Status = (int)medicalHistory.Status
|
|
||||||
}, transaction);
|
|
||||||
|
|
||||||
var queryInsertDrugs = @"
|
|
||||||
INSERT INTO drug_med_history (medical_history_id, drug_id, count)
|
|
||||||
VALUES (@MedicalHistoryId, @DrugId, @Count);";
|
|
||||||
|
|
||||||
foreach (var drug in medicalHistory.DrugMedHistory)
|
|
||||||
{
|
|
||||||
connection.Execute(queryInsertDrugs, new
|
|
||||||
{
|
|
||||||
MedicalHistoryId = historyId,
|
|
||||||
DrugId = drug.DrugId,
|
|
||||||
drug.Count
|
|
||||||
}, transaction);
|
|
||||||
}
|
|
||||||
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
transaction.Rollback();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при добавлении медицинской истории");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeletemedicalHistory(int id)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Удаление объекта");
|
|
||||||
_logger.LogDebug("Объект: {id}", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
var queryDelete = @"DELETE FROM medical_history WHERE ID=@id";
|
|
||||||
connection.Execute(queryDelete, new { id });
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при удалении объекта");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public IEnumerable<MedicalHistory> ReadMedicalHistory(DateTime? dateForm = null, DateTime? dateTo = null, int? patientId = null, int? doctorId = null)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение всех объектов");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
var querySelect = @"
|
|
||||||
SELECT mh.*, dmh.drug_id AS DrugId, dmh.count AS Count
|
|
||||||
FROM medical_history mh
|
|
||||||
LEFT JOIN drug_med_history dmh ON mh.id = dmh.medical_history_id";
|
|
||||||
|
|
||||||
var tempHistories = connection.Query<TempMedicalHistory>(querySelect);
|
|
||||||
|
|
||||||
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(tempHistories));
|
|
||||||
|
|
||||||
return tempHistories.GroupBy(x => x.Id)
|
|
||||||
.Select(group => MedicalHistory.CreateEntity(
|
|
||||||
group.First(),
|
|
||||||
group.Select(d => DrugMedHistory.CreateEntity(0, d.DrugId, d.Id, d.Count))
|
|
||||||
)).ToList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,156 +0,0 @@
|
|||||||
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.Numerics;
|
|
||||||
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 CreatPatient(Patient patient)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Добавление объекта");
|
|
||||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(patient));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
|
|
||||||
var queryInsert = @"
|
|
||||||
INSERT INTO patients (first_name, last_name, address, contactnumber)
|
|
||||||
VALUES (@First_Name, @Last_Name, @Address, @ContactNumber)";
|
|
||||||
|
|
||||||
connection.Execute(queryInsert, patient);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeletePatient(int id)
|
|
||||||
{
|
|
||||||
|
|
||||||
_logger.LogInformation("Удаление объекта");
|
|
||||||
_logger.LogDebug("Объект: {id}", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
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 IEnumerable<Patient> ReadPatient()
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение всех объектов пациентов");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Patient ReadPatientById(int id)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение объекта по идентификатору");
|
|
||||||
_logger.LogDebug("Объект: {id}", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
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 void UpdatePatient(Patient patient)
|
|
||||||
{
|
|
||||||
|
|
||||||
_logger.LogInformation("Редактирование объекта");
|
|
||||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(patient));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
|
||||||
|
|
||||||
// Проверяем, существует ли запись
|
|
||||||
var existingDoctor = connection.QueryFirstOrDefault<Patient>("SELECT * FROM Patients WHERE id = @Id", new { patient.Id });
|
|
||||||
if (existingDoctor == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Запись с Id={Id} не найдена.", patient.Id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var queryUpdate = @"
|
|
||||||
UPDATE patients
|
|
||||||
SET first_name = @First_Name,
|
|
||||||
last_name = @Last_Name,
|
|
||||||
address = @Address,
|
|
||||||
contactnumber = @Contactnumber
|
|
||||||
WHERE id = @Id";
|
|
||||||
|
|
||||||
var affectedRows = connection.Execute(queryUpdate, patient);
|
|
||||||
|
|
||||||
if (affectedRows == 0)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Обновление не выполнено. Id={Id}.", patient.Id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Запись успешно обновлена.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка при обновлении объекта");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 171 KiB |
Binary file not shown.
Before Width: | Height: | Size: 25 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.7 MiB |
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"Serilog": {
|
|
||||||
"Using": [ "Serilog.Sinks.File" ],
|
|
||||||
"MinimumLevel": "Debug",
|
|
||||||
"WriteTo": [
|
|
||||||
{
|
|
||||||
"Name": "File",
|
|
||||||
"Args": {
|
|
||||||
"path": "Logs/Polyclinic_log.txt",
|
|
||||||
"rollingInterval": "Day"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user