Compare commits

...

1 Commits
main ... Laba1

Author SHA1 Message Date
bfe732607e половина работы 2024-11-20 05:12:10 +04:00
36 changed files with 1687 additions and 33 deletions

View File

@ -8,4 +8,23 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Entities.Enums
{
[Flags]
public enum Group
{
None = 0,
First = 1,
Second = 2,
Third = 4,
Fourth = 8
}
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,31 @@
using Academic_Performance.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Entities
{
public class Mark
{
public int Id { get; private set; }
public int StudentId { get; private set; }
public int StatmentTeacherId { get; private set; }
public int StatmentSubjectId { get; private set; }
public Value? Value { get; private set; }
public DateTime Date { get; private set; }
public static Mark CreateOperation(int id, int studentId, int statmentSubjectId, int statmentTeacherId, Value value)
{
return new Mark
{
Id = id,
StudentId = studentId,
StatmentSubjectId = statmentSubjectId,
StatmentTeacherId = statmentTeacherId,
Value = value,
};
}
}
}

View File

@ -0,0 +1,32 @@
using Academic_Performance.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Entities
{
public class Order
{
public int Id { get; private set; }
public int StudentId { get; private set; }
public string Information { get; private set; }
public TypeS? TypeS { get; private set; }
public DateTime Date { get; private set; }
public static Order CreateOperation(int id, int studentId, string information,TypeS types)
{
return new Order
{
Id = id,
StudentId = studentId,
Information = information,
TypeS = types,
Date = DateTime.Now
};
}
}
}

View File

@ -0,0 +1,30 @@
using Academic_Performance.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Entities
{
public class Statement
{
public int Id { get; private set; }
public int SubjecttId { get; private set; }
public int TeacherId{ get; private set; }
public DateTime Date { get; private set; }
public static Statement CreateOperation(int id, int subjecttId, int teacherId)
{
return new Statement
{
Id = id,
SubjecttId = subjecttId,
TeacherId = teacherId ,
Date = DateTime.Now
};
}
}
}

View File

@ -0,0 +1,29 @@
using Academic_Performance.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Entities
{
public class Student
{
public int Id{ get; private set; }
public Group? Group { get; private set; }
public string Name { get; private set; } = string.Empty;
public string Flow { get; private set; } = string.Empty;
public static Student CreateEntity(int id, string name,string flow, Group group)
{
return new Student
{
Id = id,
Name = name,
Flow=flow,
Group = group,
};
}
}
}

View File

@ -0,0 +1,22 @@
using Microsoft.VisualBasic.Devices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Entities;
public class Subject
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public static Subject Create(int id, string name)
{
return new Subject
{
Id = id,
Name = name
};
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Entities;
public class Teacher
{
public int Id { get; private set; }
public string Name{ get; private set; } = string.Empty;
public static Teacher CreateEntity(int id, string name)
{
return new Teacher
{
Id = id,
Name = name,
};
}
}

View File

@ -28,12 +28,115 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); menuStrip = new MenuStrip();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; cToolStripMenuItem = new ToolStripMenuItem();
this.ClientSize = new System.Drawing.Size(800, 450); studentToolStripMenuItem = new ToolStripMenuItem();
this.Text = "Form1"; препToolStripMenuItem = new ToolStripMenuItem();
предметыToolStripMenuItem = new ToolStripMenuItem();
оценкиToolStripMenuItem = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem();
добавлениеToolStripMenuItem = new ToolStripMenuItem();
ведомостьToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
menuStrip.SuspendLayout();
SuspendLayout();
//
// menuStrip
//
menuStrip.ImageScalingSize = new Size(24, 24);
menuStrip.Items.AddRange(new ToolStripItem[] { cToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(778, 33);
menuStrip.TabIndex = 0;
menuStrip.Text = "menuStrip1";
//
// cToolStripMenuItem
//
cToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { studentToolStripMenuItem, препToolStripMenuItem, предметыToolStripMenuItem, оценкиToolStripMenuItem });
cToolStripMenuItem.Name = "cToolStripMenuItem";
cToolStripMenuItem.Size = new Size(139, 29);
cToolStripMenuItem.Text = "Справочники";
//
// studentToolStripMenuItem
//
studentToolStripMenuItem.Name = "studentToolStripMenuItem";
studentToolStripMenuItem.Size = new Size(270, 34);
studentToolStripMenuItem.Text = "Студенты";
studentToolStripMenuItem.Click += studentToolStripMenuItem_Click;
//
// препToolStripMenuItem
//
препToolStripMenuItem.Name = "препToolStripMenuItem";
препToolStripMenuItem.Size = new Size(270, 34);
препToolStripMenuItem.Text = "Преподаватели";
//
// предметыToolStripMenuItem
//
предметыToolStripMenuItem.Name = "предметыToolStripMenuItem";
предметыToolStripMenuItem.Size = new Size(270, 34);
предметыToolStripMenuItem.Text = "Предметы";
//
// оценкиToolStripMenuItem
//
оценкиToolStripMenuItem.Name = "оценкиToolStripMenuItem";
оценкиToolStripMenuItem.Size = new Size(270, 34);
оценкиToolStripMenuItem.Text = "Оценки";
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { добавлениеToolStripMenuItem, ведомостьToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(112, 29);
операцииToolStripMenuItem.Text = "Операции";
//
// добавлениеToolStripMenuItem
//
добавлениеToolStripMenuItem.Name = обавлениеToolStripMenuItem";
добавлениеToolStripMenuItem.Size = new Size(202, 34);
добавлениеToolStripMenuItem.Text = "Приказ";
//
// ведомостьToolStripMenuItem
//
ведомостьToolStripMenuItem.Name = едомостьToolStripMenuItem";
ведомостьToolStripMenuItem.Size = new Size(202, 34);
ведомостьToolStripMenuItem.Text = "Ведомость";
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(88, 29);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// Form1
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.unnamed;
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(778, 450);
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
Name = "Form1";
StartPosition = FormStartPosition.CenterScreen;
Text = "Form1";
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion
private MenuStrip menuStrip;
private ToolStripMenuItem cToolStripMenuItem;
private ToolStripMenuItem studentToolStripMenuItem;
private ToolStripMenuItem препToolStripMenuItem;
private ToolStripMenuItem предметыToolStripMenuItem;
private ToolStripMenuItem операцииToolStripMenuItem;
private ToolStripMenuItem добавлениеToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem;
private ToolStripMenuItem оценкиToolStripMenuItem;
private ToolStripMenuItem ведомостьToolStripMenuItem;
} }
} }

View File

@ -1,10 +1,33 @@
using Academic_Performance.Forms;
using Unity;
namespace Academic_Performance namespace Academic_Performance
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
public Form1() private readonly IUnityContainer _container;
public Form1(IUnityContainer container)
{ {
InitializeComponent(); InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void ñòóäåíòûToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void studentToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormStudents>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} }
} }
} }

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View File

@ -0,0 +1,142 @@
namespace Academic_Performance.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()
{
label = new Label();
label2 = new Label();
label3 = new Label();
textBoxName = new TextBox();
button1 = new Button();
button2 = new Button();
textBoxFlow = new TextBox();
comboBox1 = new ComboBox();
SuspendLayout();
//
// label
//
label.AutoSize = true;
label.Location = new Point(39, 31);
label.Name = "label";
label.Size = new Size(126, 25);
label.TabIndex = 0;
label.Text = "ФИО студента";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(46, 126);
label2.Name = "label2";
label2.Size = new Size(69, 25);
label2.TabIndex = 1;
label2.Text = "Группа";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(43, 208);
label3.Name = "label3";
label3.Size = new Size(63, 25);
label3.TabIndex = 2;
label3.Text = "Поток";
//
// textBoxName
//
textBoxName.Location = new Point(171, 27);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(385, 31);
textBoxName.TabIndex = 3;
textBoxName.TextChanged += textBox1_TextChanged;
//
// button1
//
button1.Location = new Point(68, 316);
button1.Name = "button1";
button1.Size = new Size(112, 34);
button1.TabIndex = 6;
button1.Text = "Сохранить";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// button2
//
button2.Location = new Point(291, 316);
button2.Name = "button2";
button2.Size = new Size(112, 34);
button2.TabIndex = 7;
button2.Text = "Отмена";
button2.UseVisualStyleBackColor = true;
//
// textBoxFlow
//
textBoxFlow.Location = new Point(171, 126);
textBoxFlow.Name = "textBoxFlow";
textBoxFlow.Size = new Size(397, 31);
textBoxFlow.TabIndex = 8;
//
// comboBox1
//
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox1.FormattingEnabled = true;
comboBox1.Location = new Point(171, 245);
comboBox1.Name = "comboBox1";
comboBox1.Size = new Size(182, 33);
comboBox1.TabIndex = 9;
//
// FormStudent
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(602, 388);
Controls.Add(comboBox1);
Controls.Add(textBoxFlow);
Controls.Add(button2);
Controls.Add(button1);
Controls.Add(textBoxName);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label);
Name = "FormStudent";
StartPosition = FormStartPosition.CenterScreen;
Text = "Студент";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label label;
private Label label2;
private Label label3;
private TextBox textBoxName;
private Button button1;
private Button button2;
private TextBox textBoxFlow;
private ComboBox comboBox1;
}
}

View File

@ -0,0 +1,94 @@
using Academic_Performance.Repositories;
using Academic_Performance.Entities;
using Academic_Performance.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Academic_Performance.Entities.Enums;
namespace Academic_Performance.Forms
{
public partial class FormStudent : Form
{
private readonly IStudentRepository _studentRepository;
private int? _studentId;
public int Id
{
set
{
try
{
var student = _studentRepository.GetStudentById(value);
if (student == null)
{
throw new InvalidDataException(nameof(student));
}
textBoxName.Text = student.Name;
textBoxFlow.Text = student.Flow;
comboBox1.SelectedItem =student.Group;
_studentId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormStudent(IStudentRepository studentRepository)
{
InitializeComponent();
_studentRepository = studentRepository ??
throw new ArgumentNullException(nameof(studentRepository));
comboBox1.DataSource =Enum.GetValues(typeof(Group));
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxName.Text)|| string.IsNullOrWhiteSpace(textBoxFlow.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_studentId.HasValue)
{
_studentRepository.UpdateStudent(CreateStudent(_studentId.Value));
}
else
{
_studentRepository.AddStudent(CreateStudent(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private Student CreateStudent(int id) => Student.CreateEntity(
id,
textBoxName.Text, textBoxFlow.Text, (Group)comboBox1.SelectedItem!
);
}
}

View 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>

View File

@ -0,0 +1,122 @@
namespace Academic_Performance.Forms
{
partial class FormStudents
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
button3 = new Button();
button2 = new Button();
button1 = new Button();
dataGridView1 = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(button3);
panel1.Controls.Add(button2);
panel1.Controls.Add(button1);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(591, 0);
panel1.Name = "panel1";
panel1.Size = new Size(209, 450);
panel1.TabIndex = 0;
//
// button3
//
button3.Location = new Point(52, 324);
button3.Name = "button3";
button3.Size = new Size(112, 34);
button3.TabIndex = 2;
button3.Text = "button3";
button3.UseVisualStyleBackColor = true;
button3.Click += button3_Click;
//
// button2
//
button2.Location = new Point(52, 173);
button2.Name = "button2";
button2.Size = new Size(112, 34);
button2.TabIndex = 1;
button2.Text = "button2";
button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click;
//
// button1
//
button1.Location = new Point(52, 28);
button1.Name = "button1";
button1.Size = new Size(112, 34);
button1.TabIndex = 0;
button1.Text = "button1";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false;
dataGridView1.RowHeadersWidth = 62;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(591, 450);
dataGridView1.TabIndex = 1;
//
// FormStudents
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Name = "FormStudents";
Text = "FormStudents";
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button button3;
private Button button2;
private Button button1;
private DataGridView dataGridView1;
}
}

View File

@ -0,0 +1,98 @@
using Academic_Performance.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace Academic_Performance.Forms
{
public partial class FormStudents : Form
{
private readonly IUnityContainer _container;
private readonly IStudentRepository _studentRepository;
public FormStudents(IUnityContainer container, IStudentRepository studentRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_studentRepository = studentRepository ?? throw new ArgumentNullException(nameof(studentRepository));
}
private void button1_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormStudent>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource = _studentRepository.GetAllStudents();
private void button2_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormStudent>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView1.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["ID"].Value);
return true;
}
private void button3_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
}
private void StudentsList_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View 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>

View File

@ -1,3 +1,8 @@
using Unity.Lifetime;
using Unity;
using Academic_Performance.Repositories;
using Academic_Performance.Repositories.Implementations;
namespace Academic_Performance namespace Academic_Performance
{ {
internal static class Program internal static class Program
@ -11,7 +16,29 @@ namespace Academic_Performance
// To customize application configuration such as set high DPI settings or default font, // To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration. // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
Application.Run(new Form1()); Application.Run(CreateContainer().Resolve<Form1>());
} }
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IMarkRepository,MarkRepository>(new TransientLifetimeManager());
container.RegisterType<ISubjectRepository,SubjectRepository>(new TransientLifetimeManager());
container.RegisterType<ITeacherRepository, TeacherRepository>(new
TransientLifetimeManager());
container.RegisterType<IStudentRepository,
StudentRepository>(new TransientLifetimeManager());
container.RegisterType<IOrderRepository,
OrderRepository>(new TransientLifetimeManager());
container.RegisterType<IStatementRepository,
StatementRepository>(new TransientLifetimeManager());
return container;
}
} }
} }

View File

@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Academic_Performance.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("Academic_Performance.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 unnamed {
get {
object obj = ResourceManager.GetObject("unnamed", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,124 @@
<?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="unnamed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\unnamed.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,18 @@
using Academic_Performance.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories
{
public interface IMarkRepository
{
IEnumerable<Mark> GetAllMarks();
Mark GetMarkById(int id);
void AddMark(Mark mark);
void UpdateMark(Mark mark);
void DeleteMark(int id);
}
}

View File

@ -0,0 +1,18 @@
using Academic_Performance.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories
{
public interface IOrderRepository
{
IEnumerable<Order> GetAllOrders();
Order GetOrderById(int id);
void AddOrder(Order order);
void UpdateOrder(Order order);
void DeleteOrder(int id);
}
}

View File

@ -0,0 +1,18 @@
using Academic_Performance.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories
{
public interface IStatementRepository
{
IEnumerable<Statement> GetAllStatements();
Statement GetStatementById(int id);
void AddStatement(Statement statement);
void UpdateStatement(Statement statement);
void DeleteStatement(int id);
}
}

View File

@ -0,0 +1,18 @@
using Academic_Performance.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories
{
public interface IStudentRepository
{
IEnumerable<Student> GetAllStudents();
Student GetStudentById(int id);
void AddStudent(Student student);
void UpdateStudent(Student student);
void DeleteStudent(int id);
}
}

View File

@ -0,0 +1,18 @@
using Academic_Performance.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories
{
public interface ISubjectRepository
{
IEnumerable<Subject> GetAllSubjects();
Subject GetSubjectById(int id);
void AddSubject(Subject subject);
void UpdateSubject(Subject subject);
void DeleteSubject(int id);
}
}

View File

@ -0,0 +1,18 @@
using Academic_Performance.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories
{
public interface ITeacherRepository
{
IEnumerable<Teacher> GetAllTeachers();
Teacher GetTeacherById(int id);
void AddTeacher(Teacher teacher);
void UpdateTeacher(Teacher teacher);
void DeleteTeacher(int id);
}
}

View File

@ -0,0 +1,45 @@
using Academic_Performance.Entities;
using Academic_Performance.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories.Implementations
{
public class MarkRepository : IMarkRepository
{
public void CreateMark(Mark Mark)
{
// Заглушка
}
public void UpdateMark(Mark Mark)
{
// Заглушка
}
public void DeleteMark(int id)
{
// Заглушка
}
public Mark GetMarkById(int id)
{
// Возвращаем объект с фиктивными данными, убедившись, что Mark.One существует
return Mark.CreateOperation(0, 0, 0, 0, Value.One); // Убедитесь, что Mark.One определен
}
public IEnumerable<Mark> GetAllMarks()
{
// Заглушка
return new List<Mark>();
}
public void AddMark(Mark mark)
{
// Заглушка
}
}
}

View File

@ -0,0 +1,38 @@
using Academic_Performance.Entities;
using Academic_Performance.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories.Implementations
{
public class OrderRepository : IOrderRepository
{
public void AddOrder(Order order)
{
// Заглушка
}
public void DeleteOrder(int id)
{
// Заглушка
}
public IEnumerable<Order> GetAllOrders()
{
return new List<Order>();
}
public Order GetOrderById(int id)
{
return Order.CreateOperation(0,0, string.Empty,TypeS.None);
}
public void UpdateOrder(Order order)
{
// Заглушка
}
}
}

View File

@ -0,0 +1,37 @@
using Academic_Performance.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories.Implementations
{
public class StatementRepository : IStatementRepository
{
public void AddStatement(Statement statement)
{
// Заглушка
}
public void DeleteStatement(int id)
{
// Заглушка
}
public IEnumerable<Statement> GetAllStatements()
{
return new List<Statement>();
}
public Statement GetStatementById(int id)
{
return Statement.CreateOperation(0, 0, 0);
}
public void UpdateStatement(Statement statment)
{
// Заглушка
}
}
}

View File

@ -0,0 +1,39 @@
using Academic_Performance.Entities;
using Academic_Performance.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories.Implementations
{
public class StudentRepository : IStudentRepository
{
public void AddStudent(Student subject)
{
// Заглушка
}
public void DeleteStudent(int id)
{
// Заглушка
}
public IEnumerable<Student> GetAllStudents()
{
return new List<Student>();
}
public Student GetStudentById(int id)
{
return Student.CreateEntity(0, string.Empty,string.Empty ,Group.None);
}
public void UpdateStudent(Student student)
{
// Заглушка
}
}
}

View File

@ -0,0 +1,38 @@
using Academic_Performance.Entities;
using Microsoft.VisualBasic.Devices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories.Implementations
{
public class SubjectRepository : ISubjectRepository
{
public void AddSubject(Subject subject)
{
// Заглушка
}
public void DeleteSubject(int id)
{
// Заглушка
}
public IEnumerable<Subject> GetAllSubjects()
{
return new List<Subject>();
}
public Subject GetSubjectById(int id)
{
return Subject.Create(0, string.Empty);
}
public void UpdateSubject(Subject subject)
{
// Заглушка
}
}
}

View File

@ -0,0 +1,37 @@
using Academic_Performance.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Academic_Performance.Repositories.Implementations
{
public class TeacherRepository : ITeacherRepository
{
public void AddTeacher(Teacher teacher)
{
// Заглушка
}
public void DeleteTeacher(int id)
{
// Заглушка
}
public IEnumerable<Teacher> GetAllTeachers()
{
return new List<Teacher>();
}
public Teacher GetTeacherById(int id)
{
return Teacher.CreateEntity(0, string.Empty);
}
public void UpdateTeacher(Teacher teacher)
{
// Заглушка
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB