diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/Doctor.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/Doctor.cs new file mode 100644 index 0000000..5950ccb --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/Doctor.cs @@ -0,0 +1,41 @@ +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; } //свойство Specialization, которое имеет тип Specialization + + public SpecializationLevel SpecializationLevel { get; private set; } //свойство SpecializationLevel, которое имеет тип SpecializationLevel + + 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 + }; + } + + + + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/DoctorPay.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/DoctorPay.cs new file mode 100644 index 0000000..8363c94 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/DoctorPay.cs @@ -0,0 +1,34 @@ +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 + }; + } + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/Drug.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/Drug.cs new file mode 100644 index 0000000..0696774 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/Drug.cs @@ -0,0 +1,30 @@ + 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 + }; + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/DrugMedHistory.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/DrugMedHistory.cs new file mode 100644 index 0000000..498184f --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/DrugMedHistory.cs @@ -0,0 +1,29 @@ +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 + }; + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/DrugsNames.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/DrugsNames.cs new file mode 100644 index 0000000..f5aed2b --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/DrugsNames.cs @@ -0,0 +1,25 @@ +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, +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/Specialization.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/Specialization.cs new file mode 100644 index 0000000..8bc4461 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/Specialization.cs @@ -0,0 +1,25 @@ +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 +} + diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/SpecializationLevel.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/SpecializationLevel.cs new file mode 100644 index 0000000..9d0420e --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/SpecializationLevel.cs @@ -0,0 +1,20 @@ +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 +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/Status.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/Status.cs new file mode 100644 index 0000000..85d609d --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/Enums/Status.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPolyclinic.Entities.Enums; + + +public enum Status +{ + none = 0, + + Sick= 1, + + Heal = 2 +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/MedicalHistory.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/MedicalHistory.cs new file mode 100644 index 0000000..a763536 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/MedicalHistory.cs @@ -0,0 +1,41 @@ +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 { get; private set; } = []; + + public static MedicalHistory CreateEntity(int id, int patientId, + Status status, int doctorId, IEnumerable drugMedHistory) + { + return new MedicalHistory + { + Id = id, + PatientId = patientId, + DoctorId = doctorId, + VisitDate = DateTime.Now, + Status = status, + DrugMedHistory = drugMedHistory + }; + } + +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Entities/Patient.cs b/ProjectPolyclinic/ProjectPolyclinic/Entities/Patient.cs new file mode 100644 index 0000000..9205ade --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Entities/Patient.cs @@ -0,0 +1,35 @@ +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 + }; + } + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Form1.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Form1.Designer.cs deleted file mode 100644 index 9f1767d..0000000 --- a/ProjectPolyclinic/ProjectPolyclinic/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectPolyclinic -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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 - } -} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Form1.cs b/ProjectPolyclinic/ProjectPolyclinic/Form1.cs deleted file mode 100644 index f5c71a4..0000000 --- a/ProjectPolyclinic/ProjectPolyclinic/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectPolyclinic -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.Designer.cs new file mode 100644 index 0000000..fab9e5f --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.Designer.cs @@ -0,0 +1,138 @@ +namespace ProjectPolyclinic +{ + partial class FormPolyclinic + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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(); + 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(180, 22); + DoctorsToolStripMenuItem.Text = "Врачи"; + DoctorsToolStripMenuItem.Click += DoctorsToolStripMenuItem_Click; + // + // PacientsToolStripMenuItem + // + PacientsToolStripMenuItem.Name = "PacientsToolStripMenuItem"; + PacientsToolStripMenuItem.Size = new Size(180, 22); + PacientsToolStripMenuItem.Text = "Пациенты"; + PacientsToolStripMenuItem.Click += PacientsToolStripMenuItem_Click; + // + // DrugsToolStripMenuItem + // + DrugsToolStripMenuItem.Name = "DrugsToolStripMenuItem"; + DrugsToolStripMenuItem.Size = new Size(180, 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(180, 22); + MedHistoryToolStripMenuItem.Text = "Учет мед. карты"; + MedHistoryToolStripMenuItem.Click += MedHistoryToolStripMenuItem_Click; + // + // DoctorPayToolStripMenuItem + // + DoctorPayToolStripMenuItem.Name = "DoctorPayToolStripMenuItem"; + DoctorPayToolStripMenuItem.Size = new Size(180, 22); + DoctorPayToolStripMenuItem.Text = "Оплата врачу"; + DoctorPayToolStripMenuItem.Click += DoctorPayToolStripMenuItem_Click; + // + // otchetsToolStripMenuItem + // + otchetsToolStripMenuItem.Name = "otchetsToolStripMenuItem"; + otchetsToolStripMenuItem.Size = new Size(60, 20); + otchetsToolStripMenuItem.Text = "Отчеты"; + // + // 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; + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.cs b/ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.cs new file mode 100644 index 0000000..9b5b85e --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.cs @@ -0,0 +1,81 @@ +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().ShowDialog(); + } + + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void PacientsToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void DrugsToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void MedHistoryToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void DoctorPayToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.resx b/ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.resx new file mode 100644 index 0000000..a0623c8 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/FormPolyclinic.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.Designer.cs new file mode 100644 index 0000000..5939ef3 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.Designer.cs @@ -0,0 +1,192 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormDoctor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.cs new file mode 100644 index 0000000..097d613 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.cs @@ -0,0 +1,107 @@ +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 + { + 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); + return; + } + } + } + + + 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!); + + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Form1.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.resx similarity index 93% rename from ProjectPolyclinic/ProjectPolyclinic/Form1.resx rename to ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.resx index 1af7de1..af32865 100644 --- a/ProjectPolyclinic/ProjectPolyclinic/Form1.resx +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctor.resx @@ -1,17 +1,17 @@  - diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayment.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayment.Designer.cs new file mode 100644 index 0000000..4919b10 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayment.Designer.cs @@ -0,0 +1,162 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormDoctorPayment + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + labelDoctor = new Label(); + buttonCancel = new Button(); + buttonSave = new Button(); + comboBoxDoctor = new ComboBox(); + groupBox = new GroupBox(); + dataGridViewPay = new DataGridView(); + ColumnMonth = new DataGridViewTextBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + ColumnPayment = new DataGridViewTextBoxColumn(); + groupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewPay).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(310, 396); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(93, 29); + buttonCancel.TabIndex = 11; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + // + // buttonSave + // + buttonSave.Location = new Point(22, 396); + 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(86, 29); + comboBoxDoctor.Name = "comboBoxDoctor"; + comboBoxDoctor.Size = new Size(121, 23); + comboBoxDoctor.TabIndex = 12; + // + // groupBox + // + groupBox.Controls.Add(dataGridViewPay); + groupBox.Location = new Point(22, 114); + groupBox.Name = "groupBox"; + groupBox.Size = new Size(384, 223); + groupBox.TabIndex = 13; + groupBox.TabStop = false; + groupBox.Text = "groupBox1"; + // + // dataGridViewPay + // + dataGridViewPay.AllowUserToResizeColumns = false; + dataGridViewPay.AllowUserToResizeRows = false; + dataGridViewPay.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewPay.Columns.AddRange(new DataGridViewColumn[] { ColumnMonth, ColumnCount, ColumnPayment }); + dataGridViewPay.Dock = DockStyle.Fill; + dataGridViewPay.Location = new Point(3, 19); + dataGridViewPay.Margin = new Padding(3, 2, 3, 2); + dataGridViewPay.MultiSelect = false; + dataGridViewPay.Name = "dataGridViewPay"; + dataGridViewPay.RowHeadersVisible = false; + dataGridViewPay.RowHeadersWidth = 51; + dataGridViewPay.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewPay.Size = new Size(378, 201); + dataGridViewPay.TabIndex = 1; + // + // ColumnMonth + // + ColumnMonth.HeaderText = "Месяц"; + ColumnMonth.MinimumWidth = 6; + ColumnMonth.Name = "ColumnMonth"; + ColumnMonth.Resizable = DataGridViewTriState.True; + ColumnMonth.SortMode = DataGridViewColumnSortMode.NotSortable; + ColumnMonth.Width = 125; + // + // ColumnCount + // + ColumnCount.HeaderText = "Кол-во пациентов"; + ColumnCount.MinimumWidth = 6; + ColumnCount.Name = "ColumnCount"; + ColumnCount.Width = 125; + // + // ColumnPayment + // + ColumnPayment.HeaderText = "Оплата"; + ColumnPayment.MinimumWidth = 6; + ColumnPayment.Name = "ColumnPayment"; + ColumnPayment.Width = 125; + // + // FormDoctorPayment + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(418, 450); + Controls.Add(groupBox); + Controls.Add(comboBoxDoctor); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(labelDoctor); + Name = "FormDoctorPayment"; + StartPosition = FormStartPosition.CenterScreen; + Text = "FormDoctorPayment"; + groupBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewPay).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelDoctor; + private Button buttonCancel; + private Button buttonSave; + private ComboBox comboBoxDoctor; + private GroupBox groupBox; + private DataGridView dataGridViewPay; + private DataGridViewTextBoxColumn ColumnMonth; + private DataGridViewTextBoxColumn ColumnCount; + private DataGridViewTextBoxColumn ColumnPayment; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayment.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayment.cs new file mode 100644 index 0000000..bc3f755 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayment.cs @@ -0,0 +1,84 @@ +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 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 = "Firts_Name"; + comboBoxDoctor.ValueMember = "Id"; + } + + private void buttonSave_Click(object sender, EventArgs e) + { + try + { + if (dataGridViewPay.RowCount < 1 || comboBoxDoctor.SelectedIndex < 0) + { + throw new Exception("Имеются не заполненные поля"); + } + + // Получаем значение из первой строки колонки ColumnMonth + string month = dataGridViewPay.Rows[0].Cells["ColumnMonth"].Value?.ToString(); + int countPatient = int.Parse(dataGridViewPay.Rows[0].Cells["Column2"].Value?.ToString() ?? "0"); + int payment = int.Parse(dataGridViewPay.Rows[0].Cells["Column3"].Value?.ToString() ?? "0"); + + // Проверяем, что месяц не пустой + if (string.IsNullOrEmpty(month)) + { + throw new Exception("Месяц не заполнен"); + } + + // Создаем элемент DoctorPayments + _doctorPayRepository.CreateDoctorPayments(DoctorPay.CreateElement(0, (int)comboBoxDoctor.SelectedValue!, month, countPatient, payment)); + + + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + + private List CreateListDoctorPaymentsFromDataGrid() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridViewPay.Rows) + { + if (row.Cells["ColumnMonth"].Value == null || row.Cells["ColumnCount"].Value == null || row.Cells["ColumnPayment"] == null) + { + continue; + } + // ДОДЕЛАТЬ!!! + list.Add(DoctorPay.CreateElement(0, 0, row.Cells["ColumnMonth"].Value.ToString(), Convert.ToInt32(row.Cells["ColumnCount"].Value), + Convert.ToInt32(row.Cells["ColumnPayment"].Value))); + } + + return list; + } + + + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayment.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayment.resx new file mode 100644 index 0000000..f6e5087 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayment.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayments.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayments.Designer.cs new file mode 100644 index 0000000..b17af66 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayments.Designer.cs @@ -0,0 +1,95 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormDoctorPayments + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayments.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayments.cs new file mode 100644 index 0000000..45beeda --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayments.cs @@ -0,0 +1,70 @@ +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().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayments.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayments.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctorPayments.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.Designer.cs new file mode 100644 index 0000000..14b13a3 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.Designer.cs @@ -0,0 +1,123 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormDoctors + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.cs new file mode 100644 index 0000000..0e433ef --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.cs @@ -0,0 +1,123 @@ +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().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(); + form.Id = findId; + form.ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDoctors.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrug.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrug.Designer.cs new file mode 100644 index 0000000..269e8b4 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrug.Designer.cs @@ -0,0 +1,140 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormDrug + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonCancel = new Button(); + buttonSave = new Button(); + labelName = new Label(); + labelGrams = new Label(); + labelDescription = new Label(); + checkedListBoxName = new CheckedListBox(); + textBoxGrams = new TextBox(); + textBoxDescription = new TextBox(); + SuspendLayout(); + // + // buttonCancel + // + buttonCancel.Location = new Point(177, 302); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(93, 29); + buttonCancel.TabIndex = 8; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + // + // buttonSave + // + buttonSave.Location = new Point(38, 302); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(93, 29); + buttonSave.TabIndex = 7; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(38, 44); + labelName.Name = "labelName"; + labelName.Size = new Size(59, 15); + labelName.TabIndex = 9; + labelName.Text = "Название"; + // + // labelGrams + // + labelGrams.AutoSize = true; + labelGrams.Location = new Point(38, 188); + labelGrams.Name = "labelGrams"; + labelGrams.Size = new Size(60, 15); + labelGrams.TabIndex = 10; + labelGrams.Text = "Грамовка"; + // + // labelDescription + // + labelDescription.AutoSize = true; + labelDescription.Location = new Point(38, 236); + labelDescription.Name = "labelDescription"; + labelDescription.Size = new Size(45, 15); + labelDescription.TabIndex = 11; + labelDescription.Text = "Рецепт"; + // + // checkedListBoxName + // + checkedListBoxName.FormattingEnabled = true; + checkedListBoxName.Location = new Point(136, 44); + checkedListBoxName.Name = "checkedListBoxName"; + checkedListBoxName.Size = new Size(161, 94); + checkedListBoxName.TabIndex = 12; + // + // textBoxGrams + // + textBoxGrams.Location = new Point(136, 185); + textBoxGrams.Name = "textBoxGrams"; + textBoxGrams.Size = new Size(161, 23); + textBoxGrams.TabIndex = 13; + // + // textBoxDescription + // + textBoxDescription.Location = new Point(136, 233); + textBoxDescription.Name = "textBoxDescription"; + textBoxDescription.Size = new Size(161, 23); + textBoxDescription.TabIndex = 14; + // + // FormDrug + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(309, 357); + Controls.Add(textBoxDescription); + Controls.Add(textBoxGrams); + Controls.Add(checkedListBoxName); + Controls.Add(labelDescription); + Controls.Add(labelGrams); + Controls.Add(labelName); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Name = "FormDrug"; + StartPosition = FormStartPosition.CenterScreen; + Text = "FormDrug"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button buttonCancel; + private Button buttonSave; + private Label labelName; + private Label labelGrams; + private Label labelDescription; + private CheckedListBox checkedListBoxName; + private TextBox textBoxGrams; + private TextBox textBoxDescription; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrug.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrug.cs new file mode 100644 index 0000000..5466374 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrug.cs @@ -0,0 +1,112 @@ +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); + } + } + textBoxGrams.Text = drag.Grams.ToString(); + textBoxDescription.Text = drag.Description; + _dragId = value; + + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + + public FormDrug(IDrugRepository drugRepository) + { + InitializeComponent(); + _drugRepository = drugRepository ?? + throw new ArgumentNullException(nameof(drugRepository)); + // вытаскиваем все значения + foreach (var elem in Enum.GetValues(typeof(DrugsNames))) + { + checkedListBoxName.Items.Add(elem); // заполняем поэлементно значения + } + } + + + private void buttonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxGrams.Text) || string.IsNullOrWhiteSpace(textBoxDescription.Text) || + checkedListBoxName.CheckedItems.Count == 0) + { + throw new Exception("Имеется незаполненные поля"); + } + + if (_dragId.HasValue) + { + _drugRepository.UpdateDrug(CreateDrag(_dragId.Value)); + } + else + { + _drugRepository.CreateDrug(CreateDrag(0)); + } + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + + + private Drug CreateDrag(int id) + { + DrugsNames drugName = DrugsNames.None; + + foreach (var elem in checkedListBoxName.CheckedItems) + { + drugName |= (DrugsNames)elem; + } + + return Drug.CreateElement(id, drugName, Convert.ToInt32(textBoxGrams.Text), textBoxDescription.Text); + } + + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrug.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrug.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrug.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrugs.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrugs.Designer.cs new file mode 100644 index 0000000..39a0189 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrugs.Designer.cs @@ -0,0 +1,123 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormDrugs + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrugs.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrugs.cs new file mode 100644 index 0000000..c678db3 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrugs.cs @@ -0,0 +1,123 @@ +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().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(); + 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; + } + + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrugs.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrugs.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormDrugs.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistories.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistories.Designer.cs new file mode 100644 index 0000000..0b6fccb --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistories.Designer.cs @@ -0,0 +1,109 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormMedicalHistories + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistories.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistories.cs new file mode 100644 index 0000000..4790bed --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistories.cs @@ -0,0 +1,122 @@ +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().ShowDialog(); + // LoadList(); + //} + //catch (Exception ex) + //{ + // MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + //} + + try + { + _container.Resolve().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; + } + + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistories.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistories.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistories.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistory.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistory.Designer.cs new file mode 100644 index 0000000..20cca49 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistory.Designer.cs @@ -0,0 +1,196 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormMedicalHistory + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + labelPacientName = new Label(); + labelDoctorName = new Label(); + comboBoxPacient = new ComboBox(); + comboBoxDoctor = new ComboBox(); + groupBox = new GroupBox(); + dataGridView = new DataGridView(); + ColumnDrug = new DataGridViewComboBoxColumn(); + DrugCount = new DataGridViewTextBoxColumn(); + label = new Label(); + comboBoxStatus = new ComboBox(); + buttonCancel = new Button(); + buttonSave = new Button(); + groupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // labelPacientName + // + labelPacientName.AutoSize = true; + labelPacientName.Location = new Point(30, 36); + labelPacientName.Name = "labelPacientName"; + labelPacientName.Size = new Size(54, 15); + labelPacientName.TabIndex = 0; + labelPacientName.Text = "Пациент"; + // + // labelDoctorName + // + labelDoctorName.AutoSize = true; + labelDoctorName.Location = new Point(30, 88); + labelDoctorName.Name = "labelDoctorName"; + labelDoctorName.Size = new Size(47, 15); + labelDoctorName.TabIndex = 1; + labelDoctorName.Text = "Доктор"; + // + // comboBoxPacient + // + comboBoxPacient.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxPacient.FormattingEnabled = true; + comboBoxPacient.Location = new Point(129, 33); + comboBoxPacient.Name = "comboBoxPacient"; + comboBoxPacient.Size = new Size(133, 23); + comboBoxPacient.TabIndex = 2; + // + // comboBoxDoctor + // + comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxDoctor.FormattingEnabled = true; + comboBoxDoctor.Location = new Point(129, 85); + comboBoxDoctor.Name = "comboBoxDoctor"; + comboBoxDoctor.Size = new Size(133, 23); + comboBoxDoctor.TabIndex = 3; + // + // groupBox + // + groupBox.Controls.Add(dataGridView); + groupBox.Location = new Point(30, 175); + groupBox.Name = "groupBox"; + groupBox.Size = new Size(235, 247); + 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, DrugCount }); + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(3, 19); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(229, 225); + dataGridView.TabIndex = 0; + // + // ColumnDrug + // + ColumnDrug.HeaderText = "Лекарство"; + ColumnDrug.MinimumWidth = 6; + ColumnDrug.Name = "ColumnDrug"; + ColumnDrug.Width = 125; + // + // DrugCount + // + DrugCount.HeaderText = "Количество"; + DrugCount.Name = "DrugCount"; + // + // label + // + label.AutoSize = true; + label.Location = new Point(30, 139); + label.Name = "label"; + label.Size = new Size(43, 15); + label.TabIndex = 5; + label.Text = "Статус"; + // + // comboBoxStatus + // + comboBoxStatus.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStatus.FormattingEnabled = true; + comboBoxStatus.Location = new Point(129, 136); + comboBoxStatus.Name = "comboBoxStatus"; + comboBoxStatus.Size = new Size(133, 23); + comboBoxStatus.TabIndex = 6; + comboBoxStatus.SelectedIndexChanged += comboBoxStatus_SelectedIndexChanged; + // + // buttonCancel + // + buttonCancel.Location = new Point(169, 519); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(93, 29); + buttonCancel.TabIndex = 10; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + // + // buttonSave + // + buttonSave.Location = new Point(30, 519); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(93, 29); + buttonSave.TabIndex = 9; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // FormMedicalHistory + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(296, 574); + 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); + Name = "FormMedicalHistory"; + StartPosition = FormStartPosition.CenterScreen; + Text = "FormMedicalHistory"; + 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 DrugCount; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistory.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistory.cs new file mode 100644 index 0000000..b0bb1f3 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistory.cs @@ -0,0 +1,103 @@ +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)); + + // Настройка ComboBox + comboBoxPacient.DataSource = patientRepository.ReadPatient(); + comboBoxPacient.DisplayMember = "First_Name"; + comboBoxPacient.ValueMember = "Id"; + + comboBoxDoctor.DataSource = doctorRepository.ReadDoctors(); + comboBoxDoctor.DisplayMember = "First_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); + MessageBox.Show("История болезни сохранена.", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + + private List CreateListMedicalHistoryFromDataGrid() + { + var list = new List(); + + 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; + } + + private void comboBoxStatus_SelectedIndexChanged(object sender, EventArgs e) + { + + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistory.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistory.resx new file mode 100644 index 0000000..968604a --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormMedicalHistory.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.Designer.cs new file mode 100644 index 0000000..678f6e6 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.Designer.cs @@ -0,0 +1,161 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormPatient + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.cs new file mode 100644 index 0000000..a3fe07a --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.cs @@ -0,0 +1,97 @@ +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); // 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("Имеются незаполненные поля"); + } + // проверка есть ли у нас id + if (_patientId.HasValue) + { + // мы создаем запись и передаем id + _patientRepository.UpdatePatient(CreatePatient(_patientId.Value)); + } + else + { + // если id нет, то мы создаем запись, с id ноль + _patientRepository.CreatPatient(CreatePatient(0)); + } + // закрываем форму + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + + private Patient CreatePatient(int id) => Patient.CreateEntity(id, textBoxFirstName.Text, textBoxLastName.Text, textBoxAdress.Text, textBoxNumPhone.Text); + + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatient.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.Designer.cs new file mode 100644 index 0000000..982d84b --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.Designer.cs @@ -0,0 +1,123 @@ +namespace ProjectPolyclinic.Forms +{ + partial class FormPatients + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.cs b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.cs new file mode 100644 index 0000000..9dea67b --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.cs @@ -0,0 +1,125 @@ +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) + { + // мы получаем через container объект FormPatient и вызываем его + try + { + _container.Resolve().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(); + 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; + } + + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.resx b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Forms/FormPatients.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Program.cs b/ProjectPolyclinic/ProjectPolyclinic/Program.cs index 86d17b9..e3447c2 100644 --- a/ProjectPolyclinic/ProjectPolyclinic/Program.cs +++ b/ProjectPolyclinic/ProjectPolyclinic/Program.cs @@ -1,3 +1,7 @@ +using ProjectPolyclinic.Repositories.Implementations; +using ProjectPolyclinic.Repositories; +using Unity; + namespace ProjectPolyclinic { internal static class Program @@ -11,7 +15,25 @@ namespace ProjectPolyclinic // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(CreateContainer().Resolve()); } + + private static IUnityContainer CreateContainer() + { + var container = new UnityContainer(); + + // + + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + + return container; + } + + + } } \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/ProjectPolyclinic.csproj b/ProjectPolyclinic/ProjectPolyclinic/ProjectPolyclinic.csproj index 663fdb8..df6540b 100644 --- a/ProjectPolyclinic/ProjectPolyclinic/ProjectPolyclinic.csproj +++ b/ProjectPolyclinic/ProjectPolyclinic/ProjectPolyclinic.csproj @@ -8,4 +8,35 @@ enable + + + + + + + Form + + + Form + + + Form + + + Form + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.Designer.cs b/ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.Designer.cs new file mode 100644 index 0000000..fff320e --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectPolyclinic.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом 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() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [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; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap buttonAdd { + get { + object obj = ResourceManager.GetObject("buttonAdd", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap buttonDel { + get { + object obj = ResourceManager.GetObject("buttonDel", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap buttonUpdate { + get { + object obj = ResourceManager.GetObject("buttonUpdate", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap polyclinicfon { + get { + object obj = ResourceManager.GetObject("polyclinicfon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.resx b/ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.resx new file mode 100644 index 0000000..b610b8d --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Properties/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\polyclinicfon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\buttonDel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\buttonAdd.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\buttonUpdate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/IDoctorPayRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IDoctorPayRepository.cs new file mode 100644 index 0000000..756579a --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IDoctorPayRepository.cs @@ -0,0 +1,21 @@ +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 ReadDoctorPayments(); + + DoctorPay ReadDoctorPaymentsById(int id); + + void CreateDoctorPayments(DoctorPay doctorPayments); + + void UpdateDoctorPayments(DoctorPay doctorPayments); + + void DeleteDoctorPayments(int id); +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/IDoctorRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IDoctorRepository.cs new file mode 100644 index 0000000..8f6973b --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IDoctorRepository.cs @@ -0,0 +1,22 @@ +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 ReadDoctors(); + + Doctor ReadDoctorById(int id); + + void CreateDoctor(Doctor doctor); + + void UpdateDoctor(Doctor doctor); + + void DeleteDoctor(int id); + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/IDrugRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IDrugRepository.cs new file mode 100644 index 0000000..f72ad88 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IDrugRepository.cs @@ -0,0 +1,21 @@ +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 ReadDrug(); + + Drug ReadDrugById(int id); + + void CreateDrug(Drug drag); + + void UpdateDrug(Drug drag); + + void DeleteDrug(int id); +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/IMedicalHistoryRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IMedicalHistoryRepository.cs new file mode 100644 index 0000000..905b73d --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IMedicalHistoryRepository.cs @@ -0,0 +1,19 @@ +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 ReadMedicalHistory(DateTime? dateForm = null, DateTime? dateTo = null, int? DoctorId = null, int? PatientId = null); + + + void CreateMedicalHistory(MedicalHistory medicalHistory); + + + void DeletemedicalHistory(int id); +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/IPatientRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IPatientRepository.cs new file mode 100644 index 0000000..e2d92d4 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/IPatientRepository.cs @@ -0,0 +1,22 @@ +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 ReadPatient(); + + Patient ReadPatientById(int id); + + void CreatPatient(Patient patient); + + void UpdatePatient(Patient patient); + + void DeletePatient(int id); + +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/DoctorPayRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/DoctorPayRepository.cs new file mode 100644 index 0000000..68a452f --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/DoctorPayRepository.cs @@ -0,0 +1,36 @@ +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 +{ + public void CreateDoctorPayments(DoctorPay doctorPayments) + { + + } + + public void DeleteDoctorPayments(int id) + { + + } + + public IEnumerable ReadDoctorPayments() + { + return []; + } + + public DoctorPay ReadDoctorPaymentsById(int id) + { + return DoctorPay.CreateElement(0, 0, string.Empty, 0, 0); + } + + public void UpdateDoctorPayments(DoctorPay doctorPayments) + { + throw new NotImplementedException(); + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/DoctorRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/DoctorRepository.cs new file mode 100644 index 0000000..319b3df --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/DoctorRepository.cs @@ -0,0 +1,37 @@ +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 +{ + public void CreateDoctor(Doctor doctor) + { + + } + + public void DeleteDoctor(int id) + { + + } + + public Doctor ReadDoctorById(int id) + { + return Doctor.CreateEntity(0, string.Empty, string.Empty, 0, Specialization.None, SpecializationLevel.None); + } + + public IEnumerable ReadDoctors() + { + return []; + } + + public void UpdateDoctor(Doctor doctor) + { + + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/DrugRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/DrugRepository.cs new file mode 100644 index 0000000..3e352cc --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/DrugRepository.cs @@ -0,0 +1,37 @@ +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 DrugRepository : IDrugRepository +{ + public void CreateDrug(Drug drag) + { + + } + + public void DeleteDrug(int id) + { + + } + + public IEnumerable ReadDrug() + { + return []; + } + + public Drug ReadDrugById(int id) + { + return Drug.CreateElement(0, DrugsNames.None, 0, string.Empty); + } + + public void UpdateDrug(Drug drag) + { + + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/MedicalHistoryRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/MedicalHistoryRepository.cs new file mode 100644 index 0000000..97719b1 --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/MedicalHistoryRepository.cs @@ -0,0 +1,28 @@ +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 +{ + public void CreateMedicalHistory(MedicalHistory medicalHistory) + { + + } + + + public void DeletemedicalHistory(int id) + { + + } + + public IEnumerable ReadMedicalHistory(DateTime? dateForm = null, DateTime? dateTo = null, int? PatientId = null, int? DoctorId = null) + { + return []; + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/PatientRepository.cs b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/PatientRepository.cs new file mode 100644 index 0000000..133fa5c --- /dev/null +++ b/ProjectPolyclinic/ProjectPolyclinic/Repositories/Implementations/PatientRepository.cs @@ -0,0 +1,33 @@ +using ProjectPolyclinic.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectPolyclinic.Repositories.Implementations; + +public class PatientRepository : IPatientRepository +{ + public void CreatPatient(Patient patient) + { + } + + public void DeletePatient(int id) + { + } + + public IEnumerable ReadPatient() + { + return []; + } + + public Patient ReadPatientById(int id) + { + return Patient.CreateEntity(0, string.Empty, string.Empty, string.Empty, string.Empty); + } + + public void UpdatePatient(Patient patient) + { + } +} diff --git a/ProjectPolyclinic/ProjectPolyclinic/Resources/buttonAdd.jpg b/ProjectPolyclinic/ProjectPolyclinic/Resources/buttonAdd.jpg new file mode 100644 index 0000000..fbeef11 Binary files /dev/null and b/ProjectPolyclinic/ProjectPolyclinic/Resources/buttonAdd.jpg differ diff --git a/ProjectPolyclinic/ProjectPolyclinic/Resources/buttonDel.png b/ProjectPolyclinic/ProjectPolyclinic/Resources/buttonDel.png new file mode 100644 index 0000000..5e9721b Binary files /dev/null and b/ProjectPolyclinic/ProjectPolyclinic/Resources/buttonDel.png differ diff --git a/ProjectPolyclinic/ProjectPolyclinic/Resources/buttonUpdate.png b/ProjectPolyclinic/ProjectPolyclinic/Resources/buttonUpdate.png new file mode 100644 index 0000000..81b490a Binary files /dev/null and b/ProjectPolyclinic/ProjectPolyclinic/Resources/buttonUpdate.png differ diff --git a/ProjectPolyclinic/ProjectPolyclinic/Resources/polyclinicfon.png b/ProjectPolyclinic/ProjectPolyclinic/Resources/polyclinicfon.png new file mode 100644 index 0000000..0ccbbc4 Binary files /dev/null and b/ProjectPolyclinic/ProjectPolyclinic/Resources/polyclinicfon.png differ