PIbd-24_Calimullin_A.R._LabWork01 #1

Open
Bloody_Arthur wants to merge 6 commits from LabWork_1 into main
11 changed files with 38 additions and 9 deletions
Showing only changes of commit 3f98e2cf2a - Show all commits

View File

@ -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;

View File

@ -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
//

View File

@ -11,7 +11,6 @@ namespace ProjectSchedule.Forms
IDisciplineRepository disciplineRepository, IGroupStudentsRepository groupStudentsRepository)
{
InitializeComponent();
_curriculumSupplementRepository = curriculumSupplementRepository ??
throw new ArgumentNullException(nameof(curriculumSupplementRepository));

View File

@ -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);

View File

@ -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));

View File

@ -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;

View File

@ -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));

View File

@ -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;

View File

@ -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
//

View File

@ -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));
}

View File

@ -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;