Лабораторная работа 1
This commit is contained in:
parent
1060833725
commit
71a5fe1e3a
@ -0,0 +1,9 @@
|
|||||||
|
namespace StudentProgress.Entities.Enums;
|
||||||
|
|
||||||
|
public enum DisLectE
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Praktika = 1,
|
||||||
|
Lecturer = 2,
|
||||||
|
Labaratory = 3
|
||||||
|
}
|
17
StudentProgress/StudentProgress/Entities/Enums/Grade.cs
Normal file
17
StudentProgress/StudentProgress/Entities/Enums/Grade.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StudentProgress.Entities.Enums;
|
||||||
|
|
||||||
|
public enum Grade
|
||||||
|
{
|
||||||
|
None = 0, //пересдача
|
||||||
|
Two = 1,
|
||||||
|
Three = 2,
|
||||||
|
Four = 3,
|
||||||
|
Five = 4,
|
||||||
|
Zachet = 5
|
||||||
|
}
|
10
StudentProgress/StudentProgress/Entities/Enums/TypeOfWork.cs
Normal file
10
StudentProgress/StudentProgress/Entities/Enums/TypeOfWork.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace StudentProgress.Entities.Enums;
|
||||||
|
[Flags]
|
||||||
|
public enum TypeOfWork
|
||||||
|
{
|
||||||
|
None = 0, //неизвестная работа
|
||||||
|
Exam = 1,
|
||||||
|
Zachet = 2,
|
||||||
|
Referat = 4,
|
||||||
|
Laba = 8,
|
||||||
|
}
|
20
StudentProgress/StudentProgress/Entities/Grades.cs
Normal file
20
StudentProgress/StudentProgress/Entities/Grades.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
namespace StudentProgress.Entities;
|
||||||
|
|
||||||
|
public class Grades
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public int SubjectsId { get; private set; }
|
||||||
|
public int ProfessorsId { get; private set; }
|
||||||
|
public DateTime Date { get; private set; }
|
||||||
|
|
||||||
|
public static Grades CreateEntity(int id, int subjectsId, int professorsId, DateTime date)
|
||||||
|
{
|
||||||
|
return new Grades
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
SubjectsId = subjectsId,
|
||||||
|
ProfessorsId = professorsId,
|
||||||
|
Date = date
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
17
StudentProgress/StudentProgress/Entities/Group.cs
Normal file
17
StudentProgress/StudentProgress/Entities/Group.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace StudentProgress.Entities
|
||||||
|
{
|
||||||
|
public class Group
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string NameGroup { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public static Group CreateEntity(int id, string nameGroup)
|
||||||
|
{
|
||||||
|
return new Group
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
NameGroup = nameGroup ?? string.Empty
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
35
StudentProgress/StudentProgress/Entities/Lectures.cs
Normal file
35
StudentProgress/StudentProgress/Entities/Lectures.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
namespace StudentProgress.Entities
|
||||||
|
{
|
||||||
|
public class Lectures
|
||||||
|
{
|
||||||
|
public int LectureId { get; private set; }
|
||||||
|
public int ProfessorsId { get; private set; }
|
||||||
|
public DateTime Date { get; private set; }
|
||||||
|
public string Auditorium { get; private set; }
|
||||||
|
|
||||||
|
public Lectures()
|
||||||
|
{
|
||||||
|
Auditorium = string.Empty; // Инициализация свойства Auditorium
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetProfessorsId(int professorsId)
|
||||||
|
{
|
||||||
|
ProfessorsId = professorsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDate(DateTime date)
|
||||||
|
{
|
||||||
|
Date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLectureId(int lectureId)
|
||||||
|
{
|
||||||
|
LectureId = lectureId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAuditorium(string auditorium)
|
||||||
|
{
|
||||||
|
Auditorium = auditorium;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
StudentProgress/StudentProgress/Entities/Professors.cs
Normal file
17
StudentProgress/StudentProgress/Entities/Professors.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace StudentProgress.Entities;
|
||||||
|
|
||||||
|
public class Professors
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string FirstNameProfessor { get; set; } = string.Empty;
|
||||||
|
public string SurnameProfessor { get; set; } = string.Empty;
|
||||||
|
public static Professors CreateEntity(int id, string firstName, string SurnameProfessor)
|
||||||
|
{
|
||||||
|
return new Professors
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
FirstNameProfessor = firstName ?? string.Empty,
|
||||||
|
SurnameProfessor = SurnameProfessor ?? string.Empty
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
21
StudentProgress/StudentProgress/Entities/Student.cs
Normal file
21
StudentProgress/StudentProgress/Entities/Student.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
namespace StudentProgress.Entities
|
||||||
|
{
|
||||||
|
public class Student
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string Surname { get; set; } = string.Empty;
|
||||||
|
public int GroupId { get; set; }
|
||||||
|
|
||||||
|
public static Student CreateEntity(int id, string name, string surname, int groupId)
|
||||||
|
{
|
||||||
|
return new Student
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Name = name ?? string.Empty,
|
||||||
|
Surname = surname ?? string.Empty,
|
||||||
|
GroupId = groupId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
StudentProgress/StudentProgress/Entities/StudentGrades.cs
Normal file
19
StudentProgress/StudentProgress/Entities/StudentGrades.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using StudentProgress.Entities.Enums;
|
||||||
|
|
||||||
|
namespace StudentProgress.Entities;
|
||||||
|
|
||||||
|
public class StudentGrades
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public int StudentID { get; private set; }
|
||||||
|
public Grade Grade { get; private set; }
|
||||||
|
public static StudentGrades CreateEntity(int id, int studentID, Grade grade)
|
||||||
|
{
|
||||||
|
return new StudentGrades
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
StudentID = studentID,
|
||||||
|
Grade = grade
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
17
StudentProgress/StudentProgress/Entities/Subjects.cs
Normal file
17
StudentProgress/StudentProgress/Entities/Subjects.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace StudentProgress.Entities;
|
||||||
|
|
||||||
|
public class Subjects
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string NameSubject { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public static Subjects CreateEntity_(int id, string nameSubject)
|
||||||
|
{
|
||||||
|
return new Subjects
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
NameSubject = nameSubject ?? string.Empty,
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
39
StudentProgress/StudentProgress/Form1.Designer.cs
generated
39
StudentProgress/StudentProgress/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace StudentProgress
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Text = "Form1";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace StudentProgress
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
149
StudentProgress/StudentProgress/FormStudentProgress.Designer.cs
generated
Normal file
149
StudentProgress/StudentProgress/FormStudentProgress.Designer.cs
generated
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
namespace StudentProgress
|
||||||
|
{
|
||||||
|
partial class FormStudentProgress
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
menuStrip1 = new MenuStrip();
|
||||||
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
группыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
студентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
преподавателиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
предметыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
оценкиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
учетЛекцийToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
menuStrip1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// menuStrip1
|
||||||
|
//
|
||||||
|
menuStrip1.ImageScalingSize = new Size(32, 32);
|
||||||
|
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
|
||||||
|
menuStrip1.Location = new Point(0, 0);
|
||||||
|
menuStrip1.Name = "menuStrip1";
|
||||||
|
menuStrip1.Padding = new Padding(13, 5, 0, 5);
|
||||||
|
menuStrip1.Size = new Size(915, 46);
|
||||||
|
menuStrip1.TabIndex = 0;
|
||||||
|
menuStrip1.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// справочникиToolStripMenuItem
|
||||||
|
//
|
||||||
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { группыToolStripMenuItem, студентыToolStripMenuItem, преподавателиToolStripMenuItem, предметыToolStripMenuItem });
|
||||||
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
|
справочникиToolStripMenuItem.Size = new Size(184, 36);
|
||||||
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
|
//
|
||||||
|
// группыToolStripMenuItem
|
||||||
|
//
|
||||||
|
группыToolStripMenuItem.Name = "группыToolStripMenuItem";
|
||||||
|
группыToolStripMenuItem.Size = new Size(319, 44);
|
||||||
|
группыToolStripMenuItem.Text = "Группы";
|
||||||
|
группыToolStripMenuItem.Click += GroupToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// студентыToolStripMenuItem
|
||||||
|
//
|
||||||
|
студентыToolStripMenuItem.Name = "студентыToolStripMenuItem";
|
||||||
|
студентыToolStripMenuItem.Size = new Size(319, 44);
|
||||||
|
студентыToolStripMenuItem.Text = "Студенты";
|
||||||
|
студентыToolStripMenuItem.Click += StudentToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// преподавателиToolStripMenuItem
|
||||||
|
//
|
||||||
|
преподавателиToolStripMenuItem.Name = "преподавателиToolStripMenuItem";
|
||||||
|
преподавателиToolStripMenuItem.Size = new Size(319, 44);
|
||||||
|
преподавателиToolStripMenuItem.Text = "Преподаватели";
|
||||||
|
преподавателиToolStripMenuItem.Click += ProfessorToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// предметыToolStripMenuItem
|
||||||
|
//
|
||||||
|
предметыToolStripMenuItem.Name = "предметыToolStripMenuItem";
|
||||||
|
предметыToolStripMenuItem.Size = new Size(319, 44);
|
||||||
|
предметыToolStripMenuItem.Text = "Предметы";
|
||||||
|
предметыToolStripMenuItem.Click += SubjectToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// операцииToolStripMenuItem
|
||||||
|
//
|
||||||
|
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { оценкиToolStripMenuItem, учетЛекцийToolStripMenuItem });
|
||||||
|
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||||
|
операцииToolStripMenuItem.Size = new Size(147, 36);
|
||||||
|
операцииToolStripMenuItem.Text = "Операции";
|
||||||
|
//
|
||||||
|
// оценкиToolStripMenuItem
|
||||||
|
//
|
||||||
|
оценкиToolStripMenuItem.Name = "оценкиToolStripMenuItem";
|
||||||
|
оценкиToolStripMenuItem.Size = new Size(285, 44);
|
||||||
|
оценкиToolStripMenuItem.Text = "Оценки";
|
||||||
|
оценкиToolStripMenuItem.Click += GradeToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// учетЛекцийToolStripMenuItem
|
||||||
|
//
|
||||||
|
учетЛекцийToolStripMenuItem.Name = "учетЛекцийToolStripMenuItem";
|
||||||
|
учетЛекцийToolStripMenuItem.Size = new Size(285, 44);
|
||||||
|
учетЛекцийToolStripMenuItem.Text = "Учет лекций";
|
||||||
|
учетЛекцийToolStripMenuItem.Click += LecturesCountToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// отчетыToolStripMenuItem
|
||||||
|
//
|
||||||
|
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||||
|
отчетыToolStripMenuItem.Size = new Size(116, 36);
|
||||||
|
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||||
|
//
|
||||||
|
// FormStudentProgress
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackgroundImage = Properties.Resources.BackGround;
|
||||||
|
BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ClientSize = new Size(915, 559);
|
||||||
|
Controls.Add(menuStrip1);
|
||||||
|
MainMenuStrip = menuStrip1;
|
||||||
|
Margin = new Padding(6, 7, 6, 7);
|
||||||
|
Name = "FormStudentProgress";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Учет успеваемости студентов";
|
||||||
|
menuStrip1.ResumeLayout(false);
|
||||||
|
menuStrip1.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem справочникиToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem группыToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem студентыToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem преподавателиToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem предметыToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem операцииToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem оценкиToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem учетЛекцийToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem отчетыToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
102
StudentProgress/StudentProgress/FormStudentProgress.cs
Normal file
102
StudentProgress/StudentProgress/FormStudentProgress.cs
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
using StudentProgress.Forms;
|
||||||
|
using Unity;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace StudentProgress
|
||||||
|
{
|
||||||
|
public partial class FormStudentProgress : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
public FormStudentProgress(IUnityContainer container)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GroupToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormGroups>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StudentToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormStudents>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SubjectToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormSubjects>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GradeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormGrades>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProfessorToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormProfessors>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RecordLectureToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormRecordLecture>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LecturesCountToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormLecturesCount>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
126
StudentProgress/StudentProgress/FormStudentProgress.resx
Normal file
126
StudentProgress/StudentProgress/FormStudentProgress.resx
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>25</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
219
StudentProgress/StudentProgress/Forms/FormGrade.Designer.cs
generated
Normal file
219
StudentProgress/StudentProgress/Forms/FormGrade.Designer.cs
generated
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormGrade
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
label1 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
label3 = new Label();
|
||||||
|
label4 = new Label();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
dateTimePicker1 = new DateTimePicker();
|
||||||
|
comboBoxSubject = new ComboBox();
|
||||||
|
comboBoxProfessor = new ComboBox();
|
||||||
|
checkedListBoxType = new CheckedListBox();
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
groupBox2 = new GroupBox();
|
||||||
|
dataGridView1 = new DataGridView();
|
||||||
|
ColumnStudent = new DataGridViewComboBoxColumn();
|
||||||
|
groupBox2.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(62, 49);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(94, 32);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "Работа:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(62, 272);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(116, 32);
|
||||||
|
label2.TabIndex = 1;
|
||||||
|
label2.Text = "Предмет:";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(62, 370);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(191, 32);
|
||||||
|
label3.TabIndex = 2;
|
||||||
|
label3.Text = "Преподователь:";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(62, 481);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(70, 32);
|
||||||
|
label4.TabIndex = 3;
|
||||||
|
label4.Text = "Дата:";
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(62, 625);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(150, 46);
|
||||||
|
buttonSave.TabIndex = 4;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(357, 625);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(150, 46);
|
||||||
|
buttonCancel.TabIndex = 5;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// dateTimePicker1
|
||||||
|
//
|
||||||
|
dateTimePicker1.Location = new Point(178, 481);
|
||||||
|
dateTimePicker1.Name = "dateTimePicker1";
|
||||||
|
dateTimePicker1.Size = new Size(400, 39);
|
||||||
|
dateTimePicker1.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// comboBoxSubject
|
||||||
|
//
|
||||||
|
comboBoxSubject.FormattingEnabled = true;
|
||||||
|
comboBoxSubject.Location = new Point(267, 272);
|
||||||
|
comboBoxSubject.Name = "comboBoxSubject";
|
||||||
|
comboBoxSubject.Size = new Size(242, 40);
|
||||||
|
comboBoxSubject.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// comboBoxProfessor
|
||||||
|
//
|
||||||
|
comboBoxProfessor.FormattingEnabled = true;
|
||||||
|
comboBoxProfessor.Location = new Point(267, 370);
|
||||||
|
comboBoxProfessor.Name = "comboBoxProfessor";
|
||||||
|
comboBoxProfessor.Size = new Size(242, 40);
|
||||||
|
comboBoxProfessor.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// checkedListBoxType
|
||||||
|
//
|
||||||
|
checkedListBoxType.FormattingEnabled = true;
|
||||||
|
checkedListBoxType.Location = new Point(267, 49);
|
||||||
|
checkedListBoxType.Name = "checkedListBoxType";
|
||||||
|
checkedListBoxType.Size = new Size(240, 184);
|
||||||
|
checkedListBoxType.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Location = new Point(680, 158);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(400, 200);
|
||||||
|
groupBox1.TabIndex = 11;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "groupBox1";
|
||||||
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
groupBox2.Controls.Add(dataGridView1);
|
||||||
|
groupBox2.Location = new Point(627, 49);
|
||||||
|
groupBox2.Margin = new Padding(6);
|
||||||
|
groupBox2.Name = "groupBox2";
|
||||||
|
groupBox2.Padding = new Padding(6);
|
||||||
|
groupBox2.Size = new Size(519, 622);
|
||||||
|
groupBox2.TabIndex = 12;
|
||||||
|
groupBox2.TabStop = false;
|
||||||
|
groupBox2.Text = "Оценка";
|
||||||
|
//
|
||||||
|
// dataGridView1
|
||||||
|
//
|
||||||
|
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColumnStudent });
|
||||||
|
dataGridView1.Dock = DockStyle.Fill;
|
||||||
|
dataGridView1.Location = new Point(6, 38);
|
||||||
|
dataGridView1.Margin = new Padding(6);
|
||||||
|
dataGridView1.Name = "dataGridView1";
|
||||||
|
dataGridView1.RowHeadersWidth = 82;
|
||||||
|
dataGridView1.Size = new Size(507, 578);
|
||||||
|
dataGridView1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ColumnStudent
|
||||||
|
//
|
||||||
|
ColumnStudent.HeaderText = "Студент";
|
||||||
|
ColumnStudent.MinimumWidth = 10;
|
||||||
|
ColumnStudent.Name = "ColumnStudent";
|
||||||
|
//
|
||||||
|
// FormGrade
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1161, 779);
|
||||||
|
Controls.Add(groupBox2);
|
||||||
|
Controls.Add(groupBox1);
|
||||||
|
Controls.Add(checkedListBoxType);
|
||||||
|
Controls.Add(comboBoxProfessor);
|
||||||
|
Controls.Add(comboBoxSubject);
|
||||||
|
Controls.Add(dateTimePicker1);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Name = "FormGrade";
|
||||||
|
Text = "Оценка";
|
||||||
|
Load += FormGrade_Load;
|
||||||
|
groupBox2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label label1;
|
||||||
|
private Label label2;
|
||||||
|
private Label label3;
|
||||||
|
private Label label4;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private DateTimePicker dateTimePicker1;
|
||||||
|
private ComboBox comboBoxSubject;
|
||||||
|
private ComboBox comboBoxProfessor;
|
||||||
|
private CheckedListBox checkedListBoxType;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private GroupBox groupBox2;
|
||||||
|
private DataGridView dataGridView1;
|
||||||
|
private DataGridViewComboBoxColumn ColumnStudent;
|
||||||
|
}
|
||||||
|
}
|
124
StudentProgress/StudentProgress/Forms/FormGrade.cs
Normal file
124
StudentProgress/StudentProgress/Forms/FormGrade.cs
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using StudentProgress.Entities;
|
||||||
|
using StudentProgress.Entities.Enums;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormGrade : Form
|
||||||
|
{
|
||||||
|
private readonly IGradesRepository _gradesRepository;
|
||||||
|
private readonly ISubjectsRepository _subjectsRepository;
|
||||||
|
private readonly IProfessorsNameRepository _professorsRepository;
|
||||||
|
private readonly IStudentRepository _studentRepository;
|
||||||
|
|
||||||
|
public FormGrade(IGradesRepository gradesRepository, ISubjectsRepository subjectsRepository,
|
||||||
|
IProfessorsNameRepository professorsRepository, IStudentRepository studentRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_gradesRepository = gradesRepository ?? throw new ArgumentNullException(nameof(gradesRepository));
|
||||||
|
_subjectsRepository = subjectsRepository ?? throw new ArgumentNullException(nameof(subjectsRepository));
|
||||||
|
_professorsRepository = professorsRepository ?? throw new ArgumentNullException(nameof(professorsRepository));
|
||||||
|
_studentRepository = studentRepository ?? throw new ArgumentNullException(nameof(studentRepository));
|
||||||
|
|
||||||
|
LoadWorkTypes();
|
||||||
|
LoadSubjects();
|
||||||
|
LoadProfessors();
|
||||||
|
LoadStudents();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadWorkTypes()
|
||||||
|
{
|
||||||
|
foreach (var elem in Enum.GetValues(typeof(TypeOfWork)))
|
||||||
|
{
|
||||||
|
checkedListBoxType.Items.Add(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadSubjects()
|
||||||
|
{
|
||||||
|
var subjects = _subjectsRepository.ReadSubjects();
|
||||||
|
comboBoxSubject.DataSource = subjects;
|
||||||
|
comboBoxSubject.DisplayMember = "NameSubject";
|
||||||
|
comboBoxSubject.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadProfessors()
|
||||||
|
{
|
||||||
|
var professors = _professorsRepository.ReadProfessorsName();
|
||||||
|
comboBoxProfessor.DataSource = professors;
|
||||||
|
comboBoxProfessor.DisplayMember = "FirstNameProfessor";
|
||||||
|
comboBoxProfessor.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadStudents()
|
||||||
|
{
|
||||||
|
var students = _studentRepository.ReadStudents();
|
||||||
|
ColumnStudent.DataSource = students;
|
||||||
|
ColumnStudent.DisplayMember = "Name";
|
||||||
|
ColumnStudent.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxSubject.SelectedIndex < 0 || checkedListBoxType.CheckedItems.Count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
CreateGrade(0);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private Grades CreateGrade(int id)
|
||||||
|
{
|
||||||
|
TypeOfWork typeOfWork = TypeOfWork.None;
|
||||||
|
foreach (var elem in checkedListBoxType.CheckedItems)
|
||||||
|
{
|
||||||
|
typeOfWork |= (TypeOfWork)elem;
|
||||||
|
}
|
||||||
|
return Grades.CreateEntity(id, (int)comboBoxSubject.SelectedValue, (int)comboBoxProfessor.SelectedValue, dateTimePicker1.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormGrade_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var columnGrade = new DataGridViewComboBoxColumn
|
||||||
|
{
|
||||||
|
Name = "ColumnGrade",
|
||||||
|
HeaderText = "Оценка",
|
||||||
|
DataSource = Enum.GetValues(typeof(Grade))
|
||||||
|
};
|
||||||
|
|
||||||
|
if (dataGridView1.Columns["ColumnGrade"] != null)
|
||||||
|
{
|
||||||
|
dataGridView1.Columns.Remove("ColumnGrade");
|
||||||
|
}
|
||||||
|
|
||||||
|
dataGridView1.Columns.Add(columnGrade);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<StudentGrades> CreateListFeedFeedReplenishmentsFromDataGrid()
|
||||||
|
{
|
||||||
|
var list = new List<StudentGrades>();
|
||||||
|
foreach (DataGridViewRow row in dataGridView1.Rows)
|
||||||
|
{
|
||||||
|
if (row.Cells["ColumnStudent"].Value == null || row.Cells["ColumnGrade"].Value == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list.Add(StudentGrades.CreateEntity(0, Convert.ToInt32(row.Cells["ColumnStudent"].Value), (Grade)(row.Cells["ColumnGrade"].Value)));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
StudentProgress/StudentProgress/Forms/FormGrade.resx
Normal file
126
StudentProgress/StudentProgress/Forms/FormGrade.resx
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?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="ColumnStudent.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ColumnStudent.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
110
StudentProgress/StudentProgress/Forms/FormGrades.Designer.cs
generated
Normal file
110
StudentProgress/StudentProgress/Forms/FormGrades.Designer.cs
generated
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormGrades
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(548, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(75, 271);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(7, 93);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(56, 53);
|
||||||
|
buttonDel.TabIndex = 1;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(7, 34);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(56, 53);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.Size = new Size(548, 271);
|
||||||
|
dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// FormGrades
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(623, 271);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormGrades";
|
||||||
|
Text = "Оценки";
|
||||||
|
Load += FormGrades_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonAdd;
|
||||||
|
}
|
||||||
|
}
|
80
StudentProgress/StudentProgress/Forms/FormGrades.cs
Normal file
80
StudentProgress/StudentProgress/Forms/FormGrades.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormGrades : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IGradesRepository _gradesRepository;
|
||||||
|
|
||||||
|
public FormGrades(IUnityContainer container, IGradesRepository gradesRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
_gradesRepository = gradesRepository ?? throw new ArgumentNullException(nameof(gradesRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormGrade>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormGrades_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridView.DataSource = _gradesRepository.ReadGrades();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_gradesRepository.DeleteGrade(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
108
StudentProgress/StudentProgress/Forms/FormGroup.Designer.cs
generated
Normal file
108
StudentProgress/StudentProgress/Forms/FormGroup.Designer.cs
generated
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
using System.Drawing.Printing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormGroup
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
label1 = new Label();
|
||||||
|
textBoxNameGroup = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(76, 68);
|
||||||
|
label1.Margin = new Padding(6, 0, 6, 0);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(212, 32);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "Название группы:";
|
||||||
|
//
|
||||||
|
// textBoxNameGroup
|
||||||
|
//
|
||||||
|
textBoxNameGroup.Location = new Point(338, 61);
|
||||||
|
textBoxNameGroup.Margin = new Padding(6);
|
||||||
|
textBoxNameGroup.Name = "textBoxNameGroup";
|
||||||
|
textBoxNameGroup.Size = new Size(232, 39);
|
||||||
|
textBoxNameGroup.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(74, 373);
|
||||||
|
buttonSave.Margin = new Padding(6);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(189, 62);
|
||||||
|
buttonSave.TabIndex = 6;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(338, 373);
|
||||||
|
buttonCancel.Margin = new Padding(6);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(189, 62);
|
||||||
|
buttonCancel.TabIndex = 7;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
|
||||||
|
//
|
||||||
|
// FormGroup
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(644, 461);
|
||||||
|
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxNameGroup);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Margin = new Padding(6);
|
||||||
|
Name = "FormGroup";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Группа";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label label1;
|
||||||
|
private TextBox textBoxNameGroup;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
}
|
||||||
|
}
|
83
StudentProgress/StudentProgress/Forms/FormGroup.cs
Normal file
83
StudentProgress/StudentProgress/Forms/FormGroup.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using StudentProgress.Entities.Enums;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
using StudentProgress.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 StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormGroup : Form
|
||||||
|
{
|
||||||
|
private readonly IGroupRepository _groupRepository;
|
||||||
|
private int? _groupId;
|
||||||
|
|
||||||
|
public FormGroup(IGroupRepository groupRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_groupRepository = groupRepository ?? throw new ArgumentNullException(nameof(groupRepository));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var group = _groupRepository.ReadGroupById(value);
|
||||||
|
if (group == null)
|
||||||
|
{
|
||||||
|
throw new
|
||||||
|
InvalidDataException(nameof(group));
|
||||||
|
}
|
||||||
|
textBoxNameGroup.Text = group.NameGroup;
|
||||||
|
_groupId = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxNameGroup.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_groupId.HasValue)
|
||||||
|
{
|
||||||
|
_groupRepository.UpdateGroup(CreateGroup(_groupId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_groupRepository.CreateGroup(CreateGroup(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
private Group CreateGroup(int id) => Group.CreateEntity(id, textBoxNameGroup.Text);
|
||||||
|
}
|
||||||
|
}
|
120
StudentProgress/StudentProgress/Forms/FormGroup.resx
Normal file
120
StudentProgress/StudentProgress/Forms/FormGroup.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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>
|
||||||
|
</root>
|
122
StudentProgress/StudentProgress/Forms/FormGroups.Designer.cs
generated
Normal file
122
StudentProgress/StudentProgress/Forms/FormGroups.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormGroups
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
buttonPencil = new Button();
|
||||||
|
buttonDel = new Button();
|
||||||
|
panel1 = new Panel();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(26, 30);
|
||||||
|
dataGridView.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 82;
|
||||||
|
dataGridView.Size = new Size(635, 569);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(28, 37);
|
||||||
|
buttonAdd.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(162, 115);
|
||||||
|
buttonAdd.TabIndex = 1;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// buttonPencil
|
||||||
|
//
|
||||||
|
buttonPencil.BackgroundImage = Properties.Resources.Pencil;
|
||||||
|
buttonPencil.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonPencil.Location = new Point(28, 224);
|
||||||
|
buttonPencil.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonPencil.Name = "buttonPencil";
|
||||||
|
buttonPencil.Size = new Size(162, 127);
|
||||||
|
buttonPencil.TabIndex = 2;
|
||||||
|
buttonPencil.UseVisualStyleBackColor = true;
|
||||||
|
buttonPencil.Click += buttonPencil_Click;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(28, 390);
|
||||||
|
buttonDel.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(162, 127);
|
||||||
|
buttonDel.TabIndex = 3;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Controls.Add(buttonPencil);
|
||||||
|
panel1.Location = new Point(693, 30);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(214, 569);
|
||||||
|
panel1.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// FormGroups
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(919, 628);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Margin = new Padding(6, 7, 6, 7);
|
||||||
|
Name = "FormGroups";
|
||||||
|
Text = "Группы";
|
||||||
|
Load += FormGroups_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.DataGridView dataGridView;
|
||||||
|
private System.Windows.Forms.Button buttonAdd;
|
||||||
|
private System.Windows.Forms.Button buttonPencil;
|
||||||
|
private System.Windows.Forms.Button buttonDel;
|
||||||
|
private Panel panel1;
|
||||||
|
}
|
||||||
|
}
|
103
StudentProgress/StudentProgress/Forms/FormGroups.cs
Normal file
103
StudentProgress/StudentProgress/Forms/FormGroups.cs
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
using StudentProgress.Forms;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormGroups : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IGroupRepository _groupRepository;
|
||||||
|
|
||||||
|
public FormGroups(IUnityContainer container, IGroupRepository groupRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
_groupRepository = groupRepository ?? throw new ArgumentNullException(nameof(groupRepository));
|
||||||
|
}
|
||||||
|
private void FormGroups_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormGroup>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonPencil_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormGroup>();
|
||||||
|
form.ShowDialog();
|
||||||
|
form.Id = findId;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
_groupRepository.DeleteGroup(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridView.DataSource = _groupRepository.ReadGroup();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
StudentProgress/StudentProgress/Forms/FormGroups.resx
Normal file
120
StudentProgress/StudentProgress/Forms/FormGroups.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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>
|
||||||
|
</root>
|
106
StudentProgress/StudentProgress/Forms/FormLecturesCount.Designer.cs
generated
Normal file
106
StudentProgress/StudentProgress/Forms/FormLecturesCount.Designer.cs
generated
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormLecturesCount
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
LecturesDataGridView = new DataGridView();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
buttonDel = new Button();
|
||||||
|
panel1 = new Panel();
|
||||||
|
((System.ComponentModel.ISupportInitialize)LecturesDataGridView).BeginInit();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// LecturesDataGridView
|
||||||
|
//
|
||||||
|
LecturesDataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
LecturesDataGridView.Location = new Point(15, 16);
|
||||||
|
LecturesDataGridView.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
LecturesDataGridView.Name = "LecturesDataGridView";
|
||||||
|
LecturesDataGridView.RowHeadersWidth = 82;
|
||||||
|
LecturesDataGridView.Size = new Size(841, 459);
|
||||||
|
LecturesDataGridView.TabIndex = 0;
|
||||||
|
LecturesDataGridView.CellContentClick += LecturesDataGridView_CellContentClick;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(28, 36);
|
||||||
|
buttonAdd.Margin = new Padding(13, 17, 13, 17);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(155, 128);
|
||||||
|
buttonAdd.TabIndex = 1;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(25, 281);
|
||||||
|
buttonDel.Margin = new Padding(13, 17, 13, 17);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(158, 138);
|
||||||
|
buttonDel.TabIndex = 2;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Location = new Point(885, 16);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(216, 452);
|
||||||
|
panel1.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// FormLecturesCount
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1112, 493);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(LecturesDataGridView);
|
||||||
|
Margin = new Padding(6, 7, 6, 7);
|
||||||
|
Name = "FormLecturesCount";
|
||||||
|
Text = "Учет лекций";
|
||||||
|
Load += FormLecturesCount_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)LecturesDataGridView).EndInit();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.DataGridView LecturesDataGridView;
|
||||||
|
private System.Windows.Forms.Button buttonAdd;
|
||||||
|
private System.Windows.Forms.Button buttonDel;
|
||||||
|
private Panel panel1;
|
||||||
|
}
|
||||||
|
}
|
96
StudentProgress/StudentProgress/Forms/FormLecturesCount.cs
Normal file
96
StudentProgress/StudentProgress/Forms/FormLecturesCount.cs
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormLecturesCount : Form
|
||||||
|
{
|
||||||
|
private readonly IProfessorsNameRepository _professorsRepository;
|
||||||
|
private readonly ILecturesRepository _lecturesRepository;
|
||||||
|
|
||||||
|
public FormLecturesCount(IProfessorsNameRepository professorsRepository, ILecturesRepository lecturesRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_professorsRepository = professorsRepository;
|
||||||
|
_lecturesRepository = lecturesRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormLecturesCount_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadLectures();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadLectures()
|
||||||
|
{
|
||||||
|
var lectures = _lecturesRepository.ReadLectures();
|
||||||
|
var lectureViewModels = new List<LectureViewModel>();
|
||||||
|
|
||||||
|
foreach (var lecture in lectures)
|
||||||
|
{
|
||||||
|
var professor = _professorsRepository.ReadProfessorsNameById(lecture.ProfessorsId);
|
||||||
|
lectureViewModels.Add(new LectureViewModel
|
||||||
|
{
|
||||||
|
LectureId = lecture.LectureId,
|
||||||
|
ProfessorName = $"{professor.FirstNameProfessor} {professor.SurnameProfessor}",
|
||||||
|
Auditorium = lecture.Auditorium,
|
||||||
|
Date = lecture.Date
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
LecturesDataGridView.DataSource = lectureViewModels;
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (var formRecordLecture = new FormRecordLecture(_professorsRepository, _lecturesRepository))
|
||||||
|
{
|
||||||
|
formRecordLecture.ShowDialog();
|
||||||
|
LoadLectures(); // Обновляем данные после закрытия формы
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (LecturesDataGridView.SelectedRows.Count > 0)
|
||||||
|
{
|
||||||
|
var selectedRow = LecturesDataGridView.SelectedRows[0];
|
||||||
|
var lectureViewModel = selectedRow.DataBoundItem as LectureViewModel;
|
||||||
|
|
||||||
|
if (lectureViewModel != null)
|
||||||
|
{
|
||||||
|
// Логика удаления лекции
|
||||||
|
_lecturesRepository.DeleteLecture(lectureViewModel.LectureId);
|
||||||
|
|
||||||
|
MessageBox.Show("Лекция успешно удалена!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
LoadLectures(); // Обновляем данные после удаления
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите лекцию для удаления.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LecturesDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LectureViewModel
|
||||||
|
{
|
||||||
|
public int LectureId { get; set; }
|
||||||
|
public string ProfessorName { get; set; }
|
||||||
|
public string Auditorium { get; set; }
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
public LectureViewModel()
|
||||||
|
{
|
||||||
|
ProfessorName = string.Empty; // Инициализация свойства ProfessorName
|
||||||
|
Auditorium = string.Empty; // Инициализация свойства Auditorium
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
StudentProgress/StudentProgress/Forms/FormLecturesCount.resx
Normal file
120
StudentProgress/StudentProgress/Forms/FormLecturesCount.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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>
|
||||||
|
</root>
|
124
StudentProgress/StudentProgress/Forms/FormProfesor.Designer.cs
generated
Normal file
124
StudentProgress/StudentProgress/Forms/FormProfesor.Designer.cs
generated
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormProfessor
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
textBoxFirstName = new TextBox();
|
||||||
|
textBoxSurname = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
label1 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// textBoxFirstName
|
||||||
|
//
|
||||||
|
textBoxFirstName.Location = new Point(235, 28);
|
||||||
|
textBoxFirstName.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
textBoxFirstName.Name = "textBoxFirstName";
|
||||||
|
textBoxFirstName.Size = new Size(252, 39);
|
||||||
|
textBoxFirstName.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// textBoxSurname
|
||||||
|
//
|
||||||
|
textBoxSurname.Location = new Point(235, 105);
|
||||||
|
textBoxSurname.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
textBoxSurname.Name = "textBoxSurname";
|
||||||
|
textBoxSurname.Size = new Size(306, 39);
|
||||||
|
textBoxSurname.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(53, 233);
|
||||||
|
buttonSave.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(162, 57);
|
||||||
|
buttonSave.TabIndex = 2;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(286, 233);
|
||||||
|
buttonCancel.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(162, 57);
|
||||||
|
buttonCancel.TabIndex = 3;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(53, 31);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(66, 32);
|
||||||
|
label1.TabIndex = 4;
|
||||||
|
label1.Text = "Имя:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(53, 105);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(113, 32);
|
||||||
|
label2.TabIndex = 5;
|
||||||
|
label2.Text = "Фамилия";
|
||||||
|
//
|
||||||
|
// FormProfessor
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(695, 354);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxSurname);
|
||||||
|
Controls.Add(textBoxFirstName);
|
||||||
|
Margin = new Padding(6, 7, 6, 7);
|
||||||
|
Name = "FormProfessor";
|
||||||
|
Text = "Преподаватель";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.TextBox textBoxFirstName;
|
||||||
|
private System.Windows.Forms.TextBox textBoxSurname;
|
||||||
|
private System.Windows.Forms.Button buttonSave;
|
||||||
|
private System.Windows.Forms.Button buttonCancel;
|
||||||
|
private Label label1;
|
||||||
|
private Label label2;
|
||||||
|
}
|
||||||
|
}
|
71
StudentProgress/StudentProgress/Forms/FormProfesor.cs
Normal file
71
StudentProgress/StudentProgress/Forms/FormProfesor.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormProfessor : Form
|
||||||
|
{
|
||||||
|
private readonly IProfessorsNameRepository _professorsRepository;
|
||||||
|
private int? _professorId;
|
||||||
|
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var professor = _professorsRepository.ReadProfessorsNameById(value);
|
||||||
|
if (professor == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(professor));
|
||||||
|
}
|
||||||
|
textBoxFirstName.Text = professor.FirstNameProfessor;
|
||||||
|
textBoxSurname.Text = professor.SurnameProfessor;
|
||||||
|
_professorId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormProfessor(IProfessorsNameRepository professorsRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_professorsRepository = professorsRepository ?? throw new ArgumentNullException(nameof(professorsRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) || string.IsNullOrWhiteSpace(textBoxSurname.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_professorId.HasValue)
|
||||||
|
{
|
||||||
|
_professorsRepository.UpdateProfessorsName(CreateProfessor(_professorId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_professorsRepository.CreateProfessorsName(CreateProfessor(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private Professors CreateProfessor(int id) => Professors.CreateEntity(id, textBoxFirstName.Text, textBoxSurname.Text);
|
||||||
|
}
|
||||||
|
}
|
120
StudentProgress/StudentProgress/Forms/FormProfesor.resx
Normal file
120
StudentProgress/StudentProgress/Forms/FormProfesor.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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>
|
||||||
|
</root>
|
110
StudentProgress/StudentProgress/Forms/FormProfessors.Designer.cs
generated
Normal file
110
StudentProgress/StudentProgress/Forms/FormProfessors.Designer.cs
generated
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormProfessors
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
buttonPencil = new Button();
|
||||||
|
buttonDel = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(26, 30);
|
||||||
|
dataGridView.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 82;
|
||||||
|
dataGridView.Size = new Size(867, 492);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = StudentProgress.Properties.Resources.Add;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(935, 30);
|
||||||
|
buttonAdd.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(162, 118);
|
||||||
|
buttonAdd.TabIndex = 1;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// buttonPencil
|
||||||
|
//
|
||||||
|
buttonPencil.BackgroundImage = StudentProgress.Properties.Resources.Pencil;
|
||||||
|
buttonPencil.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonPencil.Location = new Point(935, 224);
|
||||||
|
buttonPencil.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonPencil.Name = "buttonPencil";
|
||||||
|
buttonPencil.Size = new Size(162, 118);
|
||||||
|
buttonPencil.TabIndex = 2;
|
||||||
|
buttonPencil.UseVisualStyleBackColor = true;
|
||||||
|
buttonPencil.Click += buttonPencil_Click;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = StudentProgress.Properties.Resources.Del;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(935, 396);
|
||||||
|
buttonDel.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(162, 126);
|
||||||
|
buttonDel.TabIndex = 3;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// FormProfessors
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1148, 628);
|
||||||
|
Controls.Add(buttonDel);
|
||||||
|
Controls.Add(buttonPencil);
|
||||||
|
Controls.Add(buttonAdd);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Margin = new Padding(6, 7, 6, 7);
|
||||||
|
Name = "FormProfessors";
|
||||||
|
Text = "Преподаватели";
|
||||||
|
Load += FormProfessors_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.DataGridView dataGridView;
|
||||||
|
private System.Windows.Forms.Button buttonAdd;
|
||||||
|
private System.Windows.Forms.Button buttonPencil;
|
||||||
|
private System.Windows.Forms.Button buttonDel;
|
||||||
|
}
|
||||||
|
}
|
99
StudentProgress/StudentProgress/Forms/FormProfessors.cs
Normal file
99
StudentProgress/StudentProgress/Forms/FormProfessors.cs
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
using StudentProgress.Repositories;
|
||||||
|
using Unity;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormProfessors : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IProfessorsNameRepository _professorsRepository;
|
||||||
|
|
||||||
|
public FormProfessors(IUnityContainer container, IProfessorsNameRepository professorsRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
_professorsRepository = professorsRepository ?? throw new ArgumentNullException(nameof(professorsRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormProfessor>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonPencil_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormProfessor>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.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
|
||||||
|
{
|
||||||
|
_professorsRepository.DeleteProfessorsName(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormProfessors_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridView.DataSource = _professorsRepository.ReadProfessorsName();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
StudentProgress/StudentProgress/Forms/FormProfessors.resx
Normal file
120
StudentProgress/StudentProgress/Forms/FormProfessors.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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>
|
||||||
|
</root>
|
129
StudentProgress/StudentProgress/Forms/FormRecordLecture.Designer.cs
generated
Normal file
129
StudentProgress/StudentProgress/Forms/FormRecordLecture.Designer.cs
generated
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormRecordLecture
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.ProfessorsComboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.DatePicker = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.RecordLectureButton = new System.Windows.Forms.Button();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.AuditoriumTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(12, 20);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(78, 13);
|
||||||
|
this.label1.TabIndex = 0;
|
||||||
|
this.label1.Text = "Преподаватель:";
|
||||||
|
//
|
||||||
|
// ProfessorsComboBox
|
||||||
|
//
|
||||||
|
this.ProfessorsComboBox.FormattingEnabled = true;
|
||||||
|
this.ProfessorsComboBox.Location = new System.Drawing.Point(96, 17);
|
||||||
|
this.ProfessorsComboBox.Name = "ProfessorsComboBox";
|
||||||
|
this.ProfessorsComboBox.Size = new System.Drawing.Size(200, 21);
|
||||||
|
this.ProfessorsComboBox.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(12, 50);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(36, 13);
|
||||||
|
this.label2.TabIndex = 2;
|
||||||
|
this.label2.Text = "Дата:";
|
||||||
|
//
|
||||||
|
// DatePicker
|
||||||
|
//
|
||||||
|
this.DatePicker.Location = new System.Drawing.Point(96, 47);
|
||||||
|
this.DatePicker.Name = "DatePicker";
|
||||||
|
this.DatePicker.Size = new System.Drawing.Size(200, 20);
|
||||||
|
this.DatePicker.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// RecordLectureButton
|
||||||
|
//
|
||||||
|
this.RecordLectureButton.Location = new System.Drawing.Point(96, 110);
|
||||||
|
this.RecordLectureButton.Name = "RecordLectureButton";
|
||||||
|
this.RecordLectureButton.Size = new System.Drawing.Size(200, 23);
|
||||||
|
this.RecordLectureButton.TabIndex = 4;
|
||||||
|
this.RecordLectureButton.Text = "Записать лекцию";
|
||||||
|
this.RecordLectureButton.UseVisualStyleBackColor = true;
|
||||||
|
this.RecordLectureButton.Click += new System.EventHandler(this.RecordLectureButton_Click);
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(12, 80);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(64, 13);
|
||||||
|
this.label3.TabIndex = 5;
|
||||||
|
this.label3.Text = "Аудитория:";
|
||||||
|
//
|
||||||
|
// AuditoriumTextBox
|
||||||
|
//
|
||||||
|
this.AuditoriumTextBox.Location = new System.Drawing.Point(96, 77);
|
||||||
|
this.AuditoriumTextBox.Name = "AuditoriumTextBox";
|
||||||
|
this.AuditoriumTextBox.Size = new System.Drawing.Size(200, 20);
|
||||||
|
this.AuditoriumTextBox.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// FormRecordLecture
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(314, 151);
|
||||||
|
this.Controls.Add(this.AuditoriumTextBox);
|
||||||
|
this.Controls.Add(this.label3);
|
||||||
|
this.Controls.Add(this.RecordLectureButton);
|
||||||
|
this.Controls.Add(this.DatePicker);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.ProfessorsComboBox);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Name = "FormRecordLecture";
|
||||||
|
this.Text = "Запись лекции";
|
||||||
|
this.Load += new System.EventHandler(this.FormRecordLecture_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.ComboBox ProfessorsComboBox;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.DateTimePicker DatePicker;
|
||||||
|
private System.Windows.Forms.Button RecordLectureButton;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.TextBox AuditoriumTextBox;
|
||||||
|
}
|
||||||
|
}
|
47
StudentProgress/StudentProgress/Forms/FormRecordLecture.cs
Normal file
47
StudentProgress/StudentProgress/Forms/FormRecordLecture.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormRecordLecture : Form
|
||||||
|
{
|
||||||
|
private readonly IProfessorsNameRepository _professorsRepository;
|
||||||
|
private readonly ILecturesRepository _lecturesRepository;
|
||||||
|
|
||||||
|
public FormRecordLecture(IProfessorsNameRepository professorsRepository, ILecturesRepository lecturesRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_professorsRepository = professorsRepository;
|
||||||
|
_lecturesRepository = lecturesRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormRecordLecture_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadProfessors();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadProfessors()
|
||||||
|
{
|
||||||
|
var professors = _professorsRepository.ReadProfessorsName();
|
||||||
|
ProfessorsComboBox.DataSource = professors;
|
||||||
|
ProfessorsComboBox.DisplayMember = "FirstNameProfessor";
|
||||||
|
ProfessorsComboBox.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RecordLectureButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (ProfessorsComboBox.SelectedItem is Professors selectedProfessor)
|
||||||
|
{
|
||||||
|
var lecture = new Lectures();
|
||||||
|
lecture.SetProfessorsId(selectedProfessor.Id);
|
||||||
|
lecture.SetDate(DatePicker.Value);
|
||||||
|
lecture.SetAuditorium(AuditoriumTextBox.Text); // Устанавливаем аудиторию
|
||||||
|
|
||||||
|
_lecturesRepository.CreateLecture(lecture);
|
||||||
|
MessageBox.Show("Лекция успешно записана!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
StudentProgress/StudentProgress/Forms/FormRecordLecture.resx
Normal file
120
StudentProgress/StudentProgress/Forms/FormRecordLecture.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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>
|
||||||
|
</root>
|
140
StudentProgress/StudentProgress/Forms/FormStudent.Designer.cs
generated
Normal file
140
StudentProgress/StudentProgress/Forms/FormStudent.Designer.cs
generated
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormStudent
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
labelName = new Label();
|
||||||
|
labelSurname = new Label();
|
||||||
|
labelGroup = new Label();
|
||||||
|
textBoxName = new TextBox();
|
||||||
|
textBoxSurname = new TextBox();
|
||||||
|
comboBoxGroup = new ComboBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelName
|
||||||
|
//
|
||||||
|
labelName.AutoSize = true;
|
||||||
|
labelName.Location = new Point(12, 19);
|
||||||
|
labelName.Name = "labelName";
|
||||||
|
labelName.Size = new Size(49, 20);
|
||||||
|
labelName.TabIndex = 0;
|
||||||
|
labelName.Text = "Имя:";
|
||||||
|
//
|
||||||
|
// labelSurname
|
||||||
|
//
|
||||||
|
labelSurname.AutoSize = true;
|
||||||
|
labelSurname.Location = new Point(12, 69);
|
||||||
|
labelSurname.Name = "labelSurname";
|
||||||
|
labelSurname.Size = new Size(81, 20);
|
||||||
|
labelSurname.TabIndex = 1;
|
||||||
|
labelSurname.Text = "Фамилия:";
|
||||||
|
//
|
||||||
|
// labelGroup
|
||||||
|
//
|
||||||
|
labelGroup.AutoSize = true;
|
||||||
|
labelGroup.Location = new Point(12, 119);
|
||||||
|
labelGroup.Name = "labelGroup";
|
||||||
|
labelGroup.Size = new Size(61, 20);
|
||||||
|
labelGroup.TabIndex = 2;
|
||||||
|
labelGroup.Text = "Группа:";
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
textBoxName.Location = new Point(100, 16);
|
||||||
|
textBoxName.Name = "textBoxName";
|
||||||
|
textBoxName.Size = new Size(200, 27);
|
||||||
|
textBoxName.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// textBoxSurname
|
||||||
|
//
|
||||||
|
textBoxSurname.Location = new Point(100, 66);
|
||||||
|
textBoxSurname.Name = "textBoxSurname";
|
||||||
|
textBoxSurname.Size = new Size(200, 27);
|
||||||
|
textBoxSurname.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// comboBoxGroup
|
||||||
|
//
|
||||||
|
comboBoxGroup.FormattingEnabled = true;
|
||||||
|
comboBoxGroup.Location = new Point(100, 116);
|
||||||
|
comboBoxGroup.Name = "comboBoxGroup";
|
||||||
|
comboBoxGroup.Size = new Size(200, 28);
|
||||||
|
comboBoxGroup.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(12, 169);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 6;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(206, 169);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(94, 29);
|
||||||
|
buttonCancel.TabIndex = 7;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// FormStudent
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(312, 210);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(comboBoxGroup);
|
||||||
|
Controls.Add(textBoxSurname);
|
||||||
|
Controls.Add(textBoxName);
|
||||||
|
Controls.Add(labelGroup);
|
||||||
|
Controls.Add(labelSurname);
|
||||||
|
Controls.Add(labelName);
|
||||||
|
Name = "FormStudent";
|
||||||
|
Text = "Студент";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelName;
|
||||||
|
private Label labelSurname;
|
||||||
|
private Label labelGroup;
|
||||||
|
private TextBox textBoxName;
|
||||||
|
private TextBox textBoxSurname;
|
||||||
|
private ComboBox comboBoxGroup;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
}
|
||||||
|
}
|
52
StudentProgress/StudentProgress/Forms/FormStudent.cs
Normal file
52
StudentProgress/StudentProgress/Forms/FormStudent.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
using StudentProgress.Entities;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormStudent : Form
|
||||||
|
{
|
||||||
|
private readonly IStudentRepository _studentRepository;
|
||||||
|
private readonly IGroupRepository _groupRepository;
|
||||||
|
|
||||||
|
public FormStudent(IStudentRepository studentRepository, IGroupRepository groupRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_studentRepository = studentRepository ?? throw new ArgumentNullException(nameof(studentRepository));
|
||||||
|
_groupRepository = groupRepository ?? throw new ArgumentNullException(nameof(groupRepository));
|
||||||
|
|
||||||
|
LoadGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadGroups()
|
||||||
|
{
|
||||||
|
var groups = _groupRepository.ReadGroup();
|
||||||
|
comboBoxGroup.DataSource = groups;
|
||||||
|
comboBoxGroup.DisplayMember = "NameGroup";
|
||||||
|
comboBoxGroup.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxName.Text) || string.IsNullOrWhiteSpace(textBoxSurname.Text) || comboBoxGroup.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
|
||||||
|
var student = Student.CreateEntity(0, textBoxName.Text, textBoxSurname.Text, (int)comboBoxGroup.SelectedValue);
|
||||||
|
_studentRepository.CreateStudent(student);
|
||||||
|
MessageBox.Show("Студент успешно добавлен", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
}
|
||||||
|
}
|
120
StudentProgress/StudentProgress/Forms/FormStudent.resx
Normal file
120
StudentProgress/StudentProgress/Forms/FormStudent.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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>
|
||||||
|
</root>
|
124
StudentProgress/StudentProgress/Forms/FormStudents.Designer.cs
generated
Normal file
124
StudentProgress/StudentProgress/Forms/FormStudents.Designer.cs
generated
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormStudents
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonPencil = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Controls.Add(buttonPencil);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(548, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(75, 271);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(7, 172);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(56, 53);
|
||||||
|
buttonDel.TabIndex = 2;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonPencil
|
||||||
|
//
|
||||||
|
buttonPencil.BackgroundImage = Properties.Resources.Pencil;
|
||||||
|
buttonPencil.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonPencil.Location = new Point(7, 93);
|
||||||
|
buttonPencil.Name = "buttonPencil";
|
||||||
|
buttonPencil.Size = new Size(56, 53);
|
||||||
|
buttonPencil.TabIndex = 1;
|
||||||
|
buttonPencil.UseVisualStyleBackColor = true;
|
||||||
|
buttonPencil.Click += buttonPencil_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(7, 34);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(56, 53);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.Size = new Size(548, 271);
|
||||||
|
dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// FormStudents
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(623, 271);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormStudents";
|
||||||
|
Text = "Студенты";
|
||||||
|
Load += FormStudents_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonPencil;
|
||||||
|
private Button buttonAdd;
|
||||||
|
}
|
||||||
|
}
|
99
StudentProgress/StudentProgress/Forms/FormStudents.cs
Normal file
99
StudentProgress/StudentProgress/Forms/FormStudents.cs
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Unity;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormStudents : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IStudentRepository _studentRepository;
|
||||||
|
|
||||||
|
public FormStudents(IUnityContainer container, IStudentRepository studentRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||||
|
_studentRepository = studentRepository ?? throw new ArgumentNullException(nameof(studentRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormStudents_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormStudent>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonPencil_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormStudent>();
|
||||||
|
// Здесь нужно добавить логику для загрузки данных в форму редактирования
|
||||||
|
form.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
|
||||||
|
{
|
||||||
|
_studentRepository.DeleteStudent(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridView.DataSource = _studentRepository.ReadStudents();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
StudentProgress/StudentProgress/Forms/FormStudents.resx
Normal file
120
StudentProgress/StudentProgress/Forms/FormStudents.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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>
|
||||||
|
</root>
|
136
StudentProgress/StudentProgress/Forms/FormSubject.Designer.cs
generated
Normal file
136
StudentProgress/StudentProgress/Forms/FormSubject.Designer.cs
generated
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
|
||||||
|
namespace StudentPerformance.Forms
|
||||||
|
{
|
||||||
|
partial class FormSubject
|
||||||
|
{
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
textBoxName = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
labelName = new Label();
|
||||||
|
groupBox = new GroupBox();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
ColumnLast = new DataGridViewComboBoxColumn();
|
||||||
|
groupBox.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
textBoxName.Location = new Point(183, 47);
|
||||||
|
textBoxName.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
textBoxName.Name = "textBoxName";
|
||||||
|
textBoxName.Size = new Size(343, 39);
|
||||||
|
textBoxName.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(32, 579);
|
||||||
|
buttonSave.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(162, 57);
|
||||||
|
buttonSave.TabIndex = 1;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(370, 597);
|
||||||
|
buttonCancel.Margin = new Padding(6, 7, 6, 7);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(162, 57);
|
||||||
|
buttonCancel.TabIndex = 2;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// labelName
|
||||||
|
//
|
||||||
|
labelName.AutoSize = true;
|
||||||
|
labelName.Location = new Point(32, 47);
|
||||||
|
labelName.Margin = new Padding(6, 0, 6, 0);
|
||||||
|
labelName.Name = "labelName";
|
||||||
|
labelName.Size = new Size(111, 32);
|
||||||
|
labelName.TabIndex = 3;
|
||||||
|
labelName.Text = "Предмет";
|
||||||
|
//
|
||||||
|
// groupBox
|
||||||
|
//
|
||||||
|
groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
groupBox.Controls.Add(dataGridView);
|
||||||
|
groupBox.Location = new Point(32, 111);
|
||||||
|
groupBox.Margin = new Padding(6);
|
||||||
|
groupBox.Name = "groupBox";
|
||||||
|
groupBox.Padding = new Padding(6);
|
||||||
|
groupBox.Size = new Size(494, 435);
|
||||||
|
groupBox.TabIndex = 3;
|
||||||
|
groupBox.TabStop = false;
|
||||||
|
groupBox.Text = "Преподаватели";
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnLast });
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(6, 38);
|
||||||
|
dataGridView.Margin = new Padding(6);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 82;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(482, 391);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ColumnLast
|
||||||
|
//
|
||||||
|
ColumnLast.HeaderText = "Фамилия преподавателя";
|
||||||
|
ColumnLast.MinimumWidth = 10;
|
||||||
|
ColumnLast.Name = "ColumnLast";
|
||||||
|
ColumnLast.Width = 200;
|
||||||
|
//
|
||||||
|
// FormSubject
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(590, 719);
|
||||||
|
Controls.Add(groupBox);
|
||||||
|
Controls.Add(labelName);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxName);
|
||||||
|
Margin = new Padding(6, 7, 6, 7);
|
||||||
|
Name = "FormSubject";
|
||||||
|
Text = "Предметы";
|
||||||
|
Load += FormSubject_Load;
|
||||||
|
groupBox.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
private System.Windows.Forms.TextBox textBoxName;
|
||||||
|
private System.Windows.Forms.Button buttonSave;
|
||||||
|
private System.Windows.Forms.Button buttonCancel;
|
||||||
|
private System.Windows.Forms.Label labelName;
|
||||||
|
private GroupBox groupBox;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private DataGridViewComboBoxColumn ColumnLast;
|
||||||
|
}
|
||||||
|
}
|
44
StudentProgress/StudentProgress/Forms/FormSubject.cs
Normal file
44
StudentProgress/StudentProgress/Forms/FormSubject.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace StudentPerformance.Forms
|
||||||
|
{
|
||||||
|
public partial class FormSubject : Form
|
||||||
|
{
|
||||||
|
private readonly ISubjectsRepository _subjectsRepository;
|
||||||
|
|
||||||
|
public FormSubject(ISubjectsRepository subjectsRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_subjectsRepository = subjectsRepository ?? throw new ArgumentNullException(nameof(subjectsRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxName.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имя предмета не может быть пустым");
|
||||||
|
}
|
||||||
|
|
||||||
|
var subject = Subjects.CreateEntity_(0, textBoxName.Text);
|
||||||
|
_subjectsRepository.CreateSubjects_(subject);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private void FormSubject_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Инициализация формы, если необходимо
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
123
StudentProgress/StudentProgress/Forms/FormSubject.resx
Normal file
123
StudentProgress/StudentProgress/Forms/FormSubject.resx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?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="ColumnLast.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
120
StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs
generated
Normal file
120
StudentProgress/StudentProgress/Forms/FormSubjects.Designer.cs
generated
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
partial class FormSubjects
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(buttonDel);
|
||||||
|
panel1.Controls.Add(buttonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(1018, 0);
|
||||||
|
panel1.Margin = new Padding(6, 6, 6, 6);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(139, 578);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||||
|
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDel.Location = new Point(13, 367);
|
||||||
|
buttonDel.Margin = new Padding(6, 6, 6, 6);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(104, 113);
|
||||||
|
buttonDel.TabIndex = 1;
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(13, 73);
|
||||||
|
buttonAdd.Margin = new Padding(6, 6, 6, 6);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(104, 113);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.Margin = new Padding(6, 6, 6, 6);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 82;
|
||||||
|
dataGridView.Size = new Size(1018, 578);
|
||||||
|
dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// FormSubjects
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1157, 578);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Margin = new Padding(6, 6, 6, 6);
|
||||||
|
Name = "FormSubjects";
|
||||||
|
Text = "Предметы";
|
||||||
|
Load += FormSubjects__Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonAdd;
|
||||||
|
}
|
||||||
|
}
|
58
StudentProgress/StudentProgress/Forms/FormSubjects.cs
Normal file
58
StudentProgress/StudentProgress/Forms/FormSubjects.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using StudentPerformance.Forms;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
using StudentProgress.Repositories.Implementations;
|
||||||
|
|
||||||
|
namespace StudentProgress.Forms
|
||||||
|
{
|
||||||
|
public partial class FormSubjects : Form
|
||||||
|
{
|
||||||
|
private readonly ISubjectsRepository _subjectsRepository;
|
||||||
|
|
||||||
|
public FormSubjects(ISubjectsRepository subjectsRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_subjectsRepository = subjectsRepository ?? throw new ArgumentNullException(nameof(subjectsRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormSubjects__Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Загрузка данных в DataGridView
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
// Пример загрузки данных из репозитория
|
||||||
|
var subjects = _subjectsRepository.ReadSubjects();
|
||||||
|
dataGridView.DataSource = subjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Логика добавления нового предмета
|
||||||
|
using (var form = new FormSubject(new SubjectsRepository()))
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Логика удаления выбранного предмета
|
||||||
|
if (dataGridView.SelectedRows.Count > 0)
|
||||||
|
{
|
||||||
|
var selectedSubject = dataGridView.SelectedRows[0].DataBoundItem as Entities.Subjects;
|
||||||
|
if (selectedSubject != null)
|
||||||
|
{
|
||||||
|
_subjectsRepository.DeleteSubjects(selectedSubject.Id);
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
StudentProgress/StudentProgress/Forms/FormSubjects.resx
Normal file
120
StudentProgress/StudentProgress/Forms/FormSubjects.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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>
|
||||||
|
</root>
|
@ -1,17 +1,40 @@
|
|||||||
|
using StudentProgress.Forms;
|
||||||
|
using StudentProgress.Repositories;
|
||||||
|
using StudentProgress.Repositories.Implementations;
|
||||||
|
using Unity;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace StudentProgress
|
namespace StudentProgress
|
||||||
{
|
{
|
||||||
internal static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
// To customize application configuration such as set high DPI settings or default font,
|
Application.EnableVisualStyles();
|
||||||
// see https://aka.ms/applicationconfiguration.
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
ApplicationConfiguration.Initialize();
|
|
||||||
Application.Run(new Form1());
|
var container = new UnityContainer();
|
||||||
|
|
||||||
|
// Ðåãèñòðàöèÿ ðåïîçèòîðèåâ
|
||||||
|
container.RegisterType<IGradesRepository, GradesRepository>();
|
||||||
|
container.RegisterType<IGroupRepository, GroupRepository>();
|
||||||
|
container.RegisterType<IProfessorsNameRepository, ProfessorsNameRepository>();
|
||||||
|
container.RegisterType<IStudentRepository, StudentRepository>();
|
||||||
|
container.RegisterType<ISubjectsRepository, SubjectsRepository>();
|
||||||
|
container.RegisterType<ILecturesRepository, LecturesRepository>();
|
||||||
|
|
||||||
|
// Ðåãèñòðàöèÿ ôîðì
|
||||||
|
container.RegisterType<FormGroups>();
|
||||||
|
container.RegisterType<FormStudents>();
|
||||||
|
container.RegisterType<FormSubjects>();
|
||||||
|
container.RegisterType<FormGrades>();
|
||||||
|
container.RegisterType<FormProfessors>();
|
||||||
|
container.RegisterType<FormRecordLecture>();
|
||||||
|
container.RegisterType<FormLecturesCount>();
|
||||||
|
|
||||||
|
Application.Run(container.Resolve<FormStudentProgress>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
103
StudentProgress/StudentProgress/Properties/Resources.Designer.cs
generated
Normal file
103
StudentProgress/StudentProgress/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace StudentProgress.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StudentProgress.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Add {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Add", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap BackGround {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("BackGround", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Del {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Del", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Pencil {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Pencil", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
133
StudentProgress/StudentProgress/Properties/Resources.resx
Normal file
133
StudentProgress/StudentProgress/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?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>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="Del" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Del.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="BackGround" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\BackGround.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
@ -0,0 +1,10 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories;
|
||||||
|
|
||||||
|
public interface IGradesRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Grades> ReadGrades(DateTime? dateFrom = null, DateTime? dateTo = null, int? subjectsId = null, int? professorsId = null);
|
||||||
|
void CreateGrade(Grades grade);
|
||||||
|
void DeleteGrade(int id);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories;
|
||||||
|
|
||||||
|
public interface IGroupRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Group> ReadGroup();
|
||||||
|
Group ReadGroupById(int id);
|
||||||
|
void CreateGroup(Group group);
|
||||||
|
void UpdateGroup(Group group);
|
||||||
|
void DeleteGroup(int id);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories
|
||||||
|
{
|
||||||
|
public interface ILecturesRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Lectures> ReadLectures();
|
||||||
|
void CreateLecture(Lectures lecture);
|
||||||
|
void DeleteLecture(int lectureId);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories;
|
||||||
|
|
||||||
|
public interface IProfessorsNameRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Professors> ReadProfessorsName();
|
||||||
|
Professors ReadProfessorsNameById(int id);
|
||||||
|
void CreateProfessorsName(Professors professorsName);
|
||||||
|
void UpdateProfessorsName(Professors professorsName);
|
||||||
|
void DeleteProfessorsName(int id);
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories;
|
||||||
|
|
||||||
|
public interface IStudentRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Student> ReadStudents(int? groupID = null);
|
||||||
|
Student ReadStudentById(int id);
|
||||||
|
void CreateStudent(Student student);
|
||||||
|
void UpdateStudent(Student student);
|
||||||
|
void DeleteStudent(int id);
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories;
|
||||||
|
|
||||||
|
public interface ISubjectsRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Subjects> ReadSubjects(int? professorsNameId = null);
|
||||||
|
void CreateSubjects_(Subjects subject);
|
||||||
|
void DeleteSubjects(int id);
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class GradesRepository : IGradesRepository
|
||||||
|
{
|
||||||
|
public void CreateGrade(Grades grade)
|
||||||
|
{
|
||||||
|
// Логика создания оценки
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteGrade(int id)
|
||||||
|
{
|
||||||
|
// Логика удаления оценки по идентификатору
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Grades> ReadGrades(DateTime? dateFrom = null, DateTime? dateTo = null, int? subjectsId = null, int? professorsId = null)
|
||||||
|
{
|
||||||
|
// Логика чтения оценок с возможностью фильтрации по дате, идентификатору предмета и идентификатору преподавателя
|
||||||
|
return new List<Grades>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateGrade(Grades grade)
|
||||||
|
{
|
||||||
|
// Логика обновления оценки
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories.Implementations
|
||||||
|
{
|
||||||
|
public class GroupRepository : IGroupRepository
|
||||||
|
{
|
||||||
|
private readonly List<Group> _groups;
|
||||||
|
|
||||||
|
public GroupRepository()
|
||||||
|
{
|
||||||
|
// Инициализация тестовых данных
|
||||||
|
_groups = new List<Group>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateGroup(Group group)
|
||||||
|
{
|
||||||
|
// Логика создания группы
|
||||||
|
_groups.Add(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteGroup(int id)
|
||||||
|
{
|
||||||
|
// Логика удаления группы по идентификатору
|
||||||
|
_groups.RemoveAll(g => g.Id == id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Group> ReadGroup()
|
||||||
|
{
|
||||||
|
// Логика чтения всех групп
|
||||||
|
return _groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Group ReadGroupById(int id)
|
||||||
|
{
|
||||||
|
// Логика чтения группы по идентификатору
|
||||||
|
return _groups.Find(g => g.Id == id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateGroup(Group group)
|
||||||
|
{
|
||||||
|
// Логика обновления группы
|
||||||
|
var existingGroup = _groups.Find(g => g.Id == group.Id);
|
||||||
|
if (existingGroup != null)
|
||||||
|
{
|
||||||
|
existingGroup.NameGroup = group.NameGroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories.Implementations
|
||||||
|
{
|
||||||
|
public class LecturesRepository : ILecturesRepository
|
||||||
|
{
|
||||||
|
private readonly List<Lectures> _lectures = new List<Lectures>();
|
||||||
|
|
||||||
|
public IEnumerable<Lectures> ReadLectures()
|
||||||
|
{
|
||||||
|
return _lectures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateLecture(Lectures lecture)
|
||||||
|
{
|
||||||
|
int newLectureId = _lectures.Count > 0 ? _lectures.Max(l => l.LectureId) + 1 : 1;
|
||||||
|
lecture.SetLectureId(newLectureId);
|
||||||
|
_lectures.Add(lecture);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteLecture(int lectureId)
|
||||||
|
{
|
||||||
|
var lectureToRemove = _lectures.FirstOrDefault(l => l.LectureId == lectureId);
|
||||||
|
if (lectureToRemove != null)
|
||||||
|
{
|
||||||
|
_lectures.Remove(lectureToRemove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class ProfessorsNameRepository : IProfessorsNameRepository
|
||||||
|
{
|
||||||
|
public void CreateProfessorsName(Professors professorsName)
|
||||||
|
{
|
||||||
|
// Логика создания преподавателя
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteProfessorsName(int id)
|
||||||
|
{
|
||||||
|
// Логика удаления преподавателя по идентификатору
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Professors> ReadProfessorsName()
|
||||||
|
{
|
||||||
|
// Логика чтения всех преподавателей
|
||||||
|
return new List<Professors>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Professors ReadProfessorsNameById(int id)
|
||||||
|
{
|
||||||
|
// Логика чтения преподавателя по идентификатору
|
||||||
|
return Professors.CreateEntity(id, "Unknown", "Unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateProfessorsName(Professors professorsName)
|
||||||
|
{
|
||||||
|
// Логика обновления преподавателя
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories.Implementations
|
||||||
|
{
|
||||||
|
public class StudentRepository : IStudentRepository
|
||||||
|
{
|
||||||
|
private readonly List<Student> _students;
|
||||||
|
|
||||||
|
public StudentRepository()
|
||||||
|
{
|
||||||
|
// Инициализация пустого списка студентов
|
||||||
|
_students = new List<Student>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateStudent(Student student)
|
||||||
|
{
|
||||||
|
// Логика создания студента
|
||||||
|
_students.Add(student);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteStudent(int id)
|
||||||
|
{
|
||||||
|
// Логика удаления студента по идентификатору
|
||||||
|
_students.RemoveAll(s => s.Id == id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Student ReadStudentById(int id)
|
||||||
|
{
|
||||||
|
// Логика чтения студента по идентификатору
|
||||||
|
return _students.Find(s => s.Id == id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Student> ReadStudents(int? groupID = null)
|
||||||
|
{
|
||||||
|
// Логика чтения всех студентов с возможностью фильтрации по идентификатору группы
|
||||||
|
if (groupID.HasValue)
|
||||||
|
{
|
||||||
|
return _students.FindAll(s => s.GroupId == groupID.Value);
|
||||||
|
}
|
||||||
|
return _students;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateStudent(Student student)
|
||||||
|
{
|
||||||
|
// Логика обновления студента
|
||||||
|
var existingStudent = _students.Find(s => s.Id == student.Id);
|
||||||
|
if (existingStudent != null)
|
||||||
|
{
|
||||||
|
existingStudent.Name = student.Name;
|
||||||
|
existingStudent.Surname = student.Surname;
|
||||||
|
existingStudent.GroupId = student.GroupId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
using StudentProgress.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StudentProgress.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class SubjectsRepository : ISubjectsRepository
|
||||||
|
{
|
||||||
|
public void CreateSubjects(Subjects subject)
|
||||||
|
{
|
||||||
|
// Логика создания предмета
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateSubjects_(Subjects subject)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteSubjects(int id)
|
||||||
|
{
|
||||||
|
// Логика удаления предмета по идентификатору
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Subjects> ReadSubjects(int? lecturerNameId = null)
|
||||||
|
{
|
||||||
|
// Логика чтения предметов с возможностью фильтрации по идентификатору преподавателя
|
||||||
|
return new List<Subjects>();
|
||||||
|
}
|
||||||
|
}
|
BIN
StudentProgress/StudentProgress/Resources/Add.png
Normal file
BIN
StudentProgress/StudentProgress/Resources/Add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
BIN
StudentProgress/StudentProgress/Resources/BackGround.jpg
Normal file
BIN
StudentProgress/StudentProgress/Resources/BackGround.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
BIN
StudentProgress/StudentProgress/Resources/Del.png
Normal file
BIN
StudentProgress/StudentProgress/Resources/Del.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
StudentProgress/StudentProgress/Resources/Pencil.png
Normal file
BIN
StudentProgress/StudentProgress/Resources/Pencil.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
@ -8,4 +8,23 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Unity" Version="5.11.10" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Loading…
x
Reference in New Issue
Block a user