diff --git a/ProjectSchedule/ProjectSchedule/Entities/Audience.cs b/ProjectSchedule/ProjectSchedule/Entities/Audience.cs index cd6518a..c981830 100644 --- a/ProjectSchedule/ProjectSchedule/Entities/Audience.cs +++ b/ProjectSchedule/ProjectSchedule/Entities/Audience.cs @@ -5,9 +5,13 @@ namespace ProjectSchedule.Entities; public class Audience { public int Id { get; private set; } + public string NumberAudience { get; private set; } = string.Empty; + public TypeAudience TypeAudience { get; private set; } + public int QuantitySeats { get; private set; } + public static Audience CreateEntity(int id, string numberAudience, TypeAudience typeAudience, int quantitySeats) { return new Audience diff --git a/ProjectSchedule/ProjectSchedule/Entities/CompilingSchedule.cs b/ProjectSchedule/ProjectSchedule/Entities/CompilingSchedule.cs index 2e6382c..3e7ee5d 100644 --- a/ProjectSchedule/ProjectSchedule/Entities/CompilingSchedule.cs +++ b/ProjectSchedule/ProjectSchedule/Entities/CompilingSchedule.cs @@ -5,14 +5,23 @@ namespace ProjectSchedule.Entities; public class CompilingSchedule { public int Id { get; private set; } + public int EducatorId { get; private set; } + public int DisciplineId { get; private set; } + public int GroupStudentsId { get; private set; } + public int AudienceId { get; private set; } + public TypeWeek TypeWeek { get; private set; } + public int NumberDay { get; private set; } + public int NumberPair { get; private set; } + public TypeActivity TypeActivity { get; private set; } + public static CompilingSchedule CreateOperation(int id, int educatorId, int disciplineId, int groupStudentsId, int audienceId, TypeWeek typeWeek, int numberDay, int numberPair, TypeActivity typeActivity) { diff --git a/ProjectSchedule/ProjectSchedule/Entities/CurriculumSupplement.cs b/ProjectSchedule/ProjectSchedule/Entities/CurriculumSupplement.cs index 3e028f1..604ad13 100644 --- a/ProjectSchedule/ProjectSchedule/Entities/CurriculumSupplement.cs +++ b/ProjectSchedule/ProjectSchedule/Entities/CurriculumSupplement.cs @@ -3,24 +3,25 @@ public class CurriculumSupplement { public int Id { get; private set; } - public int DisciplineId { get; private set; } + public int GroupStudentsId { get; private set; } - public string NameCurriculum { get; private set; } = string.Empty; - public int QuantityLectures { get; private set; } - public int QuantityPractices { get; private set; } + + public string NameCurriculum { get; private set; } = string.Empty; + public string Semester { get; private set; } = string.Empty; - public static CurriculumSupplement CreateOperation(int id, int disciplineId, int groupStudentsId, string nameCurriculum, - int quantityLectures, int quantityPractices, string semester) + + public IEnumerable DisciplineCurriculumSupplements { get; private set; } = []; + + public static CurriculumSupplement CreateOperation(int id, int groupStudentsId, string nameCurriculum, + string semester, IEnumerable disciplineCurriculumSupplements) { return new CurriculumSupplement { Id = id, - DisciplineId = disciplineId, GroupStudentsId = groupStudentsId, NameCurriculum = nameCurriculum ?? string.Empty, - QuantityLectures = quantityLectures, - QuantityPractices = quantityPractices, - Semester = semester ?? string.Empty + Semester = semester ?? string.Empty, + DisciplineCurriculumSupplements = disciplineCurriculumSupplements }; } } \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/Discipline.cs b/ProjectSchedule/ProjectSchedule/Entities/Discipline.cs index 706fb39..5b1df40 100644 --- a/ProjectSchedule/ProjectSchedule/Entities/Discipline.cs +++ b/ProjectSchedule/ProjectSchedule/Entities/Discipline.cs @@ -3,7 +3,9 @@ public class Discipline { public int Id { get; private set; } + public string NameDiscipline { get; private set; } = string.Empty; + public static Discipline CreateEntity(int id, string nameDiscipline) { return new Discipline diff --git a/ProjectSchedule/ProjectSchedule/Entities/DisciplineCurriculumSupplement.cs b/ProjectSchedule/ProjectSchedule/Entities/DisciplineCurriculumSupplement.cs new file mode 100644 index 0000000..2ff4e0b --- /dev/null +++ b/ProjectSchedule/ProjectSchedule/Entities/DisciplineCurriculumSupplement.cs @@ -0,0 +1,23 @@ +namespace ProjectSchedule.Entities; + +public class DisciplineCurriculumSupplement +{ + public int Id { get; private set; } + + public int DisciplineId { get; private set; } + + public int QuantityLectures { get; private set; } + + public int QuantityPractices { get; private set; } + + public static DisciplineCurriculumSupplement CreateElement(int id, int disciplineId, int quantityLectures, int quantityPractices) + { + return new DisciplineCurriculumSupplement + { + Id = id, + DisciplineId = disciplineId, + QuantityLectures = quantityLectures, + QuantityPractices = quantityPractices + }; + } +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Entities/Educator.cs b/ProjectSchedule/ProjectSchedule/Entities/Educator.cs index a22e0b4..9d1501b 100644 --- a/ProjectSchedule/ProjectSchedule/Entities/Educator.cs +++ b/ProjectSchedule/ProjectSchedule/Entities/Educator.cs @@ -3,9 +3,13 @@ public class Educator { 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 Educator CreateEntity(int id, string surname, string name, string patronymic) { return new Educator diff --git a/ProjectSchedule/ProjectSchedule/Entities/GroupStudents.cs b/ProjectSchedule/ProjectSchedule/Entities/GroupStudents.cs index 88122f6..ffce5c2 100644 --- a/ProjectSchedule/ProjectSchedule/Entities/GroupStudents.cs +++ b/ProjectSchedule/ProjectSchedule/Entities/GroupStudents.cs @@ -3,9 +3,13 @@ public class GroupStudents { public int Id { get; private set; } + public string AbbreviationGroup { get; private set; } = string.Empty; + public string GroupNumber { get; private set; } = string.Empty; + public int QuantityStudents { get; private set; } + public static GroupStudents CreateEntity(int id, string abbreviationGroup, string groupNumber, int quantityStudents) { return new GroupStudents diff --git a/ProjectSchedule/ProjectSchedule/FormSchedule.cs b/ProjectSchedule/ProjectSchedule/FormSchedule.cs index 78c7207..eaf8a85 100644 --- a/ProjectSchedule/ProjectSchedule/FormSchedule.cs +++ b/ProjectSchedule/ProjectSchedule/FormSchedule.cs @@ -92,4 +92,4 @@ namespace ProjectSchedule } } } -} +} \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.Designer.cs index bdbf405..9aa10f6 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.Designer.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.Designer.cs @@ -28,55 +28,36 @@ /// private void InitializeComponent() { - comboBoxDiscipline = new ComboBox(); comboBoxGroupStudents = new ComboBox(); - labelDiscipline = new Label(); labelGroupStudents = new Label(); labelNameCurriculum = new Label(); - labelQuantityLectures = new Label(); - labelQuantityPractices = new Label(); labelSemester = new Label(); textBoxNameCurriculum = new TextBox(); - numericUpDownQuantityLectures = new NumericUpDown(); - numericUpDownQuantityPractices = new NumericUpDown(); buttonSave = new Button(); buttonCancel = new Button(); textBoxSemester = new TextBox(); - ((System.ComponentModel.ISupportInitialize)numericUpDownQuantityLectures).BeginInit(); - ((System.ComponentModel.ISupportInitialize)numericUpDownQuantityPractices).BeginInit(); + groupBoxDisciplines = new GroupBox(); + dataGridViewDisciplines = new DataGridView(); + ColumnDiscipline = new DataGridViewComboBoxColumn(); + ColumnQuantityLectures = new DataGridViewTextBoxColumn(); + ColumnQuantityPractices = new DataGridViewTextBoxColumn(); + groupBoxDisciplines.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewDisciplines).BeginInit(); SuspendLayout(); // - // comboBoxDiscipline - // - comboBoxDiscipline.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxDiscipline.FormattingEnabled = true; - comboBoxDiscipline.Location = new Point(252, 12); - comboBoxDiscipline.Name = "comboBoxDiscipline"; - comboBoxDiscipline.Size = new Size(218, 28); - comboBoxDiscipline.TabIndex = 0; - // // comboBoxGroupStudents // comboBoxGroupStudents.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxGroupStudents.FormattingEnabled = true; - comboBoxGroupStudents.Location = new Point(252, 68); + comboBoxGroupStudents.Location = new Point(252, 6); comboBoxGroupStudents.Name = "comboBoxGroupStudents"; comboBoxGroupStudents.Size = new Size(218, 28); comboBoxGroupStudents.TabIndex = 1; // - // labelDiscipline - // - labelDiscipline.AutoSize = true; - labelDiscipline.Location = new Point(12, 15); - labelDiscipline.Name = "labelDiscipline"; - labelDiscipline.Size = new Size(99, 20); - labelDiscipline.TabIndex = 2; - labelDiscipline.Text = "Дисциплина:"; - // // labelGroupStudents // labelGroupStudents.AutoSize = true; - labelGroupStudents.Location = new Point(12, 71); + labelGroupStudents.Location = new Point(12, 9); labelGroupStudents.Name = "labelGroupStudents"; labelGroupStudents.Size = new Size(133, 20); labelGroupStudents.TabIndex = 3; @@ -85,34 +66,16 @@ // labelNameCurriculum // labelNameCurriculum.AutoSize = true; - labelNameCurriculum.Location = new Point(12, 130); + labelNameCurriculum.Location = new Point(12, 46); labelNameCurriculum.Name = "labelNameCurriculum"; labelNameCurriculum.Size = new Size(230, 20); labelNameCurriculum.TabIndex = 4; labelNameCurriculum.Text = "Название учебной программы:"; // - // labelQuantityLectures - // - labelQuantityLectures.AutoSize = true; - labelQuantityLectures.Location = new Point(12, 189); - labelQuantityLectures.Name = "labelQuantityLectures"; - labelQuantityLectures.Size = new Size(147, 20); - labelQuantityLectures.TabIndex = 5; - labelQuantityLectures.Text = "Количество лекций:"; - // - // labelQuantityPractices - // - labelQuantityPractices.AutoSize = true; - labelQuantityPractices.Location = new Point(12, 236); - labelQuantityPractices.Name = "labelQuantityPractices"; - labelQuantityPractices.Size = new Size(152, 20); - labelQuantityPractices.TabIndex = 6; - labelQuantityPractices.Text = "Количество практик:"; - // // labelSemester // labelSemester.AutoSize = true; - labelSemester.Location = new Point(12, 278); + labelSemester.Location = new Point(12, 83); labelSemester.Name = "labelSemester"; labelSemester.Size = new Size(70, 20); labelSemester.TabIndex = 7; @@ -120,30 +83,15 @@ // // textBoxNameCurriculum // - textBoxNameCurriculum.Location = new Point(252, 127); + textBoxNameCurriculum.Location = new Point(252, 43); textBoxNameCurriculum.Name = "textBoxNameCurriculum"; textBoxNameCurriculum.Size = new Size(218, 27); textBoxNameCurriculum.TabIndex = 8; // - // numericUpDownQuantityLectures - // - numericUpDownQuantityLectures.Location = new Point(252, 187); - numericUpDownQuantityLectures.Maximum = new decimal(new int[] { 40, 0, 0, 0 }); - numericUpDownQuantityLectures.Name = "numericUpDownQuantityLectures"; - numericUpDownQuantityLectures.Size = new Size(218, 27); - numericUpDownQuantityLectures.TabIndex = 10; - // - // numericUpDownQuantityPractices - // - numericUpDownQuantityPractices.Location = new Point(252, 234); - numericUpDownQuantityPractices.Maximum = new decimal(new int[] { 40, 0, 0, 0 }); - numericUpDownQuantityPractices.Name = "numericUpDownQuantityPractices"; - numericUpDownQuantityPractices.Size = new Size(218, 27); - numericUpDownQuantityPractices.TabIndex = 11; - // // buttonSave // - buttonSave.Location = new Point(12, 312); + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonSave.Location = new Point(12, 462); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(116, 29); buttonSave.TabIndex = 12; @@ -153,7 +101,8 @@ // // buttonCancel // - buttonCancel.Location = new Point(354, 312); + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Location = new Point(354, 462); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(116, 29); buttonCancel.TabIndex = 13; @@ -163,55 +112,93 @@ // // textBoxSemester // - textBoxSemester.Location = new Point(252, 275); + 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, 113); + 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"; + // // FormCurriculumSupplement // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(482, 353); + ClientSize = new Size(482, 503); + Controls.Add(groupBoxDisciplines); Controls.Add(textBoxSemester); Controls.Add(buttonCancel); Controls.Add(buttonSave); - Controls.Add(numericUpDownQuantityPractices); - Controls.Add(numericUpDownQuantityLectures); Controls.Add(textBoxNameCurriculum); Controls.Add(labelSemester); - Controls.Add(labelQuantityPractices); - Controls.Add(labelQuantityLectures); Controls.Add(labelNameCurriculum); Controls.Add(labelGroupStudents); - Controls.Add(labelDiscipline); Controls.Add(comboBoxGroupStudents); - Controls.Add(comboBoxDiscipline); Name = "FormCurriculumSupplement"; StartPosition = FormStartPosition.CenterParent; Text = "Дополнение учебного плана"; - ((System.ComponentModel.ISupportInitialize)numericUpDownQuantityLectures).EndInit(); - ((System.ComponentModel.ISupportInitialize)numericUpDownQuantityPractices).EndInit(); + groupBoxDisciplines.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewDisciplines).EndInit(); ResumeLayout(false); PerformLayout(); } #endregion - - private ComboBox comboBoxDiscipline; private ComboBox comboBoxGroupStudents; - private Label labelDiscipline; private Label labelGroupStudents; private Label labelNameCurriculum; - private Label labelQuantityLectures; - private Label labelQuantityPractices; private Label labelSemester; private TextBox textBoxNameCurriculum; - private NumericUpDown numericUpDownQuantityLectures; - private NumericUpDown numericUpDownQuantityPractices; private Button buttonSave; private Button buttonCancel; private NumericUpDown numericUpDown; private TextBox textBoxSemester; + private GroupBox groupBoxDisciplines; + private DataGridView dataGridViewDisciplines; + private DataGridViewComboBoxColumn ColumnDiscipline; + private DataGridViewTextBoxColumn ColumnQuantityLectures; + private DataGridViewTextBoxColumn ColumnQuantityPractices; } } \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.cs b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.cs index e671ef4..354de0e 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.cs @@ -15,28 +15,27 @@ namespace ProjectSchedule.Forms _curriculumSupplementRepository = curriculumSupplementRepository ?? throw new ArgumentNullException(nameof(curriculumSupplementRepository)); - comboBoxDiscipline.DataSource = disciplineRepository.ReadDisciplines(); - comboBoxDiscipline.DisplayMember = "NameDiscipline"; - comboBoxDiscipline.ValueMember = "Id"; - comboBoxGroupStudents.DataSource = groupStudentsRepository.ReadGroupsStudents(); comboBoxGroupStudents.DisplayMember = "AbbreviationGroup"; comboBoxGroupStudents.ValueMember = "Id"; + + ColumnDiscipline.DataSource = disciplineRepository.ReadDisciplines(); + ColumnDiscipline.DisplayMember = "NameDiscipline"; + ColumnDiscipline.ValueMember = "Id"; } private void ButtonSave_Click(object sender, EventArgs e) { try { - if (comboBoxDiscipline.SelectedIndex < 0 || comboBoxGroupStudents.SelectedIndex < 0) + if (dataGridViewDisciplines.RowCount < 1 || comboBoxGroupStudents.SelectedIndex < 0) { throw new Exception("Имеются незаполненные поля"); } _curriculumSupplementRepository.CreateCurriculumSupplement(CurriculumSupplement.CreateOperation(0, - (int)comboBoxDiscipline.SelectedValue!, (int)comboBoxGroupStudents.SelectedValue!, - textBoxNameCurriculum.Text, Convert.ToInt32(numericUpDownQuantityLectures.Value), - Convert.ToInt32(numericUpDownQuantityPractices.Value), textBoxSemester.Text)); + (int)comboBoxGroupStudents.SelectedValue!, textBoxNameCurriculum.Text, textBoxSemester.Text, + CreateListDisciplineCurriculumSupplementsFromDataGrid())); Close(); } @@ -47,5 +46,24 @@ namespace ProjectSchedule.Forms } private void ButtonCancel_Click(object sender, EventArgs e) => Close(); - } + + private List CreateListDisciplineCurriculumSupplementsFromDataGrid() + { + 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(DisciplineCurriculumSupplement.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/FormCurriculumSupplement.resx b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.resx index af32865..a2a23f6 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.resx +++ b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.resx @@ -117,4 +117,13 @@ 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/Repositories/ICompilingScheduleRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/ICompilingScheduleRepository.cs index 02dca44..7a2b55e 100644 --- a/ProjectSchedule/ProjectSchedule/Repositories/ICompilingScheduleRepository.cs +++ b/ProjectSchedule/ProjectSchedule/Repositories/ICompilingScheduleRepository.cs @@ -6,6 +6,8 @@ public interface ICompilingScheduleRepository { IEnumerable ReadCompilingSchedules(int? educatorId = null, int? disciplineId = null, int? groupStudentsId = null, int? audienceId = null); + void CreateCompilingSchedule(CompilingSchedule compilingSchedule); + void DeleteCompilingSchedule(int id); } \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Repositories/ICurriculumSupplementRepository.cs b/ProjectSchedule/ProjectSchedule/Repositories/ICurriculumSupplementRepository.cs index ce92524..75f37e6 100644 --- a/ProjectSchedule/ProjectSchedule/Repositories/ICurriculumSupplementRepository.cs +++ b/ProjectSchedule/ProjectSchedule/Repositories/ICurriculumSupplementRepository.cs @@ -5,6 +5,8 @@ namespace ProjectSchedule.Repositories; public interface ICurriculumSupplementRepository { IEnumerable ReadCurriculumSupplements(int? disciplineId = null, int? groupStudentsId = null); + void CreateCurriculumSupplement(CurriculumSupplement curriculumSupplement); + void DeleteCurriculumSupplement(int id); } \ No newline at end of file