Готовая 1

This commit is contained in:
Ь Ъ 2024-12-23 23:24:52 +04:00
parent 242c61b655
commit 4695c8d1c8
42 changed files with 639 additions and 785 deletions

View File

@ -5,9 +5,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Academic_Performance.Entities.Enums namespace Academic_Performance.Entities.Enums
{ { [Flags]
[Flags]
public enum Group public enum Group
{ {
None = 0, None = 0,

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Entities.Enums
{
public enum Type
{
None = 0,
One = 1,
Two = 2,
Three = 3,
Four = 4,
Five = 5
}
}

View File

@ -5,9 +5,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Academic_Performance.Entities.Enums namespace Academic_Performance.Entities.Enums
{ { public enum TypeS
public enum TypeS
{ {
None = 0, None = 0,
One = 1, One = 1,

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Entities.Enums
{
public enum Value
{
None=0,
One = 1,
Two = 2,
Three = 3,
Four = 4,
Five = 5
}
}

View File

@ -13,10 +13,8 @@ namespace Academic_Performance.Entities
public int StudentId { get; private set; } public int StudentId { get; private set; }
public int StatmentTeacherId { get; private set; } public int StatmentTeacherId { get; private set; }
public int StatmentSubjectId { get; private set; } public int StatmentSubjectId { get; private set; }
public Value? Value { get; private set; } public int Value { get; private set; }
public DateTime Date { get; private set; } public static Mark CreateElement(int id, int studentId, int statmentSubjectId, int statmentTeacherId, int value)
public static Mark CreateOperation(int id, int studentId, int statmentSubjectId, int statmentTeacherId, Value value)
{ {
return new Mark return new Mark
{ {
@ -24,7 +22,7 @@ namespace Academic_Performance.Entities
StudentId = studentId, StudentId = studentId,
StatmentSubjectId = statmentSubjectId, StatmentSubjectId = statmentSubjectId,
StatmentTeacherId = statmentTeacherId, StatmentTeacherId = statmentTeacherId,
Value = value, Value = value
}; };
} }
} }

View File

@ -13,9 +13,7 @@ namespace Academic_Performance.Entities
public int StudentId { get; private set; } public int StudentId { get; private set; }
public string Information { get; private set; } = string.Empty; public string Information { get; private set; } = string.Empty;
public TypeS? TypeS { get; private set; } public TypeS? TypeS { get; private set; }
public DateTime Date { get; private set; } public DateTime Date { get; private set; }
public static Order CreateEntity(int id, int studentId, string information,TypeS types) public static Order CreateEntity(int id, int studentId, string information,TypeS types)
{ {
return new Order return new Order
@ -24,7 +22,6 @@ namespace Academic_Performance.Entities
StudentId = studentId, StudentId = studentId,
Information = information, Information = information,
TypeS = types, TypeS = types,
Date = DateTime.Now Date = DateTime.Now
}; };
} }

View File

@ -9,23 +9,19 @@ using System.Threading.Tasks;
namespace Academic_Performance.Entities namespace Academic_Performance.Entities
{ {
public class Statement public class Statement
{ { public int Id { get; private set; }
public int Id { get; private set; }
public int SubjecttId { get; private set; } public int SubjecttId { get; private set; }
public int TeacherId{ get; private set; } public int TeacherId{ get; private set; }
public DateTime Date { get; private set; } public DateTime Date { get; private set; }
public IEnumerable<Mark> Mark{ get; private set; } = [];
public static Statement CreateOperation(int id, int subjecttId, int teacherId, IEnumerable<Mark> mark)
public static Statement CreateOperation(int id, int subjecttId, int teacherId) {return new Statement
{
return new Statement
{ {
Id = id, Id = id,
SubjecttId = subjecttId, SubjecttId = subjecttId,
TeacherId = teacherId , TeacherId = teacherId,
Date = DateTime.Now,
Date = DateTime.Now Mark = mark
}; };
} }
} }

View File

@ -13,14 +13,12 @@ namespace Academic_Performance.Entities
public Group? Group { get; private set; } public Group? Group { get; private set; }
public string Name { get; private set; } = string.Empty; public string Name { get; private set; } = string.Empty;
public string Flow { get; private set; } = string.Empty; public string Flow { get; private set; } = string.Empty;
public static Student CreateEntity(int id, string name,string flow, Group group) public static Student CreateEntity(int id, string name,string flow, Group group)
{ {
return new Student return new Student
{ {
Id = id, Id = id,
Name = name, Name = name,
Flow=flow, Flow=flow,
Group = group, Group = group,
}; };

View File

@ -6,7 +6,6 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Academic_Performance.Entities; namespace Academic_Performance.Entities;
public class Subject public class Subject
{ {
public int Id { get; private set; } public int Id { get; private set; }

View File

@ -7,10 +7,8 @@ using System.Threading.Tasks;
namespace Academic_Performance.Entities; namespace Academic_Performance.Entities;
public class Teacher public class Teacher
{ { public int Id { get; private set; }
public int Id { get; private set; } public string Name{ get; private set; } = string.Empty;
public string Name{ get; private set; } = string.Empty;
public static Teacher CreateEntity(int id, string name) public static Teacher CreateEntity(int id, string name)
{ {
return new Teacher return new Teacher
@ -19,7 +17,4 @@ public class Teacher
Name = name, Name = name,
}; };
} }
} }

View File

@ -31,9 +31,8 @@
menuStrip = new MenuStrip(); menuStrip = new MenuStrip();
cToolStripMenuItem = new ToolStripMenuItem(); cToolStripMenuItem = new ToolStripMenuItem();
studentToolStripMenuItem = new ToolStripMenuItem(); studentToolStripMenuItem = new ToolStripMenuItem();
препToolStripMenuItem = new ToolStripMenuItem(); TeacherToolStripMenuItem = new ToolStripMenuItem();
предметыToolStripMenuItem = new ToolStripMenuItem(); SubToolStripMenuItem = new ToolStripMenuItem();
оценкиToolStripMenuItem = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem(); операцииToolStripMenuItem = new ToolStripMenuItem();
добавлениеToolStripMenuItem = new ToolStripMenuItem(); добавлениеToolStripMenuItem = new ToolStripMenuItem();
ведомостьToolStripMenuItem = new ToolStripMenuItem(); ведомостьToolStripMenuItem = new ToolStripMenuItem();
@ -47,76 +46,76 @@
menuStrip.Items.AddRange(new ToolStripItem[] { cToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); menuStrip.Items.AddRange(new ToolStripItem[] { cToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
menuStrip.Location = new Point(0, 0); menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip"; menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(778, 33); menuStrip.Padding = new Padding(5, 1, 0, 1);
menuStrip.Size = new Size(623, 26);
menuStrip.TabIndex = 0; menuStrip.TabIndex = 0;
menuStrip.Text = "menuStrip1"; menuStrip.Text = "menuStrip1";
// //
// cToolStripMenuItem // cToolStripMenuItem
// //
cToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { studentToolStripMenuItem, препToolStripMenuItem, предметыToolStripMenuItem, оценкиToolStripMenuItem }); cToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { studentToolStripMenuItem, TeacherToolStripMenuItem, SubToolStripMenuItem });
cToolStripMenuItem.Name = "cToolStripMenuItem"; cToolStripMenuItem.Name = "cToolStripMenuItem";
cToolStripMenuItem.Size = new Size(139, 29); cToolStripMenuItem.Size = new Size(117, 24);
cToolStripMenuItem.Text = "Справочники"; cToolStripMenuItem.Text = "Справочники";
// //
// studentToolStripMenuItem // studentToolStripMenuItem
// //
studentToolStripMenuItem.Name = "studentToolStripMenuItem"; studentToolStripMenuItem.Name = "studentToolStripMenuItem";
studentToolStripMenuItem.Size = new Size(270, 34); studentToolStripMenuItem.Size = new Size(224, 26);
studentToolStripMenuItem.Text = "Студенты"; studentToolStripMenuItem.Text = "Студенты";
studentToolStripMenuItem.Click += studentToolStripMenuItem_Click; studentToolStripMenuItem.Click += studentToolStripMenuItem_Click;
// //
// препToolStripMenuItem // TeacherToolStripMenuItem
// //
препToolStripMenuItem.Name = "препToolStripMenuItem"; TeacherToolStripMenuItem.Name = "TeacherToolStripMenuItem";
препToolStripMenuItem.Size = new Size(270, 34); TeacherToolStripMenuItem.Size = new Size(224, 26);
препToolStripMenuItem.Text = "Преподаватели"; TeacherToolStripMenuItem.Text = "Преподаватели";
TeacherToolStripMenuItem.Click += TeacherToolStripMenuItem_Click;
// //
// предметыToolStripMenuItem // SubToolStripMenuItem
// //
предметыToolStripMenuItem.Name = "предметыToolStripMenuItem"; SubToolStripMenuItem.Name = "SubToolStripMenuItem";
предметыToolStripMenuItem.Size = new Size(270, 34); SubToolStripMenuItem.Size = new Size(224, 26);
предметыToolStripMenuItem.Text = "Предметы"; SubToolStripMenuItem.Text = "Предметы";
// SubToolStripMenuItem.Click += SubToolStripMenuItem_Click;
// оценкиToolStripMenuItem
//
оценкиToolStripMenuItem.Name = "оценкиToolStripMenuItem";
оценкиToolStripMenuItem.Size = new Size(270, 34);
оценкиToolStripMenuItem.Text = "Приказ";
// //
// операцииToolStripMenuItem // операцииToolStripMenuItem
// //
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { добавлениеToolStripMenuItem, ведомостьToolStripMenuItem }); операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { добавлениеToolStripMenuItem, ведомостьToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(112, 29); операцииToolStripMenuItem.Size = new Size(95, 24);
операцииToolStripMenuItem.Text = "Операции"; операцииToolStripMenuItem.Text = "Операции";
// //
// добавлениеToolStripMenuItem // добавлениеToolStripMenuItem
// //
добавлениеToolStripMenuItem.Name = обавлениеToolStripMenuItem"; добавлениеToolStripMenuItem.Name = обавлениеToolStripMenuItem";
добавлениеToolStripMenuItem.Size = new Size(270, 34); добавлениеToolStripMenuItem.Size = new Size(224, 26);
добавлениеToolStripMenuItem.Text = "Оценка"; добавлениеToolStripMenuItem.Text = "Ведомость";
добавлениеToolStripMenuItem.Click += добавлениеToolStripMenuItem_Click;
// //
// ведомостьToolStripMenuItem // ведомостьToolStripMenuItem
// //
ведомостьToolStripMenuItem.Name = едомостьToolStripMenuItem"; ведомостьToolStripMenuItem.Name = едомостьToolStripMenuItem";
ведомостьToolStripMenuItem.Size = new Size(270, 34); ведомостьToolStripMenuItem.Size = new Size(224, 26);
ведомостьToolStripMenuItem.Text = "Ведомость"; ведомостьToolStripMenuItem.Text = "Приказ";
ведомостьToolStripMenuItem.Click += ведомостьToolStripMenuItem_Click;
// //
// отчетыToolStripMenuItem // отчетыToolStripMenuItem
// //
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(88, 29); отчетыToolStripMenuItem.Size = new Size(73, 24);
отчетыToolStripMenuItem.Text = "Отчеты"; отчетыToolStripMenuItem.Text = "Отчеты";
// //
// Form1 // Form1
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.unnamed; BackgroundImage = Properties.Resources.unnamed;
BackgroundImageLayout = ImageLayout.Stretch; BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(778, 450); ClientSize = new Size(623, 360);
Controls.Add(menuStrip); Controls.Add(menuStrip);
MainMenuStrip = menuStrip; MainMenuStrip = menuStrip;
Margin = new Padding(2, 3, 2, 3);
Name = "Form1"; Name = "Form1";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Text = "Form1"; Text = "Form1";
@ -131,12 +130,11 @@
private MenuStrip menuStrip; private MenuStrip menuStrip;
private ToolStripMenuItem cToolStripMenuItem; private ToolStripMenuItem cToolStripMenuItem;
private ToolStripMenuItem studentToolStripMenuItem; private ToolStripMenuItem studentToolStripMenuItem;
private ToolStripMenuItem препToolStripMenuItem; private ToolStripMenuItem TeacherToolStripMenuItem;
private ToolStripMenuItem предметыToolStripMenuItem; private ToolStripMenuItem SubToolStripMenuItem;
private ToolStripMenuItem операцииToolStripMenuItem; private ToolStripMenuItem операцииToolStripMenuItem;
private ToolStripMenuItem добавлениеToolStripMenuItem; private ToolStripMenuItem добавлениеToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem; private ToolStripMenuItem отчетыToolStripMenuItem;
private ToolStripMenuItem оценкиToolStripMenuItem;
private ToolStripMenuItem ведомостьToolStripMenuItem; private ToolStripMenuItem ведомостьToolStripMenuItem;
} }
} }

View File

@ -6,17 +6,11 @@ namespace Academic_Performance
public partial class Form1 : Form public partial class Form1 : Form
{ {
private readonly IUnityContainer _container; private readonly IUnityContainer _container;
public Form1(IUnityContainer container) public Form1(IUnityContainer container)
{ {
InitializeComponent(); InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container)); _container = container ?? throw new ArgumentNullException(nameof(container));
} }
private void ñòóäåíòûToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void studentToolStripMenuItem_Click(object sender, EventArgs e) private void studentToolStripMenuItem_Click(object sender, EventArgs e)
{ {
try try
@ -29,5 +23,65 @@ namespace Academic_Performance
} }
} }
private void TeacherToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormTeachers>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SubToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSubjects>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void îöåíêèToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormMarks>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void äîáàâëåíèåToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormMarks>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void âåäîìîñòüToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormOrders>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
} }
} }

View File

@ -29,58 +29,49 @@
private void InitializeComponent() private void InitializeComponent()
{ {
comboBoxTeacher = new ComboBox(); comboBoxTeacher = new ComboBox();
comboBoxStudent = new ComboBox();
comboBoxSubject = new ComboBox();
comboBoxValue = new ComboBox(); comboBoxValue = new ComboBox();
buttonSave = new Button(); buttonSave = new Button();
buttonEx = new Button(); buttonEx = new Button();
label1 = new Label();
label2 = new Label(); label2 = new Label();
label3 = new Label();
label4 = new Label(); label4 = new Label();
groupBox = new GroupBox();
button1 = new Button();
button2 = new Button();
dataGridView1 = new DataGridView();
label1 = new Label();
comboBoxSubject = new ComboBox();
ColStudent = new DataGridViewComboBoxColumn();
ColSubject = new DataGridViewTextBoxColumn();
groupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// comboBoxTeacher // comboBoxTeacher
// //
comboBoxTeacher.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxTeacher.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxTeacher.FormattingEnabled = true; comboBoxTeacher.FormattingEnabled = true;
comboBoxTeacher.Location = new Point(256, 32); comboBoxTeacher.Location = new Point(236, 12);
comboBoxTeacher.Margin = new Padding(2, 3, 2, 3);
comboBoxTeacher.Name = "comboBoxTeacher"; comboBoxTeacher.Name = "comboBoxTeacher";
comboBoxTeacher.Size = new Size(357, 33); comboBoxTeacher.Size = new Size(286, 28);
comboBoxTeacher.TabIndex = 0; comboBoxTeacher.TabIndex = 1;
//
// comboBoxStudent
//
comboBoxStudent.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxStudent.FormattingEnabled = true;
comboBoxStudent.Location = new Point(256, 101);
comboBoxStudent.Name = "comboBoxStudent";
comboBoxStudent.Size = new Size(357, 33);
comboBoxStudent.TabIndex = 1;
//
// comboBoxSubject
//
comboBoxSubject.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSubject.FormattingEnabled = true;
comboBoxSubject.Location = new Point(256, 172);
comboBoxSubject.Name = "comboBoxSubject";
comboBoxSubject.Size = new Size(357, 33);
comboBoxSubject.TabIndex = 2;
// //
// comboBoxValue // comboBoxValue
// //
comboBoxValue.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxValue.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxValue.FormattingEnabled = true; comboBoxValue.FormattingEnabled = true;
comboBoxValue.Location = new Point(256, 250); comboBoxValue.Location = new Point(205, 200);
comboBoxValue.Margin = new Padding(2, 3, 2, 3);
comboBoxValue.Name = "comboBoxValue"; comboBoxValue.Name = "comboBoxValue";
comboBoxValue.Size = new Size(357, 33); comboBoxValue.Size = new Size(286, 28);
comboBoxValue.TabIndex = 3; comboBoxValue.TabIndex = 3;
// //
// buttonSave // buttonSave
// //
buttonSave.Location = new Point(85, 376); buttonSave.Location = new Point(69, 301);
buttonSave.Margin = new Padding(2, 3, 2, 3);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 34); buttonSave.Size = new Size(89, 27);
buttonSave.TabIndex = 4; buttonSave.TabIndex = 4;
buttonSave.Text = "button1"; buttonSave.Text = "button1";
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
@ -88,82 +79,160 @@
// //
// buttonEx // buttonEx
// //
buttonEx.Location = new Point(465, 376); buttonEx.Location = new Point(373, 301);
buttonEx.Margin = new Padding(2, 3, 2, 3);
buttonEx.Name = "buttonEx"; buttonEx.Name = "buttonEx";
buttonEx.Size = new Size(112, 34); buttonEx.Size = new Size(89, 27);
buttonEx.TabIndex = 5; buttonEx.TabIndex = 5;
buttonEx.Text = "button2"; buttonEx.Text = "button2";
buttonEx.UseVisualStyleBackColor = true; buttonEx.UseVisualStyleBackColor = true;
buttonEx.Click += buttonEx_Click; buttonEx.Click += buttonEx_Click;
// //
// label1
//
label1.AutoSize = true;
label1.Location = new Point(49, 40);
label1.Name = "label1";
label1.Size = new Size(183, 25);
label1.TabIndex = 6;
label1.Text = "ФИО Преподавателя";
//
// label2 // label2
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Location = new Point(46, 109); label2.Location = new Point(50, 15);
label2.Margin = new Padding(2, 0, 2, 0);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new Size(129, 25); label2.Size = new Size(154, 20);
label2.TabIndex = 7; label2.TabIndex = 7;
label2.Text = "ФИО Студента"; label2.Text = "ФИО Преподавателя";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(49, 180);
label3.Name = "label3";
label3.Size = new Size(84, 25);
label3.TabIndex = 8;
label3.Text = "Предмет";
// //
// label4 // label4
// //
label4.AutoSize = true; label4.AutoSize = true;
label4.Location = new Point(49, 258); label4.Location = new Point(39, 207);
label4.Margin = new Padding(2, 0, 2, 0);
label4.Name = "label4"; label4.Name = "label4";
label4.Size = new Size(74, 25); label4.Size = new Size(61, 20);
label4.TabIndex = 9; label4.TabIndex = 9;
label4.Text = "Оценка"; label4.Text = "Оценка";
// //
// groupBox
//
groupBox.Controls.Add(button1);
groupBox.Controls.Add(button2);
groupBox.Controls.Add(dataGridView1);
groupBox.Dock = DockStyle.Bottom;
groupBox.Location = new Point(0, 181);
groupBox.Margin = new Padding(3, 4, 3, 4);
groupBox.Name = "groupBox";
groupBox.Padding = new Padding(3, 4, 3, 4);
groupBox.Size = new Size(640, 423);
groupBox.TabIndex = 33;
groupBox.TabStop = false;
groupBox.Text = "Ведомость";
//
// button1
//
button1.Location = new Point(406, 315);
button1.Margin = new Padding(2, 3, 2, 3);
button1.Name = "button1";
button1.Size = new Size(174, 55);
button1.TabIndex = 2;
button1.Text = "Отмена";
button1.UseVisualStyleBackColor = true;
//
// button2
//
button2.Location = new Point(73, 320);
button2.Margin = new Padding(2, 3, 2, 3);
button2.Name = "button2";
button2.Size = new Size(131, 49);
button2.TabIndex = 1;
button2.Text = "Сохранение";
button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColStudent, ColSubject });
dataGridView1.Location = new Point(26, 41);
dataGridView1.Margin = new Padding(3, 4, 3, 4);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.RowHeadersVisible = false;
dataGridView1.RowHeadersWidth = 62;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(600, 207);
dataGridView1.TabIndex = 0;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(113, 96);
label1.Name = "label1";
label1.Size = new Size(70, 20);
label1.TabIndex = 35;
label1.Text = "Предмет";
//
// comboBoxSubject
//
comboBoxSubject.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSubject.FormattingEnabled = true;
comboBoxSubject.Location = new Point(236, 88);
comboBoxSubject.Margin = new Padding(2, 3, 2, 3);
comboBoxSubject.Name = "comboBoxSubject";
comboBoxSubject.Size = new Size(286, 28);
comboBoxSubject.TabIndex = 36;
//
// ColStudent
//
ColStudent.HeaderText = "Студент";
ColStudent.MinimumWidth = 8;
ColStudent.Name = "ColStudent";
//
// ColSubject
//
ColSubject.HeaderText = "Оценка";
ColSubject.MinimumWidth = 8;
ColSubject.Name = "ColSubject";
ColSubject.Resizable = DataGridViewTriState.True;
ColSubject.SortMode = DataGridViewColumnSortMode.NotSortable;
//
// FormMark // FormMark
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(640, 604);
Controls.Add(label4); Controls.Add(comboBoxSubject);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(groupBox);
Controls.Add(label4);
Controls.Add(label2);
Controls.Add(buttonEx); Controls.Add(buttonEx);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Controls.Add(comboBoxValue); Controls.Add(comboBoxValue);
Controls.Add(comboBoxSubject);
Controls.Add(comboBoxStudent);
Controls.Add(comboBoxTeacher); Controls.Add(comboBoxTeacher);
Margin = new Padding(2, 3, 2, 3);
Name = "FormMark"; Name = "FormMark";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormMark"; Text = "FormMark";
groupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
#endregion #endregion
private ComboBox comboBoxTeacher; private ComboBox comboBoxTeacher;
private ComboBox comboBoxStudent;
private ComboBox comboBoxSubject;
private ComboBox comboBoxValue; private ComboBox comboBoxValue;
private Button buttonSave; private Button buttonSave;
private Button buttonEx; private Button buttonEx;
private Label label1;
private Label label2; private Label label2;
private Label label3;
private Label label4; private Label label4;
private GroupBox groupBox;
private Button button1;
private Button button2;
private DataGridView dataGridView1;
private Label label1;
private ComboBox comboBoxSubject;
private DataGridViewComboBoxColumn ColStudent;
private DataGridViewTextBoxColumn ColSubject;
} }
} }

View File

@ -6,37 +6,33 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace Academic_Performance.Forms namespace Academic_Performance.Forms
{ {
public partial class FormMark : Form public partial class FormMark : Form
{ {
private readonly IMarkRepository _markRepository; private readonly IStatementRepository _statementRepository;
public FormMark(IMarkRepository examConductingRepository, ITeacherRepository teacherRepository, ISubjectRepository subjectRepository, IStudentRepository studentRepository) public FormMark(IStatementRepository statementRepository, ITeacherRepository teacherRepository, ISubjectRepository subjectRepository, IStudentRepository studentRepository)
{ {
InitializeComponent(); InitializeComponent();
_statementRepository = statementRepository ??
_markRepository = examConductingRepository ?? throw new ArgumentNullException(nameof(statementRepository));
throw new ArgumentNullException(nameof(examConductingRepository)); ColStudent.DataSource = studentRepository.ReadStudent();
ColStudent.DisplayMember = "Name";
comboBoxTeacher.DataSource = teacherRepository.ReadTeachers(); ColStudent.ValueMember = "Id";
comboBoxTeacher.DisplayMember = "Name";
comboBoxTeacher.ValueMember = "Id";
comboBoxSubject.DataSource = subjectRepository.ReadSubject(); comboBoxSubject.DataSource = subjectRepository.ReadSubject();
comboBoxSubject.DisplayMember = "Name"; comboBoxSubject.DisplayMember = "Name";
comboBoxSubject.ValueMember = "Id"; comboBoxSubject.ValueMember = "Id";
comboBoxTeacher.DataSource = teacherRepository.ReadTeachers();
comboBoxStudent.DataSource = studentRepository.ReadStudent(); comboBoxTeacher.DisplayMember = "Name";
comboBoxStudent.DisplayMember = "Name"; comboBoxTeacher.ValueMember = "Id";
comboBoxStudent.ValueMember = "Id";
comboBoxValue.DataSource = Enum.GetValues(typeof(Value));
} }
@ -44,16 +40,11 @@ namespace Academic_Performance.Forms
{ {
try try
{ {
if (comboBoxTeacher.SelectedIndex < 0 || comboBoxSubject.SelectedIndex < 0 || if (dataGridView1.RowCount < 1 || comboBoxTeacher.SelectedIndex < 0)
comboBoxStudent.SelectedIndex < 0 || comboBoxValue.SelectedIndex < 1)
{ {
throw new Exception("Имеются незаполненные поля"); throw new Exception("Имеются незаполненные поля");
} }
_statementRepository.CreateStatement(Statement.CreateOperation(0, 0, 0, CreateListMark()));
_markRepository.AddMark(Mark.CreateOperation(0, (int)comboBoxStudent.SelectedValue!, (int)comboBoxSubject.SelectedValue!, (int)comboBoxTeacher.SelectedValue!,
(Value)comboBoxValue.SelectedItem!));
Close(); Close();
} }
catch (Exception ex) catch (Exception ex)
@ -61,10 +52,49 @@ namespace Academic_Performance.Forms
MessageBox.Show(ex.Message, "Ошибка сохранения", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка сохранения", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void buttonEx_Click(object sender, EventArgs e) private void buttonEx_Click(object sender, EventArgs e)
=> Close(); => Close();
private List<Mark> CreateListMark()
{
var list = new List<Mark>();
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells["ColValue"].Value == null ||
row.Cells["ColStudent"].Value == null)
{
continue;
}
list.Add(Mark.CreateElement(0,0,0, Convert.ToInt32(row.Cells["ColStudent"].Value),
Convert.ToInt32(row.Cells["ColSubject"].Value)
));
}
return list;
}
private void button2_Click(object sender, EventArgs e)
{
try
{
if (dataGridView1.RowCount < 1 ||
comboBoxTeacher.SelectedIndex < 0 || comboBoxSubject.SelectedIndex < 0 )
{
throw new Exception("Имеются незаполненные поля");
}
_statementRepository.CreateStatement(Statement.CreateOperation(0,0,
(int)comboBoxTeacher.SelectedValue!,
CreateListMark()));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
} }
} }

View File

@ -117,4 +117,10 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="ColStudent.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColSubject.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>

View File

@ -41,30 +41,35 @@
panel1.Controls.Add(buttonDel); panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonSave); panel1.Controls.Add(buttonSave);
panel1.Dock = DockStyle.Right; panel1.Dock = DockStyle.Right;
panel1.Location = new Point(591, 0); panel1.Location = new Point(473, 0);
panel1.Margin = new Padding(2, 3, 2, 3);
panel1.Name = "panel1"; panel1.Name = "panel1";
panel1.Size = new Size(209, 450); panel1.Size = new Size(167, 360);
panel1.TabIndex = 2; panel1.TabIndex = 2;
// //
// buttonDel // buttonDel
// //
buttonDel.BackgroundImage = Properties.Resources.Del; buttonDel.BackgroundImage = Properties.Resources.Del;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch; buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(52, 324); buttonDel.Location = new Point(41, 259);
buttonDel.Margin = new Padding(2, 3, 2, 3);
buttonDel.Name = "buttonDel"; buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(112, 98); buttonDel.Size = new Size(89, 79);
buttonDel.TabIndex = 2; buttonDel.TabIndex = 2;
buttonDel.UseVisualStyleBackColor = true; buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += buttonDel_Click;
// //
// buttonSave // buttonSave
// //
buttonSave.BackgroundImage = Properties.Resources.Add; buttonSave.BackgroundImage = Properties.Resources.Add;
buttonSave.BackgroundImageLayout = ImageLayout.Stretch; buttonSave.BackgroundImageLayout = ImageLayout.Stretch;
buttonSave.Location = new Point(52, 28); buttonSave.Location = new Point(41, 23);
buttonSave.Margin = new Padding(2, 3, 2, 3);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 93); buttonSave.Size = new Size(89, 75);
buttonSave.TabIndex = 0; buttonSave.TabIndex = 0;
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
// //
// dataGridView // dataGridView
// //
@ -76,24 +81,28 @@
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill; dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0); dataGridView.Location = new Point(0, 0);
dataGridView.Margin = new Padding(2, 3, 2, 3);
dataGridView.MultiSelect = false; dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView"; dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true; dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 62; dataGridView.RowHeadersWidth = 62;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(591, 450); dataGridView.Size = new Size(473, 360);
dataGridView.TabIndex = 3; dataGridView.TabIndex = 3;
// //
// FormMarks // FormMarks
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(640, 360);
Controls.Add(dataGridView); Controls.Add(dataGridView);
Controls.Add(panel1); Controls.Add(panel1);
Margin = new Padding(2, 3, 2, 3);
Name = "FormMarks"; Name = "FormMarks";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormMarks"; Text = "FormMarks";
Load += FormMarks_Load;
panel1.ResumeLayout(false); panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false); ResumeLayout(false);

View File

@ -1,4 +1,6 @@
using System; using Academic_Performance.Repositories;
using Academic_Performance.Repositories.Implementations;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@ -7,14 +9,82 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq;
using Unity;
namespace Academic_Performance.Forms namespace Academic_Performance.Forms
{ {
public partial class FormMarks : Form public partial class FormMarks : Form
{ {
public FormMarks() private readonly IUnityContainer _container;
private readonly IMarkRepository _markRepository;
public FormMarks(IUnityContainer container, IMarkRepository markRepository)
{ {
InitializeComponent(); InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_markRepository = markRepository ??
throw new ArgumentNullException(nameof(markRepository));
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormMark>().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
{
_markRepository.DeleteMark(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormMarks_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() =>
dataGridView.DataSource = _markRepository.ReadMark();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
return true;
} }
} }
} }

View File

@ -37,13 +37,15 @@
comboBoxType = new ComboBox(); comboBoxType = new ComboBox();
textBoxInf = new TextBox(); textBoxInf = new TextBox();
comboBoxIdStudent = new ComboBox(); comboBoxIdStudent = new ComboBox();
label4 = new Label();
SuspendLayout(); SuspendLayout();
// //
// buttonSave // buttonSave
// //
buttonSave.Location = new Point(80, 404); buttonSave.Location = new Point(64, 310);
buttonSave.Margin = new Padding(2);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 34); buttonSave.Size = new Size(90, 27);
buttonSave.TabIndex = 1; buttonSave.TabIndex = 1;
buttonSave.Text = "Сохранить"; buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
@ -51,9 +53,10 @@
// //
// buttonEx // buttonEx
// //
buttonEx.Location = new Point(572, 404); buttonEx.Location = new Point(458, 323);
buttonEx.Margin = new Padding(2);
buttonEx.Name = "buttonEx"; buttonEx.Name = "buttonEx";
buttonEx.Size = new Size(112, 34); buttonEx.Size = new Size(90, 27);
buttonEx.TabIndex = 2; buttonEx.TabIndex = 2;
buttonEx.Text = "Отмена"; buttonEx.Text = "Отмена";
buttonEx.UseVisualStyleBackColor = true; buttonEx.UseVisualStyleBackColor = true;
@ -62,65 +65,83 @@
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(62, 31); label1.Location = new Point(50, 25);
label1.Margin = new Padding(2, 0, 2, 0);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(49, 25); label1.Size = new Size(41, 20);
label1.TabIndex = 3; label1.TabIndex = 3;
label1.Text = "Дата"; label1.Text = "Дата";
// //
// label2 // label2
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Location = new Point(70, 104); label2.Location = new Point(56, 83);
label2.Margin = new Padding(2, 0, 2, 0);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new Size(41, 25); label2.Size = new Size(35, 20);
label2.TabIndex = 4; label2.TabIndex = 4;
label2.Text = "Тип"; label2.Text = "Тип";
// //
// label3 // label3
// //
label3.AutoSize = true; label3.AutoSize = true;
label3.Location = new Point(28, 187); label3.Location = new Point(22, 150);
label3.Margin = new Padding(2, 0, 2, 0);
label3.Name = "label3"; label3.Name = "label3";
label3.Size = new Size(121, 25); label3.Size = new Size(102, 20);
label3.TabIndex = 5; label3.TabIndex = 5;
label3.Text = "Информация"; label3.Text = "Информация";
// //
// dateTimePicker1 // dateTimePicker1
// //
dateTimePicker1.Location = new Point(184, 26); dateTimePicker1.Location = new Point(147, 21);
dateTimePicker1.Margin = new Padding(2);
dateTimePicker1.Name = "dateTimePicker1"; dateTimePicker1.Name = "dateTimePicker1";
dateTimePicker1.Size = new Size(300, 31); dateTimePicker1.Size = new Size(241, 27);
dateTimePicker1.TabIndex = 6; dateTimePicker1.TabIndex = 6;
// //
// comboBoxType // comboBoxType
// //
comboBoxType.FormattingEnabled = true; comboBoxType.FormattingEnabled = true;
comboBoxType.Location = new Point(184, 104); comboBoxType.Location = new Point(147, 83);
comboBoxType.Margin = new Padding(2);
comboBoxType.Name = "comboBoxType"; comboBoxType.Name = "comboBoxType";
comboBoxType.Size = new Size(516, 33); comboBoxType.Size = new Size(414, 28);
comboBoxType.TabIndex = 7; comboBoxType.TabIndex = 7;
// //
// textBoxInf // textBoxInf
// //
textBoxInf.Location = new Point(175, 192); textBoxInf.Location = new Point(140, 154);
textBoxInf.Margin = new Padding(2);
textBoxInf.Name = "textBoxInf"; textBoxInf.Name = "textBoxInf";
textBoxInf.Size = new Size(525, 31); textBoxInf.Size = new Size(421, 27);
textBoxInf.TabIndex = 8; textBoxInf.TabIndex = 8;
// //
// comboBoxIdStudent // comboBoxIdStudent
// //
comboBoxIdStudent.FormattingEnabled = true; comboBoxIdStudent.FormattingEnabled = true;
comboBoxIdStudent.Location = new Point(175, 268); comboBoxIdStudent.Location = new Point(140, 214);
comboBoxIdStudent.Margin = new Padding(2);
comboBoxIdStudent.Name = "comboBoxIdStudent"; comboBoxIdStudent.Name = "comboBoxIdStudent";
comboBoxIdStudent.Size = new Size(182, 33); comboBoxIdStudent.Size = new Size(421, 28);
comboBoxIdStudent.TabIndex = 9; comboBoxIdStudent.TabIndex = 9;
// //
// label4
//
label4.AutoSize = true;
label4.Location = new Point(11, 217);
label4.Margin = new Padding(2, 0, 2, 0);
label4.Name = "label4";
label4.Size = new Size(107, 20);
label4.TabIndex = 10;
label4.Text = "ФИО Студента";
//
// FormOrder // FormOrder
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(640, 360);
Controls.Add(label4);
Controls.Add(comboBoxIdStudent); Controls.Add(comboBoxIdStudent);
Controls.Add(textBoxInf); Controls.Add(textBoxInf);
Controls.Add(comboBoxType); Controls.Add(comboBoxType);
@ -130,8 +151,11 @@
Controls.Add(label1); Controls.Add(label1);
Controls.Add(buttonEx); Controls.Add(buttonEx);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Margin = new Padding(2);
Name = "FormOrder"; Name = "FormOrder";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormOrder"; Text = "FormOrder";
Load += FormOrder_Load;
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@ -147,5 +171,6 @@
private ComboBox comboBoxType; private ComboBox comboBoxType;
private TextBox textBoxInf; private TextBox textBoxInf;
private ComboBox comboBoxIdStudent; private ComboBox comboBoxIdStudent;
private Label label4;
} }
} }

View File

@ -85,9 +85,13 @@ namespace Academic_Performance.Forms
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void buttonEx_Click(object sender, EventArgs e) => Close(); private void buttonEx_Click(object sender, EventArgs e) => Close();
private Order CreateOrder(int id) => Order.CreateEntity(id, (int)comboBoxIdStudent.SelectedValue!, textBoxInf.Text, private Order CreateOrder(int id) => Order.CreateEntity(id, (int)comboBoxIdStudent.SelectedValue!, textBoxInf.Text,
(TypeS)comboBoxType.SelectedItem!); (TypeS)comboBoxType.SelectedItem!);
private void FormOrder_Load(object sender, EventArgs e)
{
}
} }
} }

View File

@ -43,18 +43,20 @@
panel1.Controls.Add(buttonUpd); panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonSave); panel1.Controls.Add(buttonSave);
panel1.Dock = DockStyle.Right; panel1.Dock = DockStyle.Right;
panel1.Location = new Point(591, 0); panel1.Location = new Point(473, 0);
panel1.Margin = new Padding(2);
panel1.Name = "panel1"; panel1.Name = "panel1";
panel1.Size = new Size(209, 450); panel1.Size = new Size(167, 360);
panel1.TabIndex = 1; panel1.TabIndex = 1;
// //
// buttonDel // buttonDel
// //
buttonDel.BackgroundImage = Properties.Resources.Del; buttonDel.BackgroundImage = Properties.Resources.Del;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch; buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(52, 324); buttonDel.Location = new Point(42, 259);
buttonDel.Margin = new Padding(2);
buttonDel.Name = "buttonDel"; buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(112, 98); buttonDel.Size = new Size(90, 78);
buttonDel.TabIndex = 2; buttonDel.TabIndex = 2;
buttonDel.UseVisualStyleBackColor = true; buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += buttonDel_Click; buttonDel.Click += buttonDel_Click;
@ -63,9 +65,10 @@
// //
buttonUpd.BackgroundImage = Properties.Resources.Upd; buttonUpd.BackgroundImage = Properties.Resources.Upd;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch; buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(52, 173); buttonUpd.Location = new Point(42, 138);
buttonUpd.Margin = new Padding(2);
buttonUpd.Name = "buttonUpd"; buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(112, 96); buttonUpd.Size = new Size(90, 77);
buttonUpd.TabIndex = 1; buttonUpd.TabIndex = 1;
buttonUpd.UseVisualStyleBackColor = true; buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += buttonUpd_Click; buttonUpd.Click += buttonUpd_Click;
@ -74,9 +77,10 @@
// //
buttonSave.BackgroundImage = Properties.Resources.Add; buttonSave.BackgroundImage = Properties.Resources.Add;
buttonSave.BackgroundImageLayout = ImageLayout.Stretch; buttonSave.BackgroundImageLayout = ImageLayout.Stretch;
buttonSave.Location = new Point(52, 28); buttonSave.Location = new Point(42, 22);
buttonSave.Margin = new Padding(2);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 93); buttonSave.Size = new Size(90, 74);
buttonSave.TabIndex = 0; buttonSave.TabIndex = 0;
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click; buttonSave.Click += buttonSave_Click;
@ -91,24 +95,28 @@
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill; dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0); dataGridView.Location = new Point(0, 0);
dataGridView.Margin = new Padding(2);
dataGridView.MultiSelect = false; dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView"; dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true; dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 62; dataGridView.RowHeadersWidth = 62;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(591, 450); dataGridView.Size = new Size(473, 360);
dataGridView.TabIndex = 2; dataGridView.TabIndex = 2;
// //
// FormOrders // FormOrders
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(640, 360);
Controls.Add(dataGridView); Controls.Add(dataGridView);
Controls.Add(panel1); Controls.Add(panel1);
Margin = new Padding(2);
Name = "FormOrders"; Name = "FormOrders";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormOrders"; Text = "FormOrders";
Load += FormOrders_Load;
panel1.ResumeLayout(false); panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false); ResumeLayout(false);

View File

@ -26,7 +26,7 @@ namespace Academic_Performance.Forms
_orderRepository = orderRepository ?? _orderRepository = orderRepository ??
throw new ArgumentNullException(nameof(orderRepository)); throw new ArgumentNullException(nameof(orderRepository));
} }
private void FormRoutes_Load(object sender, EventArgs e) private void FormOrders_Load(object sender, EventArgs e)
{ {
try try
{ {
@ -51,7 +51,6 @@ namespace Academic_Performance.Forms
MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void buttonUpd_Click(object sender, EventArgs e) private void buttonUpd_Click(object sender, EventArgs e)
{ {
if (!TryGetIdentifierFromSelectedRow(out var findId)) if (!TryGetIdentifierFromSelectedRow(out var findId))
@ -71,7 +70,6 @@ namespace Academic_Performance.Forms
MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void buttonDel_Click(object sender, EventArgs e) private void buttonDel_Click(object sender, EventArgs e)
{ {
if (!TryGetIdentifierFromSelectedRow(out var findId)) if (!TryGetIdentifierFromSelectedRow(out var findId))

View File

@ -1,151 +0,0 @@
namespace Academic_Performance.Forms
{
partial class FormStatement
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dateTimePickerDateIntroductionSubject = new DateTimePicker();
groupBoxAssessment = new GroupBox();
buttonEx = new Button();
buttonSave = new Button();
dataGridView1 = new DataGridView();
ColTeacher = new DataGridViewComboBoxColumn();
ColSubject = new DataGridViewComboBoxColumn();
Lable = new Label();
groupBoxAssessment.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// dateTimePickerDateIntroductionSubject
//
dateTimePickerDateIntroductionSubject.Location = new Point(70, 35);
dateTimePickerDateIntroductionSubject.Margin = new Padding(4, 3, 4, 3);
dateTimePickerDateIntroductionSubject.Name = "dateTimePickerDateIntroductionSubject";
dateTimePickerDateIntroductionSubject.Size = new Size(222, 31);
dateTimePickerDateIntroductionSubject.TabIndex = 31;
//
// groupBoxAssessment
//
groupBoxAssessment.Controls.Add(buttonEx);
groupBoxAssessment.Controls.Add(buttonSave);
groupBoxAssessment.Controls.Add(dataGridView1);
groupBoxAssessment.Dock = DockStyle.Bottom;
groupBoxAssessment.Location = new Point(0, 126);
groupBoxAssessment.Margin = new Padding(4, 5, 4, 5);
groupBoxAssessment.Name = "groupBoxAssessment";
groupBoxAssessment.Padding = new Padding(4, 5, 4, 5);
groupBoxAssessment.Size = new Size(800, 528);
groupBoxAssessment.TabIndex = 32;
groupBoxAssessment.TabStop = false;
groupBoxAssessment.Text = "Ведомость";
//
// buttonEx
//
buttonEx.Location = new Point(507, 393);
buttonEx.Name = "buttonEx";
buttonEx.Size = new Size(112, 34);
buttonEx.TabIndex = 2;
buttonEx.Text = "Отмена";
buttonEx.UseVisualStyleBackColor = true;
//
// buttonSave
//
buttonSave.Location = new Point(91, 400);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 34);
buttonSave.TabIndex = 1;
buttonSave.Text = "Сохранение";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColTeacher, ColSubject });
dataGridView1.Location = new Point(33, 51);
dataGridView1.Margin = new Padding(4, 5, 4, 5);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.RowHeadersVisible = false;
dataGridView1.RowHeadersWidth = 62;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(692, 259);
dataGridView1.TabIndex = 0;
//
// ColTeacher
//
ColTeacher.HeaderText = "Преподаватель";
ColTeacher.MinimumWidth = 8;
ColTeacher.Name = "ColTeacher";
//
// ColSubject
//
ColSubject.HeaderText = "Предмет";
ColSubject.MinimumWidth = 8;
ColSubject.Name = "ColSubject";
//
// Lable
//
Lable.AutoSize = true;
Lable.Location = new Point(14, 40);
Lable.Name = "Lable";
Lable.Size = new Size(49, 25);
Lable.TabIndex = 33;
Lable.Text = "Дата";
//
// FormStatement
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 654);
Controls.Add(Lable);
Controls.Add(groupBoxAssessment);
Controls.Add(dateTimePickerDateIntroductionSubject);
Name = "FormStatement";
Text = "FormStatement";
groupBoxAssessment.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private DateTimePicker dateTimePickerDateIntroductionSubject;
private GroupBox groupBoxAssessment;
private DataGridView dataGridView1;
private Label Lable;
private Button buttonEx;
private Button buttonSave;
private DataGridViewComboBoxColumn ColTeacher;
private DataGridViewComboBoxColumn ColSubject;
}
}

View File

@ -1,63 +0,0 @@
using Academic_Performance.Entities;
using Academic_Performance.Repositories;
using Academic_Performance.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Academic_Performance.Forms
{
public partial class FormStatement : Form
{
private readonly IStatementRepository _statementRepository;
public FormStatement(IStatementRepository statementRepository, ITeacherRepository teacherRepository,
ISubjectRepository subjectRepository)
{
InitializeComponent();
_statementRepository = statementRepository ??
throw new ArgumentNullException(nameof(statementRepository));
ColTeacher.DataSource = teacherRepository.ReadTeachers();
ColTeacher.DisplayMember = "Name";
ColTeacher.ValueMember = "Id";
ColSubject.DataSource = subjectRepository.ReadSubject();
ColSubject.DisplayMember = "Name";
ColSubject.ValueMember = "Id";
}
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (dataGridView1.RowCount < 1)
{
throw new Exception("Имеются незаполненные поля");
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ColTeacher.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColSubject.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColTeacher.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColSubject.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -34,50 +34,54 @@
textBoxName = new TextBox(); textBoxName = new TextBox();
button1 = new Button(); button1 = new Button();
button2 = new Button(); button2 = new Button();
textBoxFlow = new TextBox(); comboBoxFlow = new ComboBox();
comboBox1 = new ComboBox(); checkedListBoxGroup = new CheckedListBox();
SuspendLayout(); SuspendLayout();
// //
// label // label
// //
label.AutoSize = true; label.AutoSize = true;
label.Location = new Point(39, 31); label.Location = new Point(31, 25);
label.Margin = new Padding(2, 0, 2, 0);
label.Name = "label"; label.Name = "label";
label.Size = new Size(126, 25); label.Size = new Size(105, 20);
label.TabIndex = 0; label.TabIndex = 0;
label.Text = "ФИО студента"; label.Text = "ФИО студента";
// //
// label2 // label2
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Location = new Point(46, 126); label2.Location = new Point(37, 101);
label2.Margin = new Padding(2, 0, 2, 0);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new Size(69, 25); label2.Size = new Size(58, 20);
label2.TabIndex = 1; label2.TabIndex = 1;
label2.Text = "Группа"; label2.Text = "Группа";
// //
// label3 // label3
// //
label3.AutoSize = true; label3.AutoSize = true;
label3.Location = new Point(43, 208); label3.Location = new Point(44, 183);
label3.Margin = new Padding(2, 0, 2, 0);
label3.Name = "label3"; label3.Name = "label3";
label3.Size = new Size(63, 25); label3.Size = new Size(51, 20);
label3.TabIndex = 2; label3.TabIndex = 2;
label3.Text = "Поток"; label3.Text = "Поток";
// //
// textBoxName // textBoxName
// //
textBoxName.Location = new Point(171, 27); textBoxName.Location = new Point(137, 21);
textBoxName.Margin = new Padding(2, 3, 2, 3);
textBoxName.Name = "textBoxName"; textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(385, 31); textBoxName.Size = new Size(309, 27);
textBoxName.TabIndex = 3; textBoxName.TabIndex = 3;
textBoxName.TextChanged += textBox1_TextChanged;
// //
// button1 // button1
// //
button1.Location = new Point(68, 316); button1.Location = new Point(31, 253);
button1.Margin = new Padding(2, 3, 2, 3);
button1.Name = "button1"; button1.Name = "button1";
button1.Size = new Size(112, 34); button1.Size = new Size(89, 27);
button1.TabIndex = 6; button1.TabIndex = 6;
button1.Text = "Сохранить"; button1.Text = "Сохранить";
button1.UseVisualStyleBackColor = true; button1.UseVisualStyleBackColor = true;
@ -85,42 +89,46 @@
// //
// button2 // button2
// //
button2.Location = new Point(291, 316); button2.Location = new Point(357, 253);
button2.Margin = new Padding(2, 3, 2, 3);
button2.Name = "button2"; button2.Name = "button2";
button2.Size = new Size(112, 34); button2.Size = new Size(89, 27);
button2.TabIndex = 7; button2.TabIndex = 7;
button2.Text = "Отмена"; button2.Text = "Отмена";
button2.UseVisualStyleBackColor = true; button2.UseVisualStyleBackColor = true;
// //
// textBoxFlow // comboBoxFlow
// //
textBoxFlow.Location = new Point(171, 126); comboBoxFlow.DropDownStyle = ComboBoxStyle.DropDownList;
textBoxFlow.Name = "textBoxFlow"; comboBoxFlow.FormattingEnabled = true;
textBoxFlow.Size = new Size(397, 31); comboBoxFlow.Location = new Point(137, 183);
textBoxFlow.TabIndex = 8; comboBoxFlow.Margin = new Padding(2, 3, 2, 3);
comboBoxFlow.Name = "comboBoxFlow";
comboBoxFlow.Size = new Size(309, 28);
comboBoxFlow.TabIndex = 9;
// //
// comboBox1 // checkedListBoxGroup
// //
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; checkedListBoxGroup.FormattingEnabled = true;
comboBox1.FormattingEnabled = true; checkedListBoxGroup.Location = new Point(137, 69);
comboBox1.Location = new Point(171, 245); checkedListBoxGroup.Name = "checkedListBoxGroup";
comboBox1.Name = "comboBox1"; checkedListBoxGroup.Size = new Size(309, 92);
comboBox1.Size = new Size(182, 33); checkedListBoxGroup.TabIndex = 10;
comboBox1.TabIndex = 9;
// //
// FormStudent // FormStudent
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(602, 388); ClientSize = new Size(481, 311);
Controls.Add(comboBox1); Controls.Add(checkedListBoxGroup);
Controls.Add(textBoxFlow); Controls.Add(comboBoxFlow);
Controls.Add(button2); Controls.Add(button2);
Controls.Add(button1); Controls.Add(button1);
Controls.Add(textBoxName); Controls.Add(textBoxName);
Controls.Add(label3); Controls.Add(label3);
Controls.Add(label2); Controls.Add(label2);
Controls.Add(label); Controls.Add(label);
Margin = new Padding(2, 3, 2, 3);
Name = "FormStudent"; Name = "FormStudent";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Text = "Студент"; Text = "Студент";
@ -136,7 +144,7 @@
private TextBox textBoxName; private TextBox textBoxName;
private Button button1; private Button button1;
private Button button2; private Button button2;
private TextBox textBoxFlow; private ComboBox comboBoxFlow;
private ComboBox comboBox1; private CheckedListBox checkedListBoxGroup;
} }
} }

View File

@ -18,7 +18,6 @@ namespace Academic_Performance.Forms
{ {
private readonly IStudentRepository _studentRepository; private readonly IStudentRepository _studentRepository;
private int? _studentId; private int? _studentId;
public int Id public int Id
{ {
set set
@ -30,9 +29,17 @@ namespace Academic_Performance.Forms
{ {
throw new InvalidDataException(nameof(student)); throw new InvalidDataException(nameof(student));
} }
foreach (Group elem in Enum.GetValues(typeof(Group)))
{
if ((elem & student.Group) != 0)
{
checkedListBoxGroup.SetItemChecked(checkedListBoxGroup.Items.IndexOf(elem), true);
}
}
textBoxName.Text = student.Name; textBoxName.Text = student.Name;
textBoxFlow.Text = student.Flow; comboBoxFlow.Text = student.Flow;
comboBox1.SelectedItem =student.Group; checkedListBoxGroup.SelectedItem =student.Group;
_studentId = value; _studentId = value;
} }
catch (Exception ex) catch (Exception ex)
@ -48,20 +55,18 @@ namespace Academic_Performance.Forms
InitializeComponent(); InitializeComponent();
_studentRepository = studentRepository ?? _studentRepository = studentRepository ??
throw new ArgumentNullException(nameof(studentRepository)); throw new ArgumentNullException(nameof(studentRepository));
comboBox1.DataSource =Enum.GetValues(typeof(Group));
foreach (var elem in Enum.GetValues(typeof(Group)))
{
checkedListBoxGroup.Items.Add(elem);
}
} }
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
try try
{ {
if (string.IsNullOrWhiteSpace(textBoxName.Text)|| string.IsNullOrWhiteSpace(textBoxFlow.Text)) if (string.IsNullOrWhiteSpace(textBoxName.Text)|| string.IsNullOrWhiteSpace(comboBoxFlow.Text))
{ {
throw new Exception("Имеются незаполненные поля"); throw new Exception("Имеются незаполненные поля");
} }
@ -83,12 +88,11 @@ namespace Academic_Performance.Forms
} }
} }
private Student CreateStudent(int id) => Student.CreateEntity( private Student CreateStudent(int id) => Student.CreateEntity(
id, id,
textBoxName.Text, textBoxFlow.Text, (Group)comboBox1.SelectedItem! textBoxName.Text, comboBoxFlow.Text, (Group)checkedListBoxGroup.SelectedItem!
); );
} }
} }

View File

@ -43,18 +43,20 @@
panel1.Controls.Add(button2); panel1.Controls.Add(button2);
panel1.Controls.Add(button1); panel1.Controls.Add(button1);
panel1.Dock = DockStyle.Right; panel1.Dock = DockStyle.Right;
panel1.Location = new Point(591, 0); panel1.Location = new Point(473, 0);
panel1.Margin = new Padding(2);
panel1.Name = "panel1"; panel1.Name = "panel1";
panel1.Size = new Size(209, 450); panel1.Size = new Size(167, 360);
panel1.TabIndex = 0; panel1.TabIndex = 0;
// //
// button3 // button3
// //
button3.BackgroundImage = Properties.Resources.Del; button3.BackgroundImage = Properties.Resources.Del;
button3.BackgroundImageLayout = ImageLayout.Stretch; button3.BackgroundImageLayout = ImageLayout.Stretch;
button3.Location = new Point(52, 324); button3.Location = new Point(42, 259);
button3.Margin = new Padding(2);
button3.Name = "button3"; button3.Name = "button3";
button3.Size = new Size(112, 98); button3.Size = new Size(90, 78);
button3.TabIndex = 2; button3.TabIndex = 2;
button3.UseVisualStyleBackColor = true; button3.UseVisualStyleBackColor = true;
button3.Click += button3_Click; button3.Click += button3_Click;
@ -63,9 +65,10 @@
// //
button2.BackgroundImage = Properties.Resources.Upd; button2.BackgroundImage = Properties.Resources.Upd;
button2.BackgroundImageLayout = ImageLayout.Stretch; button2.BackgroundImageLayout = ImageLayout.Stretch;
button2.Location = new Point(52, 173); button2.Location = new Point(42, 138);
button2.Margin = new Padding(2);
button2.Name = "button2"; button2.Name = "button2";
button2.Size = new Size(112, 96); button2.Size = new Size(90, 77);
button2.TabIndex = 1; button2.TabIndex = 1;
button2.UseVisualStyleBackColor = true; button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click; button2.Click += button2_Click;
@ -74,9 +77,10 @@
// //
button1.BackgroundImage = Properties.Resources.Add; button1.BackgroundImage = Properties.Resources.Add;
button1.BackgroundImageLayout = ImageLayout.Stretch; button1.BackgroundImageLayout = ImageLayout.Stretch;
button1.Location = new Point(52, 28); button1.Location = new Point(42, 22);
button1.Margin = new Padding(2);
button1.Name = "button1"; button1.Name = "button1";
button1.Size = new Size(112, 93); button1.Size = new Size(90, 74);
button1.TabIndex = 0; button1.TabIndex = 0;
button1.UseVisualStyleBackColor = true; button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click; button1.Click += button1_Click;
@ -91,24 +95,28 @@
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill; dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0); dataGridView1.Location = new Point(0, 0);
dataGridView1.Margin = new Padding(2);
dataGridView1.MultiSelect = false; dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1"; dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true; dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false; dataGridView1.RowHeadersVisible = false;
dataGridView1.RowHeadersWidth = 62; dataGridView1.RowHeadersWidth = 62;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(591, 450); dataGridView1.Size = new Size(473, 360);
dataGridView1.TabIndex = 1; dataGridView1.TabIndex = 1;
// //
// FormStudents // FormStudents
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(640, 360);
Controls.Add(dataGridView1); Controls.Add(dataGridView1);
Controls.Add(panel1); Controls.Add(panel1);
Margin = new Padding(2);
Name = "FormStudents"; Name = "FormStudents";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormStudents"; Text = "FormStudents";
Load += StudentsList_Load;
panel1.ResumeLayout(false); panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false); ResumeLayout(false);

View File

@ -36,9 +36,10 @@
// //
// buttonSave // buttonSave
// //
buttonSave.Location = new Point(73, 404); buttonSave.Location = new Point(254, 180);
buttonSave.Margin = new Padding(2, 3, 2, 3);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 34); buttonSave.Size = new Size(89, 27);
buttonSave.TabIndex = 1; buttonSave.TabIndex = 1;
buttonSave.Text = "Сохранить"; buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
@ -46,9 +47,10 @@
// //
// buttonEx // buttonEx
// //
buttonEx.Location = new Point(513, 404); buttonEx.Location = new Point(396, 180);
buttonEx.Margin = new Padding(2, 3, 2, 3);
buttonEx.Name = "buttonEx"; buttonEx.Name = "buttonEx";
buttonEx.Size = new Size(112, 34); buttonEx.Size = new Size(89, 27);
buttonEx.TabIndex = 2; buttonEx.TabIndex = 2;
buttonEx.Text = "Отмена"; buttonEx.Text = "Отмена";
buttonEx.UseVisualStyleBackColor = true; buttonEx.UseVisualStyleBackColor = true;
@ -57,30 +59,33 @@
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(12, 172); label1.Location = new Point(69, 104);
label1.Margin = new Padding(2, 0, 2, 0);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(173, 25); label1.Size = new Size(148, 20);
label1.TabIndex = 3; label1.TabIndex = 3;
label1.Text = "Название предмета"; label1.Text = "Название предмета";
label1.Click += label1_Click;
// //
// textBoxName // textBoxName
// //
textBoxName.Location = new Point(295, 169); textBoxName.Location = new Point(254, 104);
textBoxName.Margin = new Padding(2, 3, 2, 3);
textBoxName.Name = "textBoxName"; textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(241, 31); textBoxName.Size = new Size(231, 27);
textBoxName.TabIndex = 4; textBoxName.TabIndex = 4;
// //
// FormSubject // FormSubject
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(640, 255);
Controls.Add(textBoxName); Controls.Add(textBoxName);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(buttonEx); Controls.Add(buttonEx);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Margin = new Padding(2, 3, 2, 3);
Name = "FormSubject"; Name = "FormSubject";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormSubject"; Text = "FormSubject";
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();

View File

@ -49,17 +49,11 @@ namespace Academic_Performance.Forms
throw new ArgumentNullException(nameof(subjectRepository)); throw new ArgumentNullException(nameof(subjectRepository));
} }
private void label1_Click(object sender, EventArgs e)
{
}
private void buttonSave_Click(object sender, EventArgs e) private void buttonSave_Click(object sender, EventArgs e)
{ {
try try
{ {
if (string.IsNullOrWhiteSpace(textBoxName.Text) ) if (string.IsNullOrWhiteSpace(textBoxName.Text))
{ {
throw new Exception("Имеются незаполненные поля"); throw new Exception("Имеются незаполненные поля");
} }
@ -81,15 +75,11 @@ namespace Academic_Performance.Forms
} }
} }
private Subject CreateSubject(int id) => Subject.CreateEntity( private Subject CreateSubject(int id) => Subject.CreateEntity(
id, id,
textBoxName.Text textBoxName.Text
); );
private void buttonEx_Click(object sender, EventArgs e) => Close(); private void buttonEx_Click(object sender, EventArgs e) => Close();
} }
} }

View File

@ -43,18 +43,20 @@
panel1.Controls.Add(button2); panel1.Controls.Add(button2);
panel1.Controls.Add(button1); panel1.Controls.Add(button1);
panel1.Dock = DockStyle.Right; panel1.Dock = DockStyle.Right;
panel1.Location = new Point(591, 0); panel1.Location = new Point(473, 0);
panel1.Margin = new Padding(2);
panel1.Name = "panel1"; panel1.Name = "panel1";
panel1.Size = new Size(209, 450); panel1.Size = new Size(167, 360);
panel1.TabIndex = 1; panel1.TabIndex = 1;
// //
// button3 // button3
// //
button3.BackgroundImage = Properties.Resources.Del; button3.BackgroundImage = Properties.Resources.Del;
button3.BackgroundImageLayout = ImageLayout.Stretch; button3.BackgroundImageLayout = ImageLayout.Stretch;
button3.Location = new Point(52, 324); button3.Location = new Point(42, 259);
button3.Margin = new Padding(2);
button3.Name = "button3"; button3.Name = "button3";
button3.Size = new Size(112, 98); button3.Size = new Size(90, 78);
button3.TabIndex = 2; button3.TabIndex = 2;
button3.UseVisualStyleBackColor = true; button3.UseVisualStyleBackColor = true;
button3.Click += button3_Click; button3.Click += button3_Click;
@ -63,9 +65,10 @@
// //
button2.BackgroundImage = Properties.Resources.Upd; button2.BackgroundImage = Properties.Resources.Upd;
button2.BackgroundImageLayout = ImageLayout.Stretch; button2.BackgroundImageLayout = ImageLayout.Stretch;
button2.Location = new Point(52, 173); button2.Location = new Point(42, 138);
button2.Margin = new Padding(2);
button2.Name = "button2"; button2.Name = "button2";
button2.Size = new Size(112, 96); button2.Size = new Size(90, 77);
button2.TabIndex = 1; button2.TabIndex = 1;
button2.UseVisualStyleBackColor = true; button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click; button2.Click += button2_Click;
@ -74,9 +77,10 @@
// //
button1.BackgroundImage = Properties.Resources.Add; button1.BackgroundImage = Properties.Resources.Add;
button1.BackgroundImageLayout = ImageLayout.Stretch; button1.BackgroundImageLayout = ImageLayout.Stretch;
button1.Location = new Point(52, 28); button1.Location = new Point(42, 22);
button1.Margin = new Padding(2);
button1.Name = "button1"; button1.Name = "button1";
button1.Size = new Size(112, 93); button1.Size = new Size(90, 74);
button1.TabIndex = 0; button1.TabIndex = 0;
button1.UseVisualStyleBackColor = true; button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click; button1.Click += button1_Click;
@ -91,24 +95,28 @@
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill; dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0); dataGridView1.Location = new Point(0, 0);
dataGridView1.Margin = new Padding(2);
dataGridView1.MultiSelect = false; dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1"; dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true; dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false; dataGridView1.RowHeadersVisible = false;
dataGridView1.RowHeadersWidth = 62; dataGridView1.RowHeadersWidth = 62;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(591, 450); dataGridView1.Size = new Size(473, 360);
dataGridView1.TabIndex = 2; dataGridView1.TabIndex = 2;
// //
// FormSubjects // FormSubjects
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(640, 360);
Controls.Add(dataGridView1); Controls.Add(dataGridView1);
Controls.Add(panel1); Controls.Add(panel1);
Margin = new Padding(2);
Name = "FormSubjects"; Name = "FormSubjects";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormSubjects"; Text = "FormSubjects";
Load += FormSubject_Load;
panel1.ResumeLayout(false); panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false); ResumeLayout(false);

View File

@ -36,9 +36,10 @@
// //
// buttonSave // buttonSave
// //
buttonSave.Location = new Point(75, 253); buttonSave.Location = new Point(85, 133);
buttonSave.Margin = new Padding(2, 2, 2, 2);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 34); buttonSave.Size = new Size(90, 27);
buttonSave.TabIndex = 0; buttonSave.TabIndex = 0;
buttonSave.Text = "Сохранить"; buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
@ -46,9 +47,10 @@
// //
// buttonEx // buttonEx
// //
buttonEx.Location = new Point(241, 253); buttonEx.Location = new Point(278, 133);
buttonEx.Margin = new Padding(2, 2, 2, 2);
buttonEx.Name = "buttonEx"; buttonEx.Name = "buttonEx";
buttonEx.Size = new Size(112, 34); buttonEx.Size = new Size(90, 27);
buttonEx.TabIndex = 1; buttonEx.TabIndex = 1;
buttonEx.Text = "Отмена"; buttonEx.Text = "Отмена";
buttonEx.UseVisualStyleBackColor = true; buttonEx.UseVisualStyleBackColor = true;
@ -57,29 +59,33 @@
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(4, 91); label1.Location = new Point(3, 73);
label1.Margin = new Padding(2, 0, 2, 0);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(183, 25); label1.Size = new Size(154, 20);
label1.TabIndex = 2; label1.TabIndex = 2;
label1.Text = "ФИО Преподавателя"; label1.Text = "ФИО Преподавателя";
// //
// textBoxName // textBoxName
// //
textBoxName.Location = new Point(218, 88); textBoxName.Location = new Point(174, 70);
textBoxName.Margin = new Padding(2, 2, 2, 2);
textBoxName.Name = "textBoxName"; textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(241, 31); textBoxName.Size = new Size(194, 27);
textBoxName.TabIndex = 3; textBoxName.TabIndex = 3;
// //
// FormTeacher // FormTeacher
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(489, 315); ClientSize = new Size(457, 206);
Controls.Add(textBoxName); Controls.Add(textBoxName);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(buttonEx); Controls.Add(buttonEx);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Margin = new Padding(2, 2, 2, 2);
Name = "FormTeacher"; Name = "FormTeacher";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormTeacher"; Text = "FormTeacher";
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();

View File

@ -43,18 +43,20 @@
panel1.Controls.Add(button2); panel1.Controls.Add(button2);
panel1.Controls.Add(button1); panel1.Controls.Add(button1);
panel1.Dock = DockStyle.Right; panel1.Dock = DockStyle.Right;
panel1.Location = new Point(591, 0); panel1.Location = new Point(473, 0);
panel1.Margin = new Padding(2);
panel1.Name = "panel1"; panel1.Name = "panel1";
panel1.Size = new Size(209, 450); panel1.Size = new Size(167, 360);
panel1.TabIndex = 1; panel1.TabIndex = 1;
// //
// button3 // button3
// //
button3.BackgroundImage = Properties.Resources.Del; button3.BackgroundImage = Properties.Resources.Del;
button3.BackgroundImageLayout = ImageLayout.Stretch; button3.BackgroundImageLayout = ImageLayout.Stretch;
button3.Location = new Point(52, 324); button3.Location = new Point(42, 259);
button3.Margin = new Padding(2);
button3.Name = "button3"; button3.Name = "button3";
button3.Size = new Size(112, 98); button3.Size = new Size(90, 78);
button3.TabIndex = 2; button3.TabIndex = 2;
button3.UseVisualStyleBackColor = true; button3.UseVisualStyleBackColor = true;
button3.Click += button3_Click; button3.Click += button3_Click;
@ -63,9 +65,10 @@
// //
button2.BackgroundImage = Properties.Resources.Upd; button2.BackgroundImage = Properties.Resources.Upd;
button2.BackgroundImageLayout = ImageLayout.Stretch; button2.BackgroundImageLayout = ImageLayout.Stretch;
button2.Location = new Point(52, 173); button2.Location = new Point(42, 138);
button2.Margin = new Padding(2);
button2.Name = "button2"; button2.Name = "button2";
button2.Size = new Size(112, 96); button2.Size = new Size(90, 77);
button2.TabIndex = 1; button2.TabIndex = 1;
button2.UseVisualStyleBackColor = true; button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click; button2.Click += button2_Click;
@ -74,9 +77,10 @@
// //
button1.BackgroundImage = Properties.Resources.Add; button1.BackgroundImage = Properties.Resources.Add;
button1.BackgroundImageLayout = ImageLayout.Stretch; button1.BackgroundImageLayout = ImageLayout.Stretch;
button1.Location = new Point(52, 28); button1.Location = new Point(42, 22);
button1.Margin = new Padding(2);
button1.Name = "button1"; button1.Name = "button1";
button1.Size = new Size(112, 93); button1.Size = new Size(90, 74);
button1.TabIndex = 0; button1.TabIndex = 0;
button1.UseVisualStyleBackColor = true; button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click; button1.Click += button1_Click;
@ -91,24 +95,27 @@
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill; dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0); dataGridView1.Location = new Point(0, 0);
dataGridView1.Margin = new Padding(2);
dataGridView1.MultiSelect = false; dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1"; dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true; dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false;
dataGridView1.RowHeadersWidth = 62; dataGridView1.RowHeadersWidth = 62;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(591, 450); dataGridView1.Size = new Size(473, 360);
dataGridView1.TabIndex = 2; dataGridView1.TabIndex = 2;
// //
// FormTeachers // FormTeachers
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(640, 360);
Controls.Add(dataGridView1); Controls.Add(dataGridView1);
Controls.Add(panel1); Controls.Add(panel1);
Margin = new Padding(2);
Name = "FormTeachers"; Name = "FormTeachers";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormTeachers"; Text = "FormTeachers";
Load += FormTeachers_Load;
panel1.ResumeLayout(false); panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false); ResumeLayout(false);

View File

@ -32,7 +32,7 @@ namespace Academic_Performance.Forms
{ {
try try
{ {
_container.Resolve<FormStudent>().ShowDialog(); _container.Resolve<FormTeacher>().ShowDialog();
LoadList(); LoadList();
} }
catch (Exception ex) catch (Exception ex)
@ -95,24 +95,19 @@ namespace Academic_Performance.Forms
} }
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView1.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value); private bool TryGetIdentifierFromSelectedRow(out int id)
return true; {
id = 0;
if (dataGridView1.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
} }
id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
return true;
}
} }
} }

View File

@ -1,4 +1,5 @@
using Academic_Performance.Entities; using Academic_Performance.Entities;
using Academic_Performance.Entities.Enums;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -8,11 +9,8 @@ using System.Threading.Tasks;
namespace Academic_Performance.Repositories namespace Academic_Performance.Repositories
{ {
public interface IMarkRepository public interface IMarkRepository
{ { IEnumerable<Mark> ReadMark();
IEnumerable<Mark> GetAllMarks(); void CreateMark(Mark mark);
Mark GetMarkById(int id);
void AddMark(Mark mark);
void UpdateMark(Mark mark);
void DeleteMark(int id); void DeleteMark(int id);
} }
} }

View File

@ -8,8 +8,7 @@ using System.Threading.Tasks;
namespace Academic_Performance.Repositories namespace Academic_Performance.Repositories
{ {
public interface IOrderRepository public interface IOrderRepository
{ { IEnumerable<Order> ReadOrder();
IEnumerable<Order> ReadOrder();
Order GetOrderById(int id); Order GetOrderById(int id);
void AddOrder(Order order); void AddOrder(Order order);
void UpdateOrder(Order order); void UpdateOrder(Order order);

View File

@ -9,9 +9,8 @@ namespace Academic_Performance.Repositories
{ {
public interface IStatementRepository public interface IStatementRepository
{ {
IEnumerable<Statement> GetAllStatements(); IEnumerable<Statement> ReadStatement();
Statement GetStatementById(int id); void CreateStatement(Statement statement);
void AddStatement(Statement statement);
void UpdateStatement(Statement statement); void UpdateStatement(Statement statement);
void DeleteStatement(int id); void DeleteStatement(int id);
} }

View File

@ -8,34 +8,20 @@ using System.Threading.Tasks;
namespace Academic_Performance.Repositories.Implementations namespace Academic_Performance.Repositories.Implementations
{ {
public class MarkRepository : IMarkRepository public class MarkRepository : IMarkRepository
{ {
public void CreateMark(Mark Mark) public void CreateMark(Mark Mark)
{ {
} }
public void UpdateMark(Mark Mark) void IMarkRepository.DeleteMark(int id)
{
}
public void DeleteMark(int id)
{
}
public Mark GetMarkById(int id)
{
return Mark.CreateOperation(0, 0, 0, 0, Value.One);
}
public IEnumerable<Mark> GetAllMarks()
{ {
return new List<Mark>();
} }
public void AddMark(Mark mark)
IEnumerable<Mark> IMarkRepository.ReadMark()
{ {
return [];
} }
} }
} }

View File

@ -13,25 +13,20 @@ namespace Academic_Performance.Repositories.Implementations
public void AddOrder(Order order) public void AddOrder(Order order)
{ {
} }
public void DeleteOrder(int id) public void DeleteOrder(int id)
{ {
} }
public IEnumerable<Order> GetAllOrders() public IEnumerable<Order> GetAllOrders()
{ {
return new List<Order>(); return new List<Order>();
} }
public Order GetOrderById(int id) public Order GetOrderById(int id)
{ {
return Order.CreateEntity(0,0, string.Empty,TypeS.None); return Order.CreateEntity(0,0, string.Empty,TypeS.None);
} }
public void UpdateOrder(Order order) public void UpdateOrder(Order order)
{ {
} }
IEnumerable<Order> IOrderRepository.ReadOrder() IEnumerable<Order> IOrderRepository.ReadOrder()
{ {
return []; return [];

View File

@ -9,29 +9,23 @@ namespace Academic_Performance.Repositories.Implementations
{ {
public class StatementRepository : IStatementRepository public class StatementRepository : IStatementRepository
{ {
public void AddStatement(Statement statement) public void CreateStatement(Statement statement)
{ {
// Заглушка
} }
public void DeleteStatement(int id) public void DeleteStatement(int id)
{ {
// Заглушка
} }
public IEnumerable<Statement> ReadStatements()
public IEnumerable<Statement> GetAllStatements()
{ {
return new List<Statement>(); return [];
} }
public Statement GetStatementById(int id)
{
return Statement.CreateOperation(0, 0, 0);
}
public void UpdateStatement(Statement statment) public void UpdateStatement(Statement statment)
{ {
// Заглушка }
public IEnumerable<Statement> ReadStatement()
{
return [];
} }
} }
} }

View File

@ -13,25 +13,20 @@ namespace Academic_Performance.Repositories.Implementations
public void AddStudent(Student subject) public void AddStudent(Student subject)
{ {
} }
public void DeleteStudent(int id) public void DeleteStudent(int id)
{ {
} }
public IEnumerable<Student> GetAllStudents() public IEnumerable<Student> GetAllStudents()
{ {
return new List<Student>(); return new List<Student>();
} }
public Student GetStudentById(int id) public Student GetStudentById(int id)
{ {
return Student.CreateEntity(0, string.Empty,string.Empty ,Group.None); return Student.CreateEntity(0, string.Empty,string.Empty ,Group.None);
} }
public void UpdateStudent(Student student) public void UpdateStudent(Student student)
{ {
} }
IEnumerable<Student> IStudentRepository.ReadStudent() IEnumerable<Student> IStudentRepository.ReadStudent()
{ {
return []; return [];

View File

@ -13,22 +13,16 @@ namespace Academic_Performance.Repositories.Implementations
public void AddSubject(Subject subject) public void AddSubject(Subject subject)
{ {
} }
public void DeleteSubject(int id) public void DeleteSubject(int id)
{ {
} }
public Subject GetSubjectById(int id) public Subject GetSubjectById(int id)
{ {
return Subject.CreateEntity(0, string.Empty); return Subject.CreateEntity(0, string.Empty);
} }
public void UpdateSubject(Subject subject) public void UpdateSubject(Subject subject)
{ {
} }
IEnumerable<Subject> ISubjectRepository.ReadSubject() IEnumerable<Subject> ISubjectRepository.ReadSubject()
{ {
return []; return [];

View File

@ -12,26 +12,21 @@ namespace Academic_Performance.Repositories.Implementations
public void CreateTeacher(Teacher teacher) public void CreateTeacher(Teacher teacher)
{ {
} }
public void DeleteTeacher(int id) public void DeleteTeacher(int id)
{ {
} }
public IEnumerable<Teacher> GetAllTeachers() public IEnumerable<Teacher> GetAllTeachers()
{ {
return new List<Teacher>(); return new List<Teacher>();
} }
public Teacher GetTeacherById(int id) public Teacher GetTeacherById(int id)
{ {
return Teacher.CreateEntity(0, string.Empty); return Teacher.CreateEntity(0, string.Empty);
} }
public IEnumerable<Teacher> ReadTeachers() public IEnumerable<Teacher> ReadTeachers()
{ {
return []; return [];
} }
public void UpdateTeacher(Teacher teacher) public void UpdateTeacher(Teacher teacher)
{ {
} }