Лабораторная работа №1
This commit is contained in:
parent
09e2895f95
commit
a902a2d7bb
21
ProjectSchedule/ProjectSchedule/Entities/Audience.cs
Normal file
21
ProjectSchedule/ProjectSchedule/Entities/Audience.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using ProjectSchedule.Entities.Enums;
|
||||
|
||||
namespace ProjectSchedule.Entities;
|
||||
|
||||
public class Audience
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string NumberAudience { get; private set; } = string.Empty;
|
||||
public TypeAudience TypeAudience { get; private set; }
|
||||
public int QuantitySeats { get; private set; }
|
||||
public static Audience CreateEntity(int id, string numberAudience, TypeAudience typeAudience, int quantitySeats)
|
||||
{
|
||||
return new Audience
|
||||
{
|
||||
Id = id,
|
||||
NumberAudience = numberAudience ?? string.Empty,
|
||||
TypeAudience = typeAudience,
|
||||
QuantitySeats = quantitySeats
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
using ProjectSchedule.Entities.Enums;
|
||||
|
||||
namespace ProjectSchedule.Entities;
|
||||
|
||||
public class CompilingSchedule
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int EducatorId { get; private set; }
|
||||
public int DisciplineId { get; private set; }
|
||||
public int GroupStudentsId { get; private set; }
|
||||
public int AudienceId { get; private set; }
|
||||
public TypeWeek TypeWeek { get; private set; }
|
||||
public int NumberDay { get; private set; }
|
||||
public int NumberPair { get; private set; }
|
||||
public TypeActivity TypeActivity { get; private set; }
|
||||
public static CompilingSchedule CreateOperation(int id, int educatorId, int disciplineId, int groupStudentsId, int audienceId, TypeWeek typeWeek,
|
||||
int numberDay, int numberPair, TypeActivity typeActivity)
|
||||
{
|
||||
return new CompilingSchedule
|
||||
{
|
||||
Id = id,
|
||||
EducatorId = educatorId,
|
||||
DisciplineId = disciplineId,
|
||||
GroupStudentsId = groupStudentsId,
|
||||
AudienceId = audienceId,
|
||||
TypeWeek = typeWeek,
|
||||
NumberDay = numberDay,
|
||||
NumberPair = numberPair,
|
||||
TypeActivity = typeActivity
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
namespace ProjectSchedule.Entities;
|
||||
|
||||
public class CurriculumSupplement
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int DisciplineId { get; private set; }
|
||||
public int GroupStudentsId { get; private set; }
|
||||
public string NameCurriculum { get; private set; } = string.Empty;
|
||||
public int QuantityLectures { get; private set; }
|
||||
public int QuantityPractices { get; private set; }
|
||||
public string Semester { get; private set; } = string.Empty;
|
||||
public static CurriculumSupplement CreateOperation(int id, int disciplineId, int groupStudentsId, string nameCurriculum,
|
||||
int quantityLectures, int quantityPractices, string semester)
|
||||
{
|
||||
return new CurriculumSupplement
|
||||
{
|
||||
Id = id,
|
||||
DisciplineId = disciplineId,
|
||||
GroupStudentsId = groupStudentsId,
|
||||
NameCurriculum = nameCurriculum ?? string.Empty,
|
||||
QuantityLectures = quantityLectures,
|
||||
QuantityPractices = quantityPractices,
|
||||
Semester = semester ?? string.Empty
|
||||
};
|
||||
}
|
||||
}
|
15
ProjectSchedule/ProjectSchedule/Entities/Discipline.cs
Normal file
15
ProjectSchedule/ProjectSchedule/Entities/Discipline.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace ProjectSchedule.Entities;
|
||||
|
||||
public class Discipline
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string NameDiscipline { get; private set; } = string.Empty;
|
||||
public static Discipline CreateEntity(int id, string nameDiscipline)
|
||||
{
|
||||
return new Discipline
|
||||
{
|
||||
Id = id,
|
||||
NameDiscipline = nameDiscipline ?? string.Empty,
|
||||
};
|
||||
}
|
||||
}
|
19
ProjectSchedule/ProjectSchedule/Entities/Educator.cs
Normal file
19
ProjectSchedule/ProjectSchedule/Entities/Educator.cs
Normal file
@ -0,0 +1,19 @@
|
||||
namespace ProjectSchedule.Entities;
|
||||
|
||||
public class Educator
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Surname { get; private set; } = string.Empty;
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public string Patronymic { get; private set; } = string.Empty;
|
||||
public static Educator CreateEntity(int id, string surname, string name, string patronymic)
|
||||
{
|
||||
return new Educator
|
||||
{
|
||||
Id = id,
|
||||
Surname = surname ?? string.Empty,
|
||||
Name = name ?? string.Empty,
|
||||
Patronymic = patronymic ?? string.Empty
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace ProjectSchedule.Entities.Enums;
|
||||
|
||||
public enum TypeActivity
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Practice = 1,
|
||||
|
||||
Lecture = 2
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace ProjectSchedule.Entities.Enums;
|
||||
|
||||
public enum TypeAudience
|
||||
{
|
||||
None = 0,
|
||||
|
||||
СomputerСlass = 1,
|
||||
|
||||
LectureAudience = 2
|
||||
}
|
10
ProjectSchedule/ProjectSchedule/Entities/Enums/TypeWeek.cs
Normal file
10
ProjectSchedule/ProjectSchedule/Entities/Enums/TypeWeek.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace ProjectSchedule.Entities.Enums;
|
||||
|
||||
public enum TypeWeek
|
||||
{
|
||||
None = 0,
|
||||
|
||||
OddWeek = 1,
|
||||
|
||||
EvenWeek = 2
|
||||
}
|
19
ProjectSchedule/ProjectSchedule/Entities/GroupStudents.cs
Normal file
19
ProjectSchedule/ProjectSchedule/Entities/GroupStudents.cs
Normal file
@ -0,0 +1,19 @@
|
||||
namespace ProjectSchedule.Entities;
|
||||
|
||||
public class GroupStudents
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string AbbreviationGroup { get; private set; } = string.Empty;
|
||||
public string GroupNumber { get; private set; } = string.Empty;
|
||||
public int QuantityStudents { get; private set; }
|
||||
public static GroupStudents CreateEntity(int id, string abbreviationGroup, string groupNumber, int quantityStudents)
|
||||
{
|
||||
return new GroupStudents
|
||||
{
|
||||
Id = id,
|
||||
AbbreviationGroup = abbreviationGroup ?? string.Empty,
|
||||
GroupNumber = groupNumber ?? string.Empty,
|
||||
QuantityStudents = quantityStudents
|
||||
};
|
||||
}
|
||||
}
|
39
ProjectSchedule/ProjectSchedule/Form1.Designer.cs
generated
39
ProjectSchedule/ProjectSchedule/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace ProjectSchedule
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace ProjectSchedule
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
147
ProjectSchedule/ProjectSchedule/FormSchedule.Designer.cs
generated
Normal file
147
ProjectSchedule/ProjectSchedule/FormSchedule.Designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
namespace ProjectSchedule
|
||||
{
|
||||
partial class FormSchedule
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
menuStrip = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
AudiencesToolStripMenuItem = new ToolStripMenuItem();
|
||||
DisciplinesToolStripMenuItem = new ToolStripMenuItem();
|
||||
EducatorsToolStripMenuItem = new ToolStripMenuItem();
|
||||
GroupsStudentsToolStripMenuItem = new ToolStripMenuItem();
|
||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||
CompilingScheduleToolStripMenuItem = new ToolStripMenuItem();
|
||||
CurriculumSupplementToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчётыToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Size = new Size(782, 28);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "menuStrip";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { AudiencesToolStripMenuItem, DisciplinesToolStripMenuItem, EducatorsToolStripMenuItem, GroupsStudentsToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// AudiencesToolStripMenuItem
|
||||
//
|
||||
AudiencesToolStripMenuItem.Name = "AudiencesToolStripMenuItem";
|
||||
AudiencesToolStripMenuItem.Size = new Size(224, 26);
|
||||
AudiencesToolStripMenuItem.Text = "Аудитории";
|
||||
AudiencesToolStripMenuItem.Click += AudiencesToolStripMenuItem_Click;
|
||||
//
|
||||
// DisciplinesToolStripMenuItem
|
||||
//
|
||||
DisciplinesToolStripMenuItem.Name = "DisciplinesToolStripMenuItem";
|
||||
DisciplinesToolStripMenuItem.Size = new Size(224, 26);
|
||||
DisciplinesToolStripMenuItem.Text = "Дисциплины";
|
||||
DisciplinesToolStripMenuItem.Click += DisciplinesToolStripMenuItem_Click;
|
||||
//
|
||||
// EducatorsToolStripMenuItem
|
||||
//
|
||||
EducatorsToolStripMenuItem.Name = "EducatorsToolStripMenuItem";
|
||||
EducatorsToolStripMenuItem.Size = new Size(224, 26);
|
||||
EducatorsToolStripMenuItem.Text = "Преподаватели";
|
||||
EducatorsToolStripMenuItem.Click += EducatorsToolStripMenuItem_Click;
|
||||
//
|
||||
// GroupsStudentsToolStripMenuItem
|
||||
//
|
||||
GroupsStudentsToolStripMenuItem.Name = "GroupsStudentsToolStripMenuItem";
|
||||
GroupsStudentsToolStripMenuItem.Size = new Size(224, 26);
|
||||
GroupsStudentsToolStripMenuItem.Text = "Группы студентов";
|
||||
GroupsStudentsToolStripMenuItem.Click += GroupsStudentsToolStripMenuItem_Click;
|
||||
//
|
||||
// операцииToolStripMenuItem
|
||||
//
|
||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CompilingScheduleToolStripMenuItem, CurriculumSupplementToolStripMenuItem });
|
||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||
операцииToolStripMenuItem.Size = new Size(95, 24);
|
||||
операцииToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// CompilingScheduleToolStripMenuItem
|
||||
//
|
||||
CompilingScheduleToolStripMenuItem.Name = "CompilingScheduleToolStripMenuItem";
|
||||
CompilingScheduleToolStripMenuItem.Size = new Size(295, 26);
|
||||
CompilingScheduleToolStripMenuItem.Text = "Составление расписания";
|
||||
CompilingScheduleToolStripMenuItem.Click += CompilingScheduleToolStripMenuItem_Click;
|
||||
//
|
||||
// CurriculumSupplementToolStripMenuItem
|
||||
//
|
||||
CurriculumSupplementToolStripMenuItem.Name = "CurriculumSupplementToolStripMenuItem";
|
||||
CurriculumSupplementToolStripMenuItem.Size = new Size(295, 26);
|
||||
CurriculumSupplementToolStripMenuItem.Text = "Дополнение учебного плана";
|
||||
CurriculumSupplementToolStripMenuItem.Click += CurriculumSupplementToolStripMenuItem_Click;
|
||||
//
|
||||
// отчётыToolStripMenuItem
|
||||
//
|
||||
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||
отчётыToolStripMenuItem.Size = new Size(73, 24);
|
||||
отчётыToolStripMenuItem.Text = "Отчёты";
|
||||
//
|
||||
// FormSchedule
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackgroundImage = Properties.Resources.Расписание_на_фон;
|
||||
BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ClientSize = new Size(782, 403);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Name = "FormSchedule";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Расписание";
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem AudiencesToolStripMenuItem;
|
||||
private ToolStripMenuItem DisciplinesToolStripMenuItem;
|
||||
private ToolStripMenuItem EducatorsToolStripMenuItem;
|
||||
private ToolStripMenuItem GroupsStudentsToolStripMenuItem;
|
||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||
private ToolStripMenuItem CompilingScheduleToolStripMenuItem;
|
||||
private ToolStripMenuItem отчётыToolStripMenuItem;
|
||||
private ToolStripMenuItem CurriculumSupplementToolStripMenuItem;
|
||||
}
|
||||
}
|
95
ProjectSchedule/ProjectSchedule/FormSchedule.cs
Normal file
95
ProjectSchedule/ProjectSchedule/FormSchedule.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using ProjectSchedule.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectSchedule
|
||||
{
|
||||
public partial class FormSchedule : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormSchedule(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void AudiencesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormAudiences>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void DisciplinesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDisciplines>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void EducatorsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormEducators>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void GroupsStudentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormGroupsStudents>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void CompilingScheduleToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCompilingSchedules>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void CurriculumSupplementToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCurriculumSupplements>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
ProjectSchedule/ProjectSchedule/FormSchedule.resx
Normal file
123
ProjectSchedule/ProjectSchedule/FormSchedule.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
145
ProjectSchedule/ProjectSchedule/Forms/FormAudience.Designer.cs
generated
Normal file
145
ProjectSchedule/ProjectSchedule/Forms/FormAudience.Designer.cs
generated
Normal file
@ -0,0 +1,145 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormAudience
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelNumberAudience = new Label();
|
||||
labelQuantitySeats = new Label();
|
||||
labelTypeAudience = new Label();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
textBoxNumberAudience = new TextBox();
|
||||
numericUpDownQuantitySeats = new NumericUpDown();
|
||||
comboBoxTypeAudience = new ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownQuantitySeats).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelNumberAudience
|
||||
//
|
||||
labelNumberAudience.AutoSize = true;
|
||||
labelNumberAudience.Location = new Point(21, 32);
|
||||
labelNumberAudience.Name = "labelNumberAudience";
|
||||
labelNumberAudience.Size = new Size(138, 20);
|
||||
labelNumberAudience.TabIndex = 0;
|
||||
labelNumberAudience.Text = "Номер аудитории:";
|
||||
//
|
||||
// labelQuantitySeats
|
||||
//
|
||||
labelQuantitySeats.AutoSize = true;
|
||||
labelQuantitySeats.Location = new Point(21, 77);
|
||||
labelQuantitySeats.Name = "labelQuantitySeats";
|
||||
labelQuantitySeats.Size = new Size(129, 20);
|
||||
labelQuantitySeats.TabIndex = 1;
|
||||
labelQuantitySeats.Text = "Количество мест:";
|
||||
//
|
||||
// labelTypeAudience
|
||||
//
|
||||
labelTypeAudience.AutoSize = true;
|
||||
labelTypeAudience.Location = new Point(21, 127);
|
||||
labelTypeAudience.Name = "labelTypeAudience";
|
||||
labelTypeAudience.Size = new Size(116, 20);
|
||||
labelTypeAudience.TabIndex = 2;
|
||||
labelTypeAudience.Text = "Тип аудитории:";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(21, 208);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(116, 29);
|
||||
buttonSave.TabIndex = 3;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(234, 208);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(116, 29);
|
||||
buttonCancel.TabIndex = 4;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// textBoxNumberAudience
|
||||
//
|
||||
textBoxNumberAudience.Location = new Point(176, 29);
|
||||
textBoxNumberAudience.Name = "textBoxNumberAudience";
|
||||
textBoxNumberAudience.Size = new Size(174, 27);
|
||||
textBoxNumberAudience.TabIndex = 5;
|
||||
//
|
||||
// numericUpDownQuantitySeats
|
||||
//
|
||||
numericUpDownQuantitySeats.Location = new Point(176, 77);
|
||||
numericUpDownQuantitySeats.Maximum = new decimal(new int[] { 500, 0, 0, 0 });
|
||||
numericUpDownQuantitySeats.Name = "numericUpDownQuantitySeats";
|
||||
numericUpDownQuantitySeats.Size = new Size(174, 27);
|
||||
numericUpDownQuantitySeats.TabIndex = 6;
|
||||
//
|
||||
// comboBoxTypeAudience
|
||||
//
|
||||
comboBoxTypeAudience.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxTypeAudience.FormattingEnabled = true;
|
||||
comboBoxTypeAudience.Location = new Point(176, 124);
|
||||
comboBoxTypeAudience.Name = "comboBoxTypeAudience";
|
||||
comboBoxTypeAudience.Size = new Size(174, 28);
|
||||
comboBoxTypeAudience.TabIndex = 7;
|
||||
//
|
||||
// FormAudience
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(382, 253);
|
||||
Controls.Add(comboBoxTypeAudience);
|
||||
Controls.Add(numericUpDownQuantitySeats);
|
||||
Controls.Add(textBoxNumberAudience);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(labelTypeAudience);
|
||||
Controls.Add(labelQuantitySeats);
|
||||
Controls.Add(labelNumberAudience);
|
||||
Name = "FormAudience";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Аудитория";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownQuantitySeats).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelNumberAudience;
|
||||
private Label labelQuantitySeats;
|
||||
private Label labelTypeAudience;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private TextBox textBoxNumberAudience;
|
||||
private NumericUpDown numericUpDownQuantitySeats;
|
||||
private ComboBox comboBoxTypeAudience;
|
||||
}
|
||||
}
|
76
ProjectSchedule/ProjectSchedule/Forms/FormAudience.cs
Normal file
76
ProjectSchedule/ProjectSchedule/Forms/FormAudience.cs
Normal file
@ -0,0 +1,76 @@
|
||||
using ProjectSchedule.Entities.Enums;
|
||||
using ProjectSchedule.Entities;
|
||||
using ProjectSchedule.Repositories;
|
||||
|
||||
namespace ProjectSchedule.Forms;
|
||||
|
||||
public partial class FormAudience : Form
|
||||
{
|
||||
private readonly IAudienceRepository _audienceRepository;
|
||||
|
||||
private int? _audienceId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var audience = _audienceRepository.ReadAudienceById(value);
|
||||
if (audience == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(audience));
|
||||
}
|
||||
|
||||
textBoxNumberAudience.Text = audience.NumberAudience;
|
||||
comboBoxTypeAudience.SelectedItem = audience.TypeAudience;
|
||||
numericUpDownQuantitySeats.Value = audience.QuantitySeats;
|
||||
_audienceId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormAudience(IAudienceRepository audienceRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_audienceRepository = audienceRepository ??
|
||||
throw new ArgumentNullException(nameof(audienceRepository));
|
||||
comboBoxTypeAudience.DataSource = Enum.GetValues(typeof(TypeAudience));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxNumberAudience.Text) || comboBoxTypeAudience.SelectedIndex < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_audienceId.HasValue)
|
||||
{
|
||||
_audienceRepository.UpdateAudience(CreateAudience(_audienceId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_audienceRepository.CreateAudience(CreateAudience(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Audience CreateAudience(int id) =>
|
||||
Audience.CreateEntity(id, textBoxNumberAudience.Text, (TypeAudience)comboBoxTypeAudience.SelectedItem!, Convert.ToInt32(numericUpDownQuantitySeats.Value));
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
<?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
|
||||
|
||||
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>
|
||||
@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
127
ProjectSchedule/ProjectSchedule/Forms/FormAudiences.Designer.cs
generated
Normal file
127
ProjectSchedule/ProjectSchedule/Forms/FormAudiences.Designer.cs
generated
Normal file
@ -0,0 +1,127 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormAudiences
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonUpd);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(672, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(140, 483);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(24, 194);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(94, 66);
|
||||
buttonDel.TabIndex = 4;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.Upd;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(24, 106);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(94, 66);
|
||||
buttonUpd.TabIndex = 3;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(24, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(94, 66);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(672, 483);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormAudiences
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(812, 483);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
Name = "FormAudiences";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Аудитории";
|
||||
Load += FormAudiences_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
98
ProjectSchedule/ProjectSchedule/Forms/FormAudiences.cs
Normal file
98
ProjectSchedule/ProjectSchedule/Forms/FormAudiences.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using ProjectSchedule.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
public partial class FormAudiences : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IAudienceRepository _audienceRepository;
|
||||
public FormAudiences(IUnityContainer container, IAudienceRepository audienceRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_audienceRepository = audienceRepository ??
|
||||
throw new ArgumentNullException(nameof(audienceRepository));
|
||||
}
|
||||
private void FormAudiences_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormAudience>().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<FormAudience>();
|
||||
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
|
||||
{
|
||||
_audienceRepository.DeleteAudience(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _audienceRepository.ReadAudiences();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSchedule/ProjectSchedule/Forms/FormAudiences.resx
Normal file
120
ProjectSchedule/ProjectSchedule/Forms/FormAudiences.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
268
ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedule.Designer.cs
generated
Normal file
268
ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedule.Designer.cs
generated
Normal file
@ -0,0 +1,268 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormCompilingSchedule
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelEducator = new Label();
|
||||
labelDiscipline = new Label();
|
||||
labelAudience = new Label();
|
||||
labelGroupStudents = new Label();
|
||||
labelNumberDay = new Label();
|
||||
labelTypeWeek = new Label();
|
||||
labelNumberPair = new Label();
|
||||
labelTypeActivity = new Label();
|
||||
comboBoxDiscipline = new ComboBox();
|
||||
comboBoxGroupStudents = new ComboBox();
|
||||
comboBoxEducator = new ComboBox();
|
||||
comboBoxAudience = new ComboBox();
|
||||
comboBoxTypeWeek = new ComboBox();
|
||||
comboBoxTypeActivity = new ComboBox();
|
||||
numericUpDownNumberPair = new NumericUpDown();
|
||||
numericUpDownNumberDay = new NumericUpDown();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumberPair).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumberDay).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelEducator
|
||||
//
|
||||
labelEducator.AutoSize = true;
|
||||
labelEducator.Location = new Point(34, 27);
|
||||
labelEducator.Name = "labelEducator";
|
||||
labelEducator.Size = new Size(120, 20);
|
||||
labelEducator.TabIndex = 0;
|
||||
labelEducator.Text = "Преподаватель:";
|
||||
//
|
||||
// labelDiscipline
|
||||
//
|
||||
labelDiscipline.AutoSize = true;
|
||||
labelDiscipline.Location = new Point(34, 66);
|
||||
labelDiscipline.Name = "labelDiscipline";
|
||||
labelDiscipline.Size = new Size(99, 20);
|
||||
labelDiscipline.TabIndex = 1;
|
||||
labelDiscipline.Text = "Дисциплина:";
|
||||
//
|
||||
// labelAudience
|
||||
//
|
||||
labelAudience.AutoSize = true;
|
||||
labelAudience.Location = new Point(34, 159);
|
||||
labelAudience.Name = "labelAudience";
|
||||
labelAudience.Size = new Size(87, 20);
|
||||
labelAudience.TabIndex = 2;
|
||||
labelAudience.Text = "Аудитория:";
|
||||
//
|
||||
// labelGroupStudents
|
||||
//
|
||||
labelGroupStudents.AutoSize = true;
|
||||
labelGroupStudents.Location = new Point(34, 111);
|
||||
labelGroupStudents.Name = "labelGroupStudents";
|
||||
labelGroupStudents.Size = new Size(133, 20);
|
||||
labelGroupStudents.TabIndex = 3;
|
||||
labelGroupStudents.Text = "Группа студентов:";
|
||||
//
|
||||
// labelNumberDay
|
||||
//
|
||||
labelNumberDay.AutoSize = true;
|
||||
labelNumberDay.Location = new Point(34, 264);
|
||||
labelNumberDay.Name = "labelNumberDay";
|
||||
labelNumberDay.Size = new Size(89, 20);
|
||||
labelNumberDay.TabIndex = 4;
|
||||
labelNumberDay.Text = "Номер дня:";
|
||||
//
|
||||
// labelTypeWeek
|
||||
//
|
||||
labelTypeWeek.AutoSize = true;
|
||||
labelTypeWeek.Location = new Point(34, 212);
|
||||
labelTypeWeek.Name = "labelTypeWeek";
|
||||
labelTypeWeek.Size = new Size(63, 20);
|
||||
labelTypeWeek.TabIndex = 5;
|
||||
labelTypeWeek.Text = "Неделя:";
|
||||
//
|
||||
// labelNumberPair
|
||||
//
|
||||
labelNumberPair.AutoSize = true;
|
||||
labelNumberPair.Location = new Point(34, 302);
|
||||
labelNumberPair.Name = "labelNumberPair";
|
||||
labelNumberPair.Size = new Size(101, 20);
|
||||
labelNumberPair.TabIndex = 6;
|
||||
labelNumberPair.Text = "Номер пары:";
|
||||
//
|
||||
// labelTypeActivity
|
||||
//
|
||||
labelTypeActivity.AutoSize = true;
|
||||
labelTypeActivity.Location = new Point(34, 355);
|
||||
labelTypeActivity.Name = "labelTypeActivity";
|
||||
labelTypeActivity.Size = new Size(97, 20);
|
||||
labelTypeActivity.TabIndex = 7;
|
||||
labelTypeActivity.Text = "Тип занятия:";
|
||||
//
|
||||
// comboBoxDiscipline
|
||||
//
|
||||
comboBoxDiscipline.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDiscipline.FormattingEnabled = true;
|
||||
comboBoxDiscipline.Location = new Point(245, 66);
|
||||
comboBoxDiscipline.Name = "comboBoxDiscipline";
|
||||
comboBoxDiscipline.Size = new Size(210, 28);
|
||||
comboBoxDiscipline.TabIndex = 8;
|
||||
//
|
||||
// comboBoxGroupStudents
|
||||
//
|
||||
comboBoxGroupStudents.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxGroupStudents.FormattingEnabled = true;
|
||||
comboBoxGroupStudents.Location = new Point(245, 108);
|
||||
comboBoxGroupStudents.Name = "comboBoxGroupStudents";
|
||||
comboBoxGroupStudents.Size = new Size(210, 28);
|
||||
comboBoxGroupStudents.TabIndex = 9;
|
||||
//
|
||||
// comboBoxEducator
|
||||
//
|
||||
comboBoxEducator.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxEducator.FormattingEnabled = true;
|
||||
comboBoxEducator.Location = new Point(245, 24);
|
||||
comboBoxEducator.Name = "comboBoxEducator";
|
||||
comboBoxEducator.Size = new Size(210, 28);
|
||||
comboBoxEducator.TabIndex = 10;
|
||||
//
|
||||
// comboBoxAudience
|
||||
//
|
||||
comboBoxAudience.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxAudience.FormattingEnabled = true;
|
||||
comboBoxAudience.Location = new Point(245, 159);
|
||||
comboBoxAudience.Name = "comboBoxAudience";
|
||||
comboBoxAudience.Size = new Size(210, 28);
|
||||
comboBoxAudience.TabIndex = 11;
|
||||
//
|
||||
// comboBoxTypeWeek
|
||||
//
|
||||
comboBoxTypeWeek.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxTypeWeek.FormattingEnabled = true;
|
||||
comboBoxTypeWeek.Location = new Point(245, 209);
|
||||
comboBoxTypeWeek.Name = "comboBoxTypeWeek";
|
||||
comboBoxTypeWeek.Size = new Size(210, 28);
|
||||
comboBoxTypeWeek.TabIndex = 12;
|
||||
//
|
||||
// comboBoxTypeActivity
|
||||
//
|
||||
comboBoxTypeActivity.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxTypeActivity.FormattingEnabled = true;
|
||||
comboBoxTypeActivity.Location = new Point(245, 347);
|
||||
comboBoxTypeActivity.Name = "comboBoxTypeActivity";
|
||||
comboBoxTypeActivity.Size = new Size(210, 28);
|
||||
comboBoxTypeActivity.TabIndex = 14;
|
||||
//
|
||||
// numericUpDownNumberPair
|
||||
//
|
||||
numericUpDownNumberPair.Location = new Point(245, 302);
|
||||
numericUpDownNumberPair.Maximum = new decimal(new int[] { 8, 0, 0, 0 });
|
||||
numericUpDownNumberPair.Name = "numericUpDownNumberPair";
|
||||
numericUpDownNumberPair.Size = new Size(210, 27);
|
||||
numericUpDownNumberPair.TabIndex = 15;
|
||||
//
|
||||
// numericUpDownNumberDay
|
||||
//
|
||||
numericUpDownNumberDay.Location = new Point(245, 257);
|
||||
numericUpDownNumberDay.Maximum = new decimal(new int[] { 7, 0, 0, 0 });
|
||||
numericUpDownNumberDay.Name = "numericUpDownNumberDay";
|
||||
numericUpDownNumberDay.Size = new Size(210, 27);
|
||||
numericUpDownNumberDay.TabIndex = 16;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(34, 409);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(116, 29);
|
||||
buttonSave.TabIndex = 17;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(339, 409);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(116, 29);
|
||||
buttonCancel.TabIndex = 18;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormCompilingSchedule
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(482, 453);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownNumberDay);
|
||||
Controls.Add(numericUpDownNumberPair);
|
||||
Controls.Add(comboBoxTypeActivity);
|
||||
Controls.Add(comboBoxTypeWeek);
|
||||
Controls.Add(comboBoxAudience);
|
||||
Controls.Add(comboBoxEducator);
|
||||
Controls.Add(comboBoxGroupStudents);
|
||||
Controls.Add(comboBoxDiscipline);
|
||||
Controls.Add(labelTypeActivity);
|
||||
Controls.Add(labelNumberPair);
|
||||
Controls.Add(labelTypeWeek);
|
||||
Controls.Add(labelNumberDay);
|
||||
Controls.Add(labelGroupStudents);
|
||||
Controls.Add(labelAudience);
|
||||
Controls.Add(labelDiscipline);
|
||||
Controls.Add(labelEducator);
|
||||
Name = "FormCompilingSchedule";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Составление расписания";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumberPair).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumberDay).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelEducator;
|
||||
private Label labelDiscipline;
|
||||
private Label labelAudience;
|
||||
private Label labelGroupStudents;
|
||||
private Label labelNumberDay;
|
||||
private Label labelTypeWeek;
|
||||
private Label labelNumberPair;
|
||||
private Label labelTypeActivity;
|
||||
private ComboBox comboBoxDiscipline;
|
||||
private ComboBox comboBoxGroupStudents;
|
||||
private ComboBox comboBoxEducator;
|
||||
private ComboBox comboBoxAudience;
|
||||
private ComboBox comboBoxTypeWeek;
|
||||
private ComboBox comboBoxTypeActivity;
|
||||
private NumericUpDown numericUpDownNumberPair;
|
||||
private NumericUpDown numericUpDownNumberDay;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
using ProjectSchedule.Entities;
|
||||
using ProjectSchedule.Entities.Enums;
|
||||
using ProjectSchedule.Repositories;
|
||||
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
public partial class FormCompilingSchedule : Form
|
||||
{
|
||||
private readonly ICompilingScheduleRepository _сompilingScheduleRepository;
|
||||
|
||||
public FormCompilingSchedule(ICompilingScheduleRepository сompilingScheduleRepository, IDisciplineRepository disciplineRepository,
|
||||
IEducatorRepository educatorRepository, IGroupStudentsRepository groupStudentsRepository, IAudienceRepository audienceRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_сompilingScheduleRepository = сompilingScheduleRepository ??
|
||||
throw new ArgumentNullException(nameof(сompilingScheduleRepository));
|
||||
|
||||
comboBoxEducator.DataSource = educatorRepository.ReadEducators();
|
||||
comboBoxEducator.DisplayMember = "Surname";
|
||||
comboBoxEducator.ValueMember = "Id";
|
||||
|
||||
comboBoxDiscipline.DataSource = disciplineRepository.ReadDisciplines();
|
||||
comboBoxDiscipline.DisplayMember = "NameDiscipline";
|
||||
comboBoxDiscipline.ValueMember = "Id";
|
||||
|
||||
comboBoxGroupStudents.DataSource = groupStudentsRepository.ReadGroupsStudents();
|
||||
comboBoxGroupStudents.DisplayMember = "AbbreviationGroup";
|
||||
comboBoxGroupStudents.ValueMember = "Id";
|
||||
|
||||
comboBoxAudience.DataSource = audienceRepository.ReadAudiences();
|
||||
comboBoxAudience.DisplayMember = "NumberAudience";
|
||||
comboBoxAudience.ValueMember = "Id";
|
||||
|
||||
comboBoxTypeWeek.DataSource = Enum.GetValues(typeof(TypeWeek));
|
||||
|
||||
comboBoxTypeActivity.DataSource = Enum.GetValues(typeof(TypeActivity));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxEducator.SelectedIndex < 0 || comboBoxDiscipline.SelectedIndex < 0 || comboBoxGroupStudents.SelectedIndex < 0 ||
|
||||
comboBoxAudience.SelectedIndex < 0 || comboBoxTypeWeek.SelectedIndex < 1 || comboBoxTypeActivity.SelectedIndex < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
_сompilingScheduleRepository.CreateCompilingSchedule(CompilingSchedule.CreateOperation(0,
|
||||
(int)comboBoxEducator.SelectedValue!, (int)comboBoxDiscipline.SelectedValue!,
|
||||
(int)comboBoxGroupStudents.SelectedValue!, (int)comboBoxAudience.SelectedValue!,
|
||||
(TypeWeek)comboBoxTypeWeek.SelectedItem!, Convert.ToInt32(numericUpDownNumberDay.Value),
|
||||
Convert.ToInt32(numericUpDownNumberPair.Value), (TypeActivity)comboBoxTypeActivity.SelectedItem!));
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка сохранения", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
120
ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedule.resx
Normal file
120
ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedule.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
113
ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedules.Designer.cs
generated
Normal file
113
ProjectSchedule/ProjectSchedule/Forms/FormCompilingSchedules.Designer.cs
generated
Normal file
@ -0,0 +1,113 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormCompilingSchedules
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(1113, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(140, 484);
|
||||
panel.TabIndex = 3;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(24, 372);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(94, 66);
|
||||
buttonDel.TabIndex = 4;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(24, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(94, 66);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(1113, 484);
|
||||
dataGridViewData.TabIndex = 4;
|
||||
//
|
||||
// FormCompilingSchedules
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1253, 484);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
Name = "FormCompilingSchedules";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Cоставление расписаний";
|
||||
Load += FormCompilingSchedules_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
using ProjectSchedule.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
public partial class FormCompilingSchedules : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly ICompilingScheduleRepository _сompilingScheduleRepository;
|
||||
|
||||
public FormCompilingSchedules(IUnityContainer container, ICompilingScheduleRepository сompilingScheduleRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_сompilingScheduleRepository = сompilingScheduleRepository ??
|
||||
throw new ArgumentNullException(nameof(сompilingScheduleRepository));
|
||||
}
|
||||
|
||||
private void FormCompilingSchedules_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCompilingSchedule>().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
|
||||
{
|
||||
_сompilingScheduleRepository.DeleteCompilingSchedule(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewData.DataSource = _сompilingScheduleRepository.ReadCompilingSchedules();
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
217
ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.Designer.cs
generated
Normal file
217
ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplement.Designer.cs
generated
Normal file
@ -0,0 +1,217 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormCurriculumSupplement
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
comboBoxDiscipline = new ComboBox();
|
||||
comboBoxGroupStudents = new ComboBox();
|
||||
labelDiscipline = new Label();
|
||||
labelGroupStudents = new Label();
|
||||
labelNameCurriculum = new Label();
|
||||
labelQuantityLectures = new Label();
|
||||
labelQuantityPractices = new Label();
|
||||
labelSemester = new Label();
|
||||
textBoxNameCurriculum = new TextBox();
|
||||
numericUpDownQuantityLectures = new NumericUpDown();
|
||||
numericUpDownQuantityPractices = new NumericUpDown();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
textBoxSemester = new TextBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownQuantityLectures).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownQuantityPractices).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxDiscipline
|
||||
//
|
||||
comboBoxDiscipline.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDiscipline.FormattingEnabled = true;
|
||||
comboBoxDiscipline.Location = new Point(252, 12);
|
||||
comboBoxDiscipline.Name = "comboBoxDiscipline";
|
||||
comboBoxDiscipline.Size = new Size(218, 28);
|
||||
comboBoxDiscipline.TabIndex = 0;
|
||||
//
|
||||
// comboBoxGroupStudents
|
||||
//
|
||||
comboBoxGroupStudents.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxGroupStudents.FormattingEnabled = true;
|
||||
comboBoxGroupStudents.Location = new Point(252, 68);
|
||||
comboBoxGroupStudents.Name = "comboBoxGroupStudents";
|
||||
comboBoxGroupStudents.Size = new Size(218, 28);
|
||||
comboBoxGroupStudents.TabIndex = 1;
|
||||
//
|
||||
// labelDiscipline
|
||||
//
|
||||
labelDiscipline.AutoSize = true;
|
||||
labelDiscipline.Location = new Point(12, 15);
|
||||
labelDiscipline.Name = "labelDiscipline";
|
||||
labelDiscipline.Size = new Size(99, 20);
|
||||
labelDiscipline.TabIndex = 2;
|
||||
labelDiscipline.Text = "Дисциплина:";
|
||||
//
|
||||
// labelGroupStudents
|
||||
//
|
||||
labelGroupStudents.AutoSize = true;
|
||||
labelGroupStudents.Location = new Point(12, 71);
|
||||
labelGroupStudents.Name = "labelGroupStudents";
|
||||
labelGroupStudents.Size = new Size(133, 20);
|
||||
labelGroupStudents.TabIndex = 3;
|
||||
labelGroupStudents.Text = "Группа студентов:";
|
||||
//
|
||||
// labelNameCurriculum
|
||||
//
|
||||
labelNameCurriculum.AutoSize = true;
|
||||
labelNameCurriculum.Location = new Point(12, 130);
|
||||
labelNameCurriculum.Name = "labelNameCurriculum";
|
||||
labelNameCurriculum.Size = new Size(230, 20);
|
||||
labelNameCurriculum.TabIndex = 4;
|
||||
labelNameCurriculum.Text = "Название учебной программы:";
|
||||
//
|
||||
// labelQuantityLectures
|
||||
//
|
||||
labelQuantityLectures.AutoSize = true;
|
||||
labelQuantityLectures.Location = new Point(12, 189);
|
||||
labelQuantityLectures.Name = "labelQuantityLectures";
|
||||
labelQuantityLectures.Size = new Size(147, 20);
|
||||
labelQuantityLectures.TabIndex = 5;
|
||||
labelQuantityLectures.Text = "Количество лекций:";
|
||||
//
|
||||
// labelQuantityPractices
|
||||
//
|
||||
labelQuantityPractices.AutoSize = true;
|
||||
labelQuantityPractices.Location = new Point(12, 236);
|
||||
labelQuantityPractices.Name = "labelQuantityPractices";
|
||||
labelQuantityPractices.Size = new Size(152, 20);
|
||||
labelQuantityPractices.TabIndex = 6;
|
||||
labelQuantityPractices.Text = "Количество практик:";
|
||||
//
|
||||
// labelSemester
|
||||
//
|
||||
labelSemester.AutoSize = true;
|
||||
labelSemester.Location = new Point(12, 278);
|
||||
labelSemester.Name = "labelSemester";
|
||||
labelSemester.Size = new Size(70, 20);
|
||||
labelSemester.TabIndex = 7;
|
||||
labelSemester.Text = "Семестр:";
|
||||
//
|
||||
// textBoxNameCurriculum
|
||||
//
|
||||
textBoxNameCurriculum.Location = new Point(252, 127);
|
||||
textBoxNameCurriculum.Name = "textBoxNameCurriculum";
|
||||
textBoxNameCurriculum.Size = new Size(218, 27);
|
||||
textBoxNameCurriculum.TabIndex = 8;
|
||||
//
|
||||
// numericUpDownQuantityLectures
|
||||
//
|
||||
numericUpDownQuantityLectures.Location = new Point(252, 187);
|
||||
numericUpDownQuantityLectures.Maximum = new decimal(new int[] { 40, 0, 0, 0 });
|
||||
numericUpDownQuantityLectures.Name = "numericUpDownQuantityLectures";
|
||||
numericUpDownQuantityLectures.Size = new Size(218, 27);
|
||||
numericUpDownQuantityLectures.TabIndex = 10;
|
||||
//
|
||||
// numericUpDownQuantityPractices
|
||||
//
|
||||
numericUpDownQuantityPractices.Location = new Point(252, 234);
|
||||
numericUpDownQuantityPractices.Maximum = new decimal(new int[] { 40, 0, 0, 0 });
|
||||
numericUpDownQuantityPractices.Name = "numericUpDownQuantityPractices";
|
||||
numericUpDownQuantityPractices.Size = new Size(218, 27);
|
||||
numericUpDownQuantityPractices.TabIndex = 11;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(12, 312);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(116, 29);
|
||||
buttonSave.TabIndex = 12;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(354, 312);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(116, 29);
|
||||
buttonCancel.TabIndex = 13;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// textBoxSemester
|
||||
//
|
||||
textBoxSemester.Location = new Point(252, 275);
|
||||
textBoxSemester.Name = "textBoxSemester";
|
||||
textBoxSemester.Size = new Size(218, 27);
|
||||
textBoxSemester.TabIndex = 15;
|
||||
//
|
||||
// FormCurriculumSupplement
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(482, 353);
|
||||
Controls.Add(textBoxSemester);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownQuantityPractices);
|
||||
Controls.Add(numericUpDownQuantityLectures);
|
||||
Controls.Add(textBoxNameCurriculum);
|
||||
Controls.Add(labelSemester);
|
||||
Controls.Add(labelQuantityPractices);
|
||||
Controls.Add(labelQuantityLectures);
|
||||
Controls.Add(labelNameCurriculum);
|
||||
Controls.Add(labelGroupStudents);
|
||||
Controls.Add(labelDiscipline);
|
||||
Controls.Add(comboBoxGroupStudents);
|
||||
Controls.Add(comboBoxDiscipline);
|
||||
Name = "FormCurriculumSupplement";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Дополнение учебного плана";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownQuantityLectures).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownQuantityPractices).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxDiscipline;
|
||||
private ComboBox comboBoxGroupStudents;
|
||||
private Label labelDiscipline;
|
||||
private Label labelGroupStudents;
|
||||
private Label labelNameCurriculum;
|
||||
private Label labelQuantityLectures;
|
||||
private Label labelQuantityPractices;
|
||||
private Label labelSemester;
|
||||
private TextBox textBoxNameCurriculum;
|
||||
private NumericUpDown numericUpDownQuantityLectures;
|
||||
private NumericUpDown numericUpDownQuantityPractices;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private NumericUpDown numericUpDown;
|
||||
private TextBox textBoxSemester;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
using ProjectSchedule.Entities;
|
||||
using ProjectSchedule.Repositories;
|
||||
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
public partial class FormCurriculumSupplement : Form
|
||||
{
|
||||
private readonly ICurriculumSupplementRepository _curriculumSupplementRepository;
|
||||
|
||||
public FormCurriculumSupplement(ICurriculumSupplementRepository curriculumSupplementRepository,
|
||||
IDisciplineRepository disciplineRepository, IGroupStudentsRepository groupStudentsRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_curriculumSupplementRepository = curriculumSupplementRepository ??
|
||||
throw new ArgumentNullException(nameof(curriculumSupplementRepository));
|
||||
|
||||
comboBoxDiscipline.DataSource = disciplineRepository.ReadDisciplines();
|
||||
comboBoxDiscipline.DisplayMember = "NameDiscipline";
|
||||
comboBoxDiscipline.ValueMember = "Id";
|
||||
|
||||
comboBoxGroupStudents.DataSource = groupStudentsRepository.ReadGroupsStudents();
|
||||
comboBoxGroupStudents.DisplayMember = "AbbreviationGroup";
|
||||
comboBoxGroupStudents.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxDiscipline.SelectedIndex < 0 || comboBoxGroupStudents.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
_curriculumSupplementRepository.CreateCurriculumSupplement(CurriculumSupplement.CreateOperation(0,
|
||||
(int)comboBoxDiscipline.SelectedValue!, (int)comboBoxGroupStudents.SelectedValue!,
|
||||
textBoxNameCurriculum.Text, Convert.ToInt32(numericUpDownQuantityLectures.Value),
|
||||
Convert.ToInt32(numericUpDownQuantityPractices.Value), textBoxSemester.Text));
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
@ -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>
|
113
ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplements.Designer.cs
generated
Normal file
113
ProjectSchedule/ProjectSchedule/Forms/FormCurriculumSupplements.Designer.cs
generated
Normal file
@ -0,0 +1,113 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormCurriculumSupplements
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(764, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(140, 453);
|
||||
panel.TabIndex = 2;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(24, 372);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(94, 66);
|
||||
buttonDel.TabIndex = 4;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(24, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(94, 66);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(764, 453);
|
||||
dataGridViewData.TabIndex = 3;
|
||||
//
|
||||
// FormCurriculumSupplements
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(904, 453);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
Name = "FormCurriculumSupplements";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Дополнения учебного плана";
|
||||
Load += FormCurriculumSupplements_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
using ProjectSchedule.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
public partial class FormCurriculumSupplements : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly ICurriculumSupplementRepository _curriculumSupplementRepository;
|
||||
|
||||
public FormCurriculumSupplements(IUnityContainer container, ICurriculumSupplementRepository curriculumSupplementRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_curriculumSupplementRepository = curriculumSupplementRepository ??
|
||||
throw new ArgumentNullException(nameof(curriculumSupplementRepository));
|
||||
}
|
||||
|
||||
private void FormCurriculumSupplements_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCurriculumSupplement>().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
|
||||
{
|
||||
_curriculumSupplementRepository.DeleteCurriculumSupplement(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewData.DataSource = _curriculumSupplementRepository.ReadCurriculumSupplements();
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
96
ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.Designer.cs
generated
Normal file
96
ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.Designer.cs
generated
Normal file
@ -0,0 +1,96 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormDiscipline
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
textBoxNameDiscipline = new TextBox();
|
||||
labelNameDiscipline = new Label();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// textBoxNameDiscipline
|
||||
//
|
||||
textBoxNameDiscipline.Location = new Point(228, 42);
|
||||
textBoxNameDiscipline.Name = "textBoxNameDiscipline";
|
||||
textBoxNameDiscipline.Size = new Size(214, 27);
|
||||
textBoxNameDiscipline.TabIndex = 0;
|
||||
//
|
||||
// labelNameDiscipline
|
||||
//
|
||||
labelNameDiscipline.AutoSize = true;
|
||||
labelNameDiscipline.Location = new Point(25, 45);
|
||||
labelNameDiscipline.Name = "labelNameDiscipline";
|
||||
labelNameDiscipline.Size = new Size(172, 20);
|
||||
labelNameDiscipline.TabIndex = 1;
|
||||
labelNameDiscipline.Text = "Название дисциплины:";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(25, 131);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(116, 29);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(326, 131);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(116, 29);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormDiscipline
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(468, 184);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(labelNameDiscipline);
|
||||
Controls.Add(textBoxNameDiscipline);
|
||||
Name = "FormDiscipline";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Дисциплина";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TextBox textBoxNameDiscipline;
|
||||
private Label labelNameDiscipline;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
70
ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.cs
Normal file
70
ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using ProjectSchedule.Entities;
|
||||
using ProjectSchedule.Repositories;
|
||||
|
||||
namespace ProjectSchedule.Forms;
|
||||
|
||||
public partial class FormDiscipline : Form
|
||||
{
|
||||
private readonly IDisciplineRepository _disciplineRepository;
|
||||
|
||||
private int? _disciplineId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var discipline = _disciplineRepository.ReadDisciplineById(value);
|
||||
if (discipline == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(discipline));
|
||||
}
|
||||
textBoxNameDiscipline.Text = discipline.NameDiscipline;
|
||||
_disciplineId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormDiscipline(IDisciplineRepository disciplineRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_disciplineRepository = disciplineRepository ??
|
||||
throw new ArgumentNullException(nameof(disciplineRepository));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxNameDiscipline.Text))
|
||||
{
|
||||
throw new Exception("Поле 'Название дисциплины' должно быть заполнено.");
|
||||
}
|
||||
if (_disciplineId.HasValue)
|
||||
{
|
||||
_disciplineRepository.UpdateDiscipline(CreateDiscipline(_disciplineId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_disciplineRepository.CreateDiscipline(CreateDiscipline(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Discipline CreateDiscipline(int id) =>
|
||||
Discipline.CreateEntity(id, textBoxNameDiscipline.Text);
|
||||
}
|
120
ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.resx
Normal file
120
ProjectSchedule/ProjectSchedule/Forms/FormDiscipline.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
127
ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.Designer.cs
generated
Normal file
127
ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.Designer.cs
generated
Normal file
@ -0,0 +1,127 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormDisciplines
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonUpd);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(660, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(140, 450);
|
||||
panel.TabIndex = 1;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(24, 194);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(94, 66);
|
||||
buttonDel.TabIndex = 4;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.Upd;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(24, 106);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(94, 66);
|
||||
buttonUpd.TabIndex = 3;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(24, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(94, 66);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(660, 450);
|
||||
dataGridViewData.TabIndex = 2;
|
||||
//
|
||||
// FormDisciplines
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
Name = "FormDisciplines";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Дисциплины";
|
||||
Load += FormDisciplines_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
98
ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.cs
Normal file
98
ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using ProjectSchedule.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
public partial class FormDisciplines : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IDisciplineRepository _disciplineRepository;
|
||||
public FormDisciplines(IUnityContainer container, IDisciplineRepository disciplineRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_disciplineRepository = disciplineRepository ??
|
||||
throw new ArgumentNullException(nameof(disciplineRepository));
|
||||
}
|
||||
private void FormDisciplines_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDiscipline>().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<FormDiscipline>();
|
||||
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
|
||||
{
|
||||
_disciplineRepository.DeleteDiscipline(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _disciplineRepository.ReadDisciplines();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.resx
Normal file
120
ProjectSchedule/ProjectSchedule/Forms/FormDisciplines.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
140
ProjectSchedule/ProjectSchedule/Forms/FormEducator.Designer.cs
generated
Normal file
140
ProjectSchedule/ProjectSchedule/Forms/FormEducator.Designer.cs
generated
Normal file
@ -0,0 +1,140 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormEducator
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelSurname = new Label();
|
||||
labelName = new Label();
|
||||
labelPatronymic = new Label();
|
||||
textBoxName = new TextBox();
|
||||
textBoxSurname = new TextBox();
|
||||
textBoxPatronymic = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelSurname
|
||||
//
|
||||
labelSurname.AutoSize = true;
|
||||
labelSurname.Location = new Point(21, 30);
|
||||
labelSurname.Name = "labelSurname";
|
||||
labelSurname.Size = new Size(76, 20);
|
||||
labelSurname.TabIndex = 0;
|
||||
labelSurname.Text = "Фамилия:";
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(21, 78);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(42, 20);
|
||||
labelName.TabIndex = 1;
|
||||
labelName.Text = "Имя:";
|
||||
//
|
||||
// labelPatronymic
|
||||
//
|
||||
labelPatronymic.AutoSize = true;
|
||||
labelPatronymic.Location = new Point(21, 133);
|
||||
labelPatronymic.Name = "labelPatronymic";
|
||||
labelPatronymic.Size = new Size(75, 20);
|
||||
labelPatronymic.TabIndex = 2;
|
||||
labelPatronymic.Text = "Отчество:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(161, 75);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(232, 27);
|
||||
textBoxName.TabIndex = 3;
|
||||
//
|
||||
// textBoxSurname
|
||||
//
|
||||
textBoxSurname.Location = new Point(161, 27);
|
||||
textBoxSurname.Name = "textBoxSurname";
|
||||
textBoxSurname.Size = new Size(232, 27);
|
||||
textBoxSurname.TabIndex = 4;
|
||||
//
|
||||
// textBoxPatronymic
|
||||
//
|
||||
textBoxPatronymic.Location = new Point(161, 130);
|
||||
textBoxPatronymic.Name = "textBoxPatronymic";
|
||||
textBoxPatronymic.Size = new Size(232, 27);
|
||||
textBoxPatronymic.TabIndex = 5;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(21, 200);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(116, 29);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(277, 200);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(116, 29);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormEducator
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(405, 246);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxPatronymic);
|
||||
Controls.Add(textBoxSurname);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelPatronymic);
|
||||
Controls.Add(labelName);
|
||||
Controls.Add(labelSurname);
|
||||
Name = "FormEducator";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Преподаватель";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelSurname;
|
||||
private Label labelName;
|
||||
private Label labelPatronymic;
|
||||
private TextBox textBoxName;
|
||||
private TextBox textBoxSurname;
|
||||
private TextBox textBoxPatronymic;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
72
ProjectSchedule/ProjectSchedule/Forms/FormEducator.cs
Normal file
72
ProjectSchedule/ProjectSchedule/Forms/FormEducator.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using ProjectSchedule.Entities;
|
||||
using ProjectSchedule.Repositories;
|
||||
|
||||
namespace ProjectSchedule.Forms;
|
||||
|
||||
public partial class FormEducator : Form
|
||||
{
|
||||
private readonly IEducatorRepository _educatorRepository;
|
||||
|
||||
private int? _educatorId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var educator = _educatorRepository.ReadEducatorById(value);
|
||||
if (educator == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(educator));
|
||||
}
|
||||
textBoxSurname.Text = educator.Surname;
|
||||
textBoxName.Text = educator.Name;
|
||||
textBoxPatronymic.Text = educator.Patronymic;
|
||||
_educatorId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormEducator(IEducatorRepository educatorRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_educatorRepository = educatorRepository ??
|
||||
throw new ArgumentNullException(nameof(educatorRepository));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxSurname.Text) || string.IsNullOrWhiteSpace(textBoxName.Text) ||
|
||||
string.IsNullOrWhiteSpace(textBoxPatronymic.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_educatorId.HasValue)
|
||||
{
|
||||
_educatorRepository.UpdateEducator(CreateEducator(_educatorId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_educatorRepository.CreateEducator(CreateEducator(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Educator CreateEducator(int id) =>
|
||||
Educator.CreateEntity(id, textBoxSurname.Text, textBoxName.Text, textBoxPatronymic.Text);
|
||||
}
|
120
ProjectSchedule/ProjectSchedule/Forms/FormEducator.resx
Normal file
120
ProjectSchedule/ProjectSchedule/Forms/FormEducator.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
127
ProjectSchedule/ProjectSchedule/Forms/FormEducators.Designer.cs
generated
Normal file
127
ProjectSchedule/ProjectSchedule/Forms/FormEducators.Designer.cs
generated
Normal file
@ -0,0 +1,127 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormEducators
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonUpd);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(642, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(140, 453);
|
||||
panel.TabIndex = 1;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(24, 194);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(94, 66);
|
||||
buttonDel.TabIndex = 4;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.Upd;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(24, 106);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(94, 66);
|
||||
buttonUpd.TabIndex = 3;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(24, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(94, 66);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(642, 453);
|
||||
dataGridViewData.TabIndex = 2;
|
||||
//
|
||||
// FormEducators
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(782, 453);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
Name = "FormEducators";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Преподаватели";
|
||||
Load += FormEducators_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
98
ProjectSchedule/ProjectSchedule/Forms/FormEducators.cs
Normal file
98
ProjectSchedule/ProjectSchedule/Forms/FormEducators.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using ProjectSchedule.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
public partial class FormEducators : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IEducatorRepository _educatorRepository;
|
||||
public FormEducators(IUnityContainer container, IEducatorRepository educatorRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_educatorRepository = educatorRepository ??
|
||||
throw new ArgumentNullException(nameof(educatorRepository));
|
||||
}
|
||||
private void FormEducators_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormEducator>().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<FormEducator>();
|
||||
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
|
||||
{
|
||||
_educatorRepository.DeleteEducator(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _educatorRepository.ReadEducators();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSchedule/ProjectSchedule/Forms/FormEducators.resx
Normal file
120
ProjectSchedule/ProjectSchedule/Forms/FormEducators.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
143
ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.Designer.cs
generated
Normal file
143
ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.Designer.cs
generated
Normal file
@ -0,0 +1,143 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormGroupStudents
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelAbbreviationGroup = new Label();
|
||||
labelGroupNumber = new Label();
|
||||
labelQuantityStudents = new Label();
|
||||
numericUpDownQuantityStudents = new NumericUpDown();
|
||||
textBoxAbbreviationGroup = new TextBox();
|
||||
textBoxGroupNumber = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownQuantityStudents).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelAbbreviationGroup
|
||||
//
|
||||
labelAbbreviationGroup.AutoSize = true;
|
||||
labelAbbreviationGroup.Location = new Point(12, 28);
|
||||
labelAbbreviationGroup.Name = "labelAbbreviationGroup";
|
||||
labelAbbreviationGroup.Size = new Size(167, 20);
|
||||
labelAbbreviationGroup.TabIndex = 0;
|
||||
labelAbbreviationGroup.Text = "Аббревиатура группы:";
|
||||
//
|
||||
// labelGroupNumber
|
||||
//
|
||||
labelGroupNumber.AutoSize = true;
|
||||
labelGroupNumber.Location = new Point(12, 74);
|
||||
labelGroupNumber.Name = "labelGroupNumber";
|
||||
labelGroupNumber.Size = new Size(115, 20);
|
||||
labelGroupNumber.TabIndex = 1;
|
||||
labelGroupNumber.Text = "Номер группы:";
|
||||
//
|
||||
// labelQuantityStudents
|
||||
//
|
||||
labelQuantityStudents.AutoSize = true;
|
||||
labelQuantityStudents.Location = new Point(12, 123);
|
||||
labelQuantityStudents.Name = "labelQuantityStudents";
|
||||
labelQuantityStudents.Size = new Size(165, 20);
|
||||
labelQuantityStudents.TabIndex = 2;
|
||||
labelQuantityStudents.Text = "Количество студентов:";
|
||||
//
|
||||
// numericUpDownQuantityStudents
|
||||
//
|
||||
numericUpDownQuantityStudents.Location = new Point(213, 121);
|
||||
numericUpDownQuantityStudents.Maximum = new decimal(new int[] { 66, 0, 0, 0 });
|
||||
numericUpDownQuantityStudents.Name = "numericUpDownQuantityStudents";
|
||||
numericUpDownQuantityStudents.Size = new Size(176, 27);
|
||||
numericUpDownQuantityStudents.TabIndex = 3;
|
||||
//
|
||||
// textBoxAbbreviationGroup
|
||||
//
|
||||
textBoxAbbreviationGroup.Location = new Point(213, 25);
|
||||
textBoxAbbreviationGroup.Name = "textBoxAbbreviationGroup";
|
||||
textBoxAbbreviationGroup.Size = new Size(176, 27);
|
||||
textBoxAbbreviationGroup.TabIndex = 4;
|
||||
//
|
||||
// textBoxGroupNumber
|
||||
//
|
||||
textBoxGroupNumber.Location = new Point(213, 71);
|
||||
textBoxGroupNumber.Name = "textBoxGroupNumber";
|
||||
textBoxGroupNumber.Size = new Size(176, 27);
|
||||
textBoxGroupNumber.TabIndex = 5;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(12, 189);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(116, 29);
|
||||
buttonSave.TabIndex = 7;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(273, 189);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(116, 29);
|
||||
buttonCancel.TabIndex = 8;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormGroupStudents
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(401, 230);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxGroupNumber);
|
||||
Controls.Add(textBoxAbbreviationGroup);
|
||||
Controls.Add(numericUpDownQuantityStudents);
|
||||
Controls.Add(labelQuantityStudents);
|
||||
Controls.Add(labelGroupNumber);
|
||||
Controls.Add(labelAbbreviationGroup);
|
||||
Name = "FormGroupStudents";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Группа студентов";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownQuantityStudents).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelAbbreviationGroup;
|
||||
private Label labelGroupNumber;
|
||||
private Label labelQuantityStudents;
|
||||
private NumericUpDown numericUpDownQuantityStudents;
|
||||
private TextBox textBoxAbbreviationGroup;
|
||||
private TextBox textBoxGroupNumber;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
75
ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.cs
Normal file
75
ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using ProjectSchedule.Entities;
|
||||
using ProjectSchedule.Repositories;
|
||||
|
||||
namespace ProjectSchedule.Forms;
|
||||
|
||||
public partial class FormGroupStudents : Form
|
||||
{
|
||||
private readonly IGroupStudentsRepository _groupStudentsRepository;
|
||||
|
||||
private int? _groupStudentsId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var groupStudents = _groupStudentsRepository.ReadGroupStudentsById(value);
|
||||
if (groupStudents == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(groupStudents));
|
||||
}
|
||||
textBoxAbbreviationGroup.Text = groupStudents.AbbreviationGroup;
|
||||
textBoxGroupNumber.Text = groupStudents.GroupNumber;
|
||||
numericUpDownQuantityStudents.Value = groupStudents.QuantityStudents;
|
||||
_groupStudentsId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormGroupStudents(IGroupStudentsRepository groupStudentsRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_groupStudentsRepository = groupStudentsRepository ??
|
||||
throw new ArgumentNullException(nameof(groupStudentsRepository));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxAbbreviationGroup.Text) || string.IsNullOrWhiteSpace(textBoxGroupNumber.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_groupStudentsId.HasValue)
|
||||
{
|
||||
_groupStudentsRepository.UpdateGroupStudents(CreateGroupOfStudents(_groupStudentsId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_groupStudentsRepository.CreateGroupStudents(CreateGroupOfStudents(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private GroupStudents CreateGroupOfStudents(int id)
|
||||
{
|
||||
return GroupStudents.CreateEntity(id, textBoxAbbreviationGroup.Text, textBoxGroupNumber.Text, Convert.ToInt32(numericUpDownQuantityStudents.Value));
|
||||
}
|
||||
}
|
120
ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.resx
Normal file
120
ProjectSchedule/ProjectSchedule/Forms/FormGroupStudents.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
127
ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.Designer.cs
generated
Normal file
127
ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.Designer.cs
generated
Normal file
@ -0,0 +1,127 @@
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
partial class FormGroupsStudents
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonUpd);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(660, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(140, 450);
|
||||
panel.TabIndex = 2;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.Del;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(24, 194);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(94, 66);
|
||||
buttonDel.TabIndex = 4;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.Upd;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(24, 106);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(94, 66);
|
||||
buttonUpd.TabIndex = 3;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(24, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(94, 66);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.RowHeadersWidth = 51;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(660, 450);
|
||||
dataGridViewData.TabIndex = 3;
|
||||
//
|
||||
// FormGroupsStudents
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
Name = "FormGroupsStudents";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Группы студентов";
|
||||
Load += FormGroupsStudents_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
98
ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.cs
Normal file
98
ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using ProjectSchedule.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectSchedule.Forms
|
||||
{
|
||||
public partial class FormGroupsStudents : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IGroupStudentsRepository _groupStudentsRepository;
|
||||
public FormGroupsStudents(IUnityContainer container, IGroupStudentsRepository groupStudentsRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_groupStudentsRepository = groupStudentsRepository ??
|
||||
throw new ArgumentNullException(nameof(groupStudentsRepository));
|
||||
}
|
||||
private void FormGroupsStudents_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormGroupStudents>().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<FormGroupStudents>();
|
||||
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
|
||||
{
|
||||
_groupStudentsRepository.DeleteGroupStudents(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _groupStudentsRepository.ReadGroupsStudents();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.resx
Normal file
120
ProjectSchedule/ProjectSchedule/Forms/FormGroupsStudents.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,3 +1,8 @@
|
||||
using Unity.Lifetime;
|
||||
using Unity;
|
||||
using ProjectSchedule.Repositories;
|
||||
using ProjectSchedule.Repositories.Implementations;
|
||||
|
||||
namespace ProjectSchedule
|
||||
{
|
||||
internal static class Program
|
||||
@ -11,7 +16,21 @@ namespace ProjectSchedule
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(CreateContainer().Resolve<FormSchedule>());
|
||||
}
|
||||
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
|
||||
container.RegisterType<IAudienceRepository, AudienceRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<ICurriculumSupplementRepository, CurriculumSupplementRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IDisciplineRepository, DisciplineRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IEducatorRepository, EducatorRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IGroupStudentsRepository, GroupStudentsRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<ICompilingScheduleRepository, CompilingScheduleRepository>(new TransientLifetimeManager());
|
||||
|
||||
return container;
|
||||
}
|
||||
}
|
||||
}
|
@ -8,4 +8,23 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
103
ProjectSchedule/ProjectSchedule/Properties/Resources.Designer.cs
generated
Normal file
103
ProjectSchedule/ProjectSchedule/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjectSchedule.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("ProjectSchedule.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 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>
|
||||
internal static System.Drawing.Bitmap Upd {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Upd", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Расписание_на_фон {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Расписание на фон", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
ProjectSchedule/ProjectSchedule/Properties/Resources.resx
Normal file
133
ProjectSchedule/ProjectSchedule/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Расписание на фон" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Расписание на фон.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>
|
||||
<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="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Add.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
@ -0,0 +1,16 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories;
|
||||
|
||||
public interface IAudienceRepository
|
||||
{
|
||||
IEnumerable<Audience> ReadAudiences();
|
||||
|
||||
Audience ReadAudienceById(int id);
|
||||
|
||||
void CreateAudience(Audience audience);
|
||||
|
||||
void UpdateAudience(Audience audience);
|
||||
|
||||
void DeleteAudience(int id);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories;
|
||||
|
||||
public interface ICompilingScheduleRepository
|
||||
{
|
||||
IEnumerable<CompilingSchedule> ReadCompilingSchedules(int? educatorId = null, int? disciplineId = null,
|
||||
int? groupStudentsId = null, int? audienceId = null);
|
||||
void CreateCompilingSchedule(CompilingSchedule compilingSchedule);
|
||||
void DeleteCompilingSchedule(int id);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories;
|
||||
|
||||
public interface ICurriculumSupplementRepository
|
||||
{
|
||||
IEnumerable<CurriculumSupplement> ReadCurriculumSupplements(int? disciplineId = null, int? groupStudentsId = null);
|
||||
void CreateCurriculumSupplement(CurriculumSupplement curriculumSupplement);
|
||||
void DeleteCurriculumSupplement(int id);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories;
|
||||
|
||||
public interface IDisciplineRepository
|
||||
{
|
||||
IEnumerable<Discipline> ReadDisciplines();
|
||||
|
||||
Discipline ReadDisciplineById(int id);
|
||||
|
||||
void CreateDiscipline(Discipline discipline);
|
||||
|
||||
void UpdateDiscipline(Discipline discipline);
|
||||
|
||||
void DeleteDiscipline(int id);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories;
|
||||
|
||||
public interface IEducatorRepository
|
||||
{
|
||||
IEnumerable<Educator> ReadEducators();
|
||||
|
||||
Educator ReadEducatorById(int id);
|
||||
|
||||
void CreateEducator(Educator educator);
|
||||
|
||||
void UpdateEducator(Educator educator);
|
||||
|
||||
void DeleteEducator(int id);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories;
|
||||
|
||||
public interface IGroupStudentsRepository
|
||||
{
|
||||
IEnumerable<GroupStudents> ReadGroupsStudents();
|
||||
|
||||
GroupStudents ReadGroupStudentsById(int id);
|
||||
|
||||
void CreateGroupStudents(GroupStudents groupStudents);
|
||||
|
||||
void UpdateGroupStudents(GroupStudents groupStudents);
|
||||
|
||||
void DeleteGroupStudents(int id);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using ProjectSchedule.Entities;
|
||||
using ProjectSchedule.Entities.Enums;
|
||||
|
||||
namespace ProjectSchedule.Repositories.Implementations;
|
||||
|
||||
public class AudienceRepository : IAudienceRepository
|
||||
{
|
||||
public void CreateAudience(Audience audience)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteAudience(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Audience ReadAudienceById(int id)
|
||||
{
|
||||
return Audience.CreateEntity(0, string.Empty, TypeAudience.None, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Audience> ReadAudiences()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateAudience(Audience audience)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories.Implementations;
|
||||
|
||||
public class CompilingScheduleRepository : ICompilingScheduleRepository
|
||||
{
|
||||
public void CreateCompilingSchedule(CompilingSchedule compilingSchedule)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteCompilingSchedule(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<CompilingSchedule> ReadCompilingSchedules(int? educatorId = null, int? disciplineId = null,
|
||||
int? groupStudentsId = null, int? audienceId = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories.Implementations;
|
||||
|
||||
public class CurriculumSupplementRepository : ICurriculumSupplementRepository
|
||||
{
|
||||
public void CreateCurriculumSupplement(CurriculumSupplement curriculumSupplement)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteCurriculumSupplement(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<CurriculumSupplement> ReadCurriculumSupplements(int? disciplineId = null, int? groupStudentsId = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories.Implementations;
|
||||
|
||||
public class DisciplineRepository : IDisciplineRepository
|
||||
{
|
||||
public void CreateDiscipline(Discipline discipline)
|
||||
{
|
||||
}
|
||||
public void DeleteDiscipline(int id)
|
||||
{
|
||||
}
|
||||
public Discipline ReadDisciplineById(int id)
|
||||
{
|
||||
return Discipline.CreateEntity(0, string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Discipline> ReadDisciplines()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateDiscipline(Discipline discipline)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories.Implementations;
|
||||
|
||||
public class EducatorRepository : IEducatorRepository
|
||||
{
|
||||
public void CreateEducator(Educator educator)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteEducator(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Educator ReadEducatorById(int id)
|
||||
{
|
||||
return Educator.CreateEntity(0, string.Empty, string.Empty, string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Educator> ReadEducators()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateEducator(Educator educator)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
using ProjectSchedule.Entities;
|
||||
|
||||
namespace ProjectSchedule.Repositories.Implementations;
|
||||
|
||||
public class GroupStudentsRepository : IGroupStudentsRepository
|
||||
{
|
||||
public void CreateGroupStudents(GroupStudents groupStudents)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteGroupStudents(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public GroupStudents ReadGroupStudentsById(int id)
|
||||
{
|
||||
return GroupStudents.CreateEntity(0, string.Empty, string.Empty, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<GroupStudents> ReadGroupsStudents()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateGroupStudents(GroupStudents groupStudents)
|
||||
{
|
||||
}
|
||||
}
|
BIN
ProjectSchedule/ProjectSchedule/Resources/Add.jpg
Normal file
BIN
ProjectSchedule/ProjectSchedule/Resources/Add.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
ProjectSchedule/ProjectSchedule/Resources/Del.png
Normal file
BIN
ProjectSchedule/ProjectSchedule/Resources/Del.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 99 KiB |
BIN
ProjectSchedule/ProjectSchedule/Resources/Upd.png
Normal file
BIN
ProjectSchedule/ProjectSchedule/Resources/Upd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 KiB |
BIN
ProjectSchedule/ProjectSchedule/Resources/Расписание на фон.png
Normal file
BIN
ProjectSchedule/ProjectSchedule/Resources/Расписание на фон.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Loading…
Reference in New Issue
Block a user