почти сделано

This commit is contained in:
Anastasia Yazykova 2024-12-04 04:31:30 +04:00
parent bfe732607e
commit c015aab079
42 changed files with 2347 additions and 48 deletions

View File

@ -16,7 +16,7 @@ namespace Academic_Performance.Entities
public Value? Value { get; private set; }
public DateTime Date { get; private set; }
public static Mark CreateOperation(int id, int studentId, int statmentSubjectId, int statmentTeacherId, Value value)
public static Mark CreateEntity(int id, int studentId, int statmentSubjectId, int statmentTeacherId, Value value)
{
return new Mark
{

View File

@ -11,12 +11,12 @@ namespace Academic_Performance.Entities
{
public int Id { get; private set; }
public int StudentId { get; private set; }
public string Information { get; private set; }
public string Information { get; private set; } = string.Empty;
public TypeS? TypeS { get; private set; }
public DateTime Date { get; private set; }
public static Order CreateOperation(int id, int studentId, string information,TypeS types)
public static Order CreateEntity(int id, int studentId, string information,TypeS types)
{
return new Order
{

View File

@ -1,6 +1,7 @@
using Academic_Performance.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -15,6 +16,7 @@ namespace Academic_Performance.Entities
public DateTime Date { get; private set; }
public static Statement CreateOperation(int id, int subjecttId, int teacherId)
{
return new Statement

View File

@ -11,7 +11,7 @@ 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)
public static Subject CreateEntity(int id, string name)
{
return new Subject
{

View File

@ -81,7 +81,7 @@
//
оценкиToolStripMenuItem.Name = "оценкиToolStripMenuItem";
оценкиToolStripMenuItem.Size = new Size(270, 34);
оценкиToolStripMenuItem.Text = "Оценки";
оценкиToolStripMenuItem.Text = "Приказ";
//
// операцииToolStripMenuItem
//
@ -93,13 +93,13 @@
// добавлениеToolStripMenuItem
//
добавлениеToolStripMenuItem.Name = обавлениеToolStripMenuItem";
добавлениеToolStripMenuItem.Size = new Size(202, 34);
добавлениеToolStripMenuItem.Text = "Приказ";
добавлениеToolStripMenuItem.Size = new Size(270, 34);
добавлениеToolStripMenuItem.Text = "Оценка";
//
// ведомостьToolStripMenuItem
//
ведомостьToolStripMenuItem.Name = едомостьToolStripMenuItem";
ведомостьToolStripMenuItem.Size = new Size(202, 34);
ведомостьToolStripMenuItem.Size = new Size(270, 34);
ведомостьToolStripMenuItem.Text = "Ведомость";
//
// отчетыToolStripMenuItem

View File

@ -0,0 +1,39 @@
namespace Academic_Performance.Forms
{
partial class FormMark
{
/// <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 = "FormMark";
}
#endregion
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Academic_Performance.Forms
{
public partial class FormMark : Form
{
public FormMark()
{
InitializeComponent();
}
}
}

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,151 @@
namespace Academic_Performance.Forms
{
partial class FormOrder
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
buttonSave = new Button();
buttonEx = new Button();
label1 = new Label();
label2 = new Label();
label3 = new Label();
dateTimePicker1 = new DateTimePicker();
comboBoxType = new ComboBox();
textBoxInf = new TextBox();
comboBoxIdStudent = new ComboBox();
SuspendLayout();
//
// buttonSave
//
buttonSave.Location = new Point(80, 404);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 34);
buttonSave.TabIndex = 1;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonEx
//
buttonEx.Location = new Point(572, 404);
buttonEx.Name = "buttonEx";
buttonEx.Size = new Size(112, 34);
buttonEx.TabIndex = 2;
buttonEx.Text = "Отмена";
buttonEx.UseVisualStyleBackColor = true;
buttonEx.Click += buttonEx_Click;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(62, 31);
label1.Name = "label1";
label1.Size = new Size(49, 25);
label1.TabIndex = 3;
label1.Text = "Дата";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(70, 104);
label2.Name = "label2";
label2.Size = new Size(41, 25);
label2.TabIndex = 4;
label2.Text = "Тип";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(28, 187);
label3.Name = "label3";
label3.Size = new Size(121, 25);
label3.TabIndex = 5;
label3.Text = "Информация";
//
// dateTimePicker1
//
dateTimePicker1.Location = new Point(184, 26);
dateTimePicker1.Name = "dateTimePicker1";
dateTimePicker1.Size = new Size(300, 31);
dateTimePicker1.TabIndex = 6;
//
// comboBoxType
//
comboBoxType.FormattingEnabled = true;
comboBoxType.Location = new Point(184, 104);
comboBoxType.Name = "comboBoxType";
comboBoxType.Size = new Size(516, 33);
comboBoxType.TabIndex = 7;
//
// textBoxInf
//
textBoxInf.Location = new Point(175, 192);
textBoxInf.Name = "textBoxInf";
textBoxInf.Size = new Size(525, 31);
textBoxInf.TabIndex = 8;
//
// comboBoxIdStudent
//
comboBoxIdStudent.FormattingEnabled = true;
comboBoxIdStudent.Location = new Point(175, 268);
comboBoxIdStudent.Name = "comboBoxIdStudent";
comboBoxIdStudent.Size = new Size(182, 33);
comboBoxIdStudent.TabIndex = 9;
//
// FormOrder
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(comboBoxIdStudent);
Controls.Add(textBoxInf);
Controls.Add(comboBoxType);
Controls.Add(dateTimePicker1);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(buttonEx);
Controls.Add(buttonSave);
Name = "FormOrder";
Text = "FormOrder";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button buttonSave;
private Button buttonEx;
private Label label1;
private Label label2;
private Label label3;
private DateTimePicker dateTimePicker1;
private ComboBox comboBoxType;
private TextBox textBoxInf;
private ComboBox comboBoxIdStudent;
}
}

View File

@ -0,0 +1,93 @@
using Academic_Performance.Entities;
using Academic_Performance.Entities.Enums;
using Academic_Performance.Repositories;
using Academic_Performance.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Academic_Performance.Forms
{
public partial class FormOrder : Form
{
private readonly IOrderRepository _orderRepository;
private int? _orderId;
public int Id
{
set
{
try
{
var order = _orderRepository.GetOrderById(value);
if (order == null)
{
throw new InvalidDataException(nameof(order));
}
textBoxInf.Text = order.Information;
_orderId = value;
comboBoxType.SelectedItem =
order.TypeS;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormOrder(IOrderRepository orderRepository, IStudentRepository studentRepository)
{
InitializeComponent();
_orderRepository = orderRepository ??
throw new
ArgumentNullException(nameof(orderRepository));
comboBoxType.DataSource =
Enum.GetValues(typeof(TypeS));
comboBoxIdStudent.DataSource = studentRepository.ReadStudent();
comboBoxIdStudent.DisplayMember = "Name";
comboBoxIdStudent.ValueMember = "Id";
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxInf.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_orderId.HasValue)
{
_orderRepository.UpdateOrder(CreateOrder(_orderId.Value));
}
else
{
_orderRepository.AddOrder(CreateOrder(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonEx_Click(object sender, EventArgs e) => Close();
private Order CreateOrder(int id) => Order.CreateEntity(id, (int)comboBoxIdStudent.SelectedValue!, textBoxInf.Text,
(TypeS)comboBoxType.SelectedItem!);
}
}

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,125 @@
namespace Academic_Performance.Forms
{
partial class FormOrders
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
buttonDel = new Button();
buttonUpd = new Button();
buttonSave = new Button();
dataGridView = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonSave);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(591, 0);
panel1.Name = "panel1";
panel1.Size = new Size(209, 450);
panel1.TabIndex = 1;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.Del;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(52, 324);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(112, 98);
buttonDel.TabIndex = 2;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += buttonDel_Click;
//
// buttonUpd
//
buttonUpd.BackgroundImage = Properties.Resources.Upd;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(52, 173);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(112, 96);
buttonUpd.TabIndex = 1;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += buttonUpd_Click;
//
// buttonSave
//
buttonSave.BackgroundImage = Properties.Resources.Add;
buttonSave.BackgroundImageLayout = ImageLayout.Stretch;
buttonSave.Location = new Point(52, 28);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 93);
buttonSave.TabIndex = 0;
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 62;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(591, 450);
dataGridView.TabIndex = 2;
//
// FormOrders
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormOrders";
Text = "FormOrders";
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonDel;
private Button buttonUpd;
private Button buttonSave;
private DataGridView dataGridView;
}
}

View File

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

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

@ -50,31 +50,34 @@
//
// button3
//
button3.BackgroundImage = Properties.Resources.Del;
button3.BackgroundImageLayout = ImageLayout.Stretch;
button3.Location = new Point(52, 324);
button3.Name = "button3";
button3.Size = new Size(112, 34);
button3.Size = new Size(112, 98);
button3.TabIndex = 2;
button3.Text = "button3";
button3.UseVisualStyleBackColor = true;
button3.Click += button3_Click;
//
// button2
//
button2.BackgroundImage = Properties.Resources.Upd;
button2.BackgroundImageLayout = ImageLayout.Stretch;
button2.Location = new Point(52, 173);
button2.Name = "button2";
button2.Size = new Size(112, 34);
button2.Size = new Size(112, 96);
button2.TabIndex = 1;
button2.Text = "button2";
button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click;
//
// button1
//
button1.BackgroundImage = Properties.Resources.Add;
button1.BackgroundImageLayout = ImageLayout.Stretch;
button1.Location = new Point(52, 28);
button1.Name = "button1";
button1.Size = new Size(112, 34);
button1.Size = new Size(112, 93);
button1.TabIndex = 0;
button1.Text = "button1";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//

View File

@ -36,7 +36,7 @@ namespace Academic_Performance.Forms
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource = _studentRepository.GetAllStudents();
private void LoadList() => dataGridView1.DataSource = _studentRepository.ReadStudent();
private void button2_Click(object sender, EventArgs e)
{
@ -79,7 +79,15 @@ namespace Academic_Performance.Forms
{
return;
}
try
{
_studentRepository.DeleteStudent(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void StudentsList_Load(object sender, EventArgs e)

View File

@ -0,0 +1,96 @@
namespace Academic_Performance.Forms
{
partial class FormSubject
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
buttonSave = new Button();
buttonEx = new Button();
label1 = new Label();
textBoxName = new TextBox();
SuspendLayout();
//
// buttonSave
//
buttonSave.Location = new Point(73, 404);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 34);
buttonSave.TabIndex = 1;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonEx
//
buttonEx.Location = new Point(513, 404);
buttonEx.Name = "buttonEx";
buttonEx.Size = new Size(112, 34);
buttonEx.TabIndex = 2;
buttonEx.Text = "Отмена";
buttonEx.UseVisualStyleBackColor = true;
buttonEx.Click += buttonEx_Click;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 172);
label1.Name = "label1";
label1.Size = new Size(173, 25);
label1.TabIndex = 3;
label1.Text = "Название предмета";
label1.Click += label1_Click;
//
// textBoxName
//
textBoxName.Location = new Point(295, 169);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(241, 31);
textBoxName.TabIndex = 4;
//
// FormSubject
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(textBoxName);
Controls.Add(label1);
Controls.Add(buttonEx);
Controls.Add(buttonSave);
Name = "FormSubject";
Text = "FormSubject";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button buttonSave;
private Button buttonEx;
private Label label1;
private TextBox textBoxName;
}
}

View File

@ -0,0 +1,95 @@
using Academic_Performance.Entities;
using Academic_Performance.Repositories;
using Academic_Performance.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace Academic_Performance.Forms
{
public partial class FormSubject : Form
{
private readonly ISubjectRepository _subjectRepository;
private int? _subjectId;
public int Id
{
set
{
try
{
var student = _subjectRepository.GetSubjectById(value);
if (student == null)
{
throw new InvalidDataException(nameof(student));
}
textBoxName.Text = student.Name;
_subjectId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormSubject(ISubjectRepository subjectRepository)
{
InitializeComponent();
_subjectRepository = subjectRepository ??
throw new ArgumentNullException(nameof(subjectRepository));
}
private void label1_Click(object sender, EventArgs e)
{
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxName.Text) )
{
throw new Exception("Имеются незаполненные поля");
}
if (_subjectId.HasValue)
{
_subjectRepository.UpdateSubject(CreateSubject(_subjectId.Value));
}
else
{
_subjectRepository.AddSubject(CreateSubject(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private Subject CreateSubject(int id) => Subject.CreateEntity(
id,
textBoxName.Text
);
private void buttonEx_Click(object sender, EventArgs e) => Close();
}
}

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,125 @@
namespace Academic_Performance.Forms
{
partial class FormSubjects
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
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 = 1;
//
// button3
//
button3.BackgroundImage = Properties.Resources.Del;
button3.BackgroundImageLayout = ImageLayout.Stretch;
button3.Location = new Point(52, 324);
button3.Name = "button3";
button3.Size = new Size(112, 98);
button3.TabIndex = 2;
button3.UseVisualStyleBackColor = true;
button3.Click += button3_Click;
//
// button2
//
button2.BackgroundImage = Properties.Resources.Upd;
button2.BackgroundImageLayout = ImageLayout.Stretch;
button2.Location = new Point(52, 173);
button2.Name = "button2";
button2.Size = new Size(112, 96);
button2.TabIndex = 1;
button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click;
//
// button1
//
button1.BackgroundImage = Properties.Resources.Add;
button1.BackgroundImageLayout = ImageLayout.Stretch;
button1.Location = new Point(52, 28);
button1.Name = "button1";
button1.Size = new Size(112, 93);
button1.TabIndex = 0;
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 = 2;
//
// FormSubjects
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Name = "FormSubjects";
Text = "FormSubjects";
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,126 @@
using Academic_Performance.Repositories;
using Academic_Performance.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using Unity;
namespace Academic_Performance.Forms
{
public partial class FormSubjects : Form
{
private readonly IUnityContainer _container;
private readonly ISubjectRepository _subjectRepository;
public FormSubjects(IUnityContainer container, ISubjectRepository subjectRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_subjectRepository = subjectRepository ?? throw new ArgumentNullException(nameof(subjectRepository));
}
private void FormSubject_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button1_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSubject>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button2_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormSubject>();
form.Id= findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button3_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_subjectRepository.DeleteSubject(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SubjectList_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource = _subjectRepository.ReadSubject();
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;
}
}
}

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,95 @@
namespace Academic_Performance.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()
{
buttonSave = new Button();
buttonEx = new Button();
label1 = new Label();
textBoxName = new TextBox();
SuspendLayout();
//
// buttonSave
//
buttonSave.Location = new Point(75, 253);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(112, 34);
buttonSave.TabIndex = 0;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonEx
//
buttonEx.Location = new Point(241, 253);
buttonEx.Name = "buttonEx";
buttonEx.Size = new Size(112, 34);
buttonEx.TabIndex = 1;
buttonEx.Text = "Отмена";
buttonEx.UseVisualStyleBackColor = true;
buttonEx.Click += buttonEx_Click;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(4, 91);
label1.Name = "label1";
label1.Size = new Size(183, 25);
label1.TabIndex = 2;
label1.Text = "ФИО Преподавателя";
//
// textBoxName
//
textBoxName.Location = new Point(218, 88);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(241, 31);
textBoxName.TabIndex = 3;
//
// FormTeacher
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(489, 315);
Controls.Add(textBoxName);
Controls.Add(label1);
Controls.Add(buttonEx);
Controls.Add(buttonSave);
Name = "FormTeacher";
Text = "FormTeacher";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button buttonSave;
private Button buttonEx;
private Label label1;
private TextBox textBoxName;
}
}

View File

@ -0,0 +1,86 @@
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;
namespace Academic_Performance.Forms
{
public partial class FormTeacher : Form
{
private readonly ITeacherRepository _teacherRepository;
private int? _teacherId;
public int Id
{
set
{
try
{
var teacher = _teacherRepository.GetTeacherById(value);
if (teacher == null)
{
throw new InvalidOperationException(nameof(teacher));
}
textBoxName.Text = teacher.Name;
_teacherId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
public FormTeacher(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("Имеются незаполненные поля");
}
if (_teacherId.HasValue)
{
_teacherRepository.UpdateTeacher(CreateTeacher(_teacherId.Value));
}
else
{
_teacherRepository.CreateTeacher(CreateTeacher(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private Teacher CreateTeacher(int id) =>
Teacher.CreateEntity(id, textBoxName.Text);
private void buttonEx_Click(object sender, EventArgs e) => Close();
}
}

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,125 @@
namespace Academic_Performance.Forms
{
partial class FormTeachers
{
/// <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 = 1;
//
// button3
//
button3.BackgroundImage = Properties.Resources.Del;
button3.BackgroundImageLayout = ImageLayout.Stretch;
button3.Location = new Point(52, 324);
button3.Name = "button3";
button3.Size = new Size(112, 98);
button3.TabIndex = 2;
button3.UseVisualStyleBackColor = true;
button3.Click += button3_Click;
//
// button2
//
button2.BackgroundImage = Properties.Resources.Upd;
button2.BackgroundImageLayout = ImageLayout.Stretch;
button2.Location = new Point(52, 173);
button2.Name = "button2";
button2.Size = new Size(112, 96);
button2.TabIndex = 1;
button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click;
//
// button1
//
button1.BackgroundImage = Properties.Resources.Add;
button1.BackgroundImageLayout = ImageLayout.Stretch;
button1.Location = new Point(52, 28);
button1.Name = "button1";
button1.Size = new Size(112, 93);
button1.TabIndex = 0;
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 = 2;
//
// FormTeachers
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Name = "FormTeachers";
Text = "FormTeachers";
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,118 @@
using Academic_Performance.Repositories;
using Academic_Performance.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using Unity;
namespace Academic_Performance.Forms
{
public partial class FormTeachers : Form
{
private readonly IUnityContainer _container;
private readonly ITeacherRepository _teacherRepository;
public FormTeachers(IUnityContainer container, ITeacherRepository teacherRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_teacherRepository = teacherRepository ??
throw new ArgumentNullException(nameof(teacherRepository));
}
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 FormTeachers_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource = _teacherRepository.ReadTeachers();
private void button2_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormTeacher>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button3_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_teacherRepository.DeleteTeacher(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private 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;
}
}
}

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

@ -60,6 +60,26 @@ namespace Academic_Performance.Properties {
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Add {
get {
object obj = ResourceManager.GetObject("Add", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Del {
get {
object obj = ResourceManager.GetObject("Del", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
@ -69,5 +89,15 @@ namespace Academic_Performance.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Upd {
get {
object obj = ResourceManager.GetObject("Upd", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -118,7 +118,16 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Del" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Del.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="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>
<data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Upd" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Upd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -9,7 +9,7 @@ namespace Academic_Performance.Repositories
{
public interface IOrderRepository
{
IEnumerable<Order> GetAllOrders();
IEnumerable<Order> ReadOrder();
Order GetOrderById(int id);
void AddOrder(Order order);
void UpdateOrder(Order order);

View File

@ -9,7 +9,7 @@ namespace Academic_Performance.Repositories
{
public interface IStudentRepository
{
IEnumerable<Student> GetAllStudents();
IEnumerable<Student> ReadStudent();
Student GetStudentById(int id);
void AddStudent(Student student);
void UpdateStudent(Student student);

View File

@ -9,7 +9,7 @@ namespace Academic_Performance.Repositories
{
public interface ISubjectRepository
{
IEnumerable<Subject> GetAllSubjects();
IEnumerable<Subject> ReadSubject();
Subject GetSubjectById(int id);
void AddSubject(Subject subject);
void UpdateSubject(Subject subject);

View File

@ -9,9 +9,9 @@ namespace Academic_Performance.Repositories
{
public interface ITeacherRepository
{
IEnumerable<Teacher> GetAllTeachers();
IEnumerable<Teacher> ReadTeachers();
Teacher GetTeacherById(int id);
void AddTeacher(Teacher teacher);
void CreateTeacher(Teacher teacher);
void UpdateTeacher(Teacher teacher);
void DeleteTeacher(int id);
}

View File

@ -13,33 +13,29 @@ namespace Academic_Performance.Repositories.Implementations
{
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 определен
return Mark.CreateEntity(0, 0, 0, 0, Value.One);
}
public IEnumerable<Mark> GetAllMarks()
{
// Заглушка
return new List<Mark>();
}
public void AddMark(Mark mark)
{
// Заглушка
}
}
}

View File

@ -12,12 +12,10 @@ namespace Academic_Performance.Repositories.Implementations
{
public void AddOrder(Order order)
{
// Заглушка
}
public void DeleteOrder(int id)
{
// Заглушка
}
public IEnumerable<Order> GetAllOrders()
@ -27,12 +25,16 @@ namespace Academic_Performance.Repositories.Implementations
public Order GetOrderById(int id)
{
return Order.CreateOperation(0,0, string.Empty,TypeS.None);
return Order.CreateEntity(0,0, string.Empty,TypeS.None);
}
public void UpdateOrder(Order order)
{
// Заглушка
}
IEnumerable<Order> IOrderRepository.ReadOrder()
{
return [];
}
}
}

View File

@ -12,12 +12,10 @@ namespace Academic_Performance.Repositories.Implementations
{
public void AddStudent(Student subject)
{
// Заглушка
}
public void DeleteStudent(int id)
{
// Заглушка
}
public IEnumerable<Student> GetAllStudents()
@ -32,7 +30,11 @@ namespace Academic_Performance.Repositories.Implementations
public void UpdateStudent(Student student)
{
// Заглушка
}
IEnumerable<Student> IStudentRepository.ReadStudent()
{
return [];
}
}
}

View File

@ -12,27 +12,26 @@ namespace Academic_Performance.Repositories.Implementations
{
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);
return Subject.CreateEntity(0, string.Empty);
}
public void UpdateSubject(Subject subject)
{
// Заглушка
}
IEnumerable<Subject> ISubjectRepository.ReadSubject()
{
return [];
}
}
}

View File

@ -9,14 +9,12 @@ namespace Academic_Performance.Repositories.Implementations
{
public class TeacherRepository : ITeacherRepository
{
public void AddTeacher(Teacher teacher)
public void CreateTeacher(Teacher teacher)
{
// Заглушка
}
public void DeleteTeacher(int id)
{
// Заглушка
}
public IEnumerable<Teacher> GetAllTeachers()
@ -29,9 +27,13 @@ namespace Academic_Performance.Repositories.Implementations
return Teacher.CreateEntity(0, string.Empty);
}
public IEnumerable<Teacher> ReadTeachers()
{
return [];
}
public void UpdateTeacher(Teacher teacher)
{
// Заглушка
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB