From c90f675d676cdff9a7ee9169db106a233fdb303c Mon Sep 17 00:00:00 2001 From: "ityurner02@mail.ru" Date: Thu, 13 Apr 2023 22:44:54 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B2=D1=81=D0=B5=D1=85=20=D1=81=D1=83=D1=89=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormCreateResultOfControl.Designer.cs | 190 ++++++++++++++++ SUBD/SUBD/FormCreateResultOfControl.cs | 118 ++++++++++ SUBD/SUBD/FormCreateResultOfControl.resx | 60 +++++ SUBD/SUBD/FormCreateStatement.Designer.cs | 170 ++++++++++++++ SUBD/SUBD/FormCreateStatement.cs | 126 +++++++++++ SUBD/SUBD/FormCreateStatement.resx | 60 +++++ SUBD/SUBD/FormResultOfControl.Designer.cs | 209 ++++++++++++++++++ SUBD/SUBD/FormResultOfControl.cs | 169 ++++++++++++++ SUBD/SUBD/FormResultOfControl.resx | 120 ++++++++++ SUBD/SUBD/FormStatement.Designer.cs | 209 ++++++++++++++++++ SUBD/SUBD/FormStatement.cs | 176 +++++++++++++++ SUBD/SUBD/FormStatement.resx | 120 ++++++++++ SUBD/SUBD/Program.cs | 6 +- 13 files changed, 1732 insertions(+), 1 deletion(-) create mode 100644 SUBD/SUBD/FormCreateResultOfControl.Designer.cs create mode 100644 SUBD/SUBD/FormCreateResultOfControl.cs create mode 100644 SUBD/SUBD/FormCreateResultOfControl.resx create mode 100644 SUBD/SUBD/FormCreateStatement.Designer.cs create mode 100644 SUBD/SUBD/FormCreateStatement.cs create mode 100644 SUBD/SUBD/FormCreateStatement.resx create mode 100644 SUBD/SUBD/FormResultOfControl.Designer.cs create mode 100644 SUBD/SUBD/FormResultOfControl.cs create mode 100644 SUBD/SUBD/FormResultOfControl.resx create mode 100644 SUBD/SUBD/FormStatement.Designer.cs create mode 100644 SUBD/SUBD/FormStatement.cs create mode 100644 SUBD/SUBD/FormStatement.resx diff --git a/SUBD/SUBD/FormCreateResultOfControl.Designer.cs b/SUBD/SUBD/FormCreateResultOfControl.Designer.cs new file mode 100644 index 0000000..911a03c --- /dev/null +++ b/SUBD/SUBD/FormCreateResultOfControl.Designer.cs @@ -0,0 +1,190 @@ +namespace SUBD +{ + partial class FormCreateResultOfControl + { + /// + /// 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() + { + comboBoxStudent = new ComboBox(); + comboBoxStatement = new ComboBox(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + datePicker = new DateTimePicker(); + label1 = new Label(); + label2 = new Label(); + label3 = new Label(); + label4 = new Label(); + label5 = new Label(); + textBoxForm = new TextBox(); + textBoxMark = new TextBox(); + SuspendLayout(); + // + // comboBoxStudent + // + comboBoxStudent.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStudent.FormattingEnabled = true; + comboBoxStudent.Location = new Point(119, 134); + comboBoxStudent.Name = "comboBoxStudent"; + comboBoxStudent.Size = new Size(250, 28); + comboBoxStudent.TabIndex = 0; + // + // comboBoxStatement + // + comboBoxStatement.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStatement.FormattingEnabled = true; + comboBoxStatement.Location = new Point(119, 169); + comboBoxStatement.Name = "comboBoxStatement"; + comboBoxStatement.Size = new Size(250, 28); + comboBoxStatement.TabIndex = 1; + // + // ButtonSave + // + ButtonSave.Location = new Point(14, 229); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(94, 29); + ButtonSave.TabIndex = 6; + ButtonSave.Text = "Сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(119, 229); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(94, 29); + ButtonCancel.TabIndex = 7; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // datePicker + // + datePicker.Location = new Point(119, 54); + datePicker.Name = "datePicker"; + datePicker.Size = new Size(250, 27); + datePicker.TabIndex = 3; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(14, 59); + label1.Name = "label1"; + label1.Size = new Size(41, 20); + label1.TabIndex = 8; + label1.Text = "Дата"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(12, 137); + label2.Name = "label2"; + label2.Size = new Size(62, 20); + label2.TabIndex = 9; + label2.Text = "Студент"; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(14, 172); + label3.Name = "label3"; + label3.Size = new Size(84, 20); + label3.TabIndex = 10; + label3.Text = "Ведомость"; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(14, 18); + label4.Name = "label4"; + label4.Size = new Size(57, 20); + label4.TabIndex = 11; + label4.Text = "Форма"; + // + // label5 + // + label5.AutoSize = true; + label5.Location = new Point(13, 94); + label5.Name = "label5"; + label5.Size = new Size(61, 20); + label5.TabIndex = 12; + label5.Text = "Оценка"; + // + // textBoxForm + // + textBoxForm.Location = new Point(119, 15); + textBoxForm.Name = "textBoxForm"; + textBoxForm.Size = new Size(250, 27); + textBoxForm.TabIndex = 13; + // + // textBoxMark + // + textBoxMark.Location = new Point(119, 91); + textBoxMark.Name = "textBoxMark"; + textBoxMark.Size = new Size(250, 27); + textBoxMark.TabIndex = 14; + // + // FormCreateResultOfControl + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(379, 274); + Controls.Add(textBoxMark); + Controls.Add(textBoxForm); + Controls.Add(label5); + Controls.Add(label4); + Controls.Add(label3); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(datePicker); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Controls.Add(comboBoxStatement); + Controls.Add(comboBoxStudent); + FormBorderStyle = FormBorderStyle.FixedToolWindow; + Name = "FormCreateResultOfControl"; + Text = "Создание результата"; + Load += FormCreateResult_Load; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBoxStudent; + private ComboBox comboBoxStatement; + private TextBox textBoxDate; + private Button ButtonSave; + private Button ButtonCancel; + private DateTimePicker datePicker; + private Label label1; + private Label label2; + private Label label3; + private Label label4; + private Label label5; + private TextBox textBoxForm; + private TextBox textBoxMark; + } +} \ No newline at end of file diff --git a/SUBD/SUBD/FormCreateResultOfControl.cs b/SUBD/SUBD/FormCreateResultOfControl.cs new file mode 100644 index 0000000..8d4ca73 --- /dev/null +++ b/SUBD/SUBD/FormCreateResultOfControl.cs @@ -0,0 +1,118 @@ +using ElectronicJournalContracts.BindingModels; +using ElectronicJournalContracts.BusinessLogicContracts; +using ElectronicJournalContracts.SearchModels; +using Microsoft.Extensions.Logging; +using System.Windows.Forms; + +namespace SUBD +{ + public partial class FormCreateResultOfControl : Form + { + private readonly ILogger _logger; + private readonly IStudentLogic _STlogic; + private readonly IStatementLogic _Slogic; + private readonly IResultOfControlLogic _Rlogic; + private int? _id; + public int Id { set { _id = value; } } + public FormCreateResultOfControl(ILogger logger, IStudentLogic stlogic, IStatementLogic slogic, IResultOfControlLogic rlogic) + { + InitializeComponent(); + _logger = logger; + _STlogic = stlogic; + _Slogic = slogic; + _Rlogic = rlogic; + } + private void ButtonSave_Click(object sender, EventArgs e) + { + _logger.LogInformation("Сохранение результата"); + try + { + var model = new ResultOfControlBindingModel + { + Id = _id ?? 0, + Form = textBoxForm.Text, + Date = DateOnly.FromDateTime(datePicker.Value.Date), + Mark = textBoxMark.Text, + StudentId = (int)comboBoxStudent.SelectedValue, + StatementId = (int)comboBoxStatement.SelectedValue + }; + var operationResult = _id.HasValue ? _Rlogic.Update(model) : + _Rlogic.Create(model); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + MessageBox.Show("Сохранение прошло успешно", "Сообщение", + MessageBoxButtons.OK, MessageBoxIcon.Information); + DialogResult = DialogResult.OK; + Close(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения результата"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + private void ButtonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + private void FormCreateResult_Load(object sender, EventArgs e) + { + try + { + _logger.LogInformation("Загрузка студента"); + var listST = _STlogic.ReadList(null).ToList(); + if (listST != null) + { + comboBoxStudent.DisplayMember = "Name"; + comboBoxStudent.ValueMember = "Id"; + comboBoxStudent.DataSource = listST; + comboBoxStudent.SelectedItem = null; + } + _logger.LogInformation("Загрузка ведомости"); + var listS = _Slogic.ReadList(null).ToList(); + if (listS != null) + { + comboBoxStatement.DisplayMember = "Id"; + comboBoxStatement.ValueMember = "Id"; + comboBoxStatement.DataSource = listS; + comboBoxStatement.SelectedItem = null; + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения получения списков. Доп информация в логах"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + if (_id.HasValue) + { + try + { + var view = _Rlogic.ReadElement(new ResultOfControlSearchModel + { + Id = _id.Value + }); + if (view != null) + { + textBoxForm.Text = view.Form; + datePicker.Text = Convert.ToString(view.Date); + textBoxMark.Text = view.Mark; + comboBoxStudent.SelectedValue = view.StudentId; + comboBoxStatement.SelectedValue = view.StatementId; + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения получения результата. Доп информация в логах"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + } +} diff --git a/SUBD/SUBD/FormCreateResultOfControl.resx b/SUBD/SUBD/FormCreateResultOfControl.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/SUBD/SUBD/FormCreateResultOfControl.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/SUBD/SUBD/FormCreateStatement.Designer.cs b/SUBD/SUBD/FormCreateStatement.Designer.cs new file mode 100644 index 0000000..a94a746 --- /dev/null +++ b/SUBD/SUBD/FormCreateStatement.Designer.cs @@ -0,0 +1,170 @@ +namespace SUBD +{ + partial class FormCreateStatement + { + /// + /// 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() + { + comboBoxTeacher = new ComboBox(); + comboBoxGroup = new ComboBox(); + comboBoxDiscipline = new ComboBox(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + datePicker = new DateTimePicker(); + label1 = new Label(); + label2 = new Label(); + label3 = new Label(); + label4 = new Label(); + SuspendLayout(); + // + // comboBoxTeacher + // + comboBoxTeacher.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxTeacher.FormattingEnabled = true; + comboBoxTeacher.Location = new Point(119, 45); + comboBoxTeacher.Name = "comboBoxTeacher"; + comboBoxTeacher.Size = new Size(250, 28); + comboBoxTeacher.TabIndex = 0; + // + // comboBoxGroup + // + comboBoxGroup.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxGroup.FormattingEnabled = true; + comboBoxGroup.Location = new Point(119, 80); + comboBoxGroup.Name = "comboBoxGroup"; + comboBoxGroup.Size = new Size(250, 28); + comboBoxGroup.TabIndex = 1; + // + // comboBoxDiscipline + // + comboBoxDiscipline.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxDiscipline.FormattingEnabled = true; + comboBoxDiscipline.Location = new Point(119, 114); + comboBoxDiscipline.Name = "comboBoxDiscipline"; + comboBoxDiscipline.Size = new Size(250, 28); + comboBoxDiscipline.TabIndex = 2; + // + // ButtonSave + // + ButtonSave.Location = new Point(14, 160); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(94, 29); + ButtonSave.TabIndex = 6; + ButtonSave.Text = "Сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(119, 160); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(94, 29); + ButtonCancel.TabIndex = 7; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // datePicker + // + datePicker.Location = new Point(119, 8); + datePicker.Name = "datePicker"; + datePicker.Size = new Size(250, 27); + datePicker.TabIndex = 3; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(12, 15); + label1.Name = "label1"; + label1.Size = new Size(41, 20); + label1.TabIndex = 8; + label1.Text = "Дата"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(12, 48); + label2.Name = "label2"; + label2.Size = new Size(65, 20); + label2.TabIndex = 9; + label2.Text = "Учитель"; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(12, 83); + label3.Name = "label3"; + label3.Size = new Size(58, 20); + label3.TabIndex = 10; + label3.Text = "Группа"; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(12, 117); + label4.Name = "label4"; + label4.Size = new Size(96, 20); + label4.TabIndex = 11; + label4.Text = "Дисциплина"; + // + // FormCreateStatement + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(379, 202); + Controls.Add(label4); + Controls.Add(label3); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(datePicker); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Controls.Add(comboBoxDiscipline); + Controls.Add(comboBoxGroup); + Controls.Add(comboBoxTeacher); + FormBorderStyle = FormBorderStyle.FixedToolWindow; + Name = "FormCreateStatement"; + Text = "Создание ведомости"; + Load += FormCreateStatement_Load; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBoxTeacher; + private ComboBox comboBoxGroup; + private ComboBox comboBoxDiscipline; + private TextBox textBoxDate; + private Button ButtonSave; + private Button ButtonCancel; + private DateTimePicker datePicker; + private Label label1; + private Label label2; + private Label label3; + private Label label4; + } +} \ No newline at end of file diff --git a/SUBD/SUBD/FormCreateStatement.cs b/SUBD/SUBD/FormCreateStatement.cs new file mode 100644 index 0000000..b781b34 --- /dev/null +++ b/SUBD/SUBD/FormCreateStatement.cs @@ -0,0 +1,126 @@ +using ElectronicJournalContracts.BindingModels; +using ElectronicJournalContracts.BusinessLogicContracts; +using ElectronicJournalContracts.SearchModels; +using Microsoft.Extensions.Logging; + +namespace SUBD +{ + public partial class FormCreateStatement : Form + { + private readonly ILogger _logger; + private readonly IDisciplineLogic _Dlogic; + private readonly IGroupLogic _Glogic; + private readonly ITeacherLogic _Tlogic; + private readonly IStatementLogic _Slogic; + private int? _id; + public int Id { set { _id = value; } } + public FormCreateStatement(ILogger logger, IDisciplineLogic dlogic, IGroupLogic glogic, ITeacherLogic tlogic, IStatementLogic slogic) + { + InitializeComponent(); + _logger = logger; + _Dlogic = dlogic; + _Glogic = glogic; + _Tlogic = tlogic; + _Slogic = slogic; + } + private void ButtonSave_Click(object sender, EventArgs e) + { + _logger.LogInformation("Сохранение ведомости"); + try + { + var model = new StatementBindingModel + { + Id = _id ?? 0, + Date = DateOnly.FromDateTime(datePicker.Value.Date), + DisciplineId = (int)comboBoxDiscipline.SelectedValue, + GroupId = (int)comboBoxGroup.SelectedValue, + TeacherId = (int)comboBoxTeacher.SelectedValue + }; + var operationResult = _id.HasValue ? _Slogic.Update(model) : + _Slogic.Create(model); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + MessageBox.Show("Сохранение прошло успешно", "Сообщение", + MessageBoxButtons.OK, MessageBoxIcon.Information); + DialogResult = DialogResult.OK; + Close(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения ведомости"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + private void ButtonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + private void FormCreateStatement_Load(object sender, EventArgs e) + { + try + { + _logger.LogInformation("Загрузка дисциплины"); + var listD = _Dlogic.ReadList(null).ToList(); + if (listD != null) + { + comboBoxDiscipline.DisplayMember = "Title"; + comboBoxDiscipline.ValueMember = "Id"; + comboBoxDiscipline.DataSource = listD; + comboBoxDiscipline.SelectedItem = null; + } + _logger.LogInformation("Загрузка группы"); + var listG = _Glogic.ReadList(null).ToList(); + if (listG != null) + { + comboBoxGroup.DisplayMember = "Title"; + comboBoxGroup.ValueMember = "Id"; + comboBoxGroup.DataSource = listG; + comboBoxGroup.SelectedItem = null; + } + _logger.LogInformation("Загрузка преодавателя"); + var listT = _Tlogic.ReadList(null).ToList(); + if (listT != null) + { + comboBoxTeacher.DisplayMember = "Name"; + comboBoxTeacher.ValueMember = "Id"; + comboBoxTeacher.DataSource = listT; + comboBoxTeacher.SelectedItem = null; + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения получения списков. Доп информация в логах"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + if (_id.HasValue) + { + try + { + var view = _Slogic.ReadElement(new StatementSearchModel + { + Id = _id.Value + }); + if (view != null) + { + datePicker.Text = Convert.ToString(view.Date); + comboBoxDiscipline.SelectedValue = view.DisciplineId; + comboBoxGroup.SelectedValue = view.GroupId; + comboBoxTeacher.SelectedValue = view.TeacherId; + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения получения ведомости. Доп информация в логах"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + } +} diff --git a/SUBD/SUBD/FormCreateStatement.resx b/SUBD/SUBD/FormCreateStatement.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/SUBD/SUBD/FormCreateStatement.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/SUBD/SUBD/FormResultOfControl.Designer.cs b/SUBD/SUBD/FormResultOfControl.Designer.cs new file mode 100644 index 0000000..290c87a --- /dev/null +++ b/SUBD/SUBD/FormResultOfControl.Designer.cs @@ -0,0 +1,209 @@ +namespace SUBD +{ + partial class FormResultOfControl + { + /// + /// 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() + { + dataGridView = new DataGridView(); + ButtonAdd = new Button(); + ButtonUpd = new Button(); + ButtonDel = new Button(); + ButtonRef = new Button(); + ButtonFilter = new Button(); + ButtonDrop = new Button(); + comboBoxFilter = new ComboBox(); + textBoxFilter = new TextBox(); + dateTimePickerFilterEnd = new DateTimePicker(); + dateTimePickerFilterStart = new DateTimePicker(); + labelTime = new Label(); + labelCount = new Label(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(0, 31); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(976, 418); + dataGridView.TabIndex = 1; + // + // ButtonAdd + // + ButtonAdd.Location = new Point(982, 31); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(147, 29); + ButtonAdd.TabIndex = 2; + ButtonAdd.Text = "Добавить"; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // ButtonUpd + // + ButtonUpd.Location = new Point(982, 66); + ButtonUpd.Name = "ButtonUpd"; + ButtonUpd.Size = new Size(147, 29); + ButtonUpd.TabIndex = 3; + ButtonUpd.Text = "Изменить"; + ButtonUpd.UseVisualStyleBackColor = true; + ButtonUpd.Click += ButtonUpd_Click; + // + // ButtonDel + // + ButtonDel.Location = new Point(982, 101); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(147, 29); + ButtonDel.TabIndex = 4; + ButtonDel.Text = "Удалить"; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonRef + // + ButtonRef.Location = new Point(982, 136); + ButtonRef.Name = "ButtonRef"; + ButtonRef.Size = new Size(147, 29); + ButtonRef.TabIndex = 5; + ButtonRef.Text = "Обновить"; + ButtonRef.UseVisualStyleBackColor = true; + ButtonRef.Click += ButtonRef_Click; + // + // ButtonFilter + // + ButtonFilter.Location = new Point(982, 379); + ButtonFilter.Name = "ButtonFilter"; + ButtonFilter.Size = new Size(147, 29); + ButtonFilter.TabIndex = 6; + ButtonFilter.Text = "Наложить фильтр"; + ButtonFilter.UseVisualStyleBackColor = true; + ButtonFilter.Click += ButtonFilter_Click; + // + // ButtonDrop + // + ButtonDrop.Location = new Point(982, 414); + ButtonDrop.Name = "ButtonDrop"; + ButtonDrop.Size = new Size(147, 29); + ButtonDrop.TabIndex = 7; + ButtonDrop.Text = "Сбросить"; + ButtonDrop.UseVisualStyleBackColor = true; + ButtonDrop.Click += ButtonDrop_Click; + // + // comboBoxFilter + // + comboBoxFilter.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxFilter.FormattingEnabled = true; + comboBoxFilter.Items.AddRange(new object[] { "Дата", "Студент", "Ведомость" }); + comboBoxFilter.Location = new Point(982, 248); + comboBoxFilter.Name = "comboBoxFilter"; + comboBoxFilter.Size = new Size(147, 28); + comboBoxFilter.TabIndex = 8; + // + // textBoxFilter + // + textBoxFilter.Location = new Point(982, 282); + textBoxFilter.Name = "textBoxFilter"; + textBoxFilter.Size = new Size(147, 27); + textBoxFilter.TabIndex = 9; + // + // dateTimePickerFilterEnd + // + dateTimePickerFilterEnd.Location = new Point(982, 348); + dateTimePickerFilterEnd.Name = "dateTimePickerFilterEnd"; + dateTimePickerFilterEnd.Size = new Size(147, 27); + dateTimePickerFilterEnd.TabIndex = 10; + // + // dateTimePickerFilterStart + // + dateTimePickerFilterStart.Location = new Point(982, 315); + dateTimePickerFilterStart.Name = "dateTimePickerFilterStart"; + dateTimePickerFilterStart.Size = new Size(147, 27); + dateTimePickerFilterStart.TabIndex = 11; + // + // labelTime + // + labelTime.AutoSize = true; + labelTime.Location = new Point(982, 216); + labelTime.Name = "labelTime"; + labelTime.Size = new Size(42, 20); + labelTime.TabIndex = 12; + labelTime.Text = "Time"; + // + // labelCount + // + labelCount.AutoSize = true; + labelCount.Location = new Point(982, 196); + labelCount.Name = "labelCount"; + labelCount.Size = new Size(51, 20); + labelCount.TabIndex = 13; + labelCount.Text = "Count:"; + // + // FormStatement + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1139, 449); + Controls.Add(labelCount); + Controls.Add(labelTime); + Controls.Add(dateTimePickerFilterStart); + Controls.Add(dateTimePickerFilterEnd); + Controls.Add(textBoxFilter); + Controls.Add(comboBoxFilter); + Controls.Add(ButtonDrop); + Controls.Add(ButtonFilter); + Controls.Add(ButtonRef); + Controls.Add(ButtonDel); + Controls.Add(ButtonUpd); + Controls.Add(ButtonAdd); + Controls.Add(dataGridView); + FormBorderStyle = FormBorderStyle.FixedToolWindow; + Name = "FormStatement"; + Text = "Ведомость"; + Load += FormResultOfControl_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private DataGridView dataGridView; + private Button ButtonAdd; + private Button ButtonUpd; + private Button ButtonDel; + private Button ButtonRef; + private Button ButtonFilter; + private Button ButtonDrop; + private ComboBox comboBoxFilter; + private TextBox textBoxFilter; + private DateTimePicker dateTimePickerFilterEnd; + private DateTimePicker dateTimePickerFilterStart; + private Label labelTime; + private Label labelCount; + } +} \ No newline at end of file diff --git a/SUBD/SUBD/FormResultOfControl.cs b/SUBD/SUBD/FormResultOfControl.cs new file mode 100644 index 0000000..1460c97 --- /dev/null +++ b/SUBD/SUBD/FormResultOfControl.cs @@ -0,0 +1,169 @@ +using ElectronicJournalContracts.BindingModels; +using ElectronicJournalContracts.BusinessLogicContracts; +using ElectronicJournalContracts.SearchModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SUBD +{ + public partial class FormResultOfControl : Form + { + private readonly ILogger _logger; + private readonly IResultOfControlLogic _resultLogic; + public FormResultOfControl(ILogger logger, IResultOfControlLogic resultLogic) + { + InitializeComponent(); + _logger = logger; + _resultLogic = resultLogic; + } + private void LoadData() + { + try + { + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + var list = _resultLogic.ReadList(null); + if (list != null) + { + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.DataSource = list; + dataGridView.Columns["StudentId"].Visible = false; + } + _logger.LogInformation("Загрузка результата"); + stopwatch.Stop(); + TimeSpan ts = stopwatch.Elapsed; + string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", + ts.Hours, ts.Minutes, ts.Seconds, + ts.Milliseconds / 10); + labelTime.Text = ("RunTime " + elapsedTime); + labelCount.Text = "Count: " + list.Count(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки результата"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + private void ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + var service = + Program.ServiceProvider?.GetService(typeof(FormCreateResultOfControl)); + if (service is FormCreateResultOfControl form) + { + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + var service = + Program.ServiceProvider?.GetService(typeof(FormCreateResultOfControl)); + if (service is FormCreateResultOfControl form) + { + form.Id = + Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (MessageBox.Show("Удалить ведомость?", "Вопрос", + MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + _logger.LogInformation("Результат удален"); + try + { + if (!_resultLogic.Delete(new ResultOfControlBindingModel + { + Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value), + })) + { + throw new Exception("Ошибка при удалении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка удаления результата"); + MessageBox.Show(ex.Message, "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void ButtonFilter_Click(object sender, EventArgs e) + { + try + { + ResultOfControlSearchModel model = new ResultOfControlSearchModel(); + model.Id = 9999; + switch (comboBoxFilter.SelectedItem) + { + case "Дата": + model.DateFrom = DateOnly.FromDateTime(dateTimePickerFilterStart.Value); + model.DateTo = DateOnly.FromDateTime(dateTimePickerFilterEnd.Value); + break; + case "Студент": + model.StudentName = textBoxFilter.Text; + break; + case "Ведомость": + model.StatementId = Convert.ToInt32(textBoxFilter.Text); + break; + default: + LoadData(); + break; + } + var list = _resultLogic.ReadList(model); + if (list != null) + { + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.DataSource = list; + dataGridView.Columns["StudentId"].Visible = false; + } + _logger.LogInformation("Загрузка результата"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки результата"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + private void ButtonDrop_Click(object sender, EventArgs e) + { + LoadData(); + } + + private void FormResultOfControl_Load(object sender, EventArgs e) + { + LoadData(); + } + } +} diff --git a/SUBD/SUBD/FormResultOfControl.resx b/SUBD/SUBD/FormResultOfControl.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SUBD/SUBD/FormResultOfControl.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/SUBD/SUBD/FormStatement.Designer.cs b/SUBD/SUBD/FormStatement.Designer.cs new file mode 100644 index 0000000..d4184a6 --- /dev/null +++ b/SUBD/SUBD/FormStatement.Designer.cs @@ -0,0 +1,209 @@ +namespace SUBD +{ + partial class FormStatement + { + /// + /// 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() + { + dataGridView = new DataGridView(); + ButtonAdd = new Button(); + ButtonUpd = new Button(); + ButtonDel = new Button(); + ButtonRef = new Button(); + ButtonFilter = new Button(); + ButtonDrop = new Button(); + comboBoxFilter = new ComboBox(); + textBoxFilter = new TextBox(); + dateTimePickerFilterEnd = new DateTimePicker(); + dateTimePickerFilterStart = new DateTimePicker(); + labelTime = new Label(); + labelCount = new Label(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(0, 31); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(976, 418); + dataGridView.TabIndex = 1; + // + // ButtonAdd + // + ButtonAdd.Location = new Point(982, 31); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(147, 29); + ButtonAdd.TabIndex = 2; + ButtonAdd.Text = "Добавить"; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // ButtonUpd + // + ButtonUpd.Location = new Point(982, 66); + ButtonUpd.Name = "ButtonUpd"; + ButtonUpd.Size = new Size(147, 29); + ButtonUpd.TabIndex = 3; + ButtonUpd.Text = "Изменить"; + ButtonUpd.UseVisualStyleBackColor = true; + ButtonUpd.Click += ButtonUpd_Click; + // + // ButtonDel + // + ButtonDel.Location = new Point(982, 101); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(147, 29); + ButtonDel.TabIndex = 4; + ButtonDel.Text = "Удалить"; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonRef + // + ButtonRef.Location = new Point(982, 136); + ButtonRef.Name = "ButtonRef"; + ButtonRef.Size = new Size(147, 29); + ButtonRef.TabIndex = 5; + ButtonRef.Text = "Обновить"; + ButtonRef.UseVisualStyleBackColor = true; + ButtonRef.Click += ButtonRef_Click; + // + // ButtonFilter + // + ButtonFilter.Location = new Point(982, 379); + ButtonFilter.Name = "ButtonFilter"; + ButtonFilter.Size = new Size(147, 29); + ButtonFilter.TabIndex = 6; + ButtonFilter.Text = "Наложить фильтр"; + ButtonFilter.UseVisualStyleBackColor = true; + ButtonFilter.Click += ButtonFilter_Click; + // + // ButtonDrop + // + ButtonDrop.Location = new Point(982, 414); + ButtonDrop.Name = "ButtonDrop"; + ButtonDrop.Size = new Size(147, 29); + ButtonDrop.TabIndex = 7; + ButtonDrop.Text = "Сбросить"; + ButtonDrop.UseVisualStyleBackColor = true; + ButtonDrop.Click += ButtonDrop_Click; + // + // comboBoxFilter + // + comboBoxFilter.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxFilter.FormattingEnabled = true; + comboBoxFilter.Items.AddRange(new object[] { "Дата", "Дисциплина", "Группа", "Преподаватель" }); + comboBoxFilter.Location = new Point(982, 248); + comboBoxFilter.Name = "comboBoxFilter"; + comboBoxFilter.Size = new Size(147, 28); + comboBoxFilter.TabIndex = 8; + // + // textBoxFilter + // + textBoxFilter.Location = new Point(982, 282); + textBoxFilter.Name = "textBoxFilter"; + textBoxFilter.Size = new Size(147, 27); + textBoxFilter.TabIndex = 9; + // + // dateTimePickerFilterEnd + // + dateTimePickerFilterEnd.Location = new Point(982, 348); + dateTimePickerFilterEnd.Name = "dateTimePickerFilterEnd"; + dateTimePickerFilterEnd.Size = new Size(147, 27); + dateTimePickerFilterEnd.TabIndex = 10; + // + // dateTimePickerFilterStart + // + dateTimePickerFilterStart.Location = new Point(982, 315); + dateTimePickerFilterStart.Name = "dateTimePickerFilterStart"; + dateTimePickerFilterStart.Size = new Size(147, 27); + dateTimePickerFilterStart.TabIndex = 11; + // + // labelTime + // + labelTime.AutoSize = true; + labelTime.Location = new Point(982, 216); + labelTime.Name = "labelTime"; + labelTime.Size = new Size(42, 20); + labelTime.TabIndex = 12; + labelTime.Text = "Time"; + // + // labelCount + // + labelCount.AutoSize = true; + labelCount.Location = new Point(982, 196); + labelCount.Name = "labelCount"; + labelCount.Size = new Size(51, 20); + labelCount.TabIndex = 13; + labelCount.Text = "Count:"; + // + // FormStatement + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1139, 449); + Controls.Add(labelCount); + Controls.Add(labelTime); + Controls.Add(dateTimePickerFilterStart); + Controls.Add(dateTimePickerFilterEnd); + Controls.Add(textBoxFilter); + Controls.Add(comboBoxFilter); + Controls.Add(ButtonDrop); + Controls.Add(ButtonFilter); + Controls.Add(ButtonRef); + Controls.Add(ButtonDel); + Controls.Add(ButtonUpd); + Controls.Add(ButtonAdd); + Controls.Add(dataGridView); + FormBorderStyle = FormBorderStyle.FixedToolWindow; + Name = "FormStatement"; + Text = "Ведомость"; + Load += FormStatement_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private DataGridView dataGridView; + private Button ButtonAdd; + private Button ButtonUpd; + private Button ButtonDel; + private Button ButtonRef; + private Button ButtonFilter; + private Button ButtonDrop; + private ComboBox comboBoxFilter; + private TextBox textBoxFilter; + private DateTimePicker dateTimePickerFilterEnd; + private DateTimePicker dateTimePickerFilterStart; + private Label labelTime; + private Label labelCount; + } +} \ No newline at end of file diff --git a/SUBD/SUBD/FormStatement.cs b/SUBD/SUBD/FormStatement.cs new file mode 100644 index 0000000..6ed7063 --- /dev/null +++ b/SUBD/SUBD/FormStatement.cs @@ -0,0 +1,176 @@ +using ElectronicJournalContracts.BindingModels; +using ElectronicJournalContracts.BusinessLogicContracts; +using ElectronicJournalContracts.SearchModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SUBD +{ + public partial class FormStatement : Form + { + private readonly ILogger _logger; + private readonly IStatementLogic _statementLogic; + public FormStatement(ILogger logger, IStatementLogic statementLogic) + { + InitializeComponent(); + _logger = logger; + _statementLogic = statementLogic; + } + private void LoadData() + { + try + { + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + var list = _statementLogic.ReadList(null); + if (list != null) + { + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.DataSource = list; + dataGridView.Columns["DisciplineId"].Visible = false; + dataGridView.Columns["GroupId"].Visible = false; + dataGridView.Columns["TeacherId"].Visible = false; + } + _logger.LogInformation("Загрузка ведомости"); + stopwatch.Stop(); + TimeSpan ts = stopwatch.Elapsed; + string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", + ts.Hours, ts.Minutes, ts.Seconds, + ts.Milliseconds / 10); + labelTime.Text = ("RunTime " + elapsedTime); + labelCount.Text = "Count: " + list.Count(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки ведомости"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + private void ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + var service = + Program.ServiceProvider?.GetService(typeof(FormCreateStatement)); + if (service is FormCreateStatement form) + { + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + + private void ButtonUpd_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + var service = + Program.ServiceProvider?.GetService(typeof(FormCreateStatement)); + if (service is FormCreateStatement form) + { + form.Id = + Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (MessageBox.Show("Удалить ведомость?", "Вопрос", + MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + _logger.LogInformation("Ведомость удалена"); + try + { + if (!_statementLogic.Delete(new StatementBindingModel + { + Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value), + })) + { + throw new Exception("Ошибка при удалении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка удаления ведомости"); + MessageBox.Show(ex.Message, "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void ButtonFilter_Click(object sender, EventArgs e) + { + try + { + StatementSearchModel model = new StatementSearchModel(); + model.Id = 9999; + switch (comboBoxFilter.SelectedItem) + { + case "Дата": + model.DateFrom = DateOnly.FromDateTime(dateTimePickerFilterStart.Value); + model.DateTo = DateOnly.FromDateTime(dateTimePickerFilterEnd.Value); + break; + case "Преподаватель": + model.TeacherName = textBoxFilter.Text; + break; + case "Дисциплина": + model.DisciplineName = textBoxFilter.Text; + break; + case "Группа": + model.GroupName = textBoxFilter.Text; + break; + default: + LoadData(); + break; + } + var list = _statementLogic.ReadList(model); + if (list != null) + { + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.DataSource = list; + dataGridView.Columns["DisciplineId"].Visible = false; + dataGridView.Columns["GroupId"].Visible = false; + dataGridView.Columns["TeacherId"].Visible = false; + } + _logger.LogInformation("Загрузка ведомости"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки ведомости"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + private void ButtonDrop_Click(object sender, EventArgs e) + { + LoadData(); + } + + private void FormStatement_Load(object sender, EventArgs e) + { + LoadData(); + } + } +} diff --git a/SUBD/SUBD/FormStatement.resx b/SUBD/SUBD/FormStatement.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SUBD/SUBD/FormStatement.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/SUBD/SUBD/Program.cs b/SUBD/SUBD/Program.cs index 6c13402..7c89a4c 100644 --- a/SUBD/SUBD/Program.cs +++ b/SUBD/SUBD/Program.cs @@ -22,7 +22,7 @@ namespace SUBD var services = new ServiceCollection(); ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); - Application.Run(_serviceProvider.GetRequiredService()); + Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) { @@ -47,10 +47,14 @@ namespace SUBD services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file