Compare commits
No commits in common. "LabWork_1" and "main" have entirely different histories.
@ -1,15 +0,0 @@
|
|||||||
namespace Project.Entities;
|
|
||||||
|
|
||||||
public class Decree
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
public int StudentId { get; private set; }
|
|
||||||
public string Name { get; private set; } = string.Empty;
|
|
||||||
public DateTime Date { get; private set; }
|
|
||||||
public string Info { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public static Decree CreateOperation(int id, int studentId, string name, DateTime date, string info)
|
|
||||||
{
|
|
||||||
return new Decree { Id = id, StudentId = studentId, Name = name, Date = date, Info = info };
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
namespace Project.Entities.Enums;
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
public enum Course
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
First = 1, // 1 курс
|
|
||||||
Second = 2, // 2 курс
|
|
||||||
Third = 4, // 3 курс
|
|
||||||
Fourth = 8 // 4 курс
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace Project.Entities.Enums;
|
|
||||||
|
|
||||||
public enum Mark
|
|
||||||
{
|
|
||||||
One = 1,
|
|
||||||
Two = 2,
|
|
||||||
Three = 3,
|
|
||||||
Four = 4,
|
|
||||||
Five = 5
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
namespace Project.Entities;
|
|
||||||
|
|
||||||
public class Statement
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
public int TeacherId { get; private set; }
|
|
||||||
public int SubjectId { get; private set; }
|
|
||||||
public DateTime Date { get; private set; }
|
|
||||||
public IEnumerable<StatementStudent> StatementStudents { get; private set; } = [];
|
|
||||||
|
|
||||||
public static Statement CreateOperation(int id, int teacherId, int subjectId, IEnumerable<StatementStudent> statementStudents)
|
|
||||||
{
|
|
||||||
return new Statement
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
TeacherId = teacherId,
|
|
||||||
SubjectId = subjectId,
|
|
||||||
Date = DateTime.Now,
|
|
||||||
StatementStudents = statementStudents
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
using Project.Entities.Enums;
|
|
||||||
|
|
||||||
namespace Project.Entities;
|
|
||||||
|
|
||||||
public class StatementStudent
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
public int StudentId { get; private set; }
|
|
||||||
public Mark Mark { get; private set; }
|
|
||||||
|
|
||||||
public static StatementStudent CreateOperation(int id, int studentId, Mark mark)
|
|
||||||
{
|
|
||||||
return new StatementStudent
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
StudentId = studentId,
|
|
||||||
Mark = mark
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
namespace Project.Entities;
|
|
||||||
|
|
||||||
public class Student
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
public string FirstName { get; private set; } = string.Empty;
|
|
||||||
public string LastName { get; private set; } = string.Empty;
|
|
||||||
public float Score { get; private set; }
|
|
||||||
//public Hostel HostelType { get; private set; }
|
|
||||||
public string DisplayName => $"{FirstName} {LastName}";
|
|
||||||
|
|
||||||
public static Student CreateOperation(int id, string firstName, string lastName, float Score)
|
|
||||||
{
|
|
||||||
return new Student
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
FirstName = firstName,
|
|
||||||
LastName = lastName
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
using Project.Entities.Enums;
|
|
||||||
|
|
||||||
namespace Project.Entities;
|
|
||||||
|
|
||||||
public class Subject
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
public string Name { get; private set; } = string.Empty;
|
|
||||||
public Course Courses { get; private set; }
|
|
||||||
|
|
||||||
public static Subject CreateOperation(int id, string name, Course courses)
|
|
||||||
{
|
|
||||||
return new Subject
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
Name = name,
|
|
||||||
Courses = courses
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
namespace Project.Entities;
|
|
||||||
|
|
||||||
public class Teacher
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
public string FirstName { get; private set; } = string.Empty;
|
|
||||||
public string LastName { get; private set; } = string.Empty;
|
|
||||||
public string DisplayName => $"{LastName} {FirstName}";
|
|
||||||
|
|
||||||
public static Teacher CreateOperation(int id, string firstName, string lastName)
|
|
||||||
{
|
|
||||||
return new Teacher
|
|
||||||
{
|
|
||||||
Id = id,
|
|
||||||
FirstName = firstName,
|
|
||||||
LastName = lastName
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
137
Project/Project/FormMain.Designer.cs
generated
137
Project/Project/FormMain.Designer.cs
generated
@ -1,137 +0,0 @@
|
|||||||
namespace Project
|
|
||||||
{
|
|
||||||
partial class FormMain
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
|
||||||
menuStrip1 = new MenuStrip();
|
|
||||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
toolStripMenuItemStudents = new ToolStripMenuItem();
|
|
||||||
toolStripMenuItemTeachers = new ToolStripMenuItem();
|
|
||||||
toolStripMenuItemSubjects = new ToolStripMenuItem();
|
|
||||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
toolStripMenuItemStatements = new ToolStripMenuItem();
|
|
||||||
toolStripMenuItemDecrees = new ToolStripMenuItem();
|
|
||||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
menuStrip1.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// menuStrip1
|
|
||||||
//
|
|
||||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
|
|
||||||
menuStrip1.Location = new Point(0, 0);
|
|
||||||
menuStrip1.Name = "menuStrip1";
|
|
||||||
menuStrip1.Size = new Size(800, 24);
|
|
||||||
menuStrip1.TabIndex = 0;
|
|
||||||
menuStrip1.Text = "menuStrip1";
|
|
||||||
//
|
|
||||||
// справочникиToolStripMenuItem
|
|
||||||
//
|
|
||||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { toolStripMenuItemStudents, toolStripMenuItemTeachers, toolStripMenuItemSubjects });
|
|
||||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
|
||||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
|
||||||
справочникиToolStripMenuItem.Text = "Справочники";
|
|
||||||
//
|
|
||||||
// toolStripMenuItemStudents
|
|
||||||
//
|
|
||||||
toolStripMenuItemStudents.Name = "toolStripMenuItemStudents";
|
|
||||||
toolStripMenuItemStudents.Size = new Size(180, 22);
|
|
||||||
toolStripMenuItemStudents.Text = "Студенты";
|
|
||||||
toolStripMenuItemStudents.Click += toolStripMenuItemStudents_Click;
|
|
||||||
//
|
|
||||||
// toolStripMenuItemTeachers
|
|
||||||
//
|
|
||||||
toolStripMenuItemTeachers.Name = "toolStripMenuItemTeachers";
|
|
||||||
toolStripMenuItemTeachers.Size = new Size(180, 22);
|
|
||||||
toolStripMenuItemTeachers.Text = "Преподаватели";
|
|
||||||
toolStripMenuItemTeachers.Click += toolStripMenuItemTeachers_Click;
|
|
||||||
//
|
|
||||||
// toolStripMenuItemSubjects
|
|
||||||
//
|
|
||||||
toolStripMenuItemSubjects.Name = "toolStripMenuItemSubjects";
|
|
||||||
toolStripMenuItemSubjects.Size = new Size(180, 22);
|
|
||||||
toolStripMenuItemSubjects.Text = "Предметы";
|
|
||||||
toolStripMenuItemSubjects.Click += toolStripMenuItemSubjects_Click;
|
|
||||||
//
|
|
||||||
// операцииToolStripMenuItem
|
|
||||||
//
|
|
||||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { toolStripMenuItemStatements, toolStripMenuItemDecrees });
|
|
||||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
|
||||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
|
||||||
операцииToolStripMenuItem.Text = "Операции";
|
|
||||||
//
|
|
||||||
// toolStripMenuItemStatements
|
|
||||||
//
|
|
||||||
toolStripMenuItemStatements.Name = "toolStripMenuItemStatements";
|
|
||||||
toolStripMenuItemStatements.Size = new Size(194, 22);
|
|
||||||
toolStripMenuItemStatements.Text = "Заполнить ведомость";
|
|
||||||
toolStripMenuItemStatements.Click += toolStripMenuItemStatements_Click;
|
|
||||||
//
|
|
||||||
// toolStripMenuItemDecrees
|
|
||||||
//
|
|
||||||
toolStripMenuItemDecrees.Name = "toolStripMenuItemDecrees";
|
|
||||||
toolStripMenuItemDecrees.Size = new Size(194, 22);
|
|
||||||
toolStripMenuItemDecrees.Text = "Выдать указ";
|
|
||||||
toolStripMenuItemDecrees.Click += toolStripMenuItemDecrees_Click;
|
|
||||||
//
|
|
||||||
// отчетыToolStripMenuItem
|
|
||||||
//
|
|
||||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
|
||||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
|
||||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
|
||||||
//
|
|
||||||
// FormMain
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
BackgroundImage = (Image)resources.GetObject("$this.BackgroundImage");
|
|
||||||
BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ClientSize = new Size(800, 450);
|
|
||||||
Controls.Add(menuStrip1);
|
|
||||||
MainMenuStrip = menuStrip1;
|
|
||||||
Name = "FormMain";
|
|
||||||
Text = " Результаты сессии";
|
|
||||||
menuStrip1.ResumeLayout(false);
|
|
||||||
menuStrip1.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private MenuStrip menuStrip1;
|
|
||||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem toolStripMenuItemStudents;
|
|
||||||
private ToolStripMenuItem toolStripMenuItemTeachers;
|
|
||||||
private ToolStripMenuItem toolStripMenuItemSubjects;
|
|
||||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem toolStripMenuItemStatements;
|
|
||||||
private ToolStripMenuItem toolStripMenuItemDecrees;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
using Project.Forms;
|
|
||||||
using Unity;
|
|
||||||
|
|
||||||
namespace Project
|
|
||||||
{
|
|
||||||
public partial class FormMain : Form
|
|
||||||
{
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
public FormMain(IUnityContainer container)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toolStripMenuItemStudents_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<StudentsListForm>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toolStripMenuItemSubjects_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<SubjectsForm>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toolStripMenuItemTeachers_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<TeachersListForm>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toolStripMenuItemDecrees_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<DecreesForm>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toolStripMenuItemStatements_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<StatementListForm>().ShowDialog();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
141
Project/Project/Forms/DecreeForm.Designer.cs
generated
141
Project/Project/Forms/DecreeForm.Designer.cs
generated
@ -1,141 +0,0 @@
|
|||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class DecreeForm
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
ButtonSave = new Button();
|
|
||||||
ButtonCancel = new Button();
|
|
||||||
textBoxName = new TextBox();
|
|
||||||
comboBoxStudent = new ComboBox();
|
|
||||||
textBoxInfo = new TextBox();
|
|
||||||
label3 = new Label();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(90, 39);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(59, 15);
|
|
||||||
label1.TabIndex = 0;
|
|
||||||
label1.Text = "Название";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(98, 10);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(50, 15);
|
|
||||||
label2.TabIndex = 1;
|
|
||||||
label2.Text = "Студент";
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
ButtonSave.Location = new Point(53, 108);
|
|
||||||
ButtonSave.Name = "ButtonSave";
|
|
||||||
ButtonSave.Size = new Size(96, 23);
|
|
||||||
ButtonSave.TabIndex = 9;
|
|
||||||
ButtonSave.Text = "Сохранить";
|
|
||||||
ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
ButtonCancel.Location = new Point(217, 108);
|
|
||||||
ButtonCancel.Name = "ButtonCancel";
|
|
||||||
ButtonCancel.Size = new Size(96, 23);
|
|
||||||
ButtonCancel.TabIndex = 10;
|
|
||||||
ButtonCancel.Text = "Отменить";
|
|
||||||
ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonCancel.Click += ButtonCancel_Click;
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
textBoxName.Location = new Point(154, 36);
|
|
||||||
textBoxName.Name = "textBoxName";
|
|
||||||
textBoxName.Size = new Size(159, 23);
|
|
||||||
textBoxName.TabIndex = 11;
|
|
||||||
//
|
|
||||||
// comboBoxStudent
|
|
||||||
//
|
|
||||||
comboBoxStudent.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxStudent.FormattingEnabled = true;
|
|
||||||
comboBoxStudent.Location = new Point(154, 7);
|
|
||||||
comboBoxStudent.Name = "comboBoxStudent";
|
|
||||||
comboBoxStudent.Size = new Size(159, 23);
|
|
||||||
comboBoxStudent.TabIndex = 12;
|
|
||||||
//
|
|
||||||
// textBoxInfo
|
|
||||||
//
|
|
||||||
textBoxInfo.Location = new Point(154, 68);
|
|
||||||
textBoxInfo.Name = "textBoxInfo";
|
|
||||||
textBoxInfo.Size = new Size(159, 23);
|
|
||||||
textBoxInfo.TabIndex = 13;
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
label3.AutoSize = true;
|
|
||||||
label3.Location = new Point(68, 71);
|
|
||||||
label3.Name = "label3";
|
|
||||||
label3.Size = new Size(81, 15);
|
|
||||||
label3.TabIndex = 14;
|
|
||||||
label3.Text = "Информация";
|
|
||||||
//
|
|
||||||
// DecreeForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(360, 157);
|
|
||||||
Controls.Add(label3);
|
|
||||||
Controls.Add(textBoxInfo);
|
|
||||||
Controls.Add(comboBoxStudent);
|
|
||||||
Controls.Add(textBoxName);
|
|
||||||
Controls.Add(ButtonCancel);
|
|
||||||
Controls.Add(ButtonSave);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(label1);
|
|
||||||
Name = "DecreeForm";
|
|
||||||
Text = "Указ";
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private ComboBox comboBoxStudent;
|
|
||||||
private TextBox textBoxInfo;
|
|
||||||
private Label label3;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
using Project.Repositories;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class DecreeForm : Form
|
|
||||||
{
|
|
||||||
private readonly IDecreeRepository _decreeRepository;
|
|
||||||
|
|
||||||
public DecreeForm(IDecreeRepository decreeRepository, IStudentRepository studentRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_decreeRepository = decreeRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(decreeRepository));
|
|
||||||
|
|
||||||
comboBoxStudent.DataSource = studentRepository.GetAllStudents();
|
|
||||||
comboBoxStudent.DisplayMember = "DisplayName";
|
|
||||||
comboBoxStudent.ValueMember = "Id";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) || comboBoxStudent.SelectedIndex < 0 || string.IsNullOrEmpty(textBoxInfo.Text))
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются незаполненные поля");
|
|
||||||
}
|
|
||||||
_decreeRepository.AddDecree(AddDecree(0));
|
|
||||||
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
|
|
||||||
private Decree AddDecree(int id) => Decree.CreateOperation(id, (int)comboBoxStudent.SelectedValue!, textBoxName.Text, DateTime.Now, textBoxInfo.Text);
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
99
Project/Project/Forms/DecreesForm.Designer.cs
generated
99
Project/Project/Forms/DecreesForm.Designer.cs
generated
@ -1,99 +0,0 @@
|
|||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class DecreesForm
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
ButtonAdd = new Button();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(ButtonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(828, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(125, 439);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
ButtonAdd.BackgroundImage = Properties.Resources.Add;
|
|
||||||
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonAdd.Location = new Point(13, 12);
|
|
||||||
ButtonAdd.Name = "ButtonAdd";
|
|
||||||
ButtonAdd.Size = new Size(100, 100);
|
|
||||||
ButtonAdd.TabIndex = 1;
|
|
||||||
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.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(828, 439);
|
|
||||||
dataGridView.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// DecreesForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(953, 439);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "DecreesForm";
|
|
||||||
Text = "Указы";
|
|
||||||
Load += GroupList_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
using Project.Repositories;
|
|
||||||
using Unity;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class DecreesForm : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
private readonly IDecreeRepository _decreeRepository;
|
|
||||||
|
|
||||||
public DecreesForm(IUnityContainer container, IDecreeRepository decreeRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
|
||||||
_decreeRepository = decreeRepository ?? throw new ArgumentNullException(nameof(decreeRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GroupList_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<DecreeForm>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadList() => dataGridView.DataSource = _decreeRepository.GetAllDecrees();
|
|
||||||
}
|
|
175
Project/Project/Forms/StatementForm.Designer.cs
generated
175
Project/Project/Forms/StatementForm.Designer.cs
generated
@ -1,175 +0,0 @@
|
|||||||
using Project.Entities.Enums;
|
|
||||||
|
|
||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class StatementForm
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
ButtonSave = new Button();
|
|
||||||
ButtonCancel = new Button();
|
|
||||||
comboBoxSubject = new ComboBox();
|
|
||||||
comboBoxTeacher = new ComboBox();
|
|
||||||
groupBox1 = new GroupBox();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
ColumnStudent = new DataGridViewComboBoxColumn();
|
|
||||||
ColumnMark = new DataGridViewComboBoxColumn();
|
|
||||||
groupBox1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(53, 19);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(55, 15);
|
|
||||||
label1.TabIndex = 0;
|
|
||||||
label1.Text = "Предмет";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(17, 57);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(91, 15);
|
|
||||||
label2.TabIndex = 1;
|
|
||||||
label2.Text = "Преподаватель";
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
ButtonSave.Location = new Point(12, 307);
|
|
||||||
ButtonSave.Name = "ButtonSave";
|
|
||||||
ButtonSave.Size = new Size(96, 23);
|
|
||||||
ButtonSave.TabIndex = 10;
|
|
||||||
ButtonSave.Text = "Сохранить";
|
|
||||||
ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
ButtonCancel.Location = new Point(217, 307);
|
|
||||||
ButtonCancel.Name = "ButtonCancel";
|
|
||||||
ButtonCancel.Size = new Size(96, 23);
|
|
||||||
ButtonCancel.TabIndex = 11;
|
|
||||||
ButtonCancel.Text = "Отменить";
|
|
||||||
ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonCancel.Click += ButtonCancel_Click;
|
|
||||||
//
|
|
||||||
// comboBoxSubject
|
|
||||||
//
|
|
||||||
comboBoxSubject.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxSubject.FormattingEnabled = true;
|
|
||||||
comboBoxSubject.Location = new Point(114, 16);
|
|
||||||
comboBoxSubject.Name = "comboBoxSubject";
|
|
||||||
comboBoxSubject.Size = new Size(196, 23);
|
|
||||||
comboBoxSubject.TabIndex = 12;
|
|
||||||
//
|
|
||||||
// comboBoxTeacher
|
|
||||||
//
|
|
||||||
comboBoxTeacher.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboBoxTeacher.FormattingEnabled = true;
|
|
||||||
comboBoxTeacher.Location = new Point(114, 54);
|
|
||||||
comboBoxTeacher.Name = "comboBoxTeacher";
|
|
||||||
comboBoxTeacher.Size = new Size(196, 23);
|
|
||||||
comboBoxTeacher.TabIndex = 13;
|
|
||||||
//
|
|
||||||
// groupBox1
|
|
||||||
//
|
|
||||||
groupBox1.Controls.Add(dataGridView);
|
|
||||||
groupBox1.Location = new Point(12, 99);
|
|
||||||
groupBox1.Name = "groupBox1";
|
|
||||||
groupBox1.Size = new Size(301, 179);
|
|
||||||
groupBox1.TabIndex = 15;
|
|
||||||
groupBox1.TabStop = false;
|
|
||||||
groupBox1.Text = "Студенты";
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.AllowUserToResizeColumns = false;
|
|
||||||
dataGridView.AllowUserToResizeRows = false;
|
|
||||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnStudent, ColumnMark });
|
|
||||||
dataGridView.Dock = DockStyle.Fill;
|
|
||||||
dataGridView.Location = new Point(3, 19);
|
|
||||||
dataGridView.MultiSelect = false;
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersVisible = false;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(295, 157);
|
|
||||||
dataGridView.TabIndex = 14;
|
|
||||||
//
|
|
||||||
// ColumnStudent
|
|
||||||
//
|
|
||||||
ColumnStudent.HeaderText = "Студенты";
|
|
||||||
ColumnStudent.Name = "ColumnStudent";
|
|
||||||
//
|
|
||||||
// ColumnMark
|
|
||||||
//
|
|
||||||
ColumnMark.DataPropertyName = "Enum.GetValues(typeof(Mark));";
|
|
||||||
ColumnMark.DataSource = Enum.GetValues(typeof(Mark));
|
|
||||||
ColumnMark.HeaderText = "Оценки";
|
|
||||||
ColumnMark.Name = "ColumnMark";
|
|
||||||
ColumnMark.Resizable = DataGridViewTriState.True;
|
|
||||||
//
|
|
||||||
// StatementForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(324, 342);
|
|
||||||
Controls.Add(groupBox1);
|
|
||||||
Controls.Add(comboBoxTeacher);
|
|
||||||
Controls.Add(comboBoxSubject);
|
|
||||||
Controls.Add(ButtonCancel);
|
|
||||||
Controls.Add(ButtonSave);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(label1);
|
|
||||||
Name = "StatementForm";
|
|
||||||
Text = "Результат сессии";
|
|
||||||
groupBox1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private ComboBox comboBoxSubject;
|
|
||||||
private ComboBox comboBoxTeacher;
|
|
||||||
private GroupBox groupBox1;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private DataGridViewComboBoxColumn ColumnStudent;
|
|
||||||
private DataGridViewComboBoxColumn ColumnMark;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
using Project.Entities.Enums;
|
|
||||||
using Project.Repositories;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class StatementForm : Form
|
|
||||||
{
|
|
||||||
private readonly IStatementRepository _statementRepository;
|
|
||||||
private readonly ITeacherRepository _teacherRepository;
|
|
||||||
private readonly ISubjectRepository _subjectRepository;
|
|
||||||
|
|
||||||
public StatementForm(IStatementRepository statementRepository, ITeacherRepository teacherRepository, ISubjectRepository subjectRepository, IStudentRepository studentRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
_statementRepository = statementRepository ?? throw new ArgumentNullException(nameof(statementRepository));
|
|
||||||
_teacherRepository = teacherRepository ?? throw new ArgumentNullException(nameof(teacherRepository));
|
|
||||||
_subjectRepository = subjectRepository ?? throw new ArgumentNullException(nameof(subjectRepository));
|
|
||||||
|
|
||||||
comboBoxTeacher.DataSource = _teacherRepository.GetAllTeachers();
|
|
||||||
comboBoxTeacher.DisplayMember = "DisplayName";
|
|
||||||
comboBoxTeacher.ValueMember = "Id";
|
|
||||||
|
|
||||||
comboBoxSubject.DataSource = _subjectRepository.GetAllSubjects();
|
|
||||||
comboBoxSubject.DisplayMember = "Name";
|
|
||||||
comboBoxSubject.ValueMember = "Id";
|
|
||||||
|
|
||||||
ColumnStudent.DataSource = studentRepository.GetAllStudents();
|
|
||||||
ColumnStudent.DisplayMember = "DisplayName";
|
|
||||||
ColumnStudent.ValueMember = "Id";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (comboBoxTeacher.SelectedIndex < 0 || comboBoxSubject.SelectedIndex < 0 || dataGridView.RowCount < 1)
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются незаполненные поля");
|
|
||||||
}
|
|
||||||
|
|
||||||
_statementRepository.CreateStatement(Statement.CreateOperation(0,
|
|
||||||
(int)comboBoxTeacher.SelectedValue!,
|
|
||||||
(int)comboBoxSubject.SelectedValue!,
|
|
||||||
CreateListStatementStudentFromDataGrid()));
|
|
||||||
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
|
|
||||||
private List<StatementStudent> CreateListStatementStudentFromDataGrid()
|
|
||||||
{
|
|
||||||
var list = new List<StatementStudent>();
|
|
||||||
foreach (DataGridViewRow row in dataGridView.Rows)
|
|
||||||
{
|
|
||||||
if (row.Cells["ColumnStudent"].Value == null ||
|
|
||||||
row.Cells["ColumnMark"].Value == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
list.Add(StatementStudent.CreateOperation(0,
|
|
||||||
Convert.ToInt32(row.Cells["ColumnStudent"].Value),
|
|
||||||
(Mark)Convert.ToInt32(row.Cells["ColumnMark"].Value)));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,126 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="ColumnStudent.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Оценки.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
97
Project/Project/Forms/StatementListForm.Designer.cs
generated
97
Project/Project/Forms/StatementListForm.Designer.cs
generated
@ -1,97 +0,0 @@
|
|||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class StatementListForm
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
ButtonAdd = new Button();
|
|
||||||
dataGridViewData = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(ButtonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(845, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(114, 449);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
ButtonAdd.BackgroundImage = Properties.Resources.Add;
|
|
||||||
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonAdd.Location = new Point(6, 12);
|
|
||||||
ButtonAdd.Name = "ButtonAdd";
|
|
||||||
ButtonAdd.Size = new Size(100, 100);
|
|
||||||
ButtonAdd.TabIndex = 3;
|
|
||||||
ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonAdd.Click += ButtonAdd_Click;
|
|
||||||
//
|
|
||||||
// dataGridViewData
|
|
||||||
//
|
|
||||||
dataGridViewData.AllowUserToAddRows = false;
|
|
||||||
dataGridViewData.AllowUserToDeleteRows = false;
|
|
||||||
dataGridViewData.AllowUserToResizeColumns = false;
|
|
||||||
dataGridViewData.AllowUserToResizeRows = false;
|
|
||||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridViewData.Dock = DockStyle.Fill;
|
|
||||||
dataGridViewData.Location = new Point(0, 0);
|
|
||||||
dataGridViewData.MultiSelect = false;
|
|
||||||
dataGridViewData.Name = "dataGridViewData";
|
|
||||||
dataGridViewData.ReadOnly = true;
|
|
||||||
dataGridViewData.RowHeadersVisible = false;
|
|
||||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridViewData.Size = new Size(845, 449);
|
|
||||||
dataGridViewData.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// StatementListForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(959, 449);
|
|
||||||
Controls.Add(dataGridViewData);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "StatementListForm";
|
|
||||||
Text = "Создание результатов сессии";
|
|
||||||
Load += StatementListForm_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private DataGridView dataGridViewData;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
using Project.Repositories;
|
|
||||||
using Unity;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class StatementListForm : Form
|
|
||||||
{
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
private readonly IStatementRepository _statementRepository;
|
|
||||||
|
|
||||||
public StatementListForm(IUnityContainer container, IStatementRepository statementRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
|
||||||
_statementRepository = statementRepository ?? throw new ArgumentNullException(nameof(statementRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<StatementForm>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadList() => dataGridViewData.DataSource = _statementRepository.GetAllStatements();
|
|
||||||
|
|
||||||
private void StatementListForm_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
144
Project/Project/Forms/StudentForm.Designer.cs
generated
144
Project/Project/Forms/StudentForm.Designer.cs
generated
@ -1,144 +0,0 @@
|
|||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class StudentForm
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
lblSurname = new Label();
|
|
||||||
lblName = new Label();
|
|
||||||
lblMiddleName = new Label();
|
|
||||||
textBoxSurname = new TextBox();
|
|
||||||
textBoxName = new TextBox();
|
|
||||||
ButtonSave = new Button();
|
|
||||||
ButtonCancel = new Button();
|
|
||||||
numericUpDownScore = new NumericUpDown();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownScore).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// lblSurname
|
|
||||||
//
|
|
||||||
lblSurname.AutoSize = true;
|
|
||||||
lblSurname.Location = new Point(62, 39);
|
|
||||||
lblSurname.Name = "lblSurname";
|
|
||||||
lblSurname.Size = new Size(61, 15);
|
|
||||||
lblSurname.TabIndex = 0;
|
|
||||||
lblSurname.Text = "Фамилия ";
|
|
||||||
//
|
|
||||||
// lblName
|
|
||||||
//
|
|
||||||
lblName.AutoSize = true;
|
|
||||||
lblName.Location = new Point(92, 69);
|
|
||||||
lblName.Name = "lblName";
|
|
||||||
lblName.Size = new Size(31, 15);
|
|
||||||
lblName.TabIndex = 1;
|
|
||||||
lblName.Text = "Имя";
|
|
||||||
//
|
|
||||||
// lblMiddleName
|
|
||||||
//
|
|
||||||
lblMiddleName.AutoSize = true;
|
|
||||||
lblMiddleName.Location = new Point(38, 98);
|
|
||||||
lblMiddleName.Name = "lblMiddleName";
|
|
||||||
lblMiddleName.Size = new Size(85, 15);
|
|
||||||
lblMiddleName.TabIndex = 2;
|
|
||||||
lblMiddleName.Text = "Средний балл";
|
|
||||||
//
|
|
||||||
// textBoxSurname
|
|
||||||
//
|
|
||||||
textBoxSurname.Location = new Point(149, 36);
|
|
||||||
textBoxSurname.Name = "textBoxSurname";
|
|
||||||
textBoxSurname.Size = new Size(141, 23);
|
|
||||||
textBoxSurname.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
textBoxName.Location = new Point(149, 66);
|
|
||||||
textBoxName.Name = "textBoxName";
|
|
||||||
textBoxName.Size = new Size(141, 23);
|
|
||||||
textBoxName.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
ButtonSave.Location = new Point(194, 136);
|
|
||||||
ButtonSave.Name = "ButtonSave";
|
|
||||||
ButtonSave.Size = new Size(96, 23);
|
|
||||||
ButtonSave.TabIndex = 8;
|
|
||||||
ButtonSave.Text = "Сохранить";
|
|
||||||
ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
ButtonCancel.Location = new Point(38, 136);
|
|
||||||
ButtonCancel.Name = "ButtonCancel";
|
|
||||||
ButtonCancel.Size = new Size(96, 23);
|
|
||||||
ButtonCancel.TabIndex = 9;
|
|
||||||
ButtonCancel.Text = "Отменить";
|
|
||||||
ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonCancel.Click += ButtonCancel_Click;
|
|
||||||
//
|
|
||||||
// numericUpDownScore
|
|
||||||
//
|
|
||||||
numericUpDownScore.DecimalPlaces = 2;
|
|
||||||
numericUpDownScore.Increment = new decimal(new int[] { 1, 0, 0, 131072 });
|
|
||||||
numericUpDownScore.Location = new Point(149, 96);
|
|
||||||
numericUpDownScore.Maximum = new decimal(new int[] { 5, 0, 0, 0 });
|
|
||||||
numericUpDownScore.Name = "numericUpDownScore";
|
|
||||||
numericUpDownScore.Size = new Size(141, 23);
|
|
||||||
numericUpDownScore.TabIndex = 10;
|
|
||||||
//
|
|
||||||
// StudentForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(331, 178);
|
|
||||||
Controls.Add(numericUpDownScore);
|
|
||||||
Controls.Add(ButtonCancel);
|
|
||||||
Controls.Add(ButtonSave);
|
|
||||||
Controls.Add(textBoxName);
|
|
||||||
Controls.Add(textBoxSurname);
|
|
||||||
Controls.Add(lblMiddleName);
|
|
||||||
Controls.Add(lblName);
|
|
||||||
Controls.Add(lblSurname);
|
|
||||||
Name = "StudentForm";
|
|
||||||
Text = "Студент";
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownScore).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label lblSurname;
|
|
||||||
private Label lblName;
|
|
||||||
private Label lblMiddleName;
|
|
||||||
private TextBox textBoxSurname;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private NumericUpDown numericUpDownScore;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
using Project.Repositories;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class StudentForm : Form
|
|
||||||
{
|
|
||||||
private readonly IStudentRepository _studentRepository;
|
|
||||||
private int? _studentId;
|
|
||||||
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var student = _studentRepository.GetStudentById(value);
|
|
||||||
if (student == null)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException(nameof(student));
|
|
||||||
}
|
|
||||||
textBoxSurname.Text = student.LastName;
|
|
||||||
textBoxName.Text = student.FirstName;
|
|
||||||
numericUpDownScore.Value = (decimal)student.Score;
|
|
||||||
_studentId = value;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public StudentForm(IStudentRepository studentRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_studentRepository = studentRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(studentRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(textBoxSurname.Text) ||
|
|
||||||
string.IsNullOrWhiteSpace(textBoxName.Text) ||
|
|
||||||
numericUpDownScore.Value <= 0)
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются незаполненные поля");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_studentId.HasValue)
|
|
||||||
{
|
|
||||||
_studentRepository.UpdateStudent(CreateStudent(_studentId.Value));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_studentRepository.AddStudent(CreateStudent(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
|
|
||||||
private Student CreateStudent(int id) => Student.CreateOperation(
|
|
||||||
id,
|
|
||||||
textBoxName.Text,
|
|
||||||
textBoxSurname.Text,(float)numericUpDownScore.Value!);
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
126
Project/Project/Forms/StudentsListForm.Designer.cs
generated
126
Project/Project/Forms/StudentsListForm.Designer.cs
generated
@ -1,126 +0,0 @@
|
|||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class StudentsListForm
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
ButtonUpd = new Button();
|
|
||||||
ButtonAdd = new Button();
|
|
||||||
dataGridViewStudents = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewStudents).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(ButtonDel);
|
|
||||||
panel1.Controls.Add(ButtonUpd);
|
|
||||||
panel1.Controls.Add(ButtonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(840, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(126, 452);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
ButtonDel.BackgroundImage = Properties.Resources.Del;
|
|
||||||
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonDel.Location = new Point(12, 266);
|
|
||||||
ButtonDel.Name = "ButtonDel";
|
|
||||||
ButtonDel.Size = new Size(101, 100);
|
|
||||||
ButtonDel.TabIndex = 2;
|
|
||||||
ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonDel.Click += ButtonDel_Click;
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
ButtonUpd.BackgroundImage = Properties.Resources.Upd;
|
|
||||||
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonUpd.Location = new Point(13, 160);
|
|
||||||
ButtonUpd.Name = "ButtonUpd";
|
|
||||||
ButtonUpd.Size = new Size(100, 100);
|
|
||||||
ButtonUpd.TabIndex = 1;
|
|
||||||
ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonUpd.Click += ButtonUpd_Click;
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
ButtonAdd.BackgroundImage = Properties.Resources.Add;
|
|
||||||
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonAdd.Location = new Point(13, 54);
|
|
||||||
ButtonAdd.Name = "ButtonAdd";
|
|
||||||
ButtonAdd.Size = new Size(100, 100);
|
|
||||||
ButtonAdd.TabIndex = 0;
|
|
||||||
ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonAdd.Click += ButtonAdd_Click;
|
|
||||||
//
|
|
||||||
// dataGridViewStudents
|
|
||||||
//
|
|
||||||
dataGridViewStudents.AllowUserToAddRows = false;
|
|
||||||
dataGridViewStudents.AllowUserToDeleteRows = false;
|
|
||||||
dataGridViewStudents.AllowUserToResizeColumns = false;
|
|
||||||
dataGridViewStudents.AllowUserToResizeRows = false;
|
|
||||||
dataGridViewStudents.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
dataGridViewStudents.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridViewStudents.Dock = DockStyle.Fill;
|
|
||||||
dataGridViewStudents.Location = new Point(0, 0);
|
|
||||||
dataGridViewStudents.MultiSelect = false;
|
|
||||||
dataGridViewStudents.Name = "dataGridViewStudents";
|
|
||||||
dataGridViewStudents.ReadOnly = true;
|
|
||||||
dataGridViewStudents.RowHeadersVisible = false;
|
|
||||||
dataGridViewStudents.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridViewStudents.Size = new Size(840, 452);
|
|
||||||
dataGridViewStudents.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// StudentsList
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(966, 452);
|
|
||||||
Controls.Add(dataGridViewStudents);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "StudentsList";
|
|
||||||
StartPosition = FormStartPosition.CenterParent;
|
|
||||||
Text = "Студенты";
|
|
||||||
Load += StudentsList_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewStudents).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private DataGridView dataGridViewStudents;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
using Project.Repositories;
|
|
||||||
using Unity;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class StudentsListForm : Form
|
|
||||||
{
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
private readonly IStudentRepository _studentRepository;
|
|
||||||
|
|
||||||
public StudentsListForm(IUnityContainer container, IStudentRepository studentRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
|
||||||
_studentRepository = studentRepository ?? throw new ArgumentNullException(nameof(studentRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void StudentsList_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<StudentForm>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var form = _container.Resolve<StudentForm>();
|
|
||||||
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
|
|
||||||
{
|
|
||||||
_studentRepository.DeleteStudent(findId);
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadList() => dataGridViewStudents.DataSource = _studentRepository.GetAllStudents();
|
|
||||||
|
|
||||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
if (dataGridViewStudents.SelectedRows.Count < 1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
id = Convert.ToInt32(dataGridViewStudents.SelectedRows[0].Cells["ID"].Value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
118
Project/Project/Forms/SubjectForm.Designer.cs
generated
118
Project/Project/Forms/SubjectForm.Designer.cs
generated
@ -1,118 +0,0 @@
|
|||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class SubjectForm
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
labelDisciplineType = new Label();
|
|
||||||
textBoxName = new TextBox();
|
|
||||||
checkedListBoxCourse = new CheckedListBox();
|
|
||||||
ButtonSave = new Button();
|
|
||||||
ButtonCancel = new Button();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelName
|
|
||||||
//
|
|
||||||
labelName.AutoSize = true;
|
|
||||||
labelName.Location = new Point(73, 33);
|
|
||||||
labelName.Name = "labelName";
|
|
||||||
labelName.Size = new Size(59, 15);
|
|
||||||
labelName.TabIndex = 0;
|
|
||||||
labelName.Text = "Название";
|
|
||||||
//
|
|
||||||
// labelDisciplineType
|
|
||||||
//
|
|
||||||
labelDisciplineType.AutoSize = true;
|
|
||||||
labelDisciplineType.Location = new Point(54, 79);
|
|
||||||
labelDisciplineType.Name = "labelDisciplineType";
|
|
||||||
labelDisciplineType.Size = new Size(78, 15);
|
|
||||||
labelDisciplineType.TabIndex = 2;
|
|
||||||
labelDisciplineType.Text = "Выбор курса";
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
textBoxName.Location = new Point(147, 33);
|
|
||||||
textBoxName.Name = "textBoxName";
|
|
||||||
textBoxName.Size = new Size(184, 23);
|
|
||||||
textBoxName.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// checkedListBoxCourse
|
|
||||||
//
|
|
||||||
checkedListBoxCourse.FormattingEnabled = true;
|
|
||||||
checkedListBoxCourse.Location = new Point(147, 79);
|
|
||||||
checkedListBoxCourse.Name = "checkedListBoxCourse";
|
|
||||||
checkedListBoxCourse.Size = new Size(184, 94);
|
|
||||||
checkedListBoxCourse.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
ButtonSave.Location = new Point(36, 200);
|
|
||||||
ButtonSave.Name = "ButtonSave";
|
|
||||||
ButtonSave.Size = new Size(96, 23);
|
|
||||||
ButtonSave.TabIndex = 10;
|
|
||||||
ButtonSave.Text = "Сохранить";
|
|
||||||
ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
ButtonCancel.Location = new Point(235, 200);
|
|
||||||
ButtonCancel.Name = "ButtonCancel";
|
|
||||||
ButtonCancel.Size = new Size(96, 23);
|
|
||||||
ButtonCancel.TabIndex = 11;
|
|
||||||
ButtonCancel.Text = "Отменить";
|
|
||||||
ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonCancel.Click += ButtonCancel_Click;
|
|
||||||
//
|
|
||||||
// SubjectForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(372, 251);
|
|
||||||
Controls.Add(ButtonCancel);
|
|
||||||
Controls.Add(ButtonSave);
|
|
||||||
Controls.Add(checkedListBoxCourse);
|
|
||||||
Controls.Add(textBoxName);
|
|
||||||
Controls.Add(labelDisciplineType);
|
|
||||||
Controls.Add(labelName);
|
|
||||||
Name = "SubjectForm";
|
|
||||||
Text = "Предмет";
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelName;
|
|
||||||
private Label labelDisciplineType;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private CheckedListBox checkedListBoxCourse;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
using Project.Repositories;
|
|
||||||
using Project.Entities.Enums;
|
|
||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class SubjectForm : Form
|
|
||||||
{
|
|
||||||
private readonly ISubjectRepository _subjectRepository;
|
|
||||||
private int? _subjectId;
|
|
||||||
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var subject = _subjectRepository.GetSubjectById(value);
|
|
||||||
if (subject == null)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException(nameof(subject));
|
|
||||||
}
|
|
||||||
foreach (Course elem in Enum.GetValues(typeof(Course)))
|
|
||||||
{
|
|
||||||
if ((elem & subject.Courses) != 0)
|
|
||||||
{
|
|
||||||
checkedListBoxCourse.SetItemChecked(checkedListBoxCourse.Items.IndexOf(elem), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
textBoxName.Text = subject.Name;
|
|
||||||
_subjectId = value;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public SubjectForm(ISubjectRepository subjectRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
_subjectRepository = subjectRepository ?? throw new ArgumentNullException(nameof(subjectRepository));
|
|
||||||
|
|
||||||
foreach (var elem in Enum.GetValues(typeof(Course)))
|
|
||||||
{
|
|
||||||
checkedListBoxCourse.Items.Add(elem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
|
|
||||||
checkedListBoxCourse.CheckedItems.Count == 0 )
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются незаполненные поля");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_subjectId.HasValue)
|
|
||||||
{
|
|
||||||
_subjectRepository.UpdateSubject(CreateSubject(_subjectId.Value));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_subjectRepository.AddSubject(CreateSubject(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
|
|
||||||
private Subject CreateSubject(int id)
|
|
||||||
{
|
|
||||||
Course course = Course.None;
|
|
||||||
foreach (var elem in checkedListBoxCourse.CheckedItems)
|
|
||||||
{
|
|
||||||
course |= (Course)elem;
|
|
||||||
}
|
|
||||||
return Subject.CreateOperation(id, textBoxName.Text, course);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
125
Project/Project/Forms/SubjectsForm.Designer.cs
generated
125
Project/Project/Forms/SubjectsForm.Designer.cs
generated
@ -1,125 +0,0 @@
|
|||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class SubjectsForm
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
ButtonUpd = new Button();
|
|
||||||
ButtonAdd = new Button();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(ButtonDel);
|
|
||||||
panel1.Controls.Add(ButtonUpd);
|
|
||||||
panel1.Controls.Add(ButtonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(800, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(134, 429);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
ButtonDel.BackgroundImage = Properties.Resources.Del;
|
|
||||||
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonDel.Location = new Point(13, 270);
|
|
||||||
ButtonDel.Name = "ButtonDel";
|
|
||||||
ButtonDel.Size = new Size(101, 100);
|
|
||||||
ButtonDel.TabIndex = 4;
|
|
||||||
ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonDel.Click += ButtonDel_Click;
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
ButtonUpd.BackgroundImage = Properties.Resources.Upd;
|
|
||||||
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonUpd.Location = new Point(13, 164);
|
|
||||||
ButtonUpd.Name = "ButtonUpd";
|
|
||||||
ButtonUpd.Size = new Size(100, 100);
|
|
||||||
ButtonUpd.TabIndex = 3;
|
|
||||||
ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonUpd.Click += ButtonUpd_Click;
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
ButtonAdd.BackgroundImage = Properties.Resources.Add;
|
|
||||||
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonAdd.Location = new Point(13, 58);
|
|
||||||
ButtonAdd.Name = "ButtonAdd";
|
|
||||||
ButtonAdd.Size = new Size(100, 100);
|
|
||||||
ButtonAdd.TabIndex = 2;
|
|
||||||
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.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(800, 429);
|
|
||||||
dataGridView.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// SubjectsForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(934, 429);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "SubjectsForm";
|
|
||||||
Text = "Предметы";
|
|
||||||
Load += SubjectsForm_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,98 +0,0 @@
|
|||||||
using Project.Repositories;
|
|
||||||
using Unity;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class SubjectsForm : Form
|
|
||||||
{
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
private readonly ISubjectRepository _subjectRepository;
|
|
||||||
|
|
||||||
public SubjectsForm(IUnityContainer container, ISubjectRepository subjectRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
|
||||||
_subjectRepository = subjectRepository ?? throw new ArgumentNullException(nameof(subjectRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<SubjectForm>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var form = _container.Resolve<SubjectForm>();
|
|
||||||
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
|
|
||||||
{
|
|
||||||
_subjectRepository.DeleteSubject(findId);
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadList() => dataGridView.DataSource = _subjectRepository.GetAllSubjects();
|
|
||||||
|
|
||||||
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 SubjectsForm_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
116
Project/Project/Forms/TeacherForm.Designer.cs
generated
116
Project/Project/Forms/TeacherForm.Designer.cs
generated
@ -1,116 +0,0 @@
|
|||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class TeacherForm
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
ButtonSave = new Button();
|
|
||||||
ButtonCancel = new Button();
|
|
||||||
labelSurname = new Label();
|
|
||||||
label2 = new Label();
|
|
||||||
textBoxSurname = new TextBox();
|
|
||||||
textBoxName = new TextBox();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
ButtonSave.Location = new Point(169, 131);
|
|
||||||
ButtonSave.Name = "ButtonSave";
|
|
||||||
ButtonSave.Size = new Size(96, 23);
|
|
||||||
ButtonSave.TabIndex = 9;
|
|
||||||
ButtonSave.Text = "Сохранить";
|
|
||||||
ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
ButtonCancel.Location = new Point(56, 131);
|
|
||||||
ButtonCancel.Name = "ButtonCancel";
|
|
||||||
ButtonCancel.Size = new Size(96, 23);
|
|
||||||
ButtonCancel.TabIndex = 10;
|
|
||||||
ButtonCancel.Text = "Отменить";
|
|
||||||
ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// labelSurname
|
|
||||||
//
|
|
||||||
labelSurname.AutoSize = true;
|
|
||||||
labelSurname.Location = new Point(56, 38);
|
|
||||||
labelSurname.Name = "labelSurname";
|
|
||||||
labelSurname.Size = new Size(58, 15);
|
|
||||||
labelSurname.TabIndex = 11;
|
|
||||||
labelSurname.Text = "Фамилия";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(83, 83);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(31, 15);
|
|
||||||
label2.TabIndex = 12;
|
|
||||||
label2.Text = "Имя";
|
|
||||||
//
|
|
||||||
// textBoxSurname
|
|
||||||
//
|
|
||||||
textBoxSurname.Location = new Point(120, 35);
|
|
||||||
textBoxSurname.Name = "textBoxSurname";
|
|
||||||
textBoxSurname.Size = new Size(145, 23);
|
|
||||||
textBoxSurname.TabIndex = 15;
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
textBoxName.Location = new Point(120, 81);
|
|
||||||
textBoxName.Name = "textBoxName";
|
|
||||||
textBoxName.Size = new Size(145, 23);
|
|
||||||
textBoxName.TabIndex = 16;
|
|
||||||
//
|
|
||||||
// TeacherForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(318, 186);
|
|
||||||
Controls.Add(textBoxName);
|
|
||||||
Controls.Add(textBoxSurname);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(labelSurname);
|
|
||||||
Controls.Add(ButtonCancel);
|
|
||||||
Controls.Add(ButtonSave);
|
|
||||||
Name = "TeacherForm";
|
|
||||||
Text = "Преподаватель";
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private Label labelSurname;
|
|
||||||
private Label label2;
|
|
||||||
private TextBox textBoxSurname;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
using Project.Repositories;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class TeacherForm : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly ITeacherRepository _teacherRepository;
|
|
||||||
private int? _teacherId;
|
|
||||||
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var teacher = _teacherRepository.GetTeacherById(value);
|
|
||||||
if (teacher == null)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException(nameof(teacher));
|
|
||||||
}
|
|
||||||
textBoxSurname.Text = teacher.LastName;
|
|
||||||
textBoxName.Text = teacher.FirstName;
|
|
||||||
_teacherId = value;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TeacherForm(ITeacherRepository teacherRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_teacherRepository = teacherRepository ?? throw new ArgumentNullException(nameof(teacherRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(textBoxSurname.Text) ||
|
|
||||||
string.IsNullOrWhiteSpace(textBoxName.Text))
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются незаполненные поля");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_teacherId.HasValue)
|
|
||||||
{
|
|
||||||
_teacherRepository.UpdateTeacher(CreateTeacher(_teacherId.Value));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_teacherRepository.AddTeacher(CreateTeacher(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
|
|
||||||
private Teacher CreateTeacher(int id) => Teacher.CreateOperation(
|
|
||||||
id,
|
|
||||||
textBoxName.Text,
|
|
||||||
textBoxSurname.Text);
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
125
Project/Project/Forms/TeachersListForm.Designer.cs
generated
125
Project/Project/Forms/TeachersListForm.Designer.cs
generated
@ -1,125 +0,0 @@
|
|||||||
namespace Project.Forms
|
|
||||||
{
|
|
||||||
partial class TeachersListForm
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
ButtonUpd = new Button();
|
|
||||||
ButtonAdd = new Button();
|
|
||||||
dataGridViewTeachers = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewTeachers).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(ButtonDel);
|
|
||||||
panel1.Controls.Add(ButtonUpd);
|
|
||||||
panel1.Controls.Add(ButtonAdd);
|
|
||||||
panel1.Dock = DockStyle.Right;
|
|
||||||
panel1.Location = new Point(836, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(125, 431);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
ButtonDel.BackgroundImage = Properties.Resources.Del;
|
|
||||||
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonDel.Location = new Point(13, 266);
|
|
||||||
ButtonDel.Name = "ButtonDel";
|
|
||||||
ButtonDel.Size = new Size(101, 100);
|
|
||||||
ButtonDel.TabIndex = 4;
|
|
||||||
ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonDel.Click += ButtonDel_Click;
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
ButtonUpd.BackgroundImage = Properties.Resources.Upd;
|
|
||||||
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonUpd.Location = new Point(13, 160);
|
|
||||||
ButtonUpd.Name = "ButtonUpd";
|
|
||||||
ButtonUpd.Size = new Size(100, 100);
|
|
||||||
ButtonUpd.TabIndex = 3;
|
|
||||||
ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonUpd.Click += ButtonUpd_Click;
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
ButtonAdd.BackgroundImage = Properties.Resources.Add;
|
|
||||||
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonAdd.Location = new Point(13, 54);
|
|
||||||
ButtonAdd.Name = "ButtonAdd";
|
|
||||||
ButtonAdd.Size = new Size(100, 100);
|
|
||||||
ButtonAdd.TabIndex = 2;
|
|
||||||
ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonAdd.Click += ButtonAdd_Click;
|
|
||||||
//
|
|
||||||
// dataGridViewTeachers
|
|
||||||
//
|
|
||||||
dataGridViewTeachers.AllowUserToAddRows = false;
|
|
||||||
dataGridViewTeachers.AllowUserToDeleteRows = false;
|
|
||||||
dataGridViewTeachers.AllowUserToResizeColumns = false;
|
|
||||||
dataGridViewTeachers.AllowUserToResizeRows = false;
|
|
||||||
dataGridViewTeachers.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
dataGridViewTeachers.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridViewTeachers.Dock = DockStyle.Fill;
|
|
||||||
dataGridViewTeachers.Location = new Point(0, 0);
|
|
||||||
dataGridViewTeachers.MultiSelect = false;
|
|
||||||
dataGridViewTeachers.Name = "dataGridViewTeachers";
|
|
||||||
dataGridViewTeachers.ReadOnly = true;
|
|
||||||
dataGridViewTeachers.RowHeadersVisible = false;
|
|
||||||
dataGridViewTeachers.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridViewTeachers.Size = new Size(836, 431);
|
|
||||||
dataGridViewTeachers.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// TeachersList
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(961, 431);
|
|
||||||
Controls.Add(dataGridViewTeachers);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "TeachersList";
|
|
||||||
Text = "Преподаватели";
|
|
||||||
Load += TeachersList_Load;
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewTeachers).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private DataGridView dataGridViewTeachers;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,97 +0,0 @@
|
|||||||
using Project.Repositories;
|
|
||||||
using Unity;
|
|
||||||
|
|
||||||
namespace Project.Forms;
|
|
||||||
|
|
||||||
public partial class TeachersListForm : Form
|
|
||||||
{
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
private readonly ITeacherRepository _teacherRepository;
|
|
||||||
|
|
||||||
public TeachersListForm(IUnityContainer container, ITeacherRepository teacherRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
|
||||||
_teacherRepository = teacherRepository ?? throw new ArgumentNullException(nameof(teacherRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TeachersList_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<TeacherForm>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var form = _container.Resolve<TeacherForm>();
|
|
||||||
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
|
|
||||||
{
|
|
||||||
_teacherRepository.DeleteTeacher(findId);
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadList() => dataGridViewTeachers.DataSource = _teacherRepository.GetAllTeachers();
|
|
||||||
|
|
||||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
if (dataGridViewTeachers.SelectedRows.Count < 1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
id = Convert.ToInt32(dataGridViewTeachers.SelectedRows[0].Cells["ID"].Value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,37 +0,0 @@
|
|||||||
using Unity.Lifetime;
|
|
||||||
using Unity.Microsoft.Logging;
|
|
||||||
using Unity;
|
|
||||||
using Project.Repositories.Implementations;
|
|
||||||
using Project.Repositories;
|
|
||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project
|
|
||||||
{
|
|
||||||
internal static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
// To customize application configuration such as set high DPI settings or default font,
|
|
||||||
// see https://aka.ms/applicationconfiguration.
|
|
||||||
ApplicationConfiguration.Initialize();
|
|
||||||
Application.Run(CreateContainer().Resolve<FormMain>());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IUnityContainer CreateContainer()
|
|
||||||
{
|
|
||||||
var container = new UnityContainer();
|
|
||||||
|
|
||||||
container.RegisterType<IStudentRepository, StudentRepository>();
|
|
||||||
container.RegisterType<IDecreeRepository, DecreeRepository>();
|
|
||||||
container.RegisterType<IStatementRepository, StatementRepository>();
|
|
||||||
container.RegisterType<ISubjectRepository, SubjectRepository>();
|
|
||||||
container.RegisterType<ITeacherRepository, TeacherRepository>();
|
|
||||||
|
|
||||||
return container;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Dapper" Version="2.1.35" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
<PackageReference Include="Npgsql" Version="9.0.1" />
|
|
||||||
<PackageReference Include="Serilog" Version="4.1.0" />
|
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
|
||||||
<PackageReference Include="Unity" Version="5.11.10" />
|
|
||||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
|
||||||
</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>PublicResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
93
Project/Project/Properties/Resources.Designer.cs
generated
93
Project/Project/Properties/Resources.Designer.cs
generated
@ -1,93 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Project.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
|
||||||
/// </summary>
|
|
||||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
|
||||||
// с помощью такого средства, как ResGen или Visual Studio.
|
|
||||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
|
||||||
// с параметром /str или перестройте свой проект VS.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
public 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>
|
|
||||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
public static global::System.Resources.ResourceManager ResourceManager {
|
|
||||||
get {
|
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Project.Properties.Resources", typeof(Resources).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
|
||||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
public static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
public static System.Drawing.Bitmap Add {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("Add", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
public static System.Drawing.Bitmap Del {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("Del", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
public static System.Drawing.Bitmap Upd {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("Upd", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories;
|
|
||||||
|
|
||||||
public interface IDecreeRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Decree> GetAllDecrees();
|
|
||||||
void AddDecree(Decree decree);
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories;
|
|
||||||
|
|
||||||
public interface IStatementRepository
|
|
||||||
{
|
|
||||||
void CreateStatement(Statement statement);
|
|
||||||
IEnumerable<Statement> GetAllStatements();
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories;
|
|
||||||
|
|
||||||
public interface IStudentRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Student> GetAllStudents();
|
|
||||||
Student GetStudentById(int id);
|
|
||||||
void AddStudent(Student student);
|
|
||||||
void UpdateStudent(Student student);
|
|
||||||
void DeleteStudent(int id);
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories;
|
|
||||||
|
|
||||||
public interface ISubjectRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Subject> GetAllSubjects();
|
|
||||||
Subject GetSubjectById(int id);
|
|
||||||
void AddSubject(Subject subject);
|
|
||||||
void UpdateSubject(Subject subject);
|
|
||||||
void DeleteSubject(int id);
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories;
|
|
||||||
|
|
||||||
public interface ITeacherRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Teacher> GetAllTeachers();
|
|
||||||
Teacher GetTeacherById(int id);
|
|
||||||
void AddTeacher(Teacher teacher);
|
|
||||||
void UpdateTeacher(Teacher teacher);
|
|
||||||
void DeleteTeacher(int id);
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories.Implementations;
|
|
||||||
|
|
||||||
|
|
||||||
public class DecreeRepository : IDecreeRepository
|
|
||||||
{
|
|
||||||
public void AddDecree(Decree decree)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Decree> GetAllDecrees()
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories.Implementations;
|
|
||||||
|
|
||||||
public class StatementRepository : IStatementRepository
|
|
||||||
{
|
|
||||||
public void CreateStatement(Statement statement)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Statement> GetAllStatements()
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories.Implementations;
|
|
||||||
|
|
||||||
public class StudentRepository : IStudentRepository
|
|
||||||
{
|
|
||||||
public void AddStudent(Student student)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteStudent(int id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Student> GetAllStudents()
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Student GetStudentById(int id)
|
|
||||||
{
|
|
||||||
return Student.CreateOperation(0, "", "", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateStudent(Student student)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories.Implementations;
|
|
||||||
|
|
||||||
|
|
||||||
public class SubjectRepository : ISubjectRepository
|
|
||||||
{
|
|
||||||
public void AddSubject(Subject subject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteSubject(int id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Subject> GetAllSubjects()
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Subject GetSubjectById(int id)
|
|
||||||
{
|
|
||||||
return Subject.CreateOperation(0, "", Entities.Enums.Course.Third);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateSubject(Subject subject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
using Project.Entities;
|
|
||||||
|
|
||||||
namespace Project.Repositories.Implementations;
|
|
||||||
|
|
||||||
public class TeacherRepository : ITeacherRepository
|
|
||||||
{
|
|
||||||
public void AddTeacher(Teacher teacher)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteTeacher(int id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Teacher> GetAllTeachers()
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Teacher GetTeacherById(int id)
|
|
||||||
{
|
|
||||||
return Teacher.CreateOperation(0, "", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateTeacher(Teacher teacher)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.8.34330.188
|
VisualStudioVersion = 17.11.35312.102
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project", "Project\Project.csproj", "{4618FAC2-6164-4984-B1D5-331D9192AEF2}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectExams", "ProjectExams\ProjectExams.csproj", "{7D39980D-FE2E-4DBA-833B-871F30933617}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -11,15 +11,15 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{4618FAC2-6164-4984-B1D5-331D9192AEF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{7D39980D-FE2E-4DBA-833B-871F30933617}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{4618FAC2-6164-4984-B1D5-331D9192AEF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{7D39980D-FE2E-4DBA-833B-871F30933617}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4618FAC2-6164-4984-B1D5-331D9192AEF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{7D39980D-FE2E-4DBA-833B-871F30933617}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{4618FAC2-6164-4984-B1D5-331D9192AEF2}.Release|Any CPU.Build.0 = Release|Any CPU
|
{7D39980D-FE2E-4DBA-833B-871F30933617}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {9E9B69A2-5266-43DD-AFC3-5860FEF81206}
|
SolutionGuid = {6C158487-80FC-494F-AF55-7E8E19014902}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
39
ProjectExams/ProjectExams/Form1.Designer.cs
generated
Normal file
39
ProjectExams/ProjectExams/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace ProjectExams
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
10
ProjectExams/ProjectExams/Form1.cs
Normal file
10
ProjectExams/ProjectExams/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace ProjectExams
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
ProjectExams/ProjectExams/Program.cs
Normal file
17
ProjectExams/ProjectExams/Program.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace ProjectExams
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
|
// see https://aka.ms/applicationconfiguration.
|
||||||
|
ApplicationConfiguration.Initialize();
|
||||||
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
ProjectExams/ProjectExams/ProjectExams.csproj
Normal file
11
ProjectExams/ProjectExams/ProjectExams.csproj
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
x
Reference in New Issue
Block a user