diff --git a/ProjectSchedule/ProjectSchedule/Entities/Audience.cs b/ProjectSchedule/ProjectSchedule/Entities/Audience.cs new file mode 100644 index 0000000..2449cb0 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/Audience.cs @@ -0,0 +1,27 @@ +using ProjectSchedule.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities; + +public class Audience +{ + public int Id { get; private set; } + public string Number { get; private set; } = string.Empty; + public int SeatsCount { get; private set; } + public TypeAudience TypeAudience { get; private set; } + + public static Audience CreateEntity(int id, string number, TypeAudience typeAudience, int seatsCount) + { + return new Audience + { + Id = id, + Number = number ?? string.Empty, + TypeAudience = typeAudience, + SeatsCount = seatsCount + }; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/Discipline.cs b/ProjectSchedule/ProjectSchedule/Entities/Discipline.cs new file mode 100644 index 0000000..4992dc1 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/Discipline.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities; + +public class Discipline +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + + public static Discipline CreateEntity(int id, string name) + { + return new Discipline + { + Id = id, + Name = name ?? string.Empty, + }; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/DisciplineStudingPlanSupplement.cs b/ProjectSchedule/ProjectSchedule/Entities/DisciplineStudingPlanSupplement.cs new file mode 100644 index 0000000..6f1b06d --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/DisciplineStudingPlanSupplement.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities; + +public class DisciplineStudingPlanSupplement +{ + public int Id { get; private set; } + public int DisciplineId { get; private set; } + public int LecturesCount { get; private set; } + public int PracticesCount { get; private set; } + + public static DisciplineStudingPlanSupplement CreateElement(int id, int disciplineId, int lecturesCount, int practicesCount) + { + return new DisciplineStudingPlanSupplement + { + Id = id, + DisciplineId = disciplineId, + LecturesCount = lecturesCount, + PracticesCount = practicesCount + }; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/Enums/TypeAudience.cs b/ProjectSchedule/ProjectSchedule/Entities/Enums/TypeAudience.cs new file mode 100644 index 0000000..ce23df3 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/Enums/TypeAudience.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities.Enums; + +[Flags] +public enum TypeAudience +{ + None = 0, + СomputerСlass = 1, + LectureAudience = 2 +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/Enums/TypePair.cs b/ProjectSchedule/ProjectSchedule/Entities/Enums/TypePair.cs new file mode 100644 index 0000000..5ad1300 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/Enums/TypePair.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities.Enums; + +public enum TypePair +{ + None = 0, + Practice = 1, + Lecture = 2 +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/Enums/TypeWeek.cs b/ProjectSchedule/ProjectSchedule/Entities/Enums/TypeWeek.cs new file mode 100644 index 0000000..140d047 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/Enums/TypeWeek.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities.Enums; + +public enum TypeWeek +{ + None = 0, + OddWeek = 1, + EvenWeek = 2 +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/Group.cs b/ProjectSchedule/ProjectSchedule/Entities/Group.cs new file mode 100644 index 0000000..4c7903a --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/Group.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities; + +public class Group +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public string GroupNumber { get; private set; } = string.Empty; + public int StudentsCount { get; private set; } + + public static Group CreateEntity(int id, string name, string groupNumber, int studentsCount) + { + return new Group + { + Id = id, + Name = name ?? string.Empty, + GroupNumber = groupNumber ?? string.Empty, + StudentsCount = studentsCount + }; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/Schedule.cs b/ProjectSchedule/ProjectSchedule/Entities/Schedule.cs new file mode 100644 index 0000000..8256fe0 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/Schedule.cs @@ -0,0 +1,40 @@ +using ProjectSchedule.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities; + +public class Schedule +{ + public int Id { get; private set; } + public int TeacherId { get; private set; } + public int DisciplineId { get; private set; } + public int GroupStudentsId { get; private set; } + public int AudienceId { get; private set; } + public DateTime DateDay { get; private set; } + public int NumberDay { get; private set; } + public int NumberPair { get; private set; } + public TypeWeek TypeWeek { get; private set; } + public TypePair TypePair { get; private set; } + + public static Schedule CreateOperation(int id, int teacherId, int disciplineId, int groupStudentsId, int audienceId, + DateTime dateDay, TypeWeek typeWeek, int numberDay, int numberPair, TypePair typePair) + { + return new Schedule + { + Id = id, + TeacherId = teacherId, + DisciplineId = disciplineId, + GroupStudentsId = groupStudentsId, + AudienceId = audienceId, + DateDay = dateDay, + TypeWeek = typeWeek, + NumberDay = numberDay, + NumberPair = numberPair, + TypePair = typePair + }; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/StudingPlanSupplement.cs b/ProjectSchedule/ProjectSchedule/Entities/StudingPlanSupplement.cs new file mode 100644 index 0000000..e90defb --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/StudingPlanSupplement.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities; + +public class StudingPlanSupplement +{ + public int Id { get; private set; } + + public int GroupId { get; private set; } + + public string NameStudingPlan { get; private set; } = string.Empty; + + public string Semester { get; private set; } = string.Empty; + + public DateTime DateApprovePlan { get; private set; } + + public IEnumerable DisciplineStudingPlanSupplements { get; private set; } = []; + + public static StudingPlanSupplement CreateOperation(int id, int groupId, string nameStudingPlan, + string semester, DateTime dateApprovePlan, IEnumerable disciplineStudingPlanSupplements) + { + return new StudingPlanSupplement + { + Id = id, + GroupId = groupId, + NameStudingPlan = nameStudingPlan ?? string.Empty, + Semester = semester ?? string.Empty, + DateApprovePlan = dateApprovePlan, + DisciplineStudingPlanSupplements = disciplineStudingPlanSupplements + }; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/Teacher.cs b/ProjectSchedule/ProjectSchedule/Entities/Teacher.cs new file mode 100644 index 0000000..598dc0d --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/Teacher.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Entities; + +public class Teacher +{ + public int Id { get; private set; } + public string Surname { get; private set; } = string.Empty; + public string Name { get; private set; } = string.Empty; + public string Patronymic { get; private set; } = string.Empty; + + public static Teacher CreateEntity(int id, string surname, string name, string patronymic) + { + return new Teacher + { + Id = id, + Surname = surname ?? string.Empty, + Name = name ?? string.Empty, + Patronymic = patronymic ?? string.Empty + }; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Form1.Designer.cs b/ProjectSchedule/ProjectSchedule/Form1.Designer.cs deleted file mode 100644 index 3180711..0000000 --- a/ProjectSchedule/ProjectSchedule/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectSchedule -{ - 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/ProjectSchedule/ProjectSchedule/Form1.cs b/ProjectSchedule/ProjectSchedule/Form1.cs deleted file mode 100644 index 488af1c..0000000 --- a/ProjectSchedule/ProjectSchedule/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectSchedule -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/ProjectSchedule/ProjectSchedule/FormSchedule.Designer.cs b/ProjectSchedule/ProjectSchedule/FormSchedule.Designer.cs new file mode 100644 index 0000000..cc5822c --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/FormSchedule.Designer.cs @@ -0,0 +1,145 @@ +namespace ProjectSchedule +{ + partial class FormSchedule + { + /// + /// 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() + { + menuStrip = new MenuStrip(); + referencesToolStripMenuItem = new ToolStripMenuItem(); + audiencesToolStripMenuItem = new ToolStripMenuItem(); + disciplinesToolStripMenuItem = new ToolStripMenuItem(); + teachersToolStripMenuItem = new ToolStripMenuItem(); + groupsStudentsToolStripMenuItem = new ToolStripMenuItem(); + operationsToolStripMenuItem = new ToolStripMenuItem(); + scheduleToolStripMenuItem = new ToolStripMenuItem(); + studingPlanSupplementToolStripMenuItem = new ToolStripMenuItem(); + reportsToolStripMenuItem = new ToolStripMenuItem(); + menuStrip.SuspendLayout(); + SuspendLayout(); + // + // menuStrip + // + menuStrip.ImageScalingSize = new Size(20, 20); + menuStrip.Items.AddRange(new ToolStripItem[] { referencesToolStripMenuItem, operationsToolStripMenuItem, reportsToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Size = new Size(782, 28); + menuStrip.TabIndex = 0; + menuStrip.Text = "menuStrip"; + // + // referencesToolStripMenuItem + // + referencesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { audiencesToolStripMenuItem, disciplinesToolStripMenuItem, teachersToolStripMenuItem, groupsStudentsToolStripMenuItem }); + referencesToolStripMenuItem.Name = "referencesToolStripMenuItem"; + referencesToolStripMenuItem.Size = new Size(117, 24); + referencesToolStripMenuItem.Text = "Справочники"; + // + // audiencesToolStripMenuItem + // + audiencesToolStripMenuItem.Name = "audiencesToolStripMenuItem"; + audiencesToolStripMenuItem.Size = new Size(224, 26); + audiencesToolStripMenuItem.Text = "Аудитории"; + audiencesToolStripMenuItem.Click += AudiencesToolStripMenuItem_Click; + // + // disciplinesToolStripMenuItem + // + disciplinesToolStripMenuItem.Name = "disciplinesToolStripMenuItem"; + disciplinesToolStripMenuItem.Size = new Size(224, 26); + disciplinesToolStripMenuItem.Text = "Дисциплины"; + disciplinesToolStripMenuItem.Click += DisciplinesToolStripMenuItem_Click; + // + // teachersToolStripMenuItem + // + teachersToolStripMenuItem.Name = "teachersToolStripMenuItem"; + teachersToolStripMenuItem.Size = new Size(224, 26); + teachersToolStripMenuItem.Text = "Преподаватели"; + teachersToolStripMenuItem.Click += TeachersToolStripMenuItem_Click; + // + // groupsStudentsToolStripMenuItem + // + groupsStudentsToolStripMenuItem.Name = "groupsStudentsToolStripMenuItem"; + groupsStudentsToolStripMenuItem.Size = new Size(224, 26); + groupsStudentsToolStripMenuItem.Text = "Группы студентов"; + groupsStudentsToolStripMenuItem.Click += GroupsToolStripMenuItem_Click; + // + // operationsToolStripMenuItem + // + operationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { scheduleToolStripMenuItem, studingPlanSupplementToolStripMenuItem }); + operationsToolStripMenuItem.Name = "operationsToolStripMenuItem"; + operationsToolStripMenuItem.Size = new Size(95, 24); + operationsToolStripMenuItem.Text = "Операции"; + // + // scheduleToolStripMenuItem + // + scheduleToolStripMenuItem.Name = "scheduleToolStripMenuItem"; + scheduleToolStripMenuItem.Size = new Size(295, 26); + scheduleToolStripMenuItem.Text = "Составление расписания"; + scheduleToolStripMenuItem.Click += ScheduleToolStripMenuItem_Click; + // + // studingPlanSupplementToolStripMenuItem + // + studingPlanSupplementToolStripMenuItem.Name = "studingPlanSupplementToolStripMenuItem"; + studingPlanSupplementToolStripMenuItem.Size = new Size(295, 26); + studingPlanSupplementToolStripMenuItem.Text = "Дополнение учебного плана"; + studingPlanSupplementToolStripMenuItem.Click += StudingPlanSupplementToolStripMenuItem_Click; + // + // reportsToolStripMenuItem + // + reportsToolStripMenuItem.Name = "reportsToolStripMenuItem"; + reportsToolStripMenuItem.Size = new Size(73, 24); + reportsToolStripMenuItem.Text = "Отчёты"; + // + // FormSchedule + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + BackgroundImage = Properties.Resources.Bg; + BackgroundImageLayout = ImageLayout.Stretch; + ClientSize = new Size(782, 403); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Name = "FormSchedule"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Расписание"; + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + #endregion + private MenuStrip menuStrip; + private ToolStripMenuItem referencesToolStripMenuItem; + private ToolStripMenuItem audiencesToolStripMenuItem; + private ToolStripMenuItem disciplinesToolStripMenuItem; + private ToolStripMenuItem teachersToolStripMenuItem; + private ToolStripMenuItem groupsStudentsToolStripMenuItem; + private ToolStripMenuItem operationsToolStripMenuItem; + private ToolStripMenuItem scheduleToolStripMenuItem; + private ToolStripMenuItem reportsToolStripMenuItem; + private ToolStripMenuItem studingPlanSupplementToolStripMenuItem; + } +} diff --git a/ProjectSchedule/ProjectSchedule/FormSchedule.cs b/ProjectSchedule/ProjectSchedule/FormSchedule.cs new file mode 100644 index 0000000..febb4d0 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/FormSchedule.cs @@ -0,0 +1,89 @@ +using ProjectSchedule.Forms; +using Unity; + +namespace ProjectSchedule +{ + public partial class FormSchedule : Form + { + private readonly IUnityContainer _container; + + public FormSchedule(IUnityContainer container) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + } + + private void AudiencesToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void DisciplinesToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void TeachersToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void GroupsToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ScheduleToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void StudingPlanSupplementToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/ProjectSchedule/ProjectSchedule/Form1.resx b/ProjectSchedule/ProjectSchedule/FormSchedule.resx similarity index 100% rename from ProjectSchedule/ProjectSchedule/Form1.resx rename to ProjectSchedule/ProjectSchedule/FormSchedule.resx diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormAudience.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormAudience.Designer.cs new file mode 100644 index 0000000..a18474a --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormAudience.Designer.cs @@ -0,0 +1,146 @@ +namespace ProjectSchedule.Forms +{ + partial class FormAudience + { + /// + /// 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() + { + labelNumberAudience = new Label(); + labelQuantitySeats = new Label(); + labelTypeAudience = new Label(); + buttonSave = new Button(); + buttonCancel = new Button(); + textBoxNumberAudience = new TextBox(); + numericUpDownSeatsCount = new NumericUpDown(); + checkedListBoxTypeAudience = new CheckedListBox(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSeatsCount).BeginInit(); + SuspendLayout(); + // + // labelNumberAudience + // + labelNumberAudience.AutoSize = true; + labelNumberAudience.Location = new Point(21, 32); + labelNumberAudience.Name = "labelNumberAudience"; + labelNumberAudience.Size = new Size(138, 20); + labelNumberAudience.TabIndex = 0; + labelNumberAudience.Text = "Номер аудитории:"; + // + // labelQuantitySeats + // + labelQuantitySeats.AutoSize = true; + labelQuantitySeats.Location = new Point(21, 77); + labelQuantitySeats.Name = "labelQuantitySeats"; + labelQuantitySeats.Size = new Size(129, 20); + labelQuantitySeats.TabIndex = 1; + labelQuantitySeats.Text = "Количество мест:"; + // + // labelTypeAudience + // + labelTypeAudience.AutoSize = true; + labelTypeAudience.Location = new Point(21, 127); + labelTypeAudience.Name = "labelTypeAudience"; + labelTypeAudience.Size = new Size(116, 20); + labelTypeAudience.TabIndex = 2; + labelTypeAudience.Text = "Тип аудитории:"; + // + // buttonSave + // + buttonSave.Location = new Point(21, 300); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(116, 29); + buttonSave.TabIndex = 3; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(282, 300); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(116, 29); + buttonCancel.TabIndex = 4; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // textBoxNumberAudience + // + textBoxNumberAudience.Location = new Point(176, 29); + textBoxNumberAudience.Name = "textBoxNumberAudience"; + textBoxNumberAudience.Size = new Size(222, 27); + textBoxNumberAudience.TabIndex = 5; + // + // numericUpDownQuantitySeats + // + numericUpDownSeatsCount.Location = new Point(176, 77); + numericUpDownSeatsCount.Maximum = new decimal(new int[] { 500, 0, 0, 0 }); + numericUpDownSeatsCount.Minimum = new decimal(new int[] { 24, 0, 0, 0 }); + numericUpDownSeatsCount.Name = "numericUpDownQuantitySeats"; + numericUpDownSeatsCount.Size = new Size(222, 27); + numericUpDownSeatsCount.TabIndex = 6; + numericUpDownSeatsCount.Value = new decimal(new int[] { 24, 0, 0, 0 }); + // + // checkedListBoxTypeAudience + // + checkedListBoxTypeAudience.FormattingEnabled = true; + checkedListBoxTypeAudience.Location = new Point(176, 127); + checkedListBoxTypeAudience.Name = "checkedListBoxTypeAudience"; + checkedListBoxTypeAudience.Size = new Size(222, 136); + checkedListBoxTypeAudience.TabIndex = 7; + // + // FormAudience + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(412, 353); + Controls.Add(checkedListBoxTypeAudience); + Controls.Add(numericUpDownSeatsCount); + Controls.Add(textBoxNumberAudience); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(labelTypeAudience); + Controls.Add(labelQuantitySeats); + Controls.Add(labelNumberAudience); + Name = "FormAudience"; + StartPosition = FormStartPosition.CenterParent; + Text = "Аудитория"; + ((System.ComponentModel.ISupportInitialize)numericUpDownSeatsCount).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelNumberAudience; + private Label labelQuantitySeats; + private Label labelTypeAudience; + private Button buttonSave; + private Button buttonCancel; + private TextBox textBoxNumberAudience; + private NumericUpDown numericUpDownSeatsCount; + private CheckedListBox checkedListBoxTypeAudience; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormAudience.cs b/ProjectSchedule/ProjectSchedule/Forms/FormAudience.cs new file mode 100644 index 0000000..0adfec3 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormAudience.cs @@ -0,0 +1,95 @@ +using ProjectSchedule.Entities.Enums; +using ProjectSchedule.Entities; +using ProjectSchedule.Repositories; + +namespace ProjectSchedule.Forms; + +public partial class FormAudience : Form +{ + private readonly IAudienceRepository _audienceRepository; + + private int? _audienceId; + + public int Id + { + set + { + try + { + var audience = _audienceRepository.ReadAudienceById(value); + if (audience == null) + { + throw new InvalidDataException(nameof(audience)); + } + + foreach (TypeAudience elem in Enum.GetValues(typeof(TypeAudience))) + { + if ((elem & audience.TypeAudience) != 0) + { + checkedListBoxTypeAudience.SetItemChecked(checkedListBoxTypeAudience.Items.IndexOf(elem), true); + } + } + + textBoxNumberAudience.Text = audience.Number; + numericUpDownSeatsCount.Value = audience.SeatsCount; + _audienceId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormAudience(IAudienceRepository audienceRepository) + { + InitializeComponent(); + _audienceRepository = audienceRepository ?? + throw new ArgumentNullException(nameof(audienceRepository)); + + foreach (var elem in Enum.GetValues(typeof(TypeAudience))) + { + checkedListBoxTypeAudience.Items.Add(elem); + } + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxNumberAudience.Text) || checkedListBoxTypeAudience.CheckedItems.Count == 0) + { + throw new Exception("Имеются незаполненные поля"); + } + + if (_audienceId.HasValue) + { + _audienceRepository.UpdateAudience(CreateAudience(_audienceId.Value)); + } + else + { + _audienceRepository.CreateAudience(CreateAudience(0)); + } + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private Audience CreateAudience(int id) + { + TypeAudience typeAudience = TypeAudience.None; + foreach (var elem in checkedListBoxTypeAudience.CheckedItems) + { + typeAudience |= (TypeAudience)elem; + } + + return Audience.CreateEntity(id, textBoxNumberAudience.Text, typeAudience, Convert.ToInt32(numericUpDownSeatsCount.Value)); + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormAudience.resx b/ProjectSchedule/ProjectSchedule/Forms/FormAudience.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormAudience.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/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.Designer.cs new file mode 100644 index 0000000..a7e4802 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.Designer.cs @@ -0,0 +1,127 @@ +namespace ProjectSchedule.Forms +{ + partial class FormAudiences + { + /// + /// 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() + { + panelButtons = new Panel(); + buttonDel = new Button(); + buttonUpd = new Button(); + buttonAdd = new Button(); + dataGridViewData = new DataGridView(); + panelButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); + SuspendLayout(); + // + // panelButtons + // + panelButtons.Controls.Add(buttonDel); + panelButtons.Controls.Add(buttonUpd); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(672, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(140, 483); + panelButtons.TabIndex = 0; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.Del; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(24, 194); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(94, 66); + buttonDel.TabIndex = 4; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // buttonUpd + // + buttonUpd.BackgroundImage = Properties.Resources.Upd; + buttonUpd.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpd.Location = new Point(24, 106); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(94, 66); + buttonUpd.TabIndex = 3; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += ButtonUpd_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources.Add; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(24, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 66); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // dataGridViewData + // + dataGridViewData.AllowUserToAddRows = false; + dataGridViewData.AllowUserToDeleteRows = false; + dataGridViewData.AllowUserToResizeColumns = false; + dataGridViewData.AllowUserToResizeRows = false; + dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewData.Dock = DockStyle.Fill; + dataGridViewData.Location = new Point(0, 0); + dataGridViewData.MultiSelect = false; + dataGridViewData.Name = "dataGridViewData"; + dataGridViewData.ReadOnly = true; + dataGridViewData.RowHeadersVisible = false; + dataGridViewData.RowHeadersWidth = 51; + dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewData.Size = new Size(672, 483); + dataGridViewData.TabIndex = 1; + // + // FormAudiences + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(812, 483); + Controls.Add(dataGridViewData); + Controls.Add(panelButtons); + Name = "FormAudiences"; + StartPosition = FormStartPosition.CenterParent; + Text = "Аудитории"; + Load += FormAudiences_Load; + panelButtons.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panelButtons; + private Button buttonDel; + private Button buttonUpd; + private Button buttonAdd; + private DataGridView dataGridViewData; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.cs b/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.cs new file mode 100644 index 0000000..4c24825 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.cs @@ -0,0 +1,104 @@ +using ProjectSchedule.Repositories; +using Unity; + +namespace ProjectSchedule.Forms +{ + public partial class FormAudiences : Form + { + private readonly IUnityContainer _container; + + private readonly IAudienceRepository _audienceRepository; + + public FormAudiences(IUnityContainer container, IAudienceRepository audienceRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _audienceRepository = audienceRepository ?? + throw new ArgumentNullException(nameof(audienceRepository)); + } + + private void FormAudiences_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _audienceRepository.DeleteAudience(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridViewData.DataSource = _audienceRepository.ReadAudiences(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridViewData.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.resx b/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.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/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.Designer.cs new file mode 100644 index 0000000..b7b81a8 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.Designer.cs @@ -0,0 +1,96 @@ +namespace ProjectSchedule.Forms +{ + partial class FormDiscipline + { + /// + /// 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() + { + textBoxNameDiscipline = new TextBox(); + labelNameDiscipline = new Label(); + buttonSave = new Button(); + buttonCancel = new Button(); + SuspendLayout(); + // + // textBoxNameDiscipline + // + textBoxNameDiscipline.Location = new Point(228, 42); + textBoxNameDiscipline.Name = "textBoxNameDiscipline"; + textBoxNameDiscipline.Size = new Size(214, 27); + textBoxNameDiscipline.TabIndex = 0; + // + // labelNameDiscipline + // + labelNameDiscipline.AutoSize = true; + labelNameDiscipline.Location = new Point(25, 45); + labelNameDiscipline.Name = "labelNameDiscipline"; + labelNameDiscipline.Size = new Size(172, 20); + labelNameDiscipline.TabIndex = 1; + labelNameDiscipline.Text = "Название дисциплины:"; + // + // buttonSave + // + buttonSave.Location = new Point(25, 131); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(116, 29); + buttonSave.TabIndex = 4; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(326, 131); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(116, 29); + buttonCancel.TabIndex = 5; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // FormDiscipline + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(468, 184); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(labelNameDiscipline); + Controls.Add(textBoxNameDiscipline); + Name = "FormDiscipline"; + StartPosition = FormStartPosition.CenterParent; + Text = "Дисциплина"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private TextBox textBoxNameDiscipline; + private Label labelNameDiscipline; + private Button buttonSave; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.cs b/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.cs new file mode 100644 index 0000000..ff93d98 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.cs @@ -0,0 +1,72 @@ +using ProjectSchedule.Entities; +using ProjectSchedule.Repositories; + +namespace ProjectSchedule.Forms; + +public partial class FormDiscipline : Form +{ + private readonly IDisciplineRepository _disciplineRepository; + + private int? _disciplineId; + + public int Id + { + set + { + try + { + var discipline = _disciplineRepository.ReadDisciplineById(value); + if (discipline == null) + { + throw new InvalidDataException(nameof(discipline)); + } + + textBoxNameDiscipline.Text = discipline.Name; + _disciplineId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormDiscipline(IDisciplineRepository disciplineRepository) + { + InitializeComponent(); + _disciplineRepository = disciplineRepository ?? + throw new ArgumentNullException(nameof(disciplineRepository)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxNameDiscipline.Text)) + { + throw new Exception("Поле 'Название дисциплины' должно быть заполнено."); + } + + if (_disciplineId.HasValue) + { + _disciplineRepository.UpdateDiscipline(CreateDiscipline(_disciplineId.Value)); + } + else + { + _disciplineRepository.CreateDiscipline(CreateDiscipline(0)); + } + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private Discipline CreateDiscipline(int id) => + Discipline.CreateEntity(id, textBoxNameDiscipline.Text); +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.resx b/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.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/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.Designer.cs new file mode 100644 index 0000000..69defd0 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.Designer.cs @@ -0,0 +1,127 @@ +namespace ProjectSchedule.Forms +{ + partial class FormDisciplines + { + /// + /// 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() + { + panelButtons = new Panel(); + buttonDel = new Button(); + buttonUpd = new Button(); + buttonAdd = new Button(); + dataGridViewData = new DataGridView(); + panelButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); + SuspendLayout(); + // + // panelButtons + // + panelButtons.Controls.Add(buttonDel); + panelButtons.Controls.Add(buttonUpd); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(660, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(140, 450); + panelButtons.TabIndex = 1; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.Del; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(24, 194); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(94, 66); + buttonDel.TabIndex = 4; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // buttonUpd + // + buttonUpd.BackgroundImage = Properties.Resources.Upd; + buttonUpd.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpd.Location = new Point(24, 106); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(94, 66); + buttonUpd.TabIndex = 3; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += ButtonUpd_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources.Add; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(24, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 66); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // dataGridViewData + // + dataGridViewData.AllowUserToAddRows = false; + dataGridViewData.AllowUserToDeleteRows = false; + dataGridViewData.AllowUserToResizeColumns = false; + dataGridViewData.AllowUserToResizeRows = false; + dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewData.Dock = DockStyle.Fill; + dataGridViewData.Location = new Point(0, 0); + dataGridViewData.MultiSelect = false; + dataGridViewData.Name = "dataGridViewData"; + dataGridViewData.ReadOnly = true; + dataGridViewData.RowHeadersVisible = false; + dataGridViewData.RowHeadersWidth = 51; + dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewData.Size = new Size(660, 450); + dataGridViewData.TabIndex = 2; + // + // FormDisciplines + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridViewData); + Controls.Add(panelButtons); + Name = "FormDisciplines"; + StartPosition = FormStartPosition.CenterParent; + Text = "Дисциплины"; + Load += FormDisciplines_Load; + panelButtons.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panelButtons; + private Button buttonDel; + private Button buttonUpd; + private Button buttonAdd; + private DataGridView dataGridViewData; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.cs b/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.cs new file mode 100644 index 0000000..a8bdced --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.cs @@ -0,0 +1,104 @@ +using ProjectSchedule.Repositories; +using Unity; + +namespace ProjectSchedule.Forms +{ + public partial class FormDisciplines : Form + { + private readonly IUnityContainer _container; + + private readonly IDisciplineRepository _disciplineRepository; + + public FormDisciplines(IUnityContainer container, IDisciplineRepository disciplineRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _disciplineRepository = disciplineRepository ?? + throw new ArgumentNullException(nameof(disciplineRepository)); + } + + private void FormDisciplines_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _disciplineRepository.DeleteDiscipline(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridViewData.DataSource = _disciplineRepository.ReadDisciplines(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridViewData.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.resx b/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.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/ProjectSchedule/ProjectSchedule/Forms/FormGroup.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormGroup.Designer.cs new file mode 100644 index 0000000..e951b40 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormGroup.Designer.cs @@ -0,0 +1,145 @@ +namespace ProjectSchedule.Forms +{ + partial class FormGroup + { + /// + /// 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() + { + labelAbbreviationGroup = new Label(); + labelGroupNumber = new Label(); + labelQuantityStudents = new Label(); + numericUpDownStudentsCount = new NumericUpDown(); + textBoxNameGroup = new TextBox(); + textBoxGroupNumber = new TextBox(); + buttonSave = new Button(); + buttonCancel = new Button(); + ((System.ComponentModel.ISupportInitialize)numericUpDownStudentsCount).BeginInit(); + SuspendLayout(); + // + // labelAbbreviationGroup + // + labelAbbreviationGroup.AutoSize = true; + labelAbbreviationGroup.Location = new Point(12, 28); + labelAbbreviationGroup.Name = "labelAbbreviationGroup"; + labelAbbreviationGroup.Size = new Size(167, 20); + labelAbbreviationGroup.TabIndex = 0; + labelAbbreviationGroup.Text = "Аббревиатура группы:"; + // + // labelGroupNumber + // + labelGroupNumber.AutoSize = true; + labelGroupNumber.Location = new Point(12, 74); + labelGroupNumber.Name = "labelGroupNumber"; + labelGroupNumber.Size = new Size(115, 20); + labelGroupNumber.TabIndex = 1; + labelGroupNumber.Text = "Номер группы:"; + // + // labelQuantityStudents + // + labelQuantityStudents.AutoSize = true; + labelQuantityStudents.Location = new Point(12, 123); + labelQuantityStudents.Name = "labelQuantityStudents"; + labelQuantityStudents.Size = new Size(165, 20); + labelQuantityStudents.TabIndex = 2; + labelQuantityStudents.Text = "Количество студентов:"; + // + // numericUpDownQuantityStudents + // + numericUpDownStudentsCount.Location = new Point(213, 121); + numericUpDownStudentsCount.Maximum = new decimal(new int[] { 66, 0, 0, 0 }); + numericUpDownStudentsCount.Minimum = new decimal(new int[] { 2, 0, 0, 0 }); + numericUpDownStudentsCount.Name = "numericUpDownQuantityStudents"; + numericUpDownStudentsCount.Size = new Size(176, 27); + numericUpDownStudentsCount.TabIndex = 3; + numericUpDownStudentsCount.Value = new decimal(new int[] { 2, 0, 0, 0 }); + // + // textBoxAbbreviationGroup + // + textBoxNameGroup.Location = new Point(213, 25); + textBoxNameGroup.Name = "textBoxAbbreviationGroup"; + textBoxNameGroup.Size = new Size(176, 27); + textBoxNameGroup.TabIndex = 4; + // + // textBoxGroupNumber + // + textBoxGroupNumber.Location = new Point(213, 71); + textBoxGroupNumber.Name = "textBoxGroupNumber"; + textBoxGroupNumber.Size = new Size(176, 27); + textBoxGroupNumber.TabIndex = 5; + // + // buttonSave + // + buttonSave.Location = new Point(12, 189); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(116, 29); + buttonSave.TabIndex = 7; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(273, 189); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(116, 29); + buttonCancel.TabIndex = 8; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // FormGroupStudents + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(401, 230); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxGroupNumber); + Controls.Add(textBoxNameGroup); + Controls.Add(numericUpDownStudentsCount); + Controls.Add(labelQuantityStudents); + Controls.Add(labelGroupNumber); + Controls.Add(labelAbbreviationGroup); + Name = "FormGroupStudents"; + StartPosition = FormStartPosition.CenterParent; + Text = "Группа студентов"; + ((System.ComponentModel.ISupportInitialize)numericUpDownStudentsCount).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelAbbreviationGroup; + private Label labelGroupNumber; + private Label labelQuantityStudents; + private NumericUpDown numericUpDownStudentsCount; + private TextBox textBoxNameGroup; + private TextBox textBoxGroupNumber; + private Button buttonSave; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormGroup.cs b/ProjectSchedule/ProjectSchedule/Forms/FormGroup.cs new file mode 100644 index 0000000..06ec083 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormGroup.cs @@ -0,0 +1,74 @@ +using ProjectSchedule.Entities; +using ProjectSchedule.Repositories; + +namespace ProjectSchedule.Forms; + +public partial class FormGroup : Form +{ + private readonly IGroupRepository _groupRepository; + + private int? _groupId; + + public int Id + { + set + { + try + { + var group = _groupRepository.ReadGroupById(value); + if (group == null) + { + throw new InvalidDataException(nameof(group)); + } + + textBoxNameGroup.Text = group.Name; + textBoxGroupNumber.Text = group.GroupNumber; + numericUpDownStudentsCount.Value = group.StudentsCount; + _groupId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormGroup(IGroupRepository groupRepository) + { + InitializeComponent(); + _groupRepository = groupRepository ?? + throw new ArgumentNullException(nameof(groupRepository)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxNameGroup.Text) || string.IsNullOrWhiteSpace(textBoxGroupNumber.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + + if (_groupId.HasValue) + { + _groupRepository.UpdateGroup(CreateGroup(_groupId.Value)); + } + else + { + _groupRepository.CreateGroup(CreateGroup(0)); + } + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private Group CreateGroup(int id) => + Group.CreateEntity(id, textBoxNameGroup.Text, textBoxGroupNumber.Text, Convert.ToInt32(numericUpDownStudentsCount.Value)); +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormGroup.resx b/ProjectSchedule/ProjectSchedule/Forms/FormGroup.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormGroup.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/ProjectSchedule/ProjectSchedule/Forms/FormGroups.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormGroups.Designer.cs new file mode 100644 index 0000000..ba21fd3 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormGroups.Designer.cs @@ -0,0 +1,127 @@ +namespace ProjectSchedule.Forms +{ + partial class FormGroups + { + /// + /// 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() + { + panelButtons = new Panel(); + buttonDel = new Button(); + buttonUpd = new Button(); + buttonAdd = new Button(); + dataGridViewData = new DataGridView(); + panelButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); + SuspendLayout(); + // + // panelButtons + // + panelButtons.Controls.Add(buttonDel); + panelButtons.Controls.Add(buttonUpd); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(660, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(140, 450); + panelButtons.TabIndex = 2; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.Del; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(24, 194); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(94, 66); + buttonDel.TabIndex = 4; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // buttonUpd + // + buttonUpd.BackgroundImage = Properties.Resources.Upd; + buttonUpd.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpd.Location = new Point(24, 106); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(94, 66); + buttonUpd.TabIndex = 3; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += ButtonUpd_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources.Add; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(24, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 66); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // dataGridViewData + // + dataGridViewData.AllowUserToAddRows = false; + dataGridViewData.AllowUserToDeleteRows = false; + dataGridViewData.AllowUserToResizeColumns = false; + dataGridViewData.AllowUserToResizeRows = false; + dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewData.Dock = DockStyle.Fill; + dataGridViewData.Location = new Point(0, 0); + dataGridViewData.MultiSelect = false; + dataGridViewData.Name = "dataGridViewData"; + dataGridViewData.ReadOnly = true; + dataGridViewData.RowHeadersVisible = false; + dataGridViewData.RowHeadersWidth = 51; + dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewData.Size = new Size(660, 450); + dataGridViewData.TabIndex = 3; + // + // FormGroupsStudents + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridViewData); + Controls.Add(panelButtons); + Name = "FormGroupsStudents"; + StartPosition = FormStartPosition.CenterParent; + Text = "Группы студентов"; + Load += FormGroups_Load; + panelButtons.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panelButtons; + private Button buttonDel; + private Button buttonUpd; + private Button buttonAdd; + private DataGridView dataGridViewData; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormGroups.cs b/ProjectSchedule/ProjectSchedule/Forms/FormGroups.cs new file mode 100644 index 0000000..dcb7a1a --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormGroups.cs @@ -0,0 +1,104 @@ +using ProjectSchedule.Repositories; +using Unity; + +namespace ProjectSchedule.Forms +{ + public partial class FormGroups : Form + { + private readonly IUnityContainer _container; + + private readonly IGroupRepository _groupRepository; + + public FormGroups(IUnityContainer container, IGroupRepository groupRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _groupRepository = groupRepository ?? + throw new ArgumentNullException(nameof(groupRepository)); + } + + private void FormGroups_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _groupRepository.DeleteGroup(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridViewData.DataSource = _groupRepository.ReadGroups(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridViewData.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormGroups.resx b/ProjectSchedule/ProjectSchedule/Forms/FormGroups.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormGroups.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/ProjectSchedule/ProjectSchedule/Forms/FormSchedule.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormSchedule.Designer.cs new file mode 100644 index 0000000..26f77a2 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormSchedule.Designer.cs @@ -0,0 +1,294 @@ +namespace ProjectSchedule.Forms +{ + partial class FormSchedule + { + /// + /// 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() + { + labelEducator = new Label(); + labelDiscipline = new Label(); + labelAudience = new Label(); + labelGroupStudents = new Label(); + labelNumberDay = new Label(); + labelTypeWeek = new Label(); + labelNumberPair = new Label(); + labelTypeActivity = new Label(); + comboBoxDiscipline = new ComboBox(); + comboBoxGroup = new ComboBox(); + comboBoxTeacher = new ComboBox(); + comboBoxAudience = new ComboBox(); + comboBoxTypeWeek = new ComboBox(); + comboBoxTypePair = new ComboBox(); + numericUpDownNumberPair = new NumericUpDown(); + numericUpDownNumberDay = new NumericUpDown(); + buttonSave = new Button(); + buttonCancel = new Button(); + labelDateDay = new Label(); + dateTimePickerDateDay = new DateTimePicker(); + ((System.ComponentModel.ISupportInitialize)numericUpDownNumberPair).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownNumberDay).BeginInit(); + SuspendLayout(); + // + // labelEducator + // + labelEducator.AutoSize = true; + labelEducator.Location = new Point(34, 27); + labelEducator.Name = "labelEducator"; + labelEducator.Size = new Size(120, 20); + labelEducator.TabIndex = 0; + labelEducator.Text = "Преподаватель:"; + // + // labelDiscipline + // + labelDiscipline.AutoSize = true; + labelDiscipline.Location = new Point(34, 66); + labelDiscipline.Name = "labelDiscipline"; + labelDiscipline.Size = new Size(99, 20); + labelDiscipline.TabIndex = 1; + labelDiscipline.Text = "Дисциплина:"; + // + // labelAudience + // + labelAudience.AutoSize = true; + labelAudience.Location = new Point(34, 159); + labelAudience.Name = "labelAudience"; + labelAudience.Size = new Size(87, 20); + labelAudience.TabIndex = 2; + labelAudience.Text = "Аудитория:"; + // + // labelGroupStudents + // + labelGroupStudents.AutoSize = true; + labelGroupStudents.Location = new Point(34, 111); + labelGroupStudents.Name = "labelGroupStudents"; + labelGroupStudents.Size = new Size(133, 20); + labelGroupStudents.TabIndex = 3; + labelGroupStudents.Text = "Группа студентов:"; + // + // labelNumberDay + // + labelNumberDay.AutoSize = true; + labelNumberDay.Location = new Point(34, 285); + labelNumberDay.Name = "labelNumberDay"; + labelNumberDay.Size = new Size(89, 20); + labelNumberDay.TabIndex = 4; + labelNumberDay.Text = "Номер дня:"; + // + // labelTypeWeek + // + labelTypeWeek.AutoSize = true; + labelTypeWeek.Location = new Point(34, 207); + labelTypeWeek.Name = "labelTypeWeek"; + labelTypeWeek.Size = new Size(63, 20); + labelTypeWeek.TabIndex = 5; + labelTypeWeek.Text = "Неделя:"; + // + // labelNumberPair + // + labelNumberPair.AutoSize = true; + labelNumberPair.Location = new Point(32, 331); + labelNumberPair.Name = "labelNumberPair"; + labelNumberPair.Size = new Size(101, 20); + labelNumberPair.TabIndex = 6; + labelNumberPair.Text = "Номер пары:"; + // + // labelTypeActivity + // + labelTypeActivity.AutoSize = true; + labelTypeActivity.Location = new Point(34, 375); + labelTypeActivity.Name = "labelTypeActivity"; + labelTypeActivity.Size = new Size(97, 20); + labelTypeActivity.TabIndex = 7; + labelTypeActivity.Text = "Тип занятия:"; + // + // comboBoxDiscipline + // + comboBoxDiscipline.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxDiscipline.FormattingEnabled = true; + comboBoxDiscipline.Location = new Point(245, 66); + comboBoxDiscipline.Name = "comboBoxDiscipline"; + comboBoxDiscipline.Size = new Size(210, 28); + comboBoxDiscipline.TabIndex = 8; + // + // comboBoxGroupStudents + // + comboBoxGroup.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxGroup.FormattingEnabled = true; + comboBoxGroup.Location = new Point(245, 108); + comboBoxGroup.Name = "comboBoxGroupStudents"; + comboBoxGroup.Size = new Size(210, 28); + comboBoxGroup.TabIndex = 9; + // + // comboBoxEducator + // + comboBoxTeacher.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxTeacher.FormattingEnabled = true; + comboBoxTeacher.Location = new Point(245, 24); + comboBoxTeacher.Name = "comboBoxEducator"; + comboBoxTeacher.Size = new Size(210, 28); + comboBoxTeacher.TabIndex = 10; + // + // comboBoxAudience + // + comboBoxAudience.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxAudience.FormattingEnabled = true; + comboBoxAudience.Location = new Point(245, 159); + comboBoxAudience.Name = "comboBoxAudience"; + comboBoxAudience.Size = new Size(210, 28); + comboBoxAudience.TabIndex = 11; + // + // comboBoxTypeWeek + // + comboBoxTypeWeek.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxTypeWeek.FormattingEnabled = true; + comboBoxTypeWeek.Location = new Point(245, 204); + comboBoxTypeWeek.Name = "comboBoxTypeWeek"; + comboBoxTypeWeek.Size = new Size(210, 28); + comboBoxTypeWeek.TabIndex = 12; + // + // comboBoxTypeActivity + // + comboBoxTypePair.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxTypePair.FormattingEnabled = true; + comboBoxTypePair.Location = new Point(245, 372); + comboBoxTypePair.Name = "comboBoxTypeActivity"; + comboBoxTypePair.Size = new Size(210, 28); + comboBoxTypePair.TabIndex = 14; + // + // numericUpDownNumberPair + // + numericUpDownNumberPair.Location = new Point(245, 329); + numericUpDownNumberPair.Maximum = new decimal(new int[] { 8, 0, 0, 0 }); + numericUpDownNumberPair.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + numericUpDownNumberPair.Name = "numericUpDownNumberPair"; + numericUpDownNumberPair.Size = new Size(210, 27); + numericUpDownNumberPair.TabIndex = 15; + numericUpDownNumberPair.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // + // numericUpDownNumberDay + // + numericUpDownNumberDay.Location = new Point(245, 283); + numericUpDownNumberDay.Maximum = new decimal(new int[] { 7, 0, 0, 0 }); + numericUpDownNumberDay.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + numericUpDownNumberDay.Name = "numericUpDownNumberDay"; + numericUpDownNumberDay.Size = new Size(210, 27); + numericUpDownNumberDay.TabIndex = 16; + numericUpDownNumberDay.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // + // buttonSave + // + buttonSave.Location = new Point(34, 430); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(116, 29); + buttonSave.TabIndex = 17; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(339, 430); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(116, 29); + buttonCancel.TabIndex = 18; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // labelDateDay + // + labelDateDay.AutoSize = true; + labelDateDay.Location = new Point(34, 251); + labelDateDay.Name = "labelDateDay"; + labelDateDay.Size = new Size(73, 20); + labelDateDay.TabIndex = 19; + labelDateDay.Text = "Дата дня:"; + // + // dateTimePickerDateDay + // + dateTimePickerDateDay.Location = new Point(245, 246); + dateTimePickerDateDay.Name = "dateTimePickerDateDay"; + dateTimePickerDateDay.Size = new Size(210, 27); + dateTimePickerDateDay.TabIndex = 20; + // + // FormCompilingSchedule + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(482, 487); + Controls.Add(dateTimePickerDateDay); + Controls.Add(labelDateDay); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(numericUpDownNumberDay); + Controls.Add(numericUpDownNumberPair); + Controls.Add(comboBoxTypePair); + Controls.Add(comboBoxTypeWeek); + Controls.Add(comboBoxAudience); + Controls.Add(comboBoxTeacher); + Controls.Add(comboBoxGroup); + Controls.Add(comboBoxDiscipline); + Controls.Add(labelTypeActivity); + Controls.Add(labelNumberPair); + Controls.Add(labelTypeWeek); + Controls.Add(labelNumberDay); + Controls.Add(labelGroupStudents); + Controls.Add(labelAudience); + Controls.Add(labelDiscipline); + Controls.Add(labelEducator); + Name = "FormCompilingSchedule"; + StartPosition = FormStartPosition.CenterParent; + Text = "Составление расписания"; + ((System.ComponentModel.ISupportInitialize)numericUpDownNumberPair).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownNumberDay).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelEducator; + private Label labelDiscipline; + private Label labelAudience; + private Label labelGroupStudents; + private Label labelNumberDay; + private Label labelTypeWeek; + private Label labelNumberPair; + private Label labelTypeActivity; + private ComboBox comboBoxDiscipline; + private ComboBox comboBoxGroup; + private ComboBox comboBoxTeacher; + private ComboBox comboBoxAudience; + private ComboBox comboBoxTypeWeek; + private ComboBox comboBoxTypePair; + private NumericUpDown numericUpDownNumberPair; + private NumericUpDown numericUpDownNumberDay; + private Button buttonSave; + private Button buttonCancel; + private Label labelDateDay; + private DateTimePicker dateTimePickerDateDay; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormSchedule.cs b/ProjectSchedule/ProjectSchedule/Forms/FormSchedule.cs new file mode 100644 index 0000000..dedb4a2 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormSchedule.cs @@ -0,0 +1,65 @@ +using ProjectSchedule.Entities; +using ProjectSchedule.Entities.Enums; +using ProjectSchedule.Repositories; + +namespace ProjectSchedule.Forms +{ + public partial class FormSchedule : Form + { + private readonly IScheduleRepository _scheduleRepository; + + public FormSchedule(IScheduleRepository scheduleRepository, IDisciplineRepository disciplineRepository, + ITeacherRepository teacherRepository, IGroupRepository groupRepository, IAudienceRepository audienceRepository) + { + InitializeComponent(); + + _scheduleRepository = scheduleRepository ?? + throw new ArgumentNullException(nameof(scheduleRepository)); + + comboBoxTeacher.DataSource = teacherRepository.ReadTeachers(); + comboBoxTeacher.DisplayMember = "Surname"; + comboBoxTeacher.ValueMember = "Id"; + + comboBoxDiscipline.DataSource = disciplineRepository.ReadDisciplines(); + comboBoxDiscipline.DisplayMember = "NameDiscipline"; + comboBoxDiscipline.ValueMember = "Id"; + + comboBoxGroup.DataSource = groupRepository.ReadGroups(); + comboBoxGroup.DisplayMember = "NameGroup"; + comboBoxGroup.ValueMember = "Id"; + + comboBoxAudience.DataSource = audienceRepository.ReadAudiences(); + comboBoxAudience.DisplayMember = "NumberAudience"; + comboBoxAudience.ValueMember = "Id"; + + comboBoxTypeWeek.DataSource = Enum.GetValues(typeof(TypeWeek)); + + comboBoxTypePair.DataSource = Enum.GetValues(typeof(TypePair)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (comboBoxTeacher.SelectedIndex < 0 || comboBoxDiscipline.SelectedIndex < 0 || comboBoxGroup.SelectedIndex < 0 || + comboBoxAudience.SelectedIndex < 0 || comboBoxTypeWeek.SelectedIndex < 1 || comboBoxTypePair.SelectedIndex < 1) + { + throw new Exception("Имеются незаполненные поля"); + } + + _scheduleRepository.CreateSchedule(Schedule.CreateOperation(0, (int)comboBoxTeacher.SelectedValue!, + (int)comboBoxDiscipline.SelectedValue!, (int)comboBoxGroup.SelectedValue!, (int)comboBoxAudience.SelectedValue!, + dateTimePickerDateDay.Value, (TypeWeek)comboBoxTypeWeek.SelectedItem!, Convert.ToInt32(numericUpDownNumberDay.Value), + Convert.ToInt32(numericUpDownNumberPair.Value), (TypePair)comboBoxTypePair.SelectedItem!)); + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка сохранения", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormSchedule.resx b/ProjectSchedule/ProjectSchedule/Forms/FormSchedule.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormSchedule.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/ProjectSchedule/ProjectSchedule/Forms/FormSchedules.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormSchedules.Designer.cs new file mode 100644 index 0000000..73b7d05 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormSchedules.Designer.cs @@ -0,0 +1,99 @@ +namespace ProjectSchedule.Forms +{ + partial class FormSchedules + { + /// + /// 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() + { + panelButtons = new Panel(); + buttonAdd = new Button(); + dataGridViewData = new DataGridView(); + panelButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); + SuspendLayout(); + // + // panelButtons + // + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(1113, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(140, 484); + panelButtons.TabIndex = 3; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources.Add; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(24, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 66); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // dataGridViewData + // + dataGridViewData.AllowUserToAddRows = false; + dataGridViewData.AllowUserToDeleteRows = false; + dataGridViewData.AllowUserToResizeColumns = false; + dataGridViewData.AllowUserToResizeRows = false; + dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewData.Dock = DockStyle.Fill; + dataGridViewData.Location = new Point(0, 0); + dataGridViewData.MultiSelect = false; + dataGridViewData.Name = "dataGridViewData"; + dataGridViewData.ReadOnly = true; + dataGridViewData.RowHeadersVisible = false; + dataGridViewData.RowHeadersWidth = 51; + dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewData.Size = new Size(1113, 484); + dataGridViewData.TabIndex = 4; + // + // FormCompilingSchedules + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1253, 484); + Controls.Add(dataGridViewData); + Controls.Add(panelButtons); + Name = "FormCompilingSchedules"; + StartPosition = FormStartPosition.CenterParent; + Text = "Cоставление расписаний"; + Load += FormSchedules_Load; + panelButtons.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panelButtons; + private Button buttonAdd; + private DataGridView dataGridViewData; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormSchedules.cs b/ProjectSchedule/ProjectSchedule/Forms/FormSchedules.cs new file mode 100644 index 0000000..0b6dcbc --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormSchedules.cs @@ -0,0 +1,48 @@ +using ProjectSchedule.Repositories; +using Unity; + +namespace ProjectSchedule.Forms +{ + public partial class FormSchedules : Form + { + private readonly IUnityContainer _container; + + private readonly IScheduleRepository _scheduleRepository; + + public FormSchedules(IUnityContainer container, IScheduleRepository scheduleRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _scheduleRepository = scheduleRepository ?? + throw new ArgumentNullException(nameof(scheduleRepository)); + } + + private void FormSchedules_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridViewData.DataSource = _scheduleRepository.ReadSchedules(); + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormSchedules.resx b/ProjectSchedule/ProjectSchedule/Forms/FormSchedules.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormSchedules.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/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplement.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplement.Designer.cs new file mode 100644 index 0000000..dedaec2 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplement.Designer.cs @@ -0,0 +1,225 @@ +namespace ProjectSchedule.Forms +{ + partial class FormStudingPlanSupplement + { + /// + /// 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() + { + comboBoxGroup = new ComboBox(); + labelGroupStudents = new Label(); + labelNameCurriculum = new Label(); + labelSemester = new Label(); + textBoxNameCurriculum = new TextBox(); + buttonSave = new Button(); + buttonCancel = new Button(); + textBoxSemester = new TextBox(); + groupBoxDisciplines = new GroupBox(); + dataGridViewDisciplines = new DataGridView(); + ColumnDiscipline = new DataGridViewComboBoxColumn(); + ColumnQuantityLectures = new DataGridViewTextBoxColumn(); + ColumnQuantityPractices = new DataGridViewTextBoxColumn(); + labelDateAdoptionPlan = new Label(); + dateTimePickerDateAdoptionPlan = new DateTimePicker(); + groupBoxDisciplines.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewDisciplines).BeginInit(); + SuspendLayout(); + // + // comboBoxGroupStudents + // + comboBoxGroup.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxGroup.FormattingEnabled = true; + comboBoxGroup.Location = new Point(252, 6); + comboBoxGroup.Name = "comboBoxGroupStudents"; + comboBoxGroup.Size = new Size(218, 28); + comboBoxGroup.TabIndex = 1; + // + // labelGroupStudents + // + labelGroupStudents.AutoSize = true; + labelGroupStudents.Location = new Point(12, 9); + labelGroupStudents.Name = "labelGroupStudents"; + labelGroupStudents.Size = new Size(133, 20); + labelGroupStudents.TabIndex = 3; + labelGroupStudents.Text = "Группа студентов:"; + // + // labelNameCurriculum + // + labelNameCurriculum.AutoSize = true; + labelNameCurriculum.Location = new Point(12, 46); + labelNameCurriculum.Name = "labelNameCurriculum"; + labelNameCurriculum.Size = new Size(230, 20); + labelNameCurriculum.TabIndex = 4; + labelNameCurriculum.Text = "Название учебной программы:"; + // + // labelSemester + // + labelSemester.AutoSize = true; + labelSemester.Location = new Point(12, 83); + labelSemester.Name = "labelSemester"; + labelSemester.Size = new Size(70, 20); + labelSemester.TabIndex = 7; + labelSemester.Text = "Семестр:"; + // + // textBoxNameCurriculum + // + textBoxNameCurriculum.Location = new Point(252, 43); + textBoxNameCurriculum.Name = "textBoxNameCurriculum"; + textBoxNameCurriculum.Size = new Size(218, 27); + textBoxNameCurriculum.TabIndex = 8; + // + // buttonSave + // + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonSave.Location = new Point(12, 522); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(116, 29); + buttonSave.TabIndex = 12; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Location = new Point(354, 522); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(116, 29); + buttonCancel.TabIndex = 13; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // textBoxSemester + // + textBoxSemester.Location = new Point(252, 80); + textBoxSemester.Name = "textBoxSemester"; + textBoxSemester.Size = new Size(218, 27); + textBoxSemester.TabIndex = 15; + // + // groupBoxDisciplines + // + groupBoxDisciplines.Controls.Add(dataGridViewDisciplines); + groupBoxDisciplines.Location = new Point(12, 155); + groupBoxDisciplines.Name = "groupBoxDisciplines"; + groupBoxDisciplines.Size = new Size(458, 343); + groupBoxDisciplines.TabIndex = 16; + groupBoxDisciplines.TabStop = false; + groupBoxDisciplines.Text = "Дисциплины"; + // + // dataGridViewDisciplines + // + dataGridViewDisciplines.AllowUserToResizeColumns = false; + dataGridViewDisciplines.AllowUserToResizeRows = false; + dataGridViewDisciplines.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewDisciplines.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewDisciplines.Columns.AddRange(new DataGridViewColumn[] { ColumnDiscipline, ColumnQuantityLectures, ColumnQuantityPractices }); + dataGridViewDisciplines.Dock = DockStyle.Fill; + dataGridViewDisciplines.Location = new Point(3, 23); + dataGridViewDisciplines.MultiSelect = false; + dataGridViewDisciplines.Name = "dataGridViewDisciplines"; + dataGridViewDisciplines.RowHeadersVisible = false; + dataGridViewDisciplines.RowHeadersWidth = 51; + dataGridViewDisciplines.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewDisciplines.Size = new Size(452, 317); + dataGridViewDisciplines.TabIndex = 0; + // + // ColumnDiscipline + // + ColumnDiscipline.HeaderText = "Дисциплина"; + ColumnDiscipline.MinimumWidth = 6; + ColumnDiscipline.Name = "ColumnDiscipline"; + // + // ColumnQuantityLectures + // + ColumnQuantityLectures.HeaderText = "Количество лекций"; + ColumnQuantityLectures.MinimumWidth = 6; + ColumnQuantityLectures.Name = "ColumnQuantityLectures"; + // + // ColumnQuantityPractices + // + ColumnQuantityPractices.HeaderText = "Количество практик"; + ColumnQuantityPractices.MinimumWidth = 6; + ColumnQuantityPractices.Name = "ColumnQuantityPractices"; + // + // labelDateAdoptionPlan + // + labelDateAdoptionPlan.AutoSize = true; + labelDateAdoptionPlan.Location = new Point(15, 122); + labelDateAdoptionPlan.Name = "labelDateAdoptionPlan"; + labelDateAdoptionPlan.Size = new Size(161, 20); + labelDateAdoptionPlan.TabIndex = 17; + labelDateAdoptionPlan.Text = "Дата принятия плана:"; + // + // dateTimePickerDateAdoptionPlan + // + dateTimePickerDateAdoptionPlan.Location = new Point(252, 117); + dateTimePickerDateAdoptionPlan.Name = "dateTimePickerDateAdoptionPlan"; + dateTimePickerDateAdoptionPlan.Size = new Size(218, 27); + dateTimePickerDateAdoptionPlan.TabIndex = 18; + // + // FormCurriculumSupplement + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(482, 563); + Controls.Add(dateTimePickerDateAdoptionPlan); + Controls.Add(labelDateAdoptionPlan); + Controls.Add(groupBoxDisciplines); + Controls.Add(textBoxSemester); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxNameCurriculum); + Controls.Add(labelSemester); + Controls.Add(labelNameCurriculum); + Controls.Add(labelGroupStudents); + Controls.Add(comboBoxGroup); + Name = "FormCurriculumSupplement"; + StartPosition = FormStartPosition.CenterParent; + Text = "Дополнение учебного плана"; + groupBoxDisciplines.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewDisciplines).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + private ComboBox comboBoxGroup; + private Label labelGroupStudents; + private Label labelNameCurriculum; + private Label labelSemester; + private TextBox textBoxNameCurriculum; + private Button buttonSave; + private Button buttonCancel; + private TextBox textBoxSemester; + private GroupBox groupBoxDisciplines; + private DataGridView dataGridViewDisciplines; + private DataGridViewComboBoxColumn ColumnDiscipline; + private DataGridViewTextBoxColumn ColumnQuantityLectures; + private DataGridViewTextBoxColumn ColumnQuantityPractices; + private Label labelDateAdoptionPlan; + private DateTimePicker dateTimePickerDateAdoptionPlan; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplement.cs b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplement.cs new file mode 100644 index 0000000..9092b6f --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplement.cs @@ -0,0 +1,70 @@ +using ProjectSchedule.Entities; +using ProjectSchedule.Repositories; +using ProjectSchedule.Repositories.Implementations; + +namespace ProjectSchedule.Forms +{ + public partial class FormStudingPlanSupplement : Form + { + private readonly IStudingPlanSupplementRepository _studingPlanSupplementRepository; + + public FormStudingPlanSupplement(IStudingPlanSupplementRepository studingPlanSupplementRepository, + IDisciplineRepository disciplineRepository, IGroupRepository groupRepository) + { + InitializeComponent(); + _studingPlanSupplementRepository = studingPlanSupplementRepository ?? + throw new ArgumentNullException(nameof(studingPlanSupplementRepository)); + + comboBoxGroup.DataSource = groupRepository.ReadGroups(); + comboBoxGroup.DisplayMember = "Name"; + comboBoxGroup.ValueMember = "Id"; + + ColumnDiscipline.DataSource = disciplineRepository.ReadDisciplines(); + ColumnDiscipline.DisplayMember = "Name"; + ColumnDiscipline.ValueMember = "Id"; + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (dataGridViewDisciplines.RowCount < 1 || comboBoxGroup.SelectedIndex < 0 || + string.IsNullOrWhiteSpace(textBoxNameCurriculum.Text) || string.IsNullOrWhiteSpace(textBoxSemester.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + + _studingPlanSupplementRepository.CreateStudingPlanSupplement(StudingPlanSupplement.CreateOperation(0, + (int)comboBoxGroup.SelectedValue!, textBoxNameCurriculum.Text, textBoxSemester.Text, + dateTimePickerDateAdoptionPlan.Value, CreateListDisciplineStudingPlanSupplementsFromDataGrid())); + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private List CreateListDisciplineStudingPlanSupplementsFromDataGrid() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridViewDisciplines.Rows) + { + if (row.Cells["ColumnDiscipline"].Value == null || row.Cells["ColumnQuantityLectures"].Value == null || + row.Cells["ColumnQuantityPractices"].Value == null) + { + continue; + } + + list.Add(DisciplineStudingPlanSupplement.CreateElement(0, Convert.ToInt32(row.Cells["ColumnDiscipline"].Value), + Convert.ToInt32(row.Cells["ColumnQuantityLectures"].Value), + Convert.ToInt32(row.Cells["ColumnQuantityPractices"].Value))); + } + + return list; + } + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplement.resx b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplement.resx new file mode 100644 index 0000000..a2a23f6 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplement.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/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplements.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplements.Designer.cs new file mode 100644 index 0000000..1312cfb --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplements.Designer.cs @@ -0,0 +1,113 @@ +namespace ProjectSchedule.Forms +{ + partial class FormStudingPlanSupplements + { + /// + /// 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() + { + panelButtons = new Panel(); + buttonDel = new Button(); + buttonAdd = new Button(); + dataGridViewData = new DataGridView(); + panelButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); + SuspendLayout(); + // + // panelButtons + // + panelButtons.Controls.Add(buttonDel); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(764, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(140, 453); + panelButtons.TabIndex = 2; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.Del; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(24, 372); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(94, 66); + buttonDel.TabIndex = 4; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources.Add; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(24, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 66); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // dataGridViewData + // + dataGridViewData.AllowUserToAddRows = false; + dataGridViewData.AllowUserToDeleteRows = false; + dataGridViewData.AllowUserToResizeColumns = false; + dataGridViewData.AllowUserToResizeRows = false; + dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewData.Dock = DockStyle.Fill; + dataGridViewData.Location = new Point(0, 0); + dataGridViewData.MultiSelect = false; + dataGridViewData.Name = "dataGridViewData"; + dataGridViewData.ReadOnly = true; + dataGridViewData.RowHeadersVisible = false; + dataGridViewData.RowHeadersWidth = 51; + dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewData.Size = new Size(764, 453); + dataGridViewData.TabIndex = 3; + // + // FormCurriculumSupplements + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(904, 453); + Controls.Add(dataGridViewData); + Controls.Add(panelButtons); + Name = "FormCurriculumSupplements"; + StartPosition = FormStartPosition.CenterParent; + Text = "Дополнения учебного плана"; + Load += FormStudingPlanSupplements_Load; + panelButtons.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panelButtons; + private Button buttonDel; + private Button buttonAdd; + private DataGridView dataGridViewData; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplements.cs b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplements.cs new file mode 100644 index 0000000..bad41e7 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplements.cs @@ -0,0 +1,86 @@ +using ProjectSchedule.Repositories; +using Unity; + +namespace ProjectSchedule.Forms +{ + public partial class FormStudingPlanSupplements : Form + { + private readonly IUnityContainer _container; + + private readonly IStudingPlanSupplementRepository _studingPlanSupplementRepository; + + public FormStudingPlanSupplements(IUnityContainer container, IStudingPlanSupplementRepository studingPlanSupplementRepository) + { + InitializeComponent(); + + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _studingPlanSupplementRepository = studingPlanSupplementRepository ?? + throw new ArgumentNullException(nameof(studingPlanSupplementRepository)); + } + + private void FormStudingPlanSupplements_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().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 + { + _studingPlanSupplementRepository.DeleteStudingPlanSupplement(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => + dataGridViewData.DataSource = _studingPlanSupplementRepository.ReadStudingPlanSupplements(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridViewData.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplements.resx b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplements.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormStudingPlanSupplements.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/ProjectSchedule/ProjectSchedule/Forms/FormTeacher.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormTeacher.Designer.cs new file mode 100644 index 0000000..87b0c9d --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormTeacher.Designer.cs @@ -0,0 +1,140 @@ +namespace ProjectSchedule.Forms +{ + partial class FormTeacher + { + /// + /// 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() + { + labelSurname = new Label(); + labelName = new Label(); + labelPatronymic = new Label(); + textBoxName = new TextBox(); + textBoxSurname = new TextBox(); + textBoxPatronymic = new TextBox(); + buttonSave = new Button(); + buttonCancel = new Button(); + SuspendLayout(); + // + // labelSurname + // + labelSurname.AutoSize = true; + labelSurname.Location = new Point(21, 30); + labelSurname.Name = "labelSurname"; + labelSurname.Size = new Size(76, 20); + labelSurname.TabIndex = 0; + labelSurname.Text = "Фамилия:"; + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(21, 78); + labelName.Name = "labelName"; + labelName.Size = new Size(42, 20); + labelName.TabIndex = 1; + labelName.Text = "Имя:"; + // + // labelPatronymic + // + labelPatronymic.AutoSize = true; + labelPatronymic.Location = new Point(21, 133); + labelPatronymic.Name = "labelPatronymic"; + labelPatronymic.Size = new Size(75, 20); + labelPatronymic.TabIndex = 2; + labelPatronymic.Text = "Отчество:"; + // + // textBoxName + // + textBoxName.Location = new Point(161, 75); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(232, 27); + textBoxName.TabIndex = 3; + // + // textBoxSurname + // + textBoxSurname.Location = new Point(161, 27); + textBoxSurname.Name = "textBoxSurname"; + textBoxSurname.Size = new Size(232, 27); + textBoxSurname.TabIndex = 4; + // + // textBoxPatronymic + // + textBoxPatronymic.Location = new Point(161, 130); + textBoxPatronymic.Name = "textBoxPatronymic"; + textBoxPatronymic.Size = new Size(232, 27); + textBoxPatronymic.TabIndex = 5; + // + // buttonSave + // + buttonSave.Location = new Point(21, 200); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(116, 29); + buttonSave.TabIndex = 6; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(277, 200); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(116, 29); + buttonCancel.TabIndex = 7; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // FormEducator + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(405, 246); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxPatronymic); + Controls.Add(textBoxSurname); + Controls.Add(textBoxName); + Controls.Add(labelPatronymic); + Controls.Add(labelName); + Controls.Add(labelSurname); + Name = "FormEducator"; + StartPosition = FormStartPosition.CenterParent; + Text = "Преподаватель"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelSurname; + private Label labelName; + private Label labelPatronymic; + private TextBox textBoxName; + private TextBox textBoxSurname; + private TextBox textBoxPatronymic; + private Button buttonSave; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormTeacher.cs b/ProjectSchedule/ProjectSchedule/Forms/FormTeacher.cs new file mode 100644 index 0000000..18eb05c --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormTeacher.cs @@ -0,0 +1,71 @@ +using ProjectSchedule.Entities; +using ProjectSchedule.Repositories; + +namespace ProjectSchedule.Forms; + +public partial class FormTeacher : Form +{ + private readonly ITeacherRepository _teacherRepository; + + private int? _teacherId; + + public int Id + { + set + { + try + { + var teacher = _teacherRepository.ReadTeacherById(value); + if (teacher == null) + { + throw new InvalidDataException(nameof(teacher)); + } + + textBoxSurname.Text = teacher.Surname; + textBoxName.Text = teacher.Name; + textBoxPatronymic.Text = teacher.Patronymic; + _teacherId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + public FormTeacher(ITeacherRepository teacherRepository) + { + InitializeComponent(); + _teacherRepository = teacherRepository ?? + throw new ArgumentNullException(nameof(teacherRepository)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxSurname.Text) || string.IsNullOrWhiteSpace(textBoxName.Text) || + string.IsNullOrWhiteSpace(textBoxPatronymic.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + + if (_teacherId.HasValue) + { + _teacherRepository.UpdateTeacher(CreateTeacher(_teacherId.Value)); + } + else + { + _teacherRepository.CreateTeacher(CreateTeacher(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + private Teacher CreateTeacher(int id) => + Teacher.CreateEntity(id, textBoxSurname.Text, textBoxName.Text, textBoxPatronymic.Text); +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormTeacher.resx b/ProjectSchedule/ProjectSchedule/Forms/FormTeacher.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormTeacher.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/ProjectSchedule/ProjectSchedule/Forms/FormTeachers.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormTeachers.Designer.cs new file mode 100644 index 0000000..0aba4b8 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormTeachers.Designer.cs @@ -0,0 +1,127 @@ +namespace ProjectSchedule.Forms +{ + partial class FormTeachers + { + /// + /// 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() + { + panelButtons = new Panel(); + buttonDel = new Button(); + buttonUpd = new Button(); + buttonAdd = new Button(); + dataGridViewData = new DataGridView(); + panelButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); + SuspendLayout(); + // + // panelButtons + // + panelButtons.Controls.Add(buttonDel); + panelButtons.Controls.Add(buttonUpd); + panelButtons.Controls.Add(buttonAdd); + panelButtons.Dock = DockStyle.Right; + panelButtons.Location = new Point(642, 0); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(140, 453); + panelButtons.TabIndex = 1; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.Del; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(24, 194); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(94, 66); + buttonDel.TabIndex = 4; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // buttonUpd + // + buttonUpd.BackgroundImage = Properties.Resources.Upd; + buttonUpd.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpd.Location = new Point(24, 106); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(94, 66); + buttonUpd.TabIndex = 3; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += ButtonUpd_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources.Add; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(24, 12); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 66); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // dataGridViewData + // + dataGridViewData.AllowUserToAddRows = false; + dataGridViewData.AllowUserToDeleteRows = false; + dataGridViewData.AllowUserToResizeColumns = false; + dataGridViewData.AllowUserToResizeRows = false; + dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewData.Dock = DockStyle.Fill; + dataGridViewData.Location = new Point(0, 0); + dataGridViewData.MultiSelect = false; + dataGridViewData.Name = "dataGridViewData"; + dataGridViewData.ReadOnly = true; + dataGridViewData.RowHeadersVisible = false; + dataGridViewData.RowHeadersWidth = 51; + dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewData.Size = new Size(642, 453); + dataGridViewData.TabIndex = 2; + // + // FormEducators + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(782, 453); + Controls.Add(dataGridViewData); + Controls.Add(panelButtons); + Name = "FormEducators"; + StartPosition = FormStartPosition.CenterParent; + Text = "Преподаватели"; + Load += FormTeachers_Load; + panelButtons.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panelButtons; + private Button buttonDel; + private Button buttonUpd; + private Button buttonAdd; + private DataGridView dataGridViewData; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormTeachers.cs b/ProjectSchedule/ProjectSchedule/Forms/FormTeachers.cs new file mode 100644 index 0000000..c6c0749 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormTeachers.cs @@ -0,0 +1,104 @@ +using ProjectSchedule.Repositories; +using Unity; + +namespace ProjectSchedule.Forms +{ + public partial class FormTeachers : Form + { + private readonly IUnityContainer _container; + + private readonly ITeacherRepository _teacherRepository; + + public FormTeachers(IUnityContainer container, ITeacherRepository teacherRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _teacherRepository = teacherRepository ?? + throw new ArgumentNullException(nameof(teacherRepository)); + } + + private void FormTeachers_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + + try + { + _teacherRepository.DeleteTeacher(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridViewData.DataSource = _teacherRepository.ReadTeachers(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridViewData.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormTeachers.resx b/ProjectSchedule/ProjectSchedule/Forms/FormTeachers.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Forms/FormTeachers.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/ProjectSchedule/ProjectSchedule/Program.cs b/ProjectSchedule/ProjectSchedule/Program.cs index 4b18fc6..acf3d64 100644 --- a/ProjectSchedule/ProjectSchedule/Program.cs +++ b/ProjectSchedule/ProjectSchedule/Program.cs @@ -1,3 +1,8 @@ +using ProjectSchedule.Repositories; +using ProjectSchedule.Repositories.Implementations; +using Unity; +using Unity.Lifetime; + namespace ProjectSchedule { internal static class Program @@ -11,7 +16,19 @@ namespace ProjectSchedule // 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(CreateUnityContainer().Resolve()); + } + + private static IUnityContainer CreateUnityContainer() + { + var container = new UnityContainer(); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + return container; } } } \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/ProjectSchedule.csproj b/ProjectSchedule/ProjectSchedule/ProjectSchedule.csproj index 663fdb8..0a35f75 100644 --- a/ProjectSchedule/ProjectSchedule/ProjectSchedule.csproj +++ b/ProjectSchedule/ProjectSchedule/ProjectSchedule.csproj @@ -8,4 +8,20 @@ enable + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Properties/Resources.Designer.cs b/ProjectSchedule/ProjectSchedule/Properties/Resources.Designer.cs new file mode 100644 index 0000000..bbe4050 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectSchedule.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("ProjectSchedule.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 Add { + get { + object obj = ResourceManager.GetObject("добавить", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Del { + get { + object obj = ResourceManager.GetObject("удалить", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Upd { + get { + object obj = ResourceManager.GetObject("редактировать", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Bg { + get { + object obj = ResourceManager.GetObject("фон", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectSchedule/ProjectSchedule/Properties/Resources.resx b/ProjectSchedule/ProjectSchedule/Properties/Resources.resx new file mode 100644 index 0000000..ad1f19f --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/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\добавить.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\редактировать.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\удалить.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\фон.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/IAudienceRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/IAudienceRepository.cs new file mode 100644 index 0000000..0c0b887 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/IAudienceRepository.cs @@ -0,0 +1,17 @@ +using ProjectSchedule.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Repositories; + +public interface IAudienceRepository +{ + IEnumerable ReadAudiences(); + Audience ReadAudienceById(int id); + void CreateAudience(Audience audience); + void UpdateAudience(Audience audience); + void DeleteAudience(int id); +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/IDisciplineRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/IDisciplineRepository.cs new file mode 100644 index 0000000..4170ccd --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/IDisciplineRepository.cs @@ -0,0 +1,17 @@ +using ProjectSchedule.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Repositories; + +public interface IDisciplineRepository +{ + IEnumerable ReadDisciplines(); + Discipline ReadDisciplineById(int id); + void CreateDiscipline(Discipline discipline); + void UpdateDiscipline(Discipline discipline); + void DeleteDiscipline(int id); +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/IGroupRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/IGroupRepository.cs new file mode 100644 index 0000000..d54f076 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/IGroupRepository.cs @@ -0,0 +1,17 @@ +using ProjectSchedule.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Repositories; + +public interface IGroupRepository +{ + IEnumerable ReadGroups(); + Group ReadGroupById(int id); + void CreateGroup(Group group); + void UpdateGroup(Group group); + void DeleteGroup(int id); +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/IScheduleRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/IScheduleRepository.cs new file mode 100644 index 0000000..f4989b6 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/IScheduleRepository.cs @@ -0,0 +1,15 @@ +using ProjectSchedule.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Repositories; + +public interface IScheduleRepository +{ + IEnumerable ReadSchedules(DateTime? dateForm = null, DateTime? dateTo = null, + int? teacherId = null, int? disciplineId = null, int? groupStudentsId = null, int? audienceId = null); + void CreateSchedule(Schedule schedule); +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/IStudingPlanSupplementRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/IStudingPlanSupplementRepository.cs new file mode 100644 index 0000000..634c319 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/IStudingPlanSupplementRepository.cs @@ -0,0 +1,16 @@ +using ProjectSchedule.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Repositories; + +public interface IStudingPlanSupplementRepository +{ + IEnumerable ReadStudingPlanSupplements(DateTime? dateForm = null, DateTime? dateTo = null, + int? disciplineId = null, int? groupStudentsId = null); + void CreateStudingPlanSupplement(StudingPlanSupplement studingPlanSupplement); + void DeleteStudingPlanSupplement(int id); +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/ITeacherRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/ITeacherRepository.cs new file mode 100644 index 0000000..5f83ca3 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/ITeacherRepository.cs @@ -0,0 +1,17 @@ +using ProjectSchedule.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSchedule.Repositories; + +public interface ITeacherRepository +{ + IEnumerable ReadTeachers(); + Teacher ReadTeacherById(int id); + void CreateTeacher(Teacher teacher); + void UpdateTeacher(Teacher teacher); + void DeleteTeacher(int id); +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/Implementations/AudienceRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/AudienceRepository.cs new file mode 100644 index 0000000..0a341ac --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/AudienceRepository.cs @@ -0,0 +1,29 @@ +using ProjectSchedule.Entities; +using ProjectSchedule.Entities.Enums; + +namespace ProjectSchedule.Repositories.Implementations; + +public class AudienceRepository : IAudienceRepository +{ + public void CreateAudience(Audience audience) + { + } + + public void DeleteAudience(int id) + { + } + + public Audience ReadAudienceById(int id) + { + return Audience.CreateEntity(0, string.Empty, TypeAudience.None, 0); + } + + public IEnumerable ReadAudiences() + { + return []; + } + + public void UpdateAudience(Audience audience) + { + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/Implementations/DisciplineRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/DisciplineRepository.cs new file mode 100644 index 0000000..fed1768 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/DisciplineRepository.cs @@ -0,0 +1,28 @@ +using ProjectSchedule.Entities; + +namespace ProjectSchedule.Repositories.Implementations; + +public class DisciplineRepository : IDisciplineRepository +{ + public void CreateDiscipline(Discipline discipline) + { + } + + public void DeleteDiscipline(int id) + { + } + + public Discipline ReadDisciplineById(int id) + { + return Discipline.CreateEntity(0, string.Empty); + } + + public IEnumerable ReadDisciplines() + { + return []; + } + + public void UpdateDiscipline(Discipline discipline) + { + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/Implementations/GroupRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/GroupRepository.cs new file mode 100644 index 0000000..5a32cf3 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/GroupRepository.cs @@ -0,0 +1,24 @@ +using ProjectSchedule.Entities; + +namespace ProjectSchedule.Repositories.Implementations; + +public class GroupRepository : IGroupRepository +{ + public void CreateGroup(Group group) + { + } + public void DeleteGroup(int id) + { + } + public Group ReadGroupById(int id) + { + return Group.CreateEntity(0, string.Empty, string.Empty, 0); + } + public IEnumerable ReadGroups() + { + return []; + } + public void UpdateGroup(Group group) + { + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/Implementations/ScheduleRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/ScheduleRepository.cs new file mode 100644 index 0000000..172f254 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/ScheduleRepository.cs @@ -0,0 +1,16 @@ +using ProjectSchedule.Entities; + +namespace ProjectSchedule.Repositories.Implementations; + +public class ScheduleRepository : IScheduleRepository +{ + public void CreateSchedule(Schedule schedule) + { + } + + public IEnumerable ReadSchedules(DateTime? dateForm = null, DateTime? dateTo = null, + int? teacherId = null, int? disciplineId = null, int? groupStudentsId = null, int? audienceId = null) + { + return []; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/Implementations/StudingPlanSupplementRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/StudingPlanSupplementRepository.cs new file mode 100644 index 0000000..bea1e88 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/StudingPlanSupplementRepository.cs @@ -0,0 +1,18 @@ +using ProjectSchedule.Entities; + +namespace ProjectSchedule.Repositories.Implementations; + +public class StudingPlanSupplementRepository : IStudingPlanSupplementRepository +{ + public void CreateStudingPlanSupplement(StudingPlanSupplement studingPlanSupplement) + { + } + public void DeleteStudingPlanSupplement(int id) + { + } + public IEnumerable ReadStudingPlanSupplements(DateTime? dateForm = null, DateTime? dateTo = null, + int? disciplineId = null, int? groupStudentsId = null) + { + return []; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/Implementations/TeacherRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/TeacherRepository.cs new file mode 100644 index 0000000..8f266e2 --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Repositories/Implementations/TeacherRepository.cs @@ -0,0 +1,24 @@ +using ProjectSchedule.Entities; + +namespace ProjectSchedule.Repositories.Implementations; + +public class TeacherRepository : ITeacherRepository +{ + public void CreateTeacher(Teacher teacher) + { + } + public void DeleteTeacher(int id) + { + } + public Teacher ReadTeacherById(int id) + { + return Teacher.CreateEntity(0, string.Empty, string.Empty, string.Empty); + } + public IEnumerable ReadTeachers() + { + return []; + } + public void UpdateTeacher(Teacher teacher) + { + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Resources/добавить.jpg b/ProjectSchedule/ProjectSchedule/Resources/добавить.jpg new file mode 100644 index 0000000..f3f1760 Binary files /dev/null and b/ProjectSchedule/ProjectSchedule/Resources/добавить.jpg differ diff --git a/ProjectSchedule/ProjectSchedule/Resources/редактировать.jpg b/ProjectSchedule/ProjectSchedule/Resources/редактировать.jpg new file mode 100644 index 0000000..82d2819 Binary files /dev/null and b/ProjectSchedule/ProjectSchedule/Resources/редактировать.jpg differ diff --git a/ProjectSchedule/ProjectSchedule/Resources/удалить.jpg b/ProjectSchedule/ProjectSchedule/Resources/удалить.jpg new file mode 100644 index 0000000..f879e35 Binary files /dev/null and b/ProjectSchedule/ProjectSchedule/Resources/удалить.jpg differ diff --git a/ProjectSchedule/ProjectSchedule/Resources/фон.jpg b/ProjectSchedule/ProjectSchedule/Resources/фон.jpg new file mode 100644 index 0000000..1435887 Binary files /dev/null and b/ProjectSchedule/ProjectSchedule/Resources/фон.jpg differ