diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.cs b/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.cs index d982761..4c24825 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormAudiences.cs @@ -8,6 +8,7 @@ namespace ProjectSchedule.Forms private readonly IUnityContainer _container; private readonly IAudienceRepository _audienceRepository; + public FormAudiences(IUnityContainer container, IAudienceRepository audienceRepository) { InitializeComponent(); @@ -16,6 +17,7 @@ namespace ProjectSchedule.Forms _audienceRepository = audienceRepository ?? throw new ArgumentNullException(nameof(audienceRepository)); } + private void FormAudiences_Load(object sender, EventArgs e) { try @@ -27,6 +29,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonAdd_Click(object sender, EventArgs e) { try @@ -39,6 +42,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonUpd_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) @@ -58,6 +62,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonDel_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) @@ -82,6 +87,7 @@ namespace ProjectSchedule.Forms } private void LoadList() => dataGridViewData.DataSource = _audienceRepository.ReadAudiences(); + private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0; diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedule.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedule.Designer.cs index 8ae86f8..24f562c 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedule.Designer.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedule.Designer.cs @@ -180,17 +180,21 @@ // numericUpDownNumberPair.Location = new Point(245, 302); 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, 257); 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 // diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.cs b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.cs index bf7c860..12a5358 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.cs @@ -11,7 +11,6 @@ namespace ProjectSchedule.Forms IDisciplineRepository disciplineRepository, IGroupStudentsRepository groupStudentsRepository) { InitializeComponent(); - _curriculumSupplementRepository = curriculumSupplementRepository ?? throw new ArgumentNullException(nameof(curriculumSupplementRepository)); diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplements.cs b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplements.cs index 07aa7de..ebefab8 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplements.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplements.cs @@ -67,15 +67,12 @@ namespace ProjectSchedule.Forms } } - private void LoadList() - { + private void LoadList() => dataGridViewData.DataSource = _curriculumSupplementRepository.ReadCurriculumSupplements(); - } private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0; - if (dataGridViewData.SelectedRows.Count < 1) { MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.cs b/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.cs index a523847..5acb941 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.cs @@ -20,6 +20,7 @@ public partial class FormDiscipline : Form { throw new InvalidDataException(nameof(discipline)); } + textBoxNameDiscipline.Text = discipline.NameDiscipline; _disciplineId = value; } @@ -46,6 +47,7 @@ public partial class FormDiscipline : Form { throw new Exception("Поле 'Название дисциплины' должно быть заполнено."); } + if (_disciplineId.HasValue) { _disciplineRepository.UpdateDiscipline(CreateDiscipline(_disciplineId.Value)); diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.cs b/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.cs index 3211251..a8bdced 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.cs @@ -8,6 +8,7 @@ namespace ProjectSchedule.Forms private readonly IUnityContainer _container; private readonly IDisciplineRepository _disciplineRepository; + public FormDisciplines(IUnityContainer container, IDisciplineRepository disciplineRepository) { InitializeComponent(); @@ -16,6 +17,7 @@ namespace ProjectSchedule.Forms _disciplineRepository = disciplineRepository ?? throw new ArgumentNullException(nameof(disciplineRepository)); } + private void FormDisciplines_Load(object sender, EventArgs e) { try @@ -27,6 +29,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonAdd_Click(object sender, EventArgs e) { try @@ -39,6 +42,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonUpd_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) @@ -58,6 +62,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonDel_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) @@ -82,6 +87,7 @@ namespace ProjectSchedule.Forms } private void LoadList() => dataGridViewData.DataSource = _disciplineRepository.ReadDisciplines(); + private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0; diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormEducator.cs b/ProjectSchedule/ProjectSchedule/Forms/FormEducator.cs index 8ba5ec6..28c6163 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormEducator.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormEducator.cs @@ -20,6 +20,7 @@ public partial class FormEducator : Form { throw new InvalidDataException(nameof(educator)); } + textBoxSurname.Text = educator.Surname; textBoxName.Text = educator.Name; textBoxPatronymic.Text = educator.Patronymic; @@ -49,6 +50,7 @@ public partial class FormEducator : Form { throw new Exception("Имеются незаполненные поля"); } + if (_educatorId.HasValue) { _educatorRepository.UpdateEducator(CreateEducator(_educatorId.Value)); diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormEducators.cs b/ProjectSchedule/ProjectSchedule/Forms/FormEducators.cs index d233401..f565951 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormEducators.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormEducators.cs @@ -8,6 +8,7 @@ namespace ProjectSchedule.Forms private readonly IUnityContainer _container; private readonly IEducatorRepository _educatorRepository; + public FormEducators(IUnityContainer container, IEducatorRepository educatorRepository) { InitializeComponent(); @@ -16,6 +17,7 @@ namespace ProjectSchedule.Forms _educatorRepository = educatorRepository ?? throw new ArgumentNullException(nameof(educatorRepository)); } + private void FormEducators_Load(object sender, EventArgs e) { try @@ -27,6 +29,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonAdd_Click(object sender, EventArgs e) { try @@ -39,6 +42,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonUpd_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) @@ -58,6 +62,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonDel_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) @@ -82,6 +87,7 @@ namespace ProjectSchedule.Forms } private void LoadList() => dataGridViewData.DataSource = _educatorRepository.ReadEducators(); + private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0; diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.Designer.cs b/ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.Designer.cs index d4979e5..4cc0f81 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.Designer.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.Designer.cs @@ -70,9 +70,11 @@ // numericUpDownQuantityStudents.Location = new Point(213, 121); numericUpDownQuantityStudents.Maximum = new decimal(new int[] { 66, 0, 0, 0 }); + numericUpDownQuantityStudents.Minimum = new decimal(new int[] { 2, 0, 0, 0 }); numericUpDownQuantityStudents.Name = "numericUpDownQuantityStudents"; numericUpDownQuantityStudents.Size = new Size(176, 27); numericUpDownQuantityStudents.TabIndex = 3; + numericUpDownQuantityStudents.Value = new decimal(new int[] { 2, 0, 0, 0 }); // // textBoxAbbreviationGroup // diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.cs b/ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.cs index 7d8aa92..3ba0444 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.cs @@ -20,6 +20,7 @@ public partial class FormGroupStudents : Form { throw new InvalidDataException(nameof(groupStudents)); } + textBoxAbbreviationGroup.Text = groupStudents.AbbreviationGroup; textBoxGroupNumber.Text = groupStudents.GroupNumber; numericUpDownQuantityStudents.Value = groupStudents.QuantityStudents; @@ -68,8 +69,6 @@ public partial class FormGroupStudents : Form private void ButtonCancel_Click(object sender, EventArgs e) => Close(); - private GroupStudents CreateGroupOfStudents(int id) - { - return GroupStudents.CreateEntity(id, textBoxAbbreviationGroup.Text, textBoxGroupNumber.Text, Convert.ToInt32(numericUpDownQuantityStudents.Value)); - } + private GroupStudents CreateGroupOfStudents(int id) => + GroupStudents.CreateEntity(id, textBoxAbbreviationGroup.Text, textBoxGroupNumber.Text, Convert.ToInt32(numericUpDownQuantityStudents.Value)); } \ No newline at end of file diff --git a/ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.cs b/ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.cs index f9eaa89..0e4a0b8 100644 --- a/ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.cs +++ b/ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.cs @@ -8,6 +8,7 @@ namespace ProjectSchedule.Forms private readonly IUnityContainer _container; private readonly IGroupStudentsRepository _groupStudentsRepository; + public FormGroupsStudents(IUnityContainer container, IGroupStudentsRepository groupStudentsRepository) { InitializeComponent(); @@ -16,6 +17,7 @@ namespace ProjectSchedule.Forms _groupStudentsRepository = groupStudentsRepository ?? throw new ArgumentNullException(nameof(groupStudentsRepository)); } + private void FormGroupsStudents_Load(object sender, EventArgs e) { try @@ -27,6 +29,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonAdd_Click(object sender, EventArgs e) { try @@ -39,6 +42,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonUpd_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) @@ -58,6 +62,7 @@ namespace ProjectSchedule.Forms MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + private void ButtonDel_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) @@ -82,6 +87,7 @@ namespace ProjectSchedule.Forms } private void LoadList() => dataGridViewData.DataSource = _groupStudentsRepository.ReadGroupsStudents(); + private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0;