diff --git a/Academic_Performance/Academic_Performance/Entities/Enums/Group.cs b/Academic_Performance/Academic_Performance/Entities/Enums/Group.cs index 96f5708..9319645 100644 --- a/Academic_Performance/Academic_Performance/Entities/Enums/Group.cs +++ b/Academic_Performance/Academic_Performance/Entities/Enums/Group.cs @@ -5,9 +5,7 @@ using System.Text; using System.Threading.Tasks; namespace Academic_Performance.Entities.Enums -{ - - [Flags] +{ [Flags] public enum Group { None = 0, diff --git a/Academic_Performance/Academic_Performance/Entities/Enums/Type.cs b/Academic_Performance/Academic_Performance/Entities/Enums/Type.cs deleted file mode 100644 index 9817419..0000000 --- a/Academic_Performance/Academic_Performance/Entities/Enums/Type.cs +++ /dev/null @@ -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 - } -} diff --git a/Academic_Performance/Academic_Performance/Entities/Enums/TypeS.cs b/Academic_Performance/Academic_Performance/Entities/Enums/TypeS.cs index fbb08b7..32ffb4d 100644 --- a/Academic_Performance/Academic_Performance/Entities/Enums/TypeS.cs +++ b/Academic_Performance/Academic_Performance/Entities/Enums/TypeS.cs @@ -5,9 +5,7 @@ using System.Text; using System.Threading.Tasks; namespace Academic_Performance.Entities.Enums -{ - - public enum TypeS +{ public enum TypeS { None = 0, One = 1, diff --git a/Academic_Performance/Academic_Performance/Entities/Enums/Value.cs b/Academic_Performance/Academic_Performance/Entities/Enums/Value.cs deleted file mode 100644 index 374f06d..0000000 --- a/Academic_Performance/Academic_Performance/Entities/Enums/Value.cs +++ /dev/null @@ -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 - } -} diff --git a/Academic_Performance/Academic_Performance/Entities/Mark.cs b/Academic_Performance/Academic_Performance/Entities/Mark.cs index 4b4a0f1..1dd19e7 100644 --- a/Academic_Performance/Academic_Performance/Entities/Mark.cs +++ b/Academic_Performance/Academic_Performance/Entities/Mark.cs @@ -13,10 +13,8 @@ namespace Academic_Performance.Entities public int StudentId { get; private set; } public int StatmentTeacherId { get; private set; } public int StatmentSubjectId { get; private set; } - public Value? Value { get; private set; } - public DateTime Date { get; private set; } - - public static Mark CreateOperation(int id, int studentId, int statmentSubjectId, int statmentTeacherId, Value value) + public int Value { get; private set; } + public static Mark CreateElement(int id, int studentId, int statmentSubjectId, int statmentTeacherId, int value) { return new Mark { @@ -24,7 +22,7 @@ namespace Academic_Performance.Entities StudentId = studentId, StatmentSubjectId = statmentSubjectId, StatmentTeacherId = statmentTeacherId, - Value = value, + Value = value }; } } diff --git a/Academic_Performance/Academic_Performance/Entities/Order.cs b/Academic_Performance/Academic_Performance/Entities/Order.cs index 1ff709d..bfd27f4 100644 --- a/Academic_Performance/Academic_Performance/Entities/Order.cs +++ b/Academic_Performance/Academic_Performance/Entities/Order.cs @@ -13,9 +13,7 @@ namespace Academic_Performance.Entities public int StudentId { get; private set; } public string Information { get; private set; } = string.Empty; public TypeS? TypeS { get; private set; } - public DateTime Date { get; private set; } - public static Order CreateEntity(int id, int studentId, string information,TypeS types) { return new Order @@ -24,7 +22,6 @@ namespace Academic_Performance.Entities StudentId = studentId, Information = information, TypeS = types, - Date = DateTime.Now }; } diff --git a/Academic_Performance/Academic_Performance/Entities/Statement.cs b/Academic_Performance/Academic_Performance/Entities/Statement.cs index b63ec34..05572d0 100644 --- a/Academic_Performance/Academic_Performance/Entities/Statement.cs +++ b/Academic_Performance/Academic_Performance/Entities/Statement.cs @@ -9,23 +9,19 @@ using System.Threading.Tasks; namespace Academic_Performance.Entities { public class Statement - { - public int Id { get; private set; } + { public int Id { get; private set; } public int SubjecttId { get; private set; } public int TeacherId{ get; private set; } - public DateTime Date { get; private set; } - - - public static Statement CreateOperation(int id, int subjecttId, int teacherId) - { - return new Statement + public IEnumerable Mark{ get; private set; } = []; + public static Statement CreateOperation(int id, int subjecttId, int teacherId, IEnumerable mark) + {return new Statement { Id = id, SubjecttId = subjecttId, - TeacherId = teacherId , - - Date = DateTime.Now + TeacherId = teacherId, + Date = DateTime.Now, + Mark = mark }; } } diff --git a/Academic_Performance/Academic_Performance/Entities/Student.cs b/Academic_Performance/Academic_Performance/Entities/Student.cs index ef76e15..ed7dadd 100644 --- a/Academic_Performance/Academic_Performance/Entities/Student.cs +++ b/Academic_Performance/Academic_Performance/Entities/Student.cs @@ -13,14 +13,12 @@ namespace Academic_Performance.Entities public Group? Group { get; private set; } public string Name { 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) { return new Student { Id = id, Name = name, - Flow=flow, Group = group, }; diff --git a/Academic_Performance/Academic_Performance/Entities/Subject.cs b/Academic_Performance/Academic_Performance/Entities/Subject.cs index 4935a50..746d312 100644 --- a/Academic_Performance/Academic_Performance/Entities/Subject.cs +++ b/Academic_Performance/Academic_Performance/Entities/Subject.cs @@ -6,7 +6,6 @@ using System.Text; using System.Threading.Tasks; namespace Academic_Performance.Entities; - public class Subject { public int Id { get; private set; } diff --git a/Academic_Performance/Academic_Performance/Entities/Teacher.cs b/Academic_Performance/Academic_Performance/Entities/Teacher.cs index 578588d..22cc227 100644 --- a/Academic_Performance/Academic_Performance/Entities/Teacher.cs +++ b/Academic_Performance/Academic_Performance/Entities/Teacher.cs @@ -7,10 +7,8 @@ using System.Threading.Tasks; namespace Academic_Performance.Entities; public class Teacher -{ - public int Id { get; private set; } - public string Name{ get; private set; } = string.Empty; - +{ public int Id { get; private set; } + public string Name{ get; private set; } = string.Empty; public static Teacher CreateEntity(int id, string name) { return new Teacher @@ -19,7 +17,4 @@ public class Teacher Name = name, }; } - - - } diff --git a/Academic_Performance/Academic_Performance/Form1.Designer.cs b/Academic_Performance/Academic_Performance/Form1.Designer.cs index 15da984..a444a28 100644 --- a/Academic_Performance/Academic_Performance/Form1.Designer.cs +++ b/Academic_Performance/Academic_Performance/Form1.Designer.cs @@ -31,9 +31,8 @@ menuStrip = new MenuStrip(); cToolStripMenuItem = new ToolStripMenuItem(); studentToolStripMenuItem = new ToolStripMenuItem(); - препToolStripMenuItem = new ToolStripMenuItem(); - предметыToolStripMenuItem = new ToolStripMenuItem(); - оценкиToolStripMenuItem = new ToolStripMenuItem(); + TeacherToolStripMenuItem = new ToolStripMenuItem(); + SubToolStripMenuItem = new ToolStripMenuItem(); операцииToolStripMenuItem = new ToolStripMenuItem(); добавлениеToolStripMenuItem = new ToolStripMenuItem(); ведомостьToolStripMenuItem = new ToolStripMenuItem(); @@ -47,76 +46,76 @@ menuStrip.Items.AddRange(new ToolStripItem[] { cToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); menuStrip.Location = new Point(0, 0); 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.Text = "menuStrip1"; // // cToolStripMenuItem // - cToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { studentToolStripMenuItem, препToolStripMenuItem, предметыToolStripMenuItem, оценкиToolStripMenuItem }); + cToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { studentToolStripMenuItem, TeacherToolStripMenuItem, SubToolStripMenuItem }); cToolStripMenuItem.Name = "cToolStripMenuItem"; - cToolStripMenuItem.Size = new Size(139, 29); + cToolStripMenuItem.Size = new Size(117, 24); cToolStripMenuItem.Text = "Справочники"; // // studentToolStripMenuItem // studentToolStripMenuItem.Name = "studentToolStripMenuItem"; - studentToolStripMenuItem.Size = new Size(270, 34); + studentToolStripMenuItem.Size = new Size(224, 26); studentToolStripMenuItem.Text = "Студенты"; studentToolStripMenuItem.Click += studentToolStripMenuItem_Click; // - // препToolStripMenuItem + // TeacherToolStripMenuItem // - препToolStripMenuItem.Name = "препToolStripMenuItem"; - препToolStripMenuItem.Size = new Size(270, 34); - препToolStripMenuItem.Text = "Преподаватели"; + TeacherToolStripMenuItem.Name = "TeacherToolStripMenuItem"; + TeacherToolStripMenuItem.Size = new Size(224, 26); + TeacherToolStripMenuItem.Text = "Преподаватели"; + TeacherToolStripMenuItem.Click += TeacherToolStripMenuItem_Click; // - // предметыToolStripMenuItem + // SubToolStripMenuItem // - предметыToolStripMenuItem.Name = "предметыToolStripMenuItem"; - предметыToolStripMenuItem.Size = new Size(270, 34); - предметыToolStripMenuItem.Text = "Предметы"; - // - // оценкиToolStripMenuItem - // - оценкиToolStripMenuItem.Name = "оценкиToolStripMenuItem"; - оценкиToolStripMenuItem.Size = new Size(270, 34); - оценкиToolStripMenuItem.Text = "Приказ"; + SubToolStripMenuItem.Name = "SubToolStripMenuItem"; + SubToolStripMenuItem.Size = new Size(224, 26); + SubToolStripMenuItem.Text = "Предметы"; + SubToolStripMenuItem.Click += SubToolStripMenuItem_Click; // // операцииToolStripMenuItem // операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { добавлениеToolStripMenuItem, ведомостьToolStripMenuItem }); операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; - операцииToolStripMenuItem.Size = new Size(112, 29); + операцииToolStripMenuItem.Size = new Size(95, 24); операцииToolStripMenuItem.Text = "Операции"; // // добавлениеToolStripMenuItem // добавлениеToolStripMenuItem.Name = "добавлениеToolStripMenuItem"; - добавлениеToolStripMenuItem.Size = new Size(270, 34); - добавлениеToolStripMenuItem.Text = "Оценка"; + добавлениеToolStripMenuItem.Size = new Size(224, 26); + добавлениеToolStripMenuItem.Text = "Ведомость"; + добавлениеToolStripMenuItem.Click += добавлениеToolStripMenuItem_Click; // // ведомостьToolStripMenuItem // ведомостьToolStripMenuItem.Name = "ведомостьToolStripMenuItem"; - ведомостьToolStripMenuItem.Size = new Size(270, 34); - ведомостьToolStripMenuItem.Text = "Ведомость"; + ведомостьToolStripMenuItem.Size = new Size(224, 26); + ведомостьToolStripMenuItem.Text = "Приказ"; + ведомостьToolStripMenuItem.Click += ведомостьToolStripMenuItem_Click; // // отчетыToolStripMenuItem // отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; - отчетыToolStripMenuItem.Size = new Size(88, 29); + отчетыToolStripMenuItem.Size = new Size(73, 24); отчетыToolStripMenuItem.Text = "Отчеты"; // // Form1 // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; BackgroundImage = Properties.Resources.unnamed; BackgroundImageLayout = ImageLayout.Stretch; - ClientSize = new Size(778, 450); + ClientSize = new Size(623, 360); Controls.Add(menuStrip); MainMenuStrip = menuStrip; + Margin = new Padding(2, 3, 2, 3); Name = "Form1"; StartPosition = FormStartPosition.CenterScreen; Text = "Form1"; @@ -131,12 +130,11 @@ private MenuStrip menuStrip; private ToolStripMenuItem cToolStripMenuItem; private ToolStripMenuItem studentToolStripMenuItem; - private ToolStripMenuItem препToolStripMenuItem; - private ToolStripMenuItem предметыToolStripMenuItem; + private ToolStripMenuItem TeacherToolStripMenuItem; + private ToolStripMenuItem SubToolStripMenuItem; private ToolStripMenuItem операцииToolStripMenuItem; private ToolStripMenuItem добавлениеToolStripMenuItem; private ToolStripMenuItem отчетыToolStripMenuItem; - private ToolStripMenuItem оценкиToolStripMenuItem; private ToolStripMenuItem ведомостьToolStripMenuItem; } } diff --git a/Academic_Performance/Academic_Performance/Form1.cs b/Academic_Performance/Academic_Performance/Form1.cs index 52a4a33..0a1597e 100644 --- a/Academic_Performance/Academic_Performance/Form1.cs +++ b/Academic_Performance/Academic_Performance/Form1.cs @@ -6,17 +6,11 @@ namespace Academic_Performance public partial class Form1 : Form { private readonly IUnityContainer _container; - public Form1(IUnityContainer container) { InitializeComponent(); _container = container ?? throw new ArgumentNullException(nameof(container)); } - - private void ToolStripMenuItem_Click(object sender, EventArgs e) - { - } - private void studentToolStripMenuItem_Click(object sender, EventArgs e) { try @@ -29,5 +23,65 @@ namespace Academic_Performance } } + + private void TeacherToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void SubToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } } } diff --git a/Academic_Performance/Academic_Performance/Forms/FormMark.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormMark.Designer.cs index c07a0da..9739729 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormMark.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormMark.Designer.cs @@ -29,58 +29,49 @@ private void InitializeComponent() { comboBoxTeacher = new ComboBox(); - comboBoxStudent = new ComboBox(); - comboBoxSubject = new ComboBox(); comboBoxValue = new ComboBox(); buttonSave = new Button(); buttonEx = new Button(); - label1 = new Label(); label2 = new Label(); - label3 = 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(); // // comboBoxTeacher // comboBoxTeacher.DropDownStyle = ComboBoxStyle.DropDownList; 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.Size = new Size(357, 33); - comboBoxTeacher.TabIndex = 0; - // - // 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; + comboBoxTeacher.Size = new Size(286, 28); + comboBoxTeacher.TabIndex = 1; // // comboBoxValue // comboBoxValue.DropDownStyle = ComboBoxStyle.DropDownList; 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.Size = new Size(357, 33); + comboBoxValue.Size = new Size(286, 28); comboBoxValue.TabIndex = 3; // // 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.Size = new Size(112, 34); + buttonSave.Size = new Size(89, 27); buttonSave.TabIndex = 4; buttonSave.Text = "button1"; buttonSave.UseVisualStyleBackColor = true; @@ -88,82 +79,160 @@ // // 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.Size = new Size(112, 34); + buttonEx.Size = new Size(89, 27); buttonEx.TabIndex = 5; buttonEx.Text = "button2"; buttonEx.UseVisualStyleBackColor = true; 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.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.Size = new Size(129, 25); + label2.Size = new Size(154, 20); label2.TabIndex = 7; - 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 = "Предмет"; + label2.Text = "ФИО Преподавателя"; // // label4 // 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.Size = new Size(74, 25); + label4.Size = new Size(61, 20); label4.TabIndex = 9; 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 // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(label4); - Controls.Add(label3); - Controls.Add(label2); + ClientSize = new Size(640, 604); + Controls.Add(comboBoxSubject); Controls.Add(label1); + Controls.Add(groupBox); + Controls.Add(label4); + Controls.Add(label2); Controls.Add(buttonEx); Controls.Add(buttonSave); Controls.Add(comboBoxValue); - Controls.Add(comboBoxSubject); - Controls.Add(comboBoxStudent); Controls.Add(comboBoxTeacher); + Margin = new Padding(2, 3, 2, 3); Name = "FormMark"; + StartPosition = FormStartPosition.CenterScreen; Text = "FormMark"; + groupBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ResumeLayout(false); PerformLayout(); } #endregion - private ComboBox comboBoxTeacher; - private ComboBox comboBoxStudent; - private ComboBox comboBoxSubject; private ComboBox comboBoxValue; private Button buttonSave; private Button buttonEx; - private Label label1; private Label label2; - private Label label3; 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; } } \ No newline at end of file diff --git a/Academic_Performance/Academic_Performance/Forms/FormMark.cs b/Academic_Performance/Academic_Performance/Forms/FormMark.cs index 3e05661..9c46141 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormMark.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormMark.cs @@ -6,37 +6,33 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; +using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Academic_Performance.Forms { public partial class FormMark : Form { - private readonly IMarkRepository _markRepository; - public FormMark(IMarkRepository examConductingRepository, ITeacherRepository teacherRepository, ISubjectRepository subjectRepository, IStudentRepository studentRepository) + private readonly IStatementRepository _statementRepository; + public FormMark(IStatementRepository statementRepository, ITeacherRepository teacherRepository, ISubjectRepository subjectRepository, IStudentRepository studentRepository) { InitializeComponent(); - - _markRepository = examConductingRepository ?? - throw new ArgumentNullException(nameof(examConductingRepository)); - - comboBoxTeacher.DataSource = teacherRepository.ReadTeachers(); - comboBoxTeacher.DisplayMember = "Name"; - comboBoxTeacher.ValueMember = "Id"; - + _statementRepository = statementRepository ?? + throw new ArgumentNullException(nameof(statementRepository)); + ColStudent.DataSource = studentRepository.ReadStudent(); + ColStudent.DisplayMember = "Name"; + ColStudent.ValueMember = "Id"; comboBoxSubject.DataSource = subjectRepository.ReadSubject(); comboBoxSubject.DisplayMember = "Name"; comboBoxSubject.ValueMember = "Id"; - - comboBoxStudent.DataSource = studentRepository.ReadStudent(); - comboBoxStudent.DisplayMember = "Name"; - comboBoxStudent.ValueMember = "Id"; - - comboBoxValue.DataSource = Enum.GetValues(typeof(Value)); + comboBoxTeacher.DataSource = teacherRepository.ReadTeachers(); + comboBoxTeacher.DisplayMember = "Name"; + comboBoxTeacher.ValueMember = "Id"; } @@ -44,16 +40,11 @@ namespace Academic_Performance.Forms { try { - if (comboBoxTeacher.SelectedIndex < 0 || comboBoxSubject.SelectedIndex < 0 || - comboBoxStudent.SelectedIndex < 0 || comboBoxValue.SelectedIndex < 1) + if (dataGridView1.RowCount < 1 || comboBoxTeacher.SelectedIndex < 0) { throw new Exception("Имеются незаполненные поля"); } - - - _markRepository.AddMark(Mark.CreateOperation(0, (int)comboBoxStudent.SelectedValue!, (int)comboBoxSubject.SelectedValue!, (int)comboBoxTeacher.SelectedValue!, - (Value)comboBoxValue.SelectedItem!)); - + _statementRepository.CreateStatement(Statement.CreateOperation(0, 0, 0, CreateListMark())); Close(); } catch (Exception ex) @@ -61,10 +52,49 @@ namespace Academic_Performance.Forms MessageBox.Show(ex.Message, "Ошибка сохранения", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void buttonEx_Click(object sender, EventArgs e) => Close(); - + private List CreateListMark() + { + var list = new List(); + 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(); + } } diff --git a/Academic_Performance/Academic_Performance/Forms/FormMark.resx b/Academic_Performance/Academic_Performance/Forms/FormMark.resx index 8b2ff64..6518eaf 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormMark.resx +++ b/Academic_Performance/Academic_Performance/Forms/FormMark.resx @@ -117,4 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + + + True + \ No newline at end of file diff --git a/Academic_Performance/Academic_Performance/Forms/FormMarks.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormMarks.Designer.cs index 39e5999..d0aeba9 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormMarks.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormMarks.Designer.cs @@ -41,30 +41,35 @@ panel1.Controls.Add(buttonDel); panel1.Controls.Add(buttonSave); 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.Size = new Size(209, 450); + panel1.Size = new Size(167, 360); panel1.TabIndex = 2; // // buttonDel // buttonDel.BackgroundImage = Properties.Resources.Del; 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.Size = new Size(112, 98); + buttonDel.Size = new Size(89, 79); buttonDel.TabIndex = 2; buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += buttonDel_Click; // // buttonSave // buttonSave.BackgroundImage = Properties.Resources.Add; 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.Size = new Size(112, 93); + buttonSave.Size = new Size(89, 75); buttonSave.TabIndex = 0; buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; // // dataGridView // @@ -76,24 +81,28 @@ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.Dock = DockStyle.Fill; dataGridView.Location = new Point(0, 0); + dataGridView.Margin = new Padding(2, 3, 2, 3); dataGridView.MultiSelect = false; dataGridView.Name = "dataGridView"; dataGridView.ReadOnly = true; dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersWidth = 62; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(591, 450); + dataGridView.Size = new Size(473, 360); dataGridView.TabIndex = 3; // // FormMarks // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(640, 360); Controls.Add(dataGridView); Controls.Add(panel1); + Margin = new Padding(2, 3, 2, 3); Name = "FormMarks"; + StartPosition = FormStartPosition.CenterScreen; Text = "FormMarks"; + Load += FormMarks_Load; panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); diff --git a/Academic_Performance/Academic_Performance/Forms/FormMarks.cs b/Academic_Performance/Academic_Performance/Forms/FormMarks.cs index 2f7c4b4..a25efb5 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormMarks.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormMarks.cs @@ -1,4 +1,6 @@ -using System; +using Academic_Performance.Repositories; +using Academic_Performance.Repositories.Implementations; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,14 +9,82 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.Xml.Linq; +using Unity; namespace Academic_Performance.Forms { public partial class FormMarks : Form { - public FormMarks() + private readonly IUnityContainer _container; + + private readonly IMarkRepository _markRepository; + public FormMarks(IUnityContainer container, IMarkRepository markRepository) { 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().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; } } } + diff --git a/Academic_Performance/Academic_Performance/Forms/FormOrder.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormOrder.Designer.cs index d478c05..f1e0eda 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormOrder.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormOrder.Designer.cs @@ -37,13 +37,15 @@ comboBoxType = new ComboBox(); textBoxInf = new TextBox(); comboBoxIdStudent = new ComboBox(); + label4 = new Label(); SuspendLayout(); // // buttonSave // - buttonSave.Location = new Point(80, 404); + buttonSave.Location = new Point(64, 310); + buttonSave.Margin = new Padding(2); buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(112, 34); + buttonSave.Size = new Size(90, 27); buttonSave.TabIndex = 1; buttonSave.Text = "Сохранить"; buttonSave.UseVisualStyleBackColor = true; @@ -51,9 +53,10 @@ // // buttonEx // - buttonEx.Location = new Point(572, 404); + buttonEx.Location = new Point(458, 323); + buttonEx.Margin = new Padding(2); buttonEx.Name = "buttonEx"; - buttonEx.Size = new Size(112, 34); + buttonEx.Size = new Size(90, 27); buttonEx.TabIndex = 2; buttonEx.Text = "Отмена"; buttonEx.UseVisualStyleBackColor = true; @@ -62,65 +65,83 @@ // label1 // 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.Size = new Size(49, 25); + label1.Size = new Size(41, 20); label1.TabIndex = 3; label1.Text = "Дата"; // // label2 // 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.Size = new Size(41, 25); + label2.Size = new Size(35, 20); label2.TabIndex = 4; label2.Text = "Тип"; // // label3 // 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.Size = new Size(121, 25); + label3.Size = new Size(102, 20); label3.TabIndex = 5; label3.Text = "Информация"; // // dateTimePicker1 // - dateTimePicker1.Location = new Point(184, 26); + dateTimePicker1.Location = new Point(147, 21); + dateTimePicker1.Margin = new Padding(2); dateTimePicker1.Name = "dateTimePicker1"; - dateTimePicker1.Size = new Size(300, 31); + dateTimePicker1.Size = new Size(241, 27); dateTimePicker1.TabIndex = 6; // // comboBoxType // comboBoxType.FormattingEnabled = true; - comboBoxType.Location = new Point(184, 104); + comboBoxType.Location = new Point(147, 83); + comboBoxType.Margin = new Padding(2); comboBoxType.Name = "comboBoxType"; - comboBoxType.Size = new Size(516, 33); + comboBoxType.Size = new Size(414, 28); comboBoxType.TabIndex = 7; // // textBoxInf // - textBoxInf.Location = new Point(175, 192); + textBoxInf.Location = new Point(140, 154); + textBoxInf.Margin = new Padding(2); textBoxInf.Name = "textBoxInf"; - textBoxInf.Size = new Size(525, 31); + textBoxInf.Size = new Size(421, 27); textBoxInf.TabIndex = 8; // // comboBoxIdStudent // comboBoxIdStudent.FormattingEnabled = true; - comboBoxIdStudent.Location = new Point(175, 268); + comboBoxIdStudent.Location = new Point(140, 214); + comboBoxIdStudent.Margin = new Padding(2); comboBoxIdStudent.Name = "comboBoxIdStudent"; - comboBoxIdStudent.Size = new Size(182, 33); + comboBoxIdStudent.Size = new Size(421, 28); 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 // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(640, 360); + Controls.Add(label4); Controls.Add(comboBoxIdStudent); Controls.Add(textBoxInf); Controls.Add(comboBoxType); @@ -130,8 +151,11 @@ Controls.Add(label1); Controls.Add(buttonEx); Controls.Add(buttonSave); + Margin = new Padding(2); Name = "FormOrder"; + StartPosition = FormStartPosition.CenterScreen; Text = "FormOrder"; + Load += FormOrder_Load; ResumeLayout(false); PerformLayout(); } @@ -147,5 +171,6 @@ private ComboBox comboBoxType; private TextBox textBoxInf; private ComboBox comboBoxIdStudent; + private Label label4; } } \ No newline at end of file diff --git a/Academic_Performance/Academic_Performance/Forms/FormOrder.cs b/Academic_Performance/Academic_Performance/Forms/FormOrder.cs index d6c4800..5a0ea62 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormOrder.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormOrder.cs @@ -85,9 +85,13 @@ namespace Academic_Performance.Forms MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void buttonEx_Click(object sender, EventArgs e) => Close(); private Order CreateOrder(int id) => Order.CreateEntity(id, (int)comboBoxIdStudent.SelectedValue!, textBoxInf.Text, (TypeS)comboBoxType.SelectedItem!); + + private void FormOrder_Load(object sender, EventArgs e) + { + + } } } diff --git a/Academic_Performance/Academic_Performance/Forms/FormOrders.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormOrders.Designer.cs index dbf57fc..0207ac7 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormOrders.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormOrders.Designer.cs @@ -43,18 +43,20 @@ panel1.Controls.Add(buttonUpd); panel1.Controls.Add(buttonSave); 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.Size = new Size(209, 450); + panel1.Size = new Size(167, 360); panel1.TabIndex = 1; // // buttonDel // buttonDel.BackgroundImage = Properties.Resources.Del; 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.Size = new Size(112, 98); + buttonDel.Size = new Size(90, 78); buttonDel.TabIndex = 2; buttonDel.UseVisualStyleBackColor = true; buttonDel.Click += buttonDel_Click; @@ -63,9 +65,10 @@ // buttonUpd.BackgroundImage = Properties.Resources.Upd; 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.Size = new Size(112, 96); + buttonUpd.Size = new Size(90, 77); buttonUpd.TabIndex = 1; buttonUpd.UseVisualStyleBackColor = true; buttonUpd.Click += buttonUpd_Click; @@ -74,9 +77,10 @@ // buttonSave.BackgroundImage = Properties.Resources.Add; 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.Size = new Size(112, 93); + buttonSave.Size = new Size(90, 74); buttonSave.TabIndex = 0; buttonSave.UseVisualStyleBackColor = true; buttonSave.Click += buttonSave_Click; @@ -91,24 +95,28 @@ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.Dock = DockStyle.Fill; dataGridView.Location = new Point(0, 0); + dataGridView.Margin = new Padding(2); dataGridView.MultiSelect = false; dataGridView.Name = "dataGridView"; dataGridView.ReadOnly = true; dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersWidth = 62; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(591, 450); + dataGridView.Size = new Size(473, 360); dataGridView.TabIndex = 2; // // FormOrders // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(640, 360); Controls.Add(dataGridView); Controls.Add(panel1); + Margin = new Padding(2); Name = "FormOrders"; + StartPosition = FormStartPosition.CenterScreen; Text = "FormOrders"; + Load += FormOrders_Load; panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); diff --git a/Academic_Performance/Academic_Performance/Forms/FormOrders.cs b/Academic_Performance/Academic_Performance/Forms/FormOrders.cs index 53d9761..ed44e6c 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormOrders.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormOrders.cs @@ -26,7 +26,7 @@ namespace Academic_Performance.Forms _orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository)); } - private void FormRoutes_Load(object sender, EventArgs e) + private void FormOrders_Load(object sender, EventArgs e) { try { @@ -51,7 +51,6 @@ namespace Academic_Performance.Forms MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void buttonUpd_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) @@ -71,7 +70,6 @@ namespace Academic_Performance.Forms MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void buttonDel_Click(object sender, EventArgs e) { if (!TryGetIdentifierFromSelectedRow(out var findId)) diff --git a/Academic_Performance/Academic_Performance/Forms/FormStatement.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormStatement.Designer.cs deleted file mode 100644 index af04b25..0000000 --- a/Academic_Performance/Academic_Performance/Forms/FormStatement.Designer.cs +++ /dev/null @@ -1,151 +0,0 @@ -namespace Academic_Performance.Forms -{ - partial class FormStatement - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - 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; - } -} \ No newline at end of file diff --git a/Academic_Performance/Academic_Performance/Forms/FormStatement.cs b/Academic_Performance/Academic_Performance/Forms/FormStatement.cs deleted file mode 100644 index ad94a13..0000000 --- a/Academic_Performance/Academic_Performance/Forms/FormStatement.cs +++ /dev/null @@ -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); - } - } - } -} diff --git a/Academic_Performance/Academic_Performance/Forms/FormStatement.resx b/Academic_Performance/Academic_Performance/Forms/FormStatement.resx deleted file mode 100644 index e010cd4..0000000 --- a/Academic_Performance/Academic_Performance/Forms/FormStatement.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - True - - - True - - - True - - \ No newline at end of file diff --git a/Academic_Performance/Academic_Performance/Forms/FormStudent.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormStudent.Designer.cs index 622878c..de3d802 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormStudent.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormStudent.Designer.cs @@ -34,50 +34,54 @@ textBoxName = new TextBox(); button1 = new Button(); button2 = new Button(); - textBoxFlow = new TextBox(); - comboBox1 = new ComboBox(); + comboBoxFlow = new ComboBox(); + checkedListBoxGroup = new CheckedListBox(); SuspendLayout(); // // label // 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.Size = new Size(126, 25); + label.Size = new Size(105, 20); label.TabIndex = 0; label.Text = "ФИО студента"; // // label2 // 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.Size = new Size(69, 25); + label2.Size = new Size(58, 20); label2.TabIndex = 1; label2.Text = "Группа"; // // label3 // 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.Size = new Size(63, 25); + label3.Size = new Size(51, 20); label3.TabIndex = 2; label3.Text = "Поток"; // // 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.Size = new Size(385, 31); + textBoxName.Size = new Size(309, 27); textBoxName.TabIndex = 3; - textBoxName.TextChanged += textBox1_TextChanged; // // 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.Size = new Size(112, 34); + button1.Size = new Size(89, 27); button1.TabIndex = 6; button1.Text = "Сохранить"; button1.UseVisualStyleBackColor = true; @@ -85,42 +89,46 @@ // // 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.Size = new Size(112, 34); + button2.Size = new Size(89, 27); button2.TabIndex = 7; button2.Text = "Отмена"; button2.UseVisualStyleBackColor = true; // - // textBoxFlow + // comboBoxFlow // - textBoxFlow.Location = new Point(171, 126); - textBoxFlow.Name = "textBoxFlow"; - textBoxFlow.Size = new Size(397, 31); - textBoxFlow.TabIndex = 8; + comboBoxFlow.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxFlow.FormattingEnabled = true; + comboBoxFlow.Location = new Point(137, 183); + 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; - comboBox1.FormattingEnabled = true; - comboBox1.Location = new Point(171, 245); - comboBox1.Name = "comboBox1"; - comboBox1.Size = new Size(182, 33); - comboBox1.TabIndex = 9; + checkedListBoxGroup.FormattingEnabled = true; + checkedListBoxGroup.Location = new Point(137, 69); + checkedListBoxGroup.Name = "checkedListBoxGroup"; + checkedListBoxGroup.Size = new Size(309, 92); + checkedListBoxGroup.TabIndex = 10; // // FormStudent // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(602, 388); - Controls.Add(comboBox1); - Controls.Add(textBoxFlow); + ClientSize = new Size(481, 311); + Controls.Add(checkedListBoxGroup); + Controls.Add(comboBoxFlow); Controls.Add(button2); Controls.Add(button1); Controls.Add(textBoxName); Controls.Add(label3); Controls.Add(label2); Controls.Add(label); + Margin = new Padding(2, 3, 2, 3); Name = "FormStudent"; StartPosition = FormStartPosition.CenterScreen; Text = "Студент"; @@ -136,7 +144,7 @@ private TextBox textBoxName; private Button button1; private Button button2; - private TextBox textBoxFlow; - private ComboBox comboBox1; + private ComboBox comboBoxFlow; + private CheckedListBox checkedListBoxGroup; } } \ No newline at end of file diff --git a/Academic_Performance/Academic_Performance/Forms/FormStudent.cs b/Academic_Performance/Academic_Performance/Forms/FormStudent.cs index 049ba4d..5adb1f1 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormStudent.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormStudent.cs @@ -18,7 +18,6 @@ namespace Academic_Performance.Forms { private readonly IStudentRepository _studentRepository; private int? _studentId; - public int Id { set @@ -30,9 +29,17 @@ namespace Academic_Performance.Forms { 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; - textBoxFlow.Text = student.Flow; - comboBox1.SelectedItem =student.Group; + comboBoxFlow.Text = student.Flow; + checkedListBoxGroup.SelectedItem =student.Group; _studentId = value; } catch (Exception ex) @@ -48,20 +55,18 @@ namespace Academic_Performance.Forms InitializeComponent(); _studentRepository = 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) { try { - if (string.IsNullOrWhiteSpace(textBoxName.Text)|| string.IsNullOrWhiteSpace(textBoxFlow.Text)) + if (string.IsNullOrWhiteSpace(textBoxName.Text)|| string.IsNullOrWhiteSpace(comboBoxFlow.Text)) { throw new Exception("Имеются незаполненные поля"); } @@ -83,12 +88,11 @@ namespace Academic_Performance.Forms } } - private Student CreateStudent(int id) => Student.CreateEntity( id, - textBoxName.Text, textBoxFlow.Text, (Group)comboBox1.SelectedItem! + textBoxName.Text, comboBoxFlow.Text, (Group)checkedListBoxGroup.SelectedItem! ); } -} +} \ No newline at end of file diff --git a/Academic_Performance/Academic_Performance/Forms/FormStudents.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormStudents.Designer.cs index 6a930d2..e88ddcd 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormStudents.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormStudents.Designer.cs @@ -43,18 +43,20 @@ panel1.Controls.Add(button2); panel1.Controls.Add(button1); 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.Size = new Size(209, 450); + panel1.Size = new Size(167, 360); panel1.TabIndex = 0; // // button3 // button3.BackgroundImage = Properties.Resources.Del; 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.Size = new Size(112, 98); + button3.Size = new Size(90, 78); button3.TabIndex = 2; button3.UseVisualStyleBackColor = true; button3.Click += button3_Click; @@ -63,9 +65,10 @@ // button2.BackgroundImage = Properties.Resources.Upd; 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.Size = new Size(112, 96); + button2.Size = new Size(90, 77); button2.TabIndex = 1; button2.UseVisualStyleBackColor = true; button2.Click += button2_Click; @@ -74,9 +77,10 @@ // button1.BackgroundImage = Properties.Resources.Add; 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.Size = new Size(112, 93); + button1.Size = new Size(90, 74); button1.TabIndex = 0; button1.UseVisualStyleBackColor = true; button1.Click += button1_Click; @@ -91,24 +95,28 @@ dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView1.Dock = DockStyle.Fill; dataGridView1.Location = new Point(0, 0); + dataGridView1.Margin = new Padding(2); dataGridView1.MultiSelect = false; dataGridView1.Name = "dataGridView1"; dataGridView1.ReadOnly = true; dataGridView1.RowHeadersVisible = false; dataGridView1.RowHeadersWidth = 62; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView1.Size = new Size(591, 450); + dataGridView1.Size = new Size(473, 360); dataGridView1.TabIndex = 1; // // FormStudents // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(640, 360); Controls.Add(dataGridView1); Controls.Add(panel1); + Margin = new Padding(2); Name = "FormStudents"; + StartPosition = FormStartPosition.CenterScreen; Text = "FormStudents"; + Load += StudentsList_Load; panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ResumeLayout(false); diff --git a/Academic_Performance/Academic_Performance/Forms/FormSubject.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormSubject.Designer.cs index 03b7b8d..a4c3b4d 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormSubject.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormSubject.Designer.cs @@ -36,9 +36,10 @@ // // 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.Size = new Size(112, 34); + buttonSave.Size = new Size(89, 27); buttonSave.TabIndex = 1; buttonSave.Text = "Сохранить"; buttonSave.UseVisualStyleBackColor = true; @@ -46,9 +47,10 @@ // // 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.Size = new Size(112, 34); + buttonEx.Size = new Size(89, 27); buttonEx.TabIndex = 2; buttonEx.Text = "Отмена"; buttonEx.UseVisualStyleBackColor = true; @@ -57,30 +59,33 @@ // label1 // 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.Size = new Size(173, 25); + label1.Size = new Size(148, 20); label1.TabIndex = 3; label1.Text = "Название предмета"; - label1.Click += label1_Click; // // 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.Size = new Size(241, 31); + textBoxName.Size = new Size(231, 27); textBoxName.TabIndex = 4; // // FormSubject // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(640, 255); Controls.Add(textBoxName); Controls.Add(label1); Controls.Add(buttonEx); Controls.Add(buttonSave); + Margin = new Padding(2, 3, 2, 3); Name = "FormSubject"; + StartPosition = FormStartPosition.CenterScreen; Text = "FormSubject"; ResumeLayout(false); PerformLayout(); diff --git a/Academic_Performance/Academic_Performance/Forms/FormSubject.cs b/Academic_Performance/Academic_Performance/Forms/FormSubject.cs index 8a4de6b..a1e505b 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormSubject.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormSubject.cs @@ -49,17 +49,11 @@ namespace Academic_Performance.Forms throw new ArgumentNullException(nameof(subjectRepository)); } - - private void label1_Click(object sender, EventArgs e) - { - - } - private void buttonSave_Click(object sender, EventArgs e) { try { - if (string.IsNullOrWhiteSpace(textBoxName.Text) ) + if (string.IsNullOrWhiteSpace(textBoxName.Text)) { throw new Exception("Имеются незаполненные поля"); } @@ -81,15 +75,11 @@ namespace Academic_Performance.Forms } } - private Subject CreateSubject(int id) => Subject.CreateEntity( id, textBoxName.Text ); - private void buttonEx_Click(object sender, EventArgs e) => Close(); - - } } diff --git a/Academic_Performance/Academic_Performance/Forms/FormSubjects.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormSubjects.Designer.cs index f62dc8b..478acd4 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormSubjects.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormSubjects.Designer.cs @@ -43,18 +43,20 @@ panel1.Controls.Add(button2); panel1.Controls.Add(button1); 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.Size = new Size(209, 450); + panel1.Size = new Size(167, 360); panel1.TabIndex = 1; // // button3 // button3.BackgroundImage = Properties.Resources.Del; 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.Size = new Size(112, 98); + button3.Size = new Size(90, 78); button3.TabIndex = 2; button3.UseVisualStyleBackColor = true; button3.Click += button3_Click; @@ -63,9 +65,10 @@ // button2.BackgroundImage = Properties.Resources.Upd; 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.Size = new Size(112, 96); + button2.Size = new Size(90, 77); button2.TabIndex = 1; button2.UseVisualStyleBackColor = true; button2.Click += button2_Click; @@ -74,9 +77,10 @@ // button1.BackgroundImage = Properties.Resources.Add; 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.Size = new Size(112, 93); + button1.Size = new Size(90, 74); button1.TabIndex = 0; button1.UseVisualStyleBackColor = true; button1.Click += button1_Click; @@ -91,24 +95,28 @@ dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView1.Dock = DockStyle.Fill; dataGridView1.Location = new Point(0, 0); + dataGridView1.Margin = new Padding(2); dataGridView1.MultiSelect = false; dataGridView1.Name = "dataGridView1"; dataGridView1.ReadOnly = true; dataGridView1.RowHeadersVisible = false; dataGridView1.RowHeadersWidth = 62; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView1.Size = new Size(591, 450); + dataGridView1.Size = new Size(473, 360); dataGridView1.TabIndex = 2; // // FormSubjects // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(640, 360); Controls.Add(dataGridView1); Controls.Add(panel1); + Margin = new Padding(2); Name = "FormSubjects"; + StartPosition = FormStartPosition.CenterScreen; Text = "FormSubjects"; + Load += FormSubject_Load; panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ResumeLayout(false); diff --git a/Academic_Performance/Academic_Performance/Forms/FormTeacher.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormTeacher.Designer.cs index 63cb131..4098e4e 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormTeacher.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormTeacher.Designer.cs @@ -36,9 +36,10 @@ // // 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.Size = new Size(112, 34); + buttonSave.Size = new Size(90, 27); buttonSave.TabIndex = 0; buttonSave.Text = "Сохранить"; buttonSave.UseVisualStyleBackColor = true; @@ -46,9 +47,10 @@ // // 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.Size = new Size(112, 34); + buttonEx.Size = new Size(90, 27); buttonEx.TabIndex = 1; buttonEx.Text = "Отмена"; buttonEx.UseVisualStyleBackColor = true; @@ -57,29 +59,33 @@ // label1 // 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.Size = new Size(183, 25); + label1.Size = new Size(154, 20); label1.TabIndex = 2; label1.Text = "ФИО Преподавателя"; // // 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.Size = new Size(241, 31); + textBoxName.Size = new Size(194, 27); textBoxName.TabIndex = 3; // // FormTeacher // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(489, 315); + ClientSize = new Size(457, 206); Controls.Add(textBoxName); Controls.Add(label1); Controls.Add(buttonEx); Controls.Add(buttonSave); + Margin = new Padding(2, 2, 2, 2); Name = "FormTeacher"; + StartPosition = FormStartPosition.CenterScreen; Text = "FormTeacher"; ResumeLayout(false); PerformLayout(); diff --git a/Academic_Performance/Academic_Performance/Forms/FormTeachers.Designer.cs b/Academic_Performance/Academic_Performance/Forms/FormTeachers.Designer.cs index 6459d3d..e54a4f2 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormTeachers.Designer.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormTeachers.Designer.cs @@ -43,18 +43,20 @@ panel1.Controls.Add(button2); panel1.Controls.Add(button1); 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.Size = new Size(209, 450); + panel1.Size = new Size(167, 360); panel1.TabIndex = 1; // // button3 // button3.BackgroundImage = Properties.Resources.Del; 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.Size = new Size(112, 98); + button3.Size = new Size(90, 78); button3.TabIndex = 2; button3.UseVisualStyleBackColor = true; button3.Click += button3_Click; @@ -63,9 +65,10 @@ // button2.BackgroundImage = Properties.Resources.Upd; 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.Size = new Size(112, 96); + button2.Size = new Size(90, 77); button2.TabIndex = 1; button2.UseVisualStyleBackColor = true; button2.Click += button2_Click; @@ -74,9 +77,10 @@ // button1.BackgroundImage = Properties.Resources.Add; 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.Size = new Size(112, 93); + button1.Size = new Size(90, 74); button1.TabIndex = 0; button1.UseVisualStyleBackColor = true; button1.Click += button1_Click; @@ -91,24 +95,27 @@ dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView1.Dock = DockStyle.Fill; dataGridView1.Location = new Point(0, 0); + dataGridView1.Margin = new Padding(2); dataGridView1.MultiSelect = false; dataGridView1.Name = "dataGridView1"; dataGridView1.ReadOnly = true; - dataGridView1.RowHeadersVisible = false; dataGridView1.RowHeadersWidth = 62; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView1.Size = new Size(591, 450); + dataGridView1.Size = new Size(473, 360); dataGridView1.TabIndex = 2; // // FormTeachers // - AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(640, 360); Controls.Add(dataGridView1); Controls.Add(panel1); + Margin = new Padding(2); Name = "FormTeachers"; + StartPosition = FormStartPosition.CenterScreen; Text = "FormTeachers"; + Load += FormTeachers_Load; panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); ResumeLayout(false); diff --git a/Academic_Performance/Academic_Performance/Forms/FormTeachers.cs b/Academic_Performance/Academic_Performance/Forms/FormTeachers.cs index ec3bc77..86f1185 100644 --- a/Academic_Performance/Academic_Performance/Forms/FormTeachers.cs +++ b/Academic_Performance/Academic_Performance/Forms/FormTeachers.cs @@ -32,7 +32,7 @@ namespace Academic_Performance.Forms { try { - _container.Resolve().ShowDialog(); + _container.Resolve().ShowDialog(); LoadList(); } 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); - return true; + 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); + return true; + } } } diff --git a/Academic_Performance/Academic_Performance/Repositories/IMarkRepository.cs b/Academic_Performance/Academic_Performance/Repositories/IMarkRepository.cs index 2960950..e84b5c4 100644 --- a/Academic_Performance/Academic_Performance/Repositories/IMarkRepository.cs +++ b/Academic_Performance/Academic_Performance/Repositories/IMarkRepository.cs @@ -1,4 +1,5 @@ using Academic_Performance.Entities; +using Academic_Performance.Entities.Enums; using System; using System.Collections.Generic; using System.Linq; @@ -8,11 +9,8 @@ using System.Threading.Tasks; namespace Academic_Performance.Repositories { public interface IMarkRepository - { - IEnumerable GetAllMarks(); - Mark GetMarkById(int id); - void AddMark(Mark mark); - void UpdateMark(Mark mark); + { IEnumerable ReadMark(); + void CreateMark(Mark mark); void DeleteMark(int id); } } diff --git a/Academic_Performance/Academic_Performance/Repositories/IOrderRepository.cs b/Academic_Performance/Academic_Performance/Repositories/IOrderRepository.cs index c576945..657be6e 100644 --- a/Academic_Performance/Academic_Performance/Repositories/IOrderRepository.cs +++ b/Academic_Performance/Academic_Performance/Repositories/IOrderRepository.cs @@ -8,8 +8,7 @@ using System.Threading.Tasks; namespace Academic_Performance.Repositories { public interface IOrderRepository - { - IEnumerable ReadOrder(); + { IEnumerable ReadOrder(); Order GetOrderById(int id); void AddOrder(Order order); void UpdateOrder(Order order); diff --git a/Academic_Performance/Academic_Performance/Repositories/IStatementRepository.cs b/Academic_Performance/Academic_Performance/Repositories/IStatementRepository.cs index fea46c8..2803102 100644 --- a/Academic_Performance/Academic_Performance/Repositories/IStatementRepository.cs +++ b/Academic_Performance/Academic_Performance/Repositories/IStatementRepository.cs @@ -9,9 +9,8 @@ namespace Academic_Performance.Repositories { public interface IStatementRepository { - IEnumerable GetAllStatements(); - Statement GetStatementById(int id); - void AddStatement(Statement statement); + IEnumerable ReadStatement(); + void CreateStatement(Statement statement); void UpdateStatement(Statement statement); void DeleteStatement(int id); } diff --git a/Academic_Performance/Academic_Performance/Repositories/Implementations/MarkRepository.cs b/Academic_Performance/Academic_Performance/Repositories/Implementations/MarkRepository.cs index 15fd7b6..46b6035 100644 --- a/Academic_Performance/Academic_Performance/Repositories/Implementations/MarkRepository.cs +++ b/Academic_Performance/Academic_Performance/Repositories/Implementations/MarkRepository.cs @@ -8,34 +8,20 @@ using System.Threading.Tasks; namespace Academic_Performance.Repositories.Implementations { - public class MarkRepository : IMarkRepository { public void CreateMark(Mark Mark) { } - public void UpdateMark(Mark Mark) - { - } - - public void DeleteMark(int id) - { - } - - public Mark GetMarkById(int id) - { - return Mark.CreateOperation(0, 0, 0, 0, Value.One); - } - - public IEnumerable GetAllMarks() + void IMarkRepository.DeleteMark(int id) { - return new List(); } - public void AddMark(Mark mark) + + IEnumerable IMarkRepository.ReadMark() { - + return []; } } } diff --git a/Academic_Performance/Academic_Performance/Repositories/Implementations/OrderRepository.cs b/Academic_Performance/Academic_Performance/Repositories/Implementations/OrderRepository.cs index 630e143..3c72810 100644 --- a/Academic_Performance/Academic_Performance/Repositories/Implementations/OrderRepository.cs +++ b/Academic_Performance/Academic_Performance/Repositories/Implementations/OrderRepository.cs @@ -13,25 +13,20 @@ namespace Academic_Performance.Repositories.Implementations public void AddOrder(Order order) { } - public void DeleteOrder(int id) { } - public IEnumerable GetAllOrders() { return new List(); } - public Order GetOrderById(int id) { return Order.CreateEntity(0,0, string.Empty,TypeS.None); } - public void UpdateOrder(Order order) { } - IEnumerable IOrderRepository.ReadOrder() { return []; diff --git a/Academic_Performance/Academic_Performance/Repositories/Implementations/StatementRepository.cs b/Academic_Performance/Academic_Performance/Repositories/Implementations/StatementRepository.cs index 8b4d87c..05d4909 100644 --- a/Academic_Performance/Academic_Performance/Repositories/Implementations/StatementRepository.cs +++ b/Academic_Performance/Academic_Performance/Repositories/Implementations/StatementRepository.cs @@ -9,29 +9,23 @@ namespace Academic_Performance.Repositories.Implementations { public class StatementRepository : IStatementRepository { - public void AddStatement(Statement statement) + public void CreateStatement(Statement statement) { - // Заглушка } - public void DeleteStatement(int id) { - // Заглушка } - - public IEnumerable GetAllStatements() + public IEnumerable ReadStatements() { - return new List(); + return []; } - - public Statement GetStatementById(int id) - { - return Statement.CreateOperation(0, 0, 0); - } - + public void UpdateStatement(Statement statment) { - // Заглушка + } + public IEnumerable ReadStatement() + { + return []; } } -} +} \ No newline at end of file diff --git a/Academic_Performance/Academic_Performance/Repositories/Implementations/StudentRepository.cs b/Academic_Performance/Academic_Performance/Repositories/Implementations/StudentRepository.cs index f95c1e2..a845006 100644 --- a/Academic_Performance/Academic_Performance/Repositories/Implementations/StudentRepository.cs +++ b/Academic_Performance/Academic_Performance/Repositories/Implementations/StudentRepository.cs @@ -13,25 +13,20 @@ namespace Academic_Performance.Repositories.Implementations public void AddStudent(Student subject) { } - public void DeleteStudent(int id) { } - public IEnumerable GetAllStudents() { return new List(); } - public Student GetStudentById(int id) { return Student.CreateEntity(0, string.Empty,string.Empty ,Group.None); } - public void UpdateStudent(Student student) { } - IEnumerable IStudentRepository.ReadStudent() { return []; diff --git a/Academic_Performance/Academic_Performance/Repositories/Implementations/SubjectRepository.cs b/Academic_Performance/Academic_Performance/Repositories/Implementations/SubjectRepository.cs index 08145de..650a9ed 100644 --- a/Academic_Performance/Academic_Performance/Repositories/Implementations/SubjectRepository.cs +++ b/Academic_Performance/Academic_Performance/Repositories/Implementations/SubjectRepository.cs @@ -13,22 +13,16 @@ namespace Academic_Performance.Repositories.Implementations public void AddSubject(Subject subject) { } - public void DeleteSubject(int id) { } - - - public Subject GetSubjectById(int id) { return Subject.CreateEntity(0, string.Empty); } - public void UpdateSubject(Subject subject) { } - IEnumerable ISubjectRepository.ReadSubject() { return []; diff --git a/Academic_Performance/Academic_Performance/Repositories/Implementations/TeacherRepository.cs b/Academic_Performance/Academic_Performance/Repositories/Implementations/TeacherRepository.cs index c862858..c59a32d 100644 --- a/Academic_Performance/Academic_Performance/Repositories/Implementations/TeacherRepository.cs +++ b/Academic_Performance/Academic_Performance/Repositories/Implementations/TeacherRepository.cs @@ -12,26 +12,21 @@ namespace Academic_Performance.Repositories.Implementations public void CreateTeacher(Teacher teacher) { } - public void DeleteTeacher(int id) { } - public IEnumerable GetAllTeachers() { return new List(); } - public Teacher GetTeacherById(int id) { return Teacher.CreateEntity(0, string.Empty); } - public IEnumerable ReadTeachers() { return []; } - public void UpdateTeacher(Teacher teacher) { }