Доделал
@ -1,19 +1,16 @@
|
||||
namespace YourNamespace.Entities
|
||||
{
|
||||
public class Discipline
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public int Estimation { get; private set; }
|
||||
namespace YourNamespace.Entities;
|
||||
|
||||
public static Discipline CreateDiscipline(int id, string name, int estimation)
|
||||
public class Discipline
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
|
||||
public static Discipline CreateEntity(int id, string name)
|
||||
{
|
||||
return new Discipline
|
||||
{
|
||||
return new Discipline
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
Estimation = estimation
|
||||
};
|
||||
}
|
||||
Id = id,
|
||||
Name = name ?? string.Empty
|
||||
};
|
||||
}
|
||||
}
|
@ -6,11 +6,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Entities.Enums;
|
||||
|
||||
public enum DisciplineName
|
||||
public enum StudentStatus
|
||||
{
|
||||
OTP = 1,
|
||||
OOP = 2,
|
||||
PI = 3,
|
||||
VM = 4,
|
||||
OAIP = 5
|
||||
Active,
|
||||
Inactive,
|
||||
Graduated
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Entities.Enums;
|
||||
|
||||
public enum TeacherName
|
||||
{
|
||||
Kuleshov = 1,
|
||||
Skalkin = 2,
|
||||
Ankilov = 3,
|
||||
Voronina = 4,
|
||||
Surkova = 5,
|
||||
Egov = 6
|
||||
}
|
@ -6,20 +6,24 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Entities;
|
||||
|
||||
public class Statament
|
||||
public class Statement
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int TeacherID { get; private set; }
|
||||
public int Discipline { get; private set; }
|
||||
public string Date { get; private set; } = string.Empty;
|
||||
public int StudentID { get; private set; }
|
||||
public int TeacherID { get; private set; }
|
||||
public int DisciplineID { get; private set; }
|
||||
public int Estimation { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
|
||||
public static Statament CreateStatament(int id, int teacherID, int discoplineID, string date)
|
||||
public static Statement CreateEntity(int id, int studentID, int teacherID, int disciplineID, int estimation, DateTime date)
|
||||
{
|
||||
return new Statament
|
||||
return new Statement
|
||||
{
|
||||
Id = id,
|
||||
StudentID = studentID,
|
||||
TeacherID = teacherID,
|
||||
Discipline = discoplineID,
|
||||
DisciplineID = disciplineID,
|
||||
Estimation = estimation,
|
||||
Date = date
|
||||
};
|
||||
}
|
||||
|
@ -9,20 +9,18 @@ namespace ProjectSession.Entities;
|
||||
public class Student
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public string FamilyStatus { get; private set; } = string.Empty;
|
||||
public string Name { get; private set; }
|
||||
public string FamilyStatus { get; private set; }
|
||||
public bool Dormitory { get; private set; }
|
||||
|
||||
public static Student CreateStudent(int id, string name, string familyStatus, bool dormitory)
|
||||
public static Student CreateEntity(int id, string name, string familyStatus, bool dormitory, Enums.StudentStatus active)
|
||||
{
|
||||
return new Student
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
FamilyStatus = familyStatus,
|
||||
Dormitory = dormitory,
|
||||
|
||||
Name = name ?? string.Empty,
|
||||
FamilyStatus = familyStatus ?? string.Empty,
|
||||
Dormitory = dormitory
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -6,16 +6,19 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Entities;
|
||||
|
||||
public class Student_Statament
|
||||
public class Student_Statement
|
||||
{
|
||||
public int StudentId { get; private set; }
|
||||
public int StatamentID { get; private set; }
|
||||
public static Student_Statament CreateStudent_Statament(int studentId, int statamentID)
|
||||
public int Id { get; private set; }
|
||||
public int StudentID { get; private set; }
|
||||
public int StatementID { get; private set; }
|
||||
|
||||
public static Student_Statement CreateEntity(int id, int studentID, int statementID)
|
||||
{
|
||||
return new Student_Statament
|
||||
return new Student_Statement
|
||||
{
|
||||
StudentId = studentId,
|
||||
StatamentID = statamentID
|
||||
Id = id,
|
||||
StudentID = studentID,
|
||||
StatementID = statementID
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -8,19 +8,20 @@ namespace ProjectSession.Entities;
|
||||
|
||||
public class Sumbission
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int StudentId { get; private set; }
|
||||
public int DisciplineID { get; private set; }
|
||||
public string Date { get; private set; } = string.Empty;
|
||||
|
||||
public static Sumbission CreateSumbission(int id, int studentID, int disciplineID, string date)
|
||||
public class Submission
|
||||
{
|
||||
return new Sumbission
|
||||
public int Id { get; private set; }
|
||||
public int DisciplineID { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
|
||||
public static Submission CreateEntity(int id, int disciplineID, DateTime date)
|
||||
{
|
||||
Id = id,
|
||||
Date = date,
|
||||
DisciplineID = disciplineID ,
|
||||
StudentId = studentID
|
||||
};
|
||||
return new Submission
|
||||
{
|
||||
Id = id,
|
||||
DisciplineID = disciplineID,
|
||||
Date = date
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,16 +9,14 @@ namespace ProjectSession.Entities;
|
||||
public class Teacher
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public DateTime Date { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
|
||||
public static Teacher CreateTeacher(int id, string name, DateTime date)
|
||||
public static Teacher CreateEntity(int id, string name)
|
||||
{
|
||||
return new Teacher
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
Date = date
|
||||
Name = name ?? string.Empty
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
39
ProjectSession/ProjectSession/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace ProjectSession
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace ProjectSession
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
140
ProjectSession/ProjectSession/FormSessionResult.Designer.cs
generated
Normal file
@ -0,0 +1,140 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormSessionResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
StudentsToolStripMenuItem = new ToolStripMenuItem();
|
||||
DisciplinesToolStripMenuItem = new ToolStripMenuItem();
|
||||
TeachersToolStripMenuItem = new ToolStripMenuItem();
|
||||
опереToolStripMenuItem = new ToolStripMenuItem();
|
||||
StatementsToolStripMenuItem = new ToolStripMenuItem();
|
||||
SubmissionsToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, опереToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Padding = new Padding(7, 3, 0, 3);
|
||||
menuStrip1.Size = new Size(896, 30);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { StudentsToolStripMenuItem, DisciplinesToolStripMenuItem, TeachersToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// StudentsToolStripMenuItem
|
||||
//
|
||||
StudentsToolStripMenuItem.Name = "StudentsToolStripMenuItem";
|
||||
StudentsToolStripMenuItem.Size = new Size(201, 26);
|
||||
StudentsToolStripMenuItem.Text = "Студенты";
|
||||
StudentsToolStripMenuItem.Click += StudentsToolStripMenuItem_Click;
|
||||
//
|
||||
// DisciplinesToolStripMenuItem
|
||||
//
|
||||
DisciplinesToolStripMenuItem.Name = "DisciplinesToolStripMenuItem";
|
||||
DisciplinesToolStripMenuItem.Size = new Size(201, 26);
|
||||
DisciplinesToolStripMenuItem.Text = "Дисциплины";
|
||||
DisciplinesToolStripMenuItem.Click += DisciplinesToolStripMenuItem_Click;
|
||||
//
|
||||
// TeachersToolStripMenuItem
|
||||
//
|
||||
TeachersToolStripMenuItem.Name = "TeachersToolStripMenuItem";
|
||||
TeachersToolStripMenuItem.Size = new Size(201, 26);
|
||||
TeachersToolStripMenuItem.Text = "Преподаватели";
|
||||
TeachersToolStripMenuItem.Click += TeachersToolStripMenuItem_Click;
|
||||
//
|
||||
// опереToolStripMenuItem
|
||||
//
|
||||
опереToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { StatementsToolStripMenuItem, SubmissionsToolStripMenuItem });
|
||||
опереToolStripMenuItem.Name = "опереToolStripMenuItem";
|
||||
опереToolStripMenuItem.Size = new Size(95, 24);
|
||||
опереToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// StatementsToolStripMenuItem
|
||||
//
|
||||
StatementsToolStripMenuItem.Name = "StatementsToolStripMenuItem";
|
||||
StatementsToolStripMenuItem.Size = new Size(166, 26);
|
||||
StatementsToolStripMenuItem.Text = "Заявления";
|
||||
StatementsToolStripMenuItem.Click += StatementsToolStripMenuItem_Click;
|
||||
//
|
||||
// SubmissionsToolStripMenuItem
|
||||
//
|
||||
SubmissionsToolStripMenuItem.Name = "SubmissionsToolStripMenuItem";
|
||||
SubmissionsToolStripMenuItem.Size = new Size(166, 26);
|
||||
SubmissionsToolStripMenuItem.Text = "Сдачи";
|
||||
SubmissionsToolStripMenuItem.Click += SubmissionsToolStripMenuItem_Click;
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(73, 24);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// FormSessionResult
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackgroundImage = Properties.Resources._1;
|
||||
BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ClientSize = new Size(896, 548);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormSessionResult";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Результаты сессии";
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem StudentsToolStripMenuItem;
|
||||
private ToolStripMenuItem DisciplinesToolStripMenuItem;
|
||||
private ToolStripMenuItem TeachersToolStripMenuItem;
|
||||
private ToolStripMenuItem опереToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem StatementsToolStripMenuItem;
|
||||
private ToolStripMenuItem SubmissionsToolStripMenuItem;
|
||||
}
|
||||
}
|
78
ProjectSession/ProjectSession/FormSessionResult.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormSessionResult : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormSessionResult(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
this.StartPosition = FormStartPosition.CenterScreen;
|
||||
}
|
||||
|
||||
private void StudentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormStudent>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisciplinesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDiscipline>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void TeachersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormTeacher>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void StatementsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormStatement>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void SubmissionsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormSubmission>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
ProjectSession/ProjectSession/FormSessionResult.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
128
ProjectSession/ProjectSession/Forms/FormDiscipline.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormDiscipline
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewDisciplines = new DataGridView();
|
||||
buttonAdd = new Button();
|
||||
buttonEdit = new Button();
|
||||
buttonDelete = new Button();
|
||||
panelButtons = new Panel();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewDisciplines).BeginInit();
|
||||
panelButtons.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewDisciplines
|
||||
//
|
||||
dataGridViewDisciplines.AllowUserToAddRows = false;
|
||||
dataGridViewDisciplines.AllowUserToDeleteRows = false;
|
||||
dataGridViewDisciplines.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewDisciplines.Dock = DockStyle.Fill;
|
||||
dataGridViewDisciplines.Location = new Point(0, 0);
|
||||
dataGridViewDisciplines.Margin = new Padding(3, 4, 3, 4);
|
||||
dataGridViewDisciplines.Name = "dataGridViewDisciplines";
|
||||
dataGridViewDisciplines.ReadOnly = true;
|
||||
dataGridViewDisciplines.RowHeadersVisible = false;
|
||||
dataGridViewDisciplines.RowHeadersWidth = 51;
|
||||
dataGridViewDisciplines.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewDisciplines.Size = new Size(732, 533);
|
||||
dataGridViewDisciplines.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.add_icon;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(44, 13);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(100, 100);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.BackgroundImage = Properties.Resources.edit_icon;
|
||||
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonEdit.Location = new Point(44, 229);
|
||||
buttonEdit.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(100, 100);
|
||||
buttonEdit.TabIndex = 2;
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += buttonEdit_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.delete_icon;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(44, 121);
|
||||
buttonDelete.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(100, 100);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// panelButtons
|
||||
//
|
||||
panelButtons.Controls.Add(buttonDelete);
|
||||
panelButtons.Controls.Add(buttonEdit);
|
||||
panelButtons.Controls.Add(buttonAdd);
|
||||
panelButtons.Dock = DockStyle.Right;
|
||||
panelButtons.Location = new Point(732, 0);
|
||||
panelButtons.Margin = new Padding(3, 4, 3, 4);
|
||||
panelButtons.Name = "panelButtons";
|
||||
panelButtons.Size = new Size(182, 533);
|
||||
panelButtons.TabIndex = 4;
|
||||
//
|
||||
// FormDiscipline
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(914, 533);
|
||||
Controls.Add(dataGridViewDisciplines);
|
||||
Controls.Add(panelButtons);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormDiscipline";
|
||||
Text = "Дисциплины";
|
||||
Load += FormDiscipline_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewDisciplines).EndInit();
|
||||
panelButtons.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewDisciplines;
|
||||
private Button buttonAdd;
|
||||
private Button buttonEdit;
|
||||
private Button buttonDelete;
|
||||
private Panel panelButtons;
|
||||
}
|
||||
}
|
109
ProjectSession/ProjectSession/Forms/FormDiscipline.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormDiscipline : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IDisciplineRepository _disciplineRepository;
|
||||
|
||||
public FormDiscipline(IUnityContainer container, IDisciplineRepository disciplineRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_disciplineRepository = disciplineRepository ?? throw new ArgumentNullException(nameof(disciplineRepository));
|
||||
}
|
||||
|
||||
private void FormDiscipline_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadDisciplines();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadDisciplines()
|
||||
{
|
||||
dataGridViewDisciplines.DataSource = _disciplineRepository.ReadDisciplines();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormDisciplineEdit>();
|
||||
form.ShowDialog();
|
||||
LoadDisciplines();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedDisciplineId(out var disciplineId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormDisciplineEdit>();
|
||||
form.DisciplineId = disciplineId;
|
||||
form.ShowDialog();
|
||||
LoadDisciplines();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при редактировании", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedDisciplineId(out var disciplineId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_disciplineRepository.DeleteDiscipline(disciplineId);
|
||||
LoadDisciplines();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetSelectedDisciplineId(out int disciplineId)
|
||||
{
|
||||
disciplineId = 0;
|
||||
|
||||
if (dataGridViewDisciplines.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
disciplineId = Convert.ToInt32(dataGridViewDisciplines.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
95
ProjectSession/ProjectSession/Forms/FormDisciplineEdit.Designer.cs
generated
Normal file
@ -0,0 +1,95 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormDisciplineEdit
|
||||
{
|
||||
/// <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();
|
||||
textBoxName = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(12, 20);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(62, 15);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Название:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(12, 38);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(200, 23);
|
||||
textBoxName.TabIndex = 1;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(12, 70);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 2;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(93, 70);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 3;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormDisciplineEdit
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(224, 105);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormDisciplineEdit";
|
||||
Text = "Редактирование дисциплины";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
70
ProjectSession/ProjectSession/Forms/FormDisciplineEdit.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
using YourNamespace.Entities;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormDisciplineEdit : Form
|
||||
{
|
||||
private readonly IDisciplineRepository _disciplineRepository;
|
||||
private int? _disciplineId;
|
||||
|
||||
public int? DisciplineId
|
||||
{
|
||||
get => _disciplineId;
|
||||
set
|
||||
{
|
||||
_disciplineId = value;
|
||||
if (_disciplineId.HasValue)
|
||||
{
|
||||
var discipline = _disciplineRepository.ReadDisciplineById(_disciplineId.Value);
|
||||
textBoxName.Text = discipline.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormDisciplineEdit(IDisciplineRepository disciplineRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_disciplineRepository = disciplineRepository ?? throw new ArgumentNullException(nameof(disciplineRepository));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
var discipline = Discipline.CreateEntity(
|
||||
_disciplineId ?? 0,
|
||||
textBoxName.Text
|
||||
);
|
||||
|
||||
if (_disciplineId.HasValue)
|
||||
{
|
||||
_disciplineRepository.UpdateDiscipline(discipline);
|
||||
}
|
||||
else
|
||||
{
|
||||
_disciplineRepository.CreateDiscipline(discipline);
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSession/ProjectSession/Forms/FormDisciplineEdit.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
121
ProjectSession/ProjectSession/Forms/FormStatement.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormStatement
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridViewStatements = new DataGridView();
|
||||
buttonAdd = new Button();
|
||||
buttonEdit = new Button();
|
||||
buttonDelete = new Button();
|
||||
panelButtons = new Panel();
|
||||
panelButtons.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewStatements).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewStatements
|
||||
//
|
||||
dataGridViewStatements.AllowUserToAddRows = false;
|
||||
dataGridViewStatements.AllowUserToDeleteRows = false;
|
||||
dataGridViewStatements.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewStatements.Dock = DockStyle.Fill;
|
||||
dataGridViewStatements.Location = new Point(0, 0);
|
||||
dataGridViewStatements.Name = "dataGridViewStatements";
|
||||
dataGridViewStatements.ReadOnly = true;
|
||||
dataGridViewStatements.RowHeadersVisible = false;
|
||||
dataGridViewStatements.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewStatements.Size = new Size(718, 400);
|
||||
dataGridViewStatements.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.add_icon;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(44, 13);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(100, 100);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.BackgroundImage = Properties.Resources.edit_icon;
|
||||
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonEdit.Location = new Point(44, 229);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(100, 100);
|
||||
buttonEdit.TabIndex = 2;
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += buttonEdit_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.delete_icon;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(44, 121);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(100, 100);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// panelButtons
|
||||
//
|
||||
panelButtons.Controls.Add(buttonDelete);
|
||||
panelButtons.Controls.Add(buttonEdit);
|
||||
panelButtons.Controls.Add(buttonAdd);
|
||||
panelButtons.Dock = DockStyle.Right;
|
||||
panelButtons.Location = new Point(718, 0);
|
||||
panelButtons.Name = "panelButtons";
|
||||
panelButtons.Size = new Size(182, 400);
|
||||
panelButtons.TabIndex = 4;
|
||||
//
|
||||
// FormStatement
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(900, 400);
|
||||
Controls.Add(dataGridViewStatements);
|
||||
Controls.Add(panelButtons);
|
||||
Name = "FormStatement";
|
||||
Text = "Заявления";
|
||||
Load += FormStatement_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewStatements).EndInit();
|
||||
panelButtons.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewStatements;
|
||||
private Button buttonAdd;
|
||||
private Button buttonEdit;
|
||||
private Button buttonDelete;
|
||||
private Panel panelButtons;
|
||||
}
|
||||
}
|
109
ProjectSession/ProjectSession/Forms/FormStatement.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormStatement : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IStatementRepository _statementRepository;
|
||||
|
||||
public FormStatement(IUnityContainer container, IStatementRepository statementRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_statementRepository = statementRepository ?? throw new ArgumentNullException(nameof(statementRepository));
|
||||
}
|
||||
|
||||
private void FormStatement_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadStatements();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadStatements()
|
||||
{
|
||||
dataGridViewStatements.DataSource = _statementRepository.ReadStatements();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormStatementEdit>();
|
||||
form.ShowDialog();
|
||||
LoadStatements();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedStatementId(out var statementId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormStatementEdit>();
|
||||
form.StatementId = statementId;
|
||||
form.ShowDialog();
|
||||
LoadStatements();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при редактировании", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedStatementId(out var statementId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_statementRepository.DeleteStatement(statementId);
|
||||
LoadStatements();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetSelectedStatementId(out int statementId)
|
||||
{
|
||||
statementId = 0;
|
||||
|
||||
if (dataGridViewStatements.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
statementId = Convert.ToInt32(dataGridViewStatements.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSession/ProjectSession/Forms/FormStatement.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
191
ProjectSession/ProjectSession/Forms/FormStatementEdit.Designer.cs
generated
Normal file
@ -0,0 +1,191 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormStatementEdit
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelStudentID = new Label();
|
||||
textBoxStudentID = new TextBox();
|
||||
labelTeacherID = new Label();
|
||||
textBoxTeacherID = new TextBox();
|
||||
labelDisciplineID = new Label();
|
||||
textBoxDisciplineID = new TextBox();
|
||||
labelEstimation = new Label();
|
||||
textBoxEstimation = new TextBox();
|
||||
labelDate = new Label();
|
||||
dateTimePickerDate = new DateTimePicker();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelStudentID
|
||||
//
|
||||
labelStudentID.AutoSize = true;
|
||||
labelStudentID.Location = new Point(14, 27);
|
||||
labelStudentID.Name = "labelStudentID";
|
||||
labelStudentID.Size = new Size(65, 20);
|
||||
labelStudentID.TabIndex = 0;
|
||||
labelStudentID.Text = "Студент:";
|
||||
//
|
||||
// textBoxStudentID
|
||||
//
|
||||
textBoxStudentID.Location = new Point(14, 51);
|
||||
textBoxStudentID.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxStudentID.Name = "textBoxStudentID";
|
||||
textBoxStudentID.Size = new Size(228, 27);
|
||||
textBoxStudentID.TabIndex = 1;
|
||||
//
|
||||
// labelTeacherID
|
||||
//
|
||||
labelTeacherID.AutoSize = true;
|
||||
labelTeacherID.Location = new Point(14, 93);
|
||||
labelTeacherID.Name = "labelTeacherID";
|
||||
labelTeacherID.Size = new Size(121, 20);
|
||||
labelTeacherID.TabIndex = 2;
|
||||
labelTeacherID.Text = "Преподователь:";
|
||||
//
|
||||
// textBoxTeacherID
|
||||
//
|
||||
textBoxTeacherID.Location = new Point(14, 117);
|
||||
textBoxTeacherID.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxTeacherID.Name = "textBoxTeacherID";
|
||||
textBoxTeacherID.Size = new Size(228, 27);
|
||||
textBoxTeacherID.TabIndex = 3;
|
||||
//
|
||||
// labelDisciplineID
|
||||
//
|
||||
labelDisciplineID.AutoSize = true;
|
||||
labelDisciplineID.Location = new Point(14, 160);
|
||||
labelDisciplineID.Name = "labelDisciplineID";
|
||||
labelDisciplineID.Size = new Size(73, 20);
|
||||
labelDisciplineID.TabIndex = 4;
|
||||
labelDisciplineID.Text = "Предмет:";
|
||||
//
|
||||
// textBoxDisciplineID
|
||||
//
|
||||
textBoxDisciplineID.Location = new Point(14, 184);
|
||||
textBoxDisciplineID.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxDisciplineID.Name = "textBoxDisciplineID";
|
||||
textBoxDisciplineID.Size = new Size(228, 27);
|
||||
textBoxDisciplineID.TabIndex = 5;
|
||||
//
|
||||
// labelEstimation
|
||||
//
|
||||
labelEstimation.AutoSize = true;
|
||||
labelEstimation.Location = new Point(14, 227);
|
||||
labelEstimation.Name = "labelEstimation";
|
||||
labelEstimation.Size = new Size(64, 20);
|
||||
labelEstimation.TabIndex = 6;
|
||||
labelEstimation.Text = "Оценка:";
|
||||
//
|
||||
// textBoxEstimation
|
||||
//
|
||||
textBoxEstimation.Location = new Point(14, 251);
|
||||
textBoxEstimation.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxEstimation.Name = "textBoxEstimation";
|
||||
textBoxEstimation.Size = new Size(228, 27);
|
||||
textBoxEstimation.TabIndex = 7;
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(14, 293);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(44, 20);
|
||||
labelDate.TabIndex = 8;
|
||||
labelDate.Text = "Дата:";
|
||||
//
|
||||
// dateTimePickerDate
|
||||
//
|
||||
dateTimePickerDate.Location = new Point(14, 317);
|
||||
dateTimePickerDate.Margin = new Padding(3, 4, 3, 4);
|
||||
dateTimePickerDate.Name = "dateTimePickerDate";
|
||||
dateTimePickerDate.Size = new Size(228, 27);
|
||||
dateTimePickerDate.TabIndex = 9;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(14, 360);
|
||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(86, 31);
|
||||
buttonSave.TabIndex = 10;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(106, 360);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(86, 31);
|
||||
buttonCancel.TabIndex = 11;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormStatementEdit
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(256, 407);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(dateTimePickerDate);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(textBoxEstimation);
|
||||
Controls.Add(labelEstimation);
|
||||
Controls.Add(textBoxDisciplineID);
|
||||
Controls.Add(labelDisciplineID);
|
||||
Controls.Add(textBoxTeacherID);
|
||||
Controls.Add(labelTeacherID);
|
||||
Controls.Add(textBoxStudentID);
|
||||
Controls.Add(labelStudentID);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormStatementEdit";
|
||||
Text = "Редактирование заявления";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelStudentID;
|
||||
private TextBox textBoxStudentID;
|
||||
private Label labelTeacherID;
|
||||
private TextBox textBoxTeacherID;
|
||||
private Label labelDisciplineID;
|
||||
private TextBox textBoxDisciplineID;
|
||||
private Label labelEstimation;
|
||||
private TextBox textBoxEstimation;
|
||||
private Label labelDate;
|
||||
private DateTimePicker dateTimePickerDate;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
80
ProjectSession/ProjectSession/Forms/FormStatementEdit.cs
Normal file
@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormStatementEdit : Form
|
||||
{
|
||||
private readonly IStatementRepository _statementRepository;
|
||||
private int? _statementId;
|
||||
|
||||
public int? StatementId
|
||||
{
|
||||
get => _statementId;
|
||||
set
|
||||
{
|
||||
_statementId = value;
|
||||
if (_statementId.HasValue)
|
||||
{
|
||||
var statement = _statementRepository.ReadStatementById(_statementId.Value);
|
||||
textBoxStudentID.Text = statement.StudentID.ToString();
|
||||
textBoxTeacherID.Text = statement.TeacherID.ToString();
|
||||
textBoxDisciplineID.Text = statement.DisciplineID.ToString();
|
||||
textBoxEstimation.Text = statement.Estimation.ToString();
|
||||
dateTimePickerDate.Value = statement.Date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormStatementEdit(IStatementRepository statementRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_statementRepository = statementRepository ?? throw new ArgumentNullException(nameof(statementRepository));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxStudentID.Text) ||
|
||||
string.IsNullOrWhiteSpace(textBoxTeacherID.Text) ||
|
||||
string.IsNullOrWhiteSpace(textBoxDisciplineID.Text) ||
|
||||
string.IsNullOrWhiteSpace(textBoxEstimation.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
var statement = Statement.CreateEntity(
|
||||
_statementId ?? 0,
|
||||
int.Parse(textBoxStudentID.Text),
|
||||
int.Parse(textBoxTeacherID.Text),
|
||||
int.Parse(textBoxDisciplineID.Text),
|
||||
int.Parse(textBoxEstimation.Text),
|
||||
dateTimePickerDate.Value
|
||||
);
|
||||
|
||||
if (_statementId.HasValue)
|
||||
{
|
||||
_statementRepository.UpdateStatement(statement);
|
||||
}
|
||||
else
|
||||
{
|
||||
_statementRepository.CreateStatement(statement);
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSession/ProjectSession/Forms/FormStatementEdit.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
128
ProjectSession/ProjectSession/Forms/FormStudent.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormStudent
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridViewStudents = new DataGridView();
|
||||
buttonAdd = new Button();
|
||||
buttonEdit = new Button();
|
||||
buttonDelete = new Button();
|
||||
panelButtons = new Panel();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewStudents).BeginInit();
|
||||
panelButtons.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewStudents
|
||||
//
|
||||
dataGridViewStudents.AllowUserToAddRows = false;
|
||||
dataGridViewStudents.AllowUserToDeleteRows = false;
|
||||
dataGridViewStudents.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewStudents.Dock = DockStyle.Fill;
|
||||
dataGridViewStudents.Location = new Point(0, 0);
|
||||
dataGridViewStudents.Margin = new Padding(3, 4, 3, 4);
|
||||
dataGridViewStudents.Name = "dataGridViewStudents";
|
||||
dataGridViewStudents.ReadOnly = true;
|
||||
dataGridViewStudents.RowHeadersVisible = false;
|
||||
dataGridViewStudents.RowHeadersWidth = 51;
|
||||
dataGridViewStudents.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewStudents.Size = new Size(732, 533);
|
||||
dataGridViewStudents.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.add_icon;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(44, 13);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(100, 100);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.BackgroundImage = Properties.Resources.edit_icon;
|
||||
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonEdit.Location = new Point(44, 229);
|
||||
buttonEdit.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(100, 100);
|
||||
buttonEdit.TabIndex = 2;
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += buttonEdit_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.delete_icon;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(44, 121);
|
||||
buttonDelete.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(100, 100);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// panelButtons
|
||||
//
|
||||
panelButtons.Controls.Add(buttonDelete);
|
||||
panelButtons.Controls.Add(buttonEdit);
|
||||
panelButtons.Controls.Add(buttonAdd);
|
||||
panelButtons.Dock = DockStyle.Right;
|
||||
panelButtons.Location = new Point(732, 0);
|
||||
panelButtons.Margin = new Padding(3, 4, 3, 4);
|
||||
panelButtons.Name = "panelButtons";
|
||||
panelButtons.Size = new Size(182, 533);
|
||||
panelButtons.TabIndex = 4;
|
||||
//
|
||||
// FormStudent
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(914, 533);
|
||||
Controls.Add(dataGridViewStudents);
|
||||
Controls.Add(panelButtons);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormStudent";
|
||||
Text = "Студенты";
|
||||
Load += FormStudent_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewStudents).EndInit();
|
||||
panelButtons.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewStudents;
|
||||
private Button buttonAdd;
|
||||
private Button buttonEdit;
|
||||
private Button buttonDelete;
|
||||
private Panel panelButtons;
|
||||
}
|
||||
}
|
109
ProjectSession/ProjectSession/Forms/FormStudent.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormStudent : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IStudentRepository _studentRepository;
|
||||
|
||||
public FormStudent(IUnityContainer container, IStudentRepository studentRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_studentRepository = studentRepository ?? throw new ArgumentNullException(nameof(studentRepository));
|
||||
}
|
||||
|
||||
private void FormStudent_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadStudents();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadStudents()
|
||||
{
|
||||
dataGridViewStudents.DataSource = _studentRepository.ReadStudents();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormStudentEdit>();
|
||||
form.ShowDialog();
|
||||
LoadStudents();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedStudentId(out var studentId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormStudentEdit>();
|
||||
form.StudentId = studentId;
|
||||
form.ShowDialog();
|
||||
LoadStudents();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при редактировании", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedStudentId(out var studentId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_studentRepository.DeleteStudent(studentId);
|
||||
LoadStudents();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetSelectedStudentId(out int studentId)
|
||||
{
|
||||
studentId = 0;
|
||||
|
||||
if (dataGridViewStudents.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
studentId = Convert.ToInt32(dataGridViewStudents.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSession/ProjectSession/Forms/FormStudent.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
136
ProjectSession/ProjectSession/Forms/FormStudentEdit.Designer.cs
generated
Normal file
@ -0,0 +1,136 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormStudentEdit
|
||||
{
|
||||
/// <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();
|
||||
textBoxName = new TextBox();
|
||||
labelFamilyStatus = new Label();
|
||||
textBoxFamilyStatus = new TextBox();
|
||||
checkBoxDormitory = new CheckBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(14, 27);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(42, 20);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Имя:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(14, 51);
|
||||
textBoxName.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(228, 27);
|
||||
textBoxName.TabIndex = 1;
|
||||
//
|
||||
// labelFamilyStatus
|
||||
//
|
||||
labelFamilyStatus.AutoSize = true;
|
||||
labelFamilyStatus.Location = new Point(14, 93);
|
||||
labelFamilyStatus.Name = "labelFamilyStatus";
|
||||
labelFamilyStatus.Size = new Size(131, 20);
|
||||
labelFamilyStatus.TabIndex = 2;
|
||||
labelFamilyStatus.Text = "Семейный статус:";
|
||||
//
|
||||
// textBoxFamilyStatus
|
||||
//
|
||||
textBoxFamilyStatus.Location = new Point(14, 117);
|
||||
textBoxFamilyStatus.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxFamilyStatus.Name = "textBoxFamilyStatus";
|
||||
textBoxFamilyStatus.Size = new Size(228, 27);
|
||||
textBoxFamilyStatus.TabIndex = 3;
|
||||
//
|
||||
// checkBoxDormitory
|
||||
//
|
||||
checkBoxDormitory.AutoSize = true;
|
||||
checkBoxDormitory.Location = new Point(14, 160);
|
||||
checkBoxDormitory.Margin = new Padding(3, 4, 3, 4);
|
||||
checkBoxDormitory.Name = "checkBoxDormitory";
|
||||
checkBoxDormitory.Size = new Size(208, 24);
|
||||
checkBoxDormitory.TabIndex = 4;
|
||||
checkBoxDormitory.Text = "Проживает в общежитии";
|
||||
checkBoxDormitory.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(14, 200);
|
||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(86, 31);
|
||||
buttonSave.TabIndex = 5;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(106, 200);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(86, 31);
|
||||
buttonCancel.TabIndex = 6;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormStudentEdit
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(256, 247);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(checkBoxDormitory);
|
||||
Controls.Add(textBoxFamilyStatus);
|
||||
Controls.Add(labelFamilyStatus);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelName);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormStudentEdit";
|
||||
Text = "Редактирование студента";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private Label labelFamilyStatus;
|
||||
private TextBox textBoxFamilyStatus;
|
||||
private CheckBox checkBoxDormitory;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
74
ProjectSession/ProjectSession/Forms/FormStudentEdit.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormStudentEdit : Form
|
||||
{
|
||||
private readonly IStudentRepository _studentRepository;
|
||||
private int? _studentId;
|
||||
|
||||
public int? StudentId
|
||||
{
|
||||
get => _studentId;
|
||||
set
|
||||
{
|
||||
_studentId = value;
|
||||
if (_studentId.HasValue)
|
||||
{
|
||||
var student = _studentRepository.ReadStudentById(_studentId.Value);
|
||||
textBoxName.Text = student.Name;
|
||||
textBoxFamilyStatus.Text = student.FamilyStatus;
|
||||
checkBoxDormitory.Checked = student.Dormitory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormStudentEdit(IStudentRepository studentRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_studentRepository = studentRepository ?? throw new ArgumentNullException(nameof(studentRepository));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) || string.IsNullOrWhiteSpace(textBoxFamilyStatus.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
var student = Student.CreateEntity(
|
||||
_studentId ?? 0,
|
||||
textBoxName.Text,
|
||||
textBoxFamilyStatus.Text,
|
||||
checkBoxDormitory.Checked,
|
||||
Entities.Enums.StudentStatus.Active
|
||||
);
|
||||
|
||||
if (_studentId.HasValue)
|
||||
{
|
||||
_studentRepository.UpdateStudent(student);
|
||||
}
|
||||
else
|
||||
{
|
||||
_studentRepository.CreateStudent(student);
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSession/ProjectSession/Forms/FormStudentEdit.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
128
ProjectSession/ProjectSession/Forms/FormSubmission.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormSubmission
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewSubmissions = new DataGridView();
|
||||
buttonAdd = new Button();
|
||||
buttonEdit = new Button();
|
||||
buttonDelete = new Button();
|
||||
panelButtons = new Panel();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewSubmissions).BeginInit();
|
||||
panelButtons.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewSubmissions
|
||||
//
|
||||
dataGridViewSubmissions.AllowUserToAddRows = false;
|
||||
dataGridViewSubmissions.AllowUserToDeleteRows = false;
|
||||
dataGridViewSubmissions.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewSubmissions.Dock = DockStyle.Fill;
|
||||
dataGridViewSubmissions.Location = new Point(0, 0);
|
||||
dataGridViewSubmissions.Margin = new Padding(3, 4, 3, 4);
|
||||
dataGridViewSubmissions.Name = "dataGridViewSubmissions";
|
||||
dataGridViewSubmissions.ReadOnly = true;
|
||||
dataGridViewSubmissions.RowHeadersVisible = false;
|
||||
dataGridViewSubmissions.RowHeadersWidth = 51;
|
||||
dataGridViewSubmissions.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewSubmissions.Size = new Size(732, 533);
|
||||
dataGridViewSubmissions.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.add_icon;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(44, 13);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(100, 100);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.BackgroundImage = Properties.Resources.edit_icon;
|
||||
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonEdit.Location = new Point(44, 229);
|
||||
buttonEdit.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(100, 100);
|
||||
buttonEdit.TabIndex = 2;
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += buttonEdit_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.delete_icon;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(44, 121);
|
||||
buttonDelete.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(100, 100);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// panelButtons
|
||||
//
|
||||
panelButtons.Controls.Add(buttonDelete);
|
||||
panelButtons.Controls.Add(buttonEdit);
|
||||
panelButtons.Controls.Add(buttonAdd);
|
||||
panelButtons.Dock = DockStyle.Right;
|
||||
panelButtons.Location = new Point(732, 0);
|
||||
panelButtons.Margin = new Padding(3, 4, 3, 4);
|
||||
panelButtons.Name = "panelButtons";
|
||||
panelButtons.Size = new Size(182, 533);
|
||||
panelButtons.TabIndex = 4;
|
||||
//
|
||||
// FormSubmission
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(914, 533);
|
||||
Controls.Add(dataGridViewSubmissions);
|
||||
Controls.Add(panelButtons);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormSubmission";
|
||||
Text = "Подачи";
|
||||
Load += FormSubmission_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewSubmissions).EndInit();
|
||||
panelButtons.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewSubmissions;
|
||||
private Button buttonAdd;
|
||||
private Button buttonEdit;
|
||||
private Button buttonDelete;
|
||||
private Panel panelButtons;
|
||||
}
|
||||
}
|
109
ProjectSession/ProjectSession/Forms/FormSubmission.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormSubmission : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly ISubmissionRepository _submissionRepository;
|
||||
|
||||
public FormSubmission(IUnityContainer container, ISubmissionRepository submissionRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_submissionRepository = submissionRepository ?? throw new ArgumentNullException(nameof(submissionRepository));
|
||||
}
|
||||
|
||||
private void FormSubmission_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadSubmissions();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadSubmissions()
|
||||
{
|
||||
dataGridViewSubmissions.DataSource = _submissionRepository.ReadSubmissions();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormSubmissionEdit>();
|
||||
form.ShowDialog();
|
||||
LoadSubmissions();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedSubmissionId(out var submissionId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormSubmissionEdit>();
|
||||
form.SubmissionId = submissionId;
|
||||
form.ShowDialog();
|
||||
LoadSubmissions();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при редактировании", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedSubmissionId(out var submissionId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_submissionRepository.DeleteSubmission(submissionId);
|
||||
LoadSubmissions();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetSelectedSubmissionId(out int submissionId)
|
||||
{
|
||||
submissionId = 0;
|
||||
|
||||
if (dataGridViewSubmissions.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
submissionId = Convert.ToInt32(dataGridViewSubmissions.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSession/ProjectSession/Forms/FormSubmission.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
123
ProjectSession/ProjectSession/Forms/FormSubmissionEdit.Designer.cs
generated
Normal file
@ -0,0 +1,123 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormSubmissionEdit
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelDisciplineID = new Label();
|
||||
textBoxDisciplineID = new TextBox();
|
||||
labelDate = new Label();
|
||||
dateTimePickerDate = new DateTimePicker();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelDisciplineID
|
||||
//
|
||||
labelDisciplineID.AutoSize = true;
|
||||
labelDisciplineID.Location = new Point(14, 27);
|
||||
labelDisciplineID.Name = "labelDisciplineID";
|
||||
labelDisciplineID.Size = new Size(73, 20);
|
||||
labelDisciplineID.TabIndex = 0;
|
||||
labelDisciplineID.Text = "Предмет:";
|
||||
labelDisciplineID.Click += labelDisciplineID_Click;
|
||||
//
|
||||
// textBoxDisciplineID
|
||||
//
|
||||
textBoxDisciplineID.Location = new Point(14, 51);
|
||||
textBoxDisciplineID.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxDisciplineID.Name = "textBoxDisciplineID";
|
||||
textBoxDisciplineID.Size = new Size(228, 27);
|
||||
textBoxDisciplineID.TabIndex = 1;
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(14, 93);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(44, 20);
|
||||
labelDate.TabIndex = 2;
|
||||
labelDate.Text = "Дата:";
|
||||
//
|
||||
// dateTimePickerDate
|
||||
//
|
||||
dateTimePickerDate.Location = new Point(14, 117);
|
||||
dateTimePickerDate.Margin = new Padding(3, 4, 3, 4);
|
||||
dateTimePickerDate.Name = "dateTimePickerDate";
|
||||
dateTimePickerDate.Size = new Size(228, 27);
|
||||
dateTimePickerDate.TabIndex = 3;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(14, 160);
|
||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(86, 31);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(106, 160);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(86, 31);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormSubmissionEdit
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(256, 207);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(dateTimePickerDate);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(textBoxDisciplineID);
|
||||
Controls.Add(labelDisciplineID);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormSubmissionEdit";
|
||||
Text = "Редактирование сдачи";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelDisciplineID;
|
||||
private TextBox textBoxDisciplineID;
|
||||
private Label labelDate;
|
||||
private DateTimePicker dateTimePickerDate;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
77
ProjectSession/ProjectSession/Forms/FormSubmissionEdit.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
using static ProjectSession.Entities.Sumbission;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormSubmissionEdit : Form
|
||||
{
|
||||
private readonly ISubmissionRepository _submissionRepository;
|
||||
private int? _submissionId;
|
||||
|
||||
public int? SubmissionId
|
||||
{
|
||||
get => _submissionId;
|
||||
set
|
||||
{
|
||||
_submissionId = value;
|
||||
if (_submissionId.HasValue)
|
||||
{
|
||||
var submission = _submissionRepository.ReadSubmissionById(_submissionId.Value);
|
||||
textBoxDisciplineID.Text = submission.DisciplineID.ToString();
|
||||
dateTimePickerDate.Value = submission.Date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormSubmissionEdit(ISubmissionRepository submissionRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_submissionRepository = submissionRepository ?? throw new ArgumentNullException(nameof(submissionRepository));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxDisciplineID.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
var submission = Submission.CreateEntity(
|
||||
_submissionId ?? 0,
|
||||
int.Parse(textBoxDisciplineID.Text),
|
||||
dateTimePickerDate.Value
|
||||
);
|
||||
|
||||
if (_submissionId.HasValue)
|
||||
{
|
||||
_submissionRepository.UpdateSubmission(submission);
|
||||
}
|
||||
else
|
||||
{
|
||||
_submissionRepository.CreateSubmission(submission);
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void labelDisciplineID_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSession/ProjectSession/Forms/FormSubmissionEdit.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
128
ProjectSession/ProjectSession/Forms/FormTeacher.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormTeacher
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewTeachers = new DataGridView();
|
||||
buttonAdd = new Button();
|
||||
buttonEdit = new Button();
|
||||
buttonDelete = new Button();
|
||||
panelButtons = new Panel();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewTeachers).BeginInit();
|
||||
panelButtons.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewTeachers
|
||||
//
|
||||
dataGridViewTeachers.AllowUserToAddRows = false;
|
||||
dataGridViewTeachers.AllowUserToDeleteRows = false;
|
||||
dataGridViewTeachers.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewTeachers.Dock = DockStyle.Fill;
|
||||
dataGridViewTeachers.Location = new Point(0, 0);
|
||||
dataGridViewTeachers.Margin = new Padding(3, 4, 3, 4);
|
||||
dataGridViewTeachers.Name = "dataGridViewTeachers";
|
||||
dataGridViewTeachers.ReadOnly = true;
|
||||
dataGridViewTeachers.RowHeadersVisible = false;
|
||||
dataGridViewTeachers.RowHeadersWidth = 51;
|
||||
dataGridViewTeachers.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewTeachers.Size = new Size(732, 533);
|
||||
dataGridViewTeachers.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.add_icon;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(44, 13);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(100, 100);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.BackgroundImage = Properties.Resources.edit_icon;
|
||||
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonEdit.Location = new Point(44, 229);
|
||||
buttonEdit.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(100, 100);
|
||||
buttonEdit.TabIndex = 2;
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += buttonEdit_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.delete_icon;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(44, 121);
|
||||
buttonDelete.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(100, 100);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// panelButtons
|
||||
//
|
||||
panelButtons.Controls.Add(buttonDelete);
|
||||
panelButtons.Controls.Add(buttonEdit);
|
||||
panelButtons.Controls.Add(buttonAdd);
|
||||
panelButtons.Dock = DockStyle.Right;
|
||||
panelButtons.Location = new Point(732, 0);
|
||||
panelButtons.Margin = new Padding(3, 4, 3, 4);
|
||||
panelButtons.Name = "panelButtons";
|
||||
panelButtons.Size = new Size(182, 533);
|
||||
panelButtons.TabIndex = 4;
|
||||
//
|
||||
// FormTeacher
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(914, 533);
|
||||
Controls.Add(dataGridViewTeachers);
|
||||
Controls.Add(panelButtons);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormTeacher";
|
||||
Text = "Преподаватели";
|
||||
Load += FormTeacher_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewTeachers).EndInit();
|
||||
panelButtons.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewTeachers;
|
||||
private Button buttonAdd;
|
||||
private Button buttonEdit;
|
||||
private Button buttonDelete;
|
||||
private Panel panelButtons;
|
||||
}
|
||||
}
|
109
ProjectSession/ProjectSession/Forms/FormTeacher.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormTeacher : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly ITeacherRepository _teacherRepository;
|
||||
|
||||
public FormTeacher(IUnityContainer container, ITeacherRepository teacherRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_teacherRepository = teacherRepository ?? throw new ArgumentNullException(nameof(teacherRepository));
|
||||
}
|
||||
|
||||
private void FormTeacher_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadTeachers();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadTeachers()
|
||||
{
|
||||
dataGridViewTeachers.DataSource = _teacherRepository.ReadTeachers();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormTeacherEdit>();
|
||||
form.ShowDialog();
|
||||
LoadTeachers();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedTeacherId(out var teacherId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormTeacherEdit>();
|
||||
form.TeacherId = teacherId;
|
||||
form.ShowDialog();
|
||||
LoadTeachers();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при редактировании", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetSelectedTeacherId(out var teacherId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_teacherRepository.DeleteTeacher(teacherId);
|
||||
LoadTeachers();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetSelectedTeacherId(out int teacherId)
|
||||
{
|
||||
teacherId = 0;
|
||||
|
||||
if (dataGridViewTeachers.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
teacherId = Convert.ToInt32(dataGridViewTeachers.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSession/ProjectSession/Forms/FormTeacher.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
95
ProjectSession/ProjectSession/Forms/FormTeacherEdit.Designer.cs
generated
Normal file
@ -0,0 +1,95 @@
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
partial class FormTeacherEdit
|
||||
{
|
||||
/// <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();
|
||||
textBoxName = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(12, 20);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(37, 15);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Имя:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(12, 38);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(200, 23);
|
||||
textBoxName.TabIndex = 1;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(12, 70);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 2;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(93, 70);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 3;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormTeacherEdit
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(224, 105);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormTeacherEdit";
|
||||
Text = "Редактирование преподавателя";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
69
ProjectSession/ProjectSession/Forms/FormTeacherEdit.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using ProjectSession.Entities;
|
||||
using ProjectSession.Repositories;
|
||||
|
||||
namespace ProjectSession.Forms
|
||||
{
|
||||
public partial class FormTeacherEdit : Form
|
||||
{
|
||||
private readonly ITeacherRepository _teacherRepository;
|
||||
private int? _teacherId;
|
||||
|
||||
public int? TeacherId
|
||||
{
|
||||
get => _teacherId;
|
||||
set
|
||||
{
|
||||
_teacherId = value;
|
||||
if (_teacherId.HasValue)
|
||||
{
|
||||
var teacher = _teacherRepository.ReadTeacherById(_teacherId.Value);
|
||||
textBoxName.Text = teacher.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormTeacherEdit(ITeacherRepository teacherRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_teacherRepository = teacherRepository ?? throw new ArgumentNullException(nameof(teacherRepository));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
var teacher = Teacher.CreateEntity(
|
||||
_teacherId ?? 0,
|
||||
textBoxName.Text
|
||||
);
|
||||
|
||||
if (_teacherId.HasValue)
|
||||
{
|
||||
_teacherRepository.UpdateTeacher(teacher);
|
||||
}
|
||||
else
|
||||
{
|
||||
_teacherRepository.CreateTeacher(teacher);
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSession/ProjectSession/Forms/FormTeacherEdit.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,17 +1,36 @@
|
||||
using ProjectSession.Repositories.Implementations;
|
||||
using ProjectSession.Repositories;
|
||||
using Unity.Lifetime;
|
||||
using Unity;
|
||||
using ProjectSession.Forms;
|
||||
|
||||
namespace ProjectSession
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// 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());
|
||||
Application.Run(CreateContainer().Resolve<FormSessionResult>());
|
||||
}
|
||||
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
|
||||
// Ðåãèñòðàöèÿ ðåïîçèòîðèåâ
|
||||
container.RegisterType<IStudentRepository, StudentRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IDisciplineRepository, DisciplineRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<ITeacherRepository, TeacherRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IStatementRepository, StatementRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<ISubmissionRepository, SubmissionRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IStudent_StatementRepository, Student_StatementRepository>(new TransientLifetimeManager());
|
||||
|
||||
return container;
|
||||
}
|
||||
}
|
||||
}
|
@ -8,4 +8,23 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
103
ProjectSession/ProjectSession/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjectSession.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()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectSession.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap _1 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("1", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap add_icon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("add_icon", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap delete_icon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("delete_icon", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap edit_icon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("edit_icon", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
ProjectSession/ProjectSession/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="delete_icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\delete_icon.jpeg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="add_icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\add_icon.jpeg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="edit_icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\edit_icon.jpeg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
@ -4,14 +4,15 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YourNamespace.Entities;
|
||||
|
||||
namespace ProjectSession.Repositories;
|
||||
|
||||
public interface IDisciplineRepository
|
||||
{
|
||||
IEnumerable<Discipline> ReadDiscipline();
|
||||
Discipline ReadDisciplineID(int id);
|
||||
void CreateDiscipline(Discipline teacher);
|
||||
void UpdateDiscipline(Discipline teacher);
|
||||
IEnumerable<Discipline> ReadDisciplines();
|
||||
Discipline ReadDisciplineById(int id);
|
||||
void CreateDiscipline(Discipline discipline);
|
||||
void UpdateDiscipline(Discipline discipline);
|
||||
void DeleteDiscipline(int id);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ProjectSession.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,7 +7,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Repositories;
|
||||
|
||||
public interface IStatamentRepository
|
||||
public interface IStatementRepository
|
||||
{
|
||||
IEnumerable<Statament> ReadStataments(DateTime? dateForm = null, DateTime? dateTo = null, int? teacherID = null, int? discoplineID, int? )
|
||||
IEnumerable<Statement> ReadStatements();
|
||||
Statement ReadStatementById(int id);
|
||||
void CreateStatement(Statement statement);
|
||||
void UpdateStatement(Statement statement);
|
||||
void DeleteStatement(int id);
|
||||
}
|
||||
|
@ -9,11 +9,9 @@ namespace ProjectSession.Repositories;
|
||||
|
||||
public interface IStudentRepository
|
||||
{
|
||||
IEnumerable<Student> ReadStudent();
|
||||
|
||||
Student ReadStudentID(int id);
|
||||
|
||||
IEnumerable<Student> ReadStudents();
|
||||
Student ReadStudentById(int id);
|
||||
void CreateStudent(Student student);
|
||||
void UpdateStudent(Student student);
|
||||
void DeleteStident(int id);
|
||||
}
|
||||
void DeleteStudent(int id);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using ProjectSession.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Repositories;
|
||||
|
||||
public interface IStudent_StatementRepository
|
||||
{
|
||||
IEnumerable<Student_Statement> ReadStudent_Statements();
|
||||
Student_Statement ReadStudent_StatementById(int id);
|
||||
void CreateStudent_Statement(Student_Statement student_Statement);
|
||||
void UpdateStudent_Statement(Student_Statement student_Statement);
|
||||
void DeleteStudent_Statement(int id);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static ProjectSession.Entities.Sumbission;
|
||||
|
||||
namespace ProjectSession.Repositories;
|
||||
|
||||
public interface ISubmissionRepository
|
||||
{
|
||||
IEnumerable<Submission> ReadSubmissions();
|
||||
Submission ReadSubmissionById(int id);
|
||||
void CreateSubmission(Submission submission);
|
||||
void UpdateSubmission(Submission submission);
|
||||
void DeleteSubmission(int id);
|
||||
}
|
@ -9,8 +9,8 @@ namespace ProjectSession.Repositories;
|
||||
|
||||
public interface ITeacherRepository
|
||||
{
|
||||
IEnumerable<Teacher> ReadTeacher();
|
||||
Teacher ReadTeacherID(int id);
|
||||
IEnumerable<Teacher> ReadTeachers();
|
||||
Teacher ReadTeacherById(int id);
|
||||
void CreateTeacher(Teacher teacher);
|
||||
void UpdateTeacher(Teacher teacher);
|
||||
void DeleteTeacher(int id);
|
||||
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YourNamespace.Entities;
|
||||
|
||||
namespace ProjectSession.Repositories.Implementations;
|
||||
|
||||
public class DisciplineRepository : IDisciplineRepository
|
||||
{
|
||||
public void CreateDiscipline(Discipline discipline) { }
|
||||
public void DeleteDiscipline(int id) { }
|
||||
public Discipline ReadDisciplineById(int id) { return Discipline.CreateEntity(0, string.Empty); }
|
||||
public IEnumerable<Discipline> ReadDisciplines() { return new List<Discipline>(); }
|
||||
public void UpdateDiscipline(Discipline discipline) { }
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using ProjectSession.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Repositories.Implementations;
|
||||
|
||||
public class StatementRepository : IStatementRepository
|
||||
{
|
||||
public void CreateStatement(Statement statement) { }
|
||||
public void DeleteStatement(int id) { }
|
||||
public Statement ReadStatementById(int id) { return Statement.CreateEntity(0, 0, 0, 0, 0, DateTime.Now); }
|
||||
public IEnumerable<Statement> ReadStatements() { return new List<Statement>(); }
|
||||
public void UpdateStatement(Statement statement) { }
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using ProjectSession.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Repositories.Implementations;
|
||||
|
||||
public class StudentRepository : IStudentRepository
|
||||
{
|
||||
public void CreateStudent(Student student) { }
|
||||
public void DeleteStudent(int id) { }
|
||||
public Student ReadStudentById(int id) { return Student.CreateEntity(0, string.Empty, string.Empty, false, Entities.Enums.StudentStatus.Active); }
|
||||
public IEnumerable<Student> ReadStudents() { return new List<Student>(); }
|
||||
public void UpdateStudent(Student student) { }
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using ProjectSession.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Repositories.Implementations;
|
||||
|
||||
public class Student_StatementRepository : IStudent_StatementRepository
|
||||
{
|
||||
public void CreateStudent_Statement(Student_Statement student_Statement) { }
|
||||
public void DeleteStudent_Statement(int id) { }
|
||||
public Student_Statement ReadStudent_StatementById(int id) { return Student_Statement.CreateEntity(0, 0, 0); }
|
||||
public IEnumerable<Student_Statement> ReadStudent_Statements() { return new List<Student_Statement>(); }
|
||||
public void UpdateStudent_Statement(Student_Statement student_Statement) { }
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static ProjectSession.Entities.Sumbission;
|
||||
|
||||
namespace ProjectSession.Repositories.Implementations;
|
||||
|
||||
public class SubmissionRepository : ISubmissionRepository
|
||||
{
|
||||
public void CreateSubmission(Submission submission) { }
|
||||
public void DeleteSubmission(int id) { }
|
||||
public Submission ReadSubmissionById(int id) { return Submission.CreateEntity(0, 0, DateTime.Now); }
|
||||
public IEnumerable<Submission> ReadSubmissions() { return new List<Submission>(); }
|
||||
public void UpdateSubmission(Submission submission) { }
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using ProjectSession.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectSession.Repositories.Implementations;
|
||||
|
||||
public class TeacherRepository : ITeacherRepository
|
||||
{
|
||||
public void CreateTeacher(Teacher teacher) { }
|
||||
public void DeleteTeacher(int id) { }
|
||||
public Teacher ReadTeacherById(int id) { return Teacher.CreateEntity(0, string.Empty); }
|
||||
public IEnumerable<Teacher> ReadTeachers() { return new List<Teacher>(); }
|
||||
public void UpdateTeacher(Teacher teacher) { }
|
||||
}
|
BIN
ProjectSession/ProjectSession/Resources/1.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
ProjectSession/ProjectSession/Resources/add_icon.jpeg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
ProjectSession/ProjectSession/Resources/delete_icon.jpeg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
ProjectSession/ProjectSession/Resources/edit_icon.jpeg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
Картинки/-.webp
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
Картинки/1.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
Картинки/add_icon.jpeg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
Картинки/delete_icon.jpeg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
Картинки/edit_icon.jpeg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
Картинки/i.webp
Normal file
After Width: | Height: | Size: 7.8 KiB |