Compare commits
No commits in common. "Lab1" and "main" have entirely different histories.
@ -1,20 +0,0 @@
|
||||
namespace ProjectRacing.Entities;
|
||||
|
||||
public class Competitions
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public DateOnly DateOfCompetitions { get; set; }
|
||||
public string Adress { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public static Competitions CreateEntity(int id, DateOnly dateOfCompetitions, string adress, string name)
|
||||
{
|
||||
return new Competitions
|
||||
{
|
||||
Id = id,
|
||||
Adress = adress,
|
||||
DateOfCompetitions = dateOfCompetitions,
|
||||
Name = name
|
||||
};
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace ProjectRacing.Entities.Enums;
|
||||
[Flags]
|
||||
public enum Gender
|
||||
{
|
||||
Unknown = 0,
|
||||
Man = 1,
|
||||
Woman = 2
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace ProjectRacing.Entities.Enums;
|
||||
public enum HealthStatus
|
||||
{
|
||||
Completely = 0,
|
||||
Partially = 1,
|
||||
Unwell = 2
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
using ProjectRacing.Entities.Enums;
|
||||
|
||||
namespace ProjectRacing.Entities;
|
||||
public class Horse
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string NameOfHorse { get; private set; } = string.Empty;
|
||||
public Gender Sex { get; private set; }
|
||||
public DateOnly Birthday { get; private set; }
|
||||
public int OwnerId { get; private set; }
|
||||
|
||||
public static Horse CreateEntity(int id, string nameOfHorse, Gender sex, DateOnly birthday, int ownerId)
|
||||
{
|
||||
return new Horse
|
||||
{
|
||||
Id = id,
|
||||
NameOfHorse = nameOfHorse,
|
||||
Sex = sex,
|
||||
Birthday = birthday,
|
||||
OwnerId = ownerId
|
||||
};
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
namespace ProjectRacing.Entities;
|
||||
public class Jockey
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string NameOfJockey { get; private set; } = string.Empty;
|
||||
public int Age { get; private set; }
|
||||
public int Rating { get; private set; }
|
||||
public string Number { get; private set; } = string.Empty;
|
||||
public static Jockey CreateEntity(int id, string nameOfJockey, int age, int rating, string number)
|
||||
{
|
||||
return new Jockey
|
||||
{
|
||||
Id = id,
|
||||
NameOfJockey = nameOfJockey,
|
||||
Age = age,
|
||||
Rating = rating,
|
||||
Number = number
|
||||
};
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using ProjectRacing.Entities.Enums;
|
||||
|
||||
namespace ProjectRacing.Entities;
|
||||
public class MedicalExamination
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public DateOnly Date { get; private set; }
|
||||
public HealthStatus HealthStatus { get; private set; }
|
||||
public int HorseId { get; private set; }
|
||||
public static MedicalExamination CreateEntity(int id, DateOnly date, HealthStatus healthStatus, int horseId)
|
||||
{
|
||||
return new MedicalExamination
|
||||
{
|
||||
Id = id,
|
||||
Date = date,
|
||||
HealthStatus = healthStatus,
|
||||
HorseId = horseId
|
||||
};
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
namespace ProjectRacing.Entities;
|
||||
public class Owner
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string NameOfOwner { get; private set; } = string.Empty;
|
||||
public string Number { get; private set; } = string.Empty;
|
||||
public string Adress { get; private set; } = string.Empty;
|
||||
public static Owner CreateEntity(int id, string nameOfOwner, string number, string adress)
|
||||
{
|
||||
return new Owner
|
||||
{
|
||||
Id = id,
|
||||
NameOfOwner = nameOfOwner,
|
||||
Number = number,
|
||||
Adress = adress
|
||||
};
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
namespace ProjectRacing.Entities;
|
||||
public class Participants
|
||||
{
|
||||
public int ParticipantId { get; private set; }
|
||||
public int JockeyId { get; private set; }
|
||||
public int CompetitionsId { get; private set; }
|
||||
public int HorsesId { get; private set; }
|
||||
public int Place { get; private set; }
|
||||
public static Participants CreateEntity(int id, int jockeyId, int horsesId, int competitionsId, int place)
|
||||
{
|
||||
|
||||
|
||||
return new Participants
|
||||
{
|
||||
ParticipantId = id,
|
||||
JockeyId = jockeyId,
|
||||
HorsesId = horsesId,
|
||||
CompetitionsId = competitionsId,
|
||||
Place = place
|
||||
};
|
||||
}
|
||||
}
|
39
ProjectRacing/Form1.Designer.cs
generated
Normal file
39
ProjectRacing/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
||||
namespace ProjectRacing
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
10
ProjectRacing/Form1.cs
Normal file
10
ProjectRacing/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace ProjectRacing
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
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.
|
||||
-->
|
137
ProjectRacing/FormRacing.Designer.cs
generated
137
ProjectRacing/FormRacing.Designer.cs
generated
@ -1,137 +0,0 @@
|
||||
namespace ProjectRacing
|
||||
{
|
||||
partial class FormRacing
|
||||
{
|
||||
/// <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();
|
||||
infoToolStripMenuItem = new ToolStripMenuItem();
|
||||
horsesToolStripMenuItem = new ToolStripMenuItem();
|
||||
ownersToolStripMenuItem = new ToolStripMenuItem();
|
||||
jockeysToolStripMenuItem = new ToolStripMenuItem();
|
||||
operationToolStripMenuItem = new ToolStripMenuItem();
|
||||
registrationCompetitionToolStripMenuItem = new ToolStripMenuItem();
|
||||
completeMedicalExaminationToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { infoToolStripMenuItem, operationToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Size = new Size(800, 24);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// infoToolStripMenuItem
|
||||
//
|
||||
infoToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { horsesToolStripMenuItem, ownersToolStripMenuItem, jockeysToolStripMenuItem });
|
||||
infoToolStripMenuItem.Name = "infoToolStripMenuItem";
|
||||
infoToolStripMenuItem.Size = new Size(94, 20);
|
||||
infoToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// horsesToolStripMenuItem
|
||||
//
|
||||
horsesToolStripMenuItem.Name = "horsesToolStripMenuItem";
|
||||
horsesToolStripMenuItem.Size = new Size(180, 22);
|
||||
horsesToolStripMenuItem.Text = "Лошади";
|
||||
horsesToolStripMenuItem.Click += HorsesToolStripMenuItem_Click;
|
||||
//
|
||||
// ownersToolStripMenuItem
|
||||
//
|
||||
ownersToolStripMenuItem.Name = "ownersToolStripMenuItem";
|
||||
ownersToolStripMenuItem.Size = new Size(180, 22);
|
||||
ownersToolStripMenuItem.Text = "Владельцы";
|
||||
ownersToolStripMenuItem.Click += OwnersToolStripMenuItem_Click;
|
||||
//
|
||||
// jockeysToolStripMenuItem
|
||||
//
|
||||
jockeysToolStripMenuItem.Name = "jockeysToolStripMenuItem";
|
||||
jockeysToolStripMenuItem.Size = new Size(180, 22);
|
||||
jockeysToolStripMenuItem.Text = "Жокеи";
|
||||
jockeysToolStripMenuItem.Click += JockeysToolStripMenuItem_Click;
|
||||
//
|
||||
// operationToolStripMenuItem
|
||||
//
|
||||
operationToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { registrationCompetitionToolStripMenuItem, completeMedicalExaminationToolStripMenuItem });
|
||||
operationToolStripMenuItem.Name = "operationToolStripMenuItem";
|
||||
operationToolStripMenuItem.Size = new Size(75, 20);
|
||||
operationToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// registrationCompetitionToolStripMenuItem
|
||||
//
|
||||
registrationCompetitionToolStripMenuItem.Name = "registrationCompetitionToolStripMenuItem";
|
||||
registrationCompetitionToolStripMenuItem.Size = new Size(225, 22);
|
||||
registrationCompetitionToolStripMenuItem.Text = "Регистрация соревнований";
|
||||
registrationCompetitionToolStripMenuItem.Click += RegistrationCompetitionToolStripMenuItem_Click;
|
||||
//
|
||||
// completeMedicalExaminationToolStripMenuItem
|
||||
//
|
||||
completeMedicalExaminationToolStripMenuItem.Name = "completeMedicalExaminationToolStripMenuItem";
|
||||
completeMedicalExaminationToolStripMenuItem.Size = new Size(225, 22);
|
||||
completeMedicalExaminationToolStripMenuItem.Text = "Провести медосмотр";
|
||||
completeMedicalExaminationToolStripMenuItem.Click += CompleteMedicalExaminationToolStripMenuItem_Click;
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// FormRacing
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackgroundImage = Properties.Resources.orig;
|
||||
BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Name = "FormRacing";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Скачки";
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem infoToolStripMenuItem;
|
||||
private ToolStripMenuItem horsesToolStripMenuItem;
|
||||
private ToolStripMenuItem ownersToolStripMenuItem;
|
||||
private ToolStripMenuItem jockeysToolStripMenuItem;
|
||||
private ToolStripMenuItem operationToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem registrationCompetitionToolStripMenuItem;
|
||||
private ToolStripMenuItem completeMedicalExaminationToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
using ProjectRacing.Forms;
|
||||
using ProjectRacing.Forms.Competitions;
|
||||
using ProjectRacing.Forms.Jockeys;
|
||||
using ProjectRacing.Forms.MedicalExamination;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectRacing
|
||||
{
|
||||
public partial class FormRacing : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public FormRacing(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
private void CompetitionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCompetitions>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void HorsesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormHorses>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void OwnersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormOwners>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void JockeysToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormJockeys>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void RegistrationCompetitionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCompetitions>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CompleteMedicalExaminationToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormMedicalExaminations>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -1,210 +0,0 @@
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
partial class FormCompetition
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dateTimePickerDateOfCompetition = new DateTimePicker();
|
||||
textBoxNameOfCompetition = new TextBox();
|
||||
labelDateOfCompetition = new Label();
|
||||
labelNameOfCompetitions = new Label();
|
||||
buttonSave = new Button();
|
||||
buttonExit = new Button();
|
||||
textBoxAdressOfCompetition = new TextBox();
|
||||
labelAdressOfCompetition = new Label();
|
||||
label1 = new Label();
|
||||
numericUpDownPlace = new NumericUpDown();
|
||||
comboBoxHorses = new ComboBox();
|
||||
comboBoxJockeys = new ComboBox();
|
||||
labelHorses = new Label();
|
||||
labelJockeys = new Label();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPlace).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dateTimePickerDateOfCompetition
|
||||
//
|
||||
dateTimePickerDateOfCompetition.Location = new Point(159, 108);
|
||||
dateTimePickerDateOfCompetition.Name = "dateTimePickerDateOfCompetition";
|
||||
dateTimePickerDateOfCompetition.Size = new Size(173, 23);
|
||||
dateTimePickerDateOfCompetition.TabIndex = 0;
|
||||
//
|
||||
// textBoxNameOfCompetition
|
||||
//
|
||||
textBoxNameOfCompetition.Location = new Point(159, 143);
|
||||
textBoxNameOfCompetition.Name = "textBoxNameOfCompetition";
|
||||
textBoxNameOfCompetition.Size = new Size(173, 23);
|
||||
textBoxNameOfCompetition.TabIndex = 1;
|
||||
//
|
||||
// labelDateOfCompetition
|
||||
//
|
||||
labelDateOfCompetition.AutoSize = true;
|
||||
labelDateOfCompetition.Location = new Point(12, 108);
|
||||
labelDateOfCompetition.Name = "labelDateOfCompetition";
|
||||
labelDateOfCompetition.Size = new Size(114, 15);
|
||||
labelDateOfCompetition.TabIndex = 2;
|
||||
labelDateOfCompetition.Text = "Дата соревнований";
|
||||
//
|
||||
// labelNameOfCompetitions
|
||||
//
|
||||
labelNameOfCompetitions.AutoSize = true;
|
||||
labelNameOfCompetitions.Location = new Point(12, 143);
|
||||
labelNameOfCompetitions.Name = "labelNameOfCompetitions";
|
||||
labelNameOfCompetitions.Size = new Size(141, 15);
|
||||
labelNameOfCompetitions.TabIndex = 3;
|
||||
labelNameOfCompetitions.Text = "Название соревнований";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(51, 212);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonExit
|
||||
//
|
||||
buttonExit.Location = new Point(179, 212);
|
||||
buttonExit.Name = "buttonExit";
|
||||
buttonExit.Size = new Size(75, 23);
|
||||
buttonExit.TabIndex = 5;
|
||||
buttonExit.Text = "Отмена";
|
||||
buttonExit.UseVisualStyleBackColor = true;
|
||||
buttonExit.Click += ButtonExit_Click;
|
||||
//
|
||||
// textBoxAdressOfCompetition
|
||||
//
|
||||
textBoxAdressOfCompetition.Location = new Point(159, 180);
|
||||
textBoxAdressOfCompetition.Name = "textBoxAdressOfCompetition";
|
||||
textBoxAdressOfCompetition.Size = new Size(173, 23);
|
||||
textBoxAdressOfCompetition.TabIndex = 6;
|
||||
//
|
||||
// labelAdressOfCompetition
|
||||
//
|
||||
labelAdressOfCompetition.AutoSize = true;
|
||||
labelAdressOfCompetition.Location = new Point(12, 183);
|
||||
labelAdressOfCompetition.Name = "labelAdressOfCompetition";
|
||||
labelAdressOfCompetition.Size = new Size(124, 15);
|
||||
labelAdressOfCompetition.TabIndex = 7;
|
||||
labelAdressOfCompetition.Text = "Место соревнований";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(14, 72);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(42, 15);
|
||||
label1.TabIndex = 24;
|
||||
label1.Text = "Место";
|
||||
//
|
||||
// numericUpDownPlace
|
||||
//
|
||||
numericUpDownPlace.Location = new Point(159, 70);
|
||||
numericUpDownPlace.Name = "numericUpDownPlace";
|
||||
numericUpDownPlace.Size = new Size(173, 23);
|
||||
numericUpDownPlace.TabIndex = 23;
|
||||
numericUpDownPlace.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||
//
|
||||
// comboBoxHorses
|
||||
//
|
||||
comboBoxHorses.FormattingEnabled = true;
|
||||
comboBoxHorses.Location = new Point(159, 41);
|
||||
comboBoxHorses.Name = "comboBoxHorses";
|
||||
comboBoxHorses.Size = new Size(173, 23);
|
||||
comboBoxHorses.TabIndex = 22;
|
||||
//
|
||||
// comboBoxJockeys
|
||||
//
|
||||
comboBoxJockeys.FormattingEnabled = true;
|
||||
comboBoxJockeys.Location = new Point(159, 12);
|
||||
comboBoxJockeys.Name = "comboBoxJockeys";
|
||||
comboBoxJockeys.Size = new Size(173, 23);
|
||||
comboBoxJockeys.TabIndex = 21;
|
||||
//
|
||||
// labelHorses
|
||||
//
|
||||
labelHorses.AutoSize = true;
|
||||
labelHorses.Location = new Point(12, 44);
|
||||
labelHorses.Name = "labelHorses";
|
||||
labelHorses.Size = new Size(51, 15);
|
||||
labelHorses.TabIndex = 18;
|
||||
labelHorses.Text = "Лошадь";
|
||||
//
|
||||
// labelJockeys
|
||||
//
|
||||
labelJockeys.AutoSize = true;
|
||||
labelJockeys.Location = new Point(12, 9);
|
||||
labelJockeys.Name = "labelJockeys";
|
||||
labelJockeys.Size = new Size(44, 15);
|
||||
labelJockeys.TabIndex = 17;
|
||||
labelJockeys.Text = "Жокей";
|
||||
//
|
||||
// FormCompetition
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(350, 269);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(numericUpDownPlace);
|
||||
Controls.Add(comboBoxHorses);
|
||||
Controls.Add(comboBoxJockeys);
|
||||
Controls.Add(labelHorses);
|
||||
Controls.Add(labelJockeys);
|
||||
Controls.Add(labelAdressOfCompetition);
|
||||
Controls.Add(textBoxAdressOfCompetition);
|
||||
Controls.Add(buttonExit);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(labelNameOfCompetitions);
|
||||
Controls.Add(labelDateOfCompetition);
|
||||
Controls.Add(textBoxNameOfCompetition);
|
||||
Controls.Add(dateTimePickerDateOfCompetition);
|
||||
Name = "FormCompetition";
|
||||
Text = "Соревнование";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPlace).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DateTimePicker dateTimePickerDateOfCompetition;
|
||||
private TextBox textBoxNameOfCompetition;
|
||||
private Label labelDateOfCompetition;
|
||||
private Label labelNameOfCompetitions;
|
||||
private Button buttonSave;
|
||||
private Button buttonExit;
|
||||
private TextBox textBoxAdressOfCompetition;
|
||||
private Label labelAdressOfCompetition;
|
||||
private Label label1;
|
||||
private NumericUpDown numericUpDownPlace;
|
||||
private ComboBox comboBoxHorses;
|
||||
private ComboBox comboBoxJockeys;
|
||||
private Label labelHorses;
|
||||
private Label labelJockeys;
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
using ProjectRacing.Repositories;
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
public partial class FormCompetition : Form
|
||||
{
|
||||
private readonly ICompetitionsRepository _competitionRepository;
|
||||
private readonly IParticipantsRepository _participantsRepository;
|
||||
private readonly IHorseRepository _horseRepository;
|
||||
private readonly IJockeyRepository _jockeyRepository;
|
||||
private int? _participantsId;
|
||||
private int? _competitionId;
|
||||
public int ID
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var competition = _competitionRepository.GetCompetitionById(value);
|
||||
if (competition == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(competition));
|
||||
}
|
||||
textBoxNameOfCompetition.Text = competition.Name;
|
||||
dateTimePickerDateOfCompetition.Text = competition.DateOfCompetitions.ToString();
|
||||
_competitionId = value;
|
||||
var participants = _participantsRepository.GetParticipantsById(value);
|
||||
if (participants == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(participants));
|
||||
}
|
||||
comboBoxJockeys.DataSource = _jockeyRepository.GetJockeys();
|
||||
comboBoxHorses.DataSource = _horseRepository.GetHorses();
|
||||
_participantsId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormCompetition(ICompetitionsRepository competitionRepository, IParticipantsRepository participantsRepository, IJockeyRepository jockeyRepository, IHorseRepository horseRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_competitionRepository = competitionRepository ?? throw new ArgumentNullException(nameof(competitionRepository));
|
||||
_participantsRepository = participantsRepository ?? throw new ArgumentNullException( nameof(participantsRepository));
|
||||
_horseRepository = horseRepository ?? throw new ArgumentNullException( nameof(horseRepository));
|
||||
_jockeyRepository = jockeyRepository ?? throw new ArgumentNullException(nameof(jockeyRepository));
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxNameOfCompetition.Text)) throw new Exception("Название соревнований не заполнено");
|
||||
if (string.IsNullOrWhiteSpace(textBoxAdressOfCompetition.Text)) throw new Exception("Место соревнований не заполнено");
|
||||
|
||||
if (_competitionId.HasValue)
|
||||
{
|
||||
_competitionRepository.UpdateCompetitions(_competitionId.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_competitionRepository.CreateCompetitions(CreateCompetition(0));
|
||||
}
|
||||
if (_participantsId.HasValue)
|
||||
_participantsRepository.UpdateParticipants(_participantsId.Value);
|
||||
else
|
||||
_participantsRepository.CreateParticipants(CreateParticipants(0));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonExit_Click(object sender, EventArgs e) => Close();
|
||||
private Entities.Competitions CreateCompetition(int id) => Entities.Competitions.CreateEntity(id, DateOnly.FromDateTime(dateTimePickerDateOfCompetition.Value), textBoxAdressOfCompetition.Text, textBoxNameOfCompetition.Text);
|
||||
private Entities.Participants CreateParticipants(int id) => Entities.Participants.CreateEntity(id, comboBoxJockeys.SelectedIndex, comboBoxHorses.SelectedIndex, _competitionId == null? 0 : (int)_competitionId, (int)numericUpDownPlace.Value);
|
||||
}
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
namespace ProjectRacing.Forms.Competitions
|
||||
{
|
||||
partial class FormCompetitions
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
buttonUpdate = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewCompetitionsAndParticipants = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewCompetitionsAndParticipants).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonDelete);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(684, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(116, 450);
|
||||
panel1.TabIndex = 4;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.BackgroundImage = Properties.Resources.icons8_update_64;
|
||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpdate.Location = new Point(16, 146);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(75, 61);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.icons8_delete_480;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(16, 79);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(75, 61);
|
||||
buttonDelete.TabIndex = 1;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += ButtonDelete_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.icons8_add_100;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(16, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 61);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewCompetitionsAndParticipants
|
||||
//
|
||||
dataGridViewCompetitionsAndParticipants.AllowUserToAddRows = false;
|
||||
dataGridViewCompetitionsAndParticipants.AllowUserToDeleteRows = false;
|
||||
dataGridViewCompetitionsAndParticipants.AllowUserToResizeColumns = false;
|
||||
dataGridViewCompetitionsAndParticipants.AllowUserToResizeRows = false;
|
||||
dataGridViewCompetitionsAndParticipants.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewCompetitionsAndParticipants.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewCompetitionsAndParticipants.Dock = DockStyle.Fill;
|
||||
dataGridViewCompetitionsAndParticipants.Location = new Point(0, 0);
|
||||
dataGridViewCompetitionsAndParticipants.MultiSelect = false;
|
||||
dataGridViewCompetitionsAndParticipants.Name = "dataGridViewCompetitionsAndParticipants";
|
||||
dataGridViewCompetitionsAndParticipants.ReadOnly = true;
|
||||
dataGridViewCompetitionsAndParticipants.RowHeadersVisible = false;
|
||||
dataGridViewCompetitionsAndParticipants.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewCompetitionsAndParticipants.Size = new Size(800, 450);
|
||||
dataGridViewCompetitionsAndParticipants.TabIndex = 5;
|
||||
//
|
||||
// FormCompetitions
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(dataGridViewCompetitionsAndParticipants);
|
||||
Name = "FormCompetitions";
|
||||
Text = "Соревнования";
|
||||
Load += FormCompetitions_Load_1;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewCompetitionsAndParticipants).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonDelete;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewCompetitionsAndParticipants;
|
||||
}
|
||||
}
|
@ -1,159 +0,0 @@
|
||||
using ProjectRacing.Repositories;
|
||||
using System.Data;
|
||||
using Unity;
|
||||
namespace ProjectRacing.Forms.Competitions
|
||||
{
|
||||
public partial class FormCompetitions : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly ICompetitionsRepository _competitionRepository;
|
||||
private readonly IParticipantsRepository _participantsRepository;
|
||||
private readonly IHorseRepository _horseRepository;
|
||||
private readonly IJockeyRepository _jockeyRepository;
|
||||
public FormCompetitions(IUnityContainer container, ICompetitionsRepository competitionRepository, IParticipantsRepository participantsRepository, IHorseRepository horseRepository, IJockeyRepository jockeyRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_competitionRepository = competitionRepository ?? throw new ArgumentNullException(nameof(competitionRepository));
|
||||
_participantsRepository = participantsRepository ?? throw new ArgumentNullException(nameof(participantsRepository));
|
||||
_horseRepository = horseRepository ?? throw new ArgumentNullException(nameof(horseRepository));
|
||||
_jockeyRepository = jockeyRepository ?? throw new ArgumentNullException(nameof(jockeyRepository));
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCompetition>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_competitionRepository.DeleteCompetitions(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormCompetition>();
|
||||
form.ID = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Получение данных из репозиториев
|
||||
var competitions = _competitionRepository.GetCompetitionses();
|
||||
var participants = _participantsRepository.GetParticipants();
|
||||
|
||||
// Создание DataTable для объединения данных
|
||||
var dataTable = new DataTable();
|
||||
|
||||
// Добавление столбцов для данных из Competitions
|
||||
dataTable.Columns.Add("CompetitionId", typeof(int));
|
||||
dataTable.Columns.Add("CompetitionName", typeof(string));
|
||||
dataTable.Columns.Add("CompetitionDate", typeof(DateOnly));
|
||||
dataTable.Columns.Add("CompetitionAdress",typeof(string));
|
||||
|
||||
|
||||
// Добавление столбцов для данных из Participants
|
||||
dataTable.Columns.Add("ParticipantId", typeof(int));
|
||||
dataTable.Columns.Add("JockeyName", typeof(string));
|
||||
dataTable.Columns.Add("HorseName", typeof(string));
|
||||
dataTable.Columns.Add("Place", typeof(int));
|
||||
// Объединение данных в DataTable
|
||||
foreach (var competition in competitions)
|
||||
{
|
||||
var row = dataTable.NewRow();
|
||||
row["CompetitionId"] = competition.Id;
|
||||
row["CompetitionName"] = competition.Name;
|
||||
row["CompetitionDate"] = competition.DateOfCompetitions;
|
||||
row["CompetitionAdress"] = competition.Adress;
|
||||
dataTable.Rows.Add(row);
|
||||
}
|
||||
|
||||
foreach (var participant in participants)
|
||||
{
|
||||
var row = dataTable.NewRow();
|
||||
row["ParticipantId"] = participant.ParticipantId;
|
||||
row["HorseName"] = _horseRepository.GetHorseById(participant.HorsesId).NameOfHorse;
|
||||
row["JockeyName"] = _jockeyRepository.GetJockeyById(participant.JockeyId).NameOfJockey;
|
||||
row["Place"] = participant.Place;
|
||||
dataTable.Rows.Add(row);
|
||||
}
|
||||
|
||||
// Установка источника данных для DataGridView
|
||||
dataGridViewCompetitionsAndParticipants.DataSource = dataTable;
|
||||
|
||||
// Убедитесь, что заголовки отображаются корректно
|
||||
dataGridViewCompetitionsAndParticipants.Columns["CompetitionId"].HeaderText = "ID Соревнования";
|
||||
dataGridViewCompetitionsAndParticipants.Columns["CompetitionName"].HeaderText = "Название Соревнования";
|
||||
dataGridViewCompetitionsAndParticipants.Columns["CompetitionDate"].HeaderText = "Дата соревнований";
|
||||
dataGridViewCompetitionsAndParticipants.Columns["CompetitionAdress"].HeaderText = "Адресс соревановний";
|
||||
dataGridViewCompetitionsAndParticipants.Columns["ParticipantId"].HeaderText = "ID участников";
|
||||
dataGridViewCompetitionsAndParticipants.Columns["JockeyName"].HeaderText = "Имя лошади";
|
||||
dataGridViewCompetitionsAndParticipants.Columns["HorseName"].HeaderText = "Имя жокея";
|
||||
dataGridViewCompetitionsAndParticipants.Columns["Place"].HeaderText = "Занятое место";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private bool TryGetIdentifierFromsSelectRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewCompetitionsAndParticipants.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewCompetitionsAndParticipants.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
private void FormCompetitions_Load_1(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
163
ProjectRacing/Forms/Horses/FormHorse.Designer.cs
generated
163
ProjectRacing/Forms/Horses/FormHorse.Designer.cs
generated
@ -1,163 +0,0 @@
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
partial class FormHorse
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelNameOfHorse = new Label();
|
||||
labelSex = new Label();
|
||||
labelDateOfBirthday = new Label();
|
||||
textBoxNameOfHorse = new TextBox();
|
||||
dateTimePickerDateOfBirthday = new DateTimePicker();
|
||||
buttonSave = new Button();
|
||||
buttonExit = new Button();
|
||||
labelOwner = new Label();
|
||||
comboBoxOwner = new ComboBox();
|
||||
comboBoxSex = new ComboBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelNameOfHorse
|
||||
//
|
||||
labelNameOfHorse.AutoSize = true;
|
||||
labelNameOfHorse.Location = new Point(12, 38);
|
||||
labelNameOfHorse.Name = "labelNameOfHorse";
|
||||
labelNameOfHorse.Size = new Size(94, 15);
|
||||
labelNameOfHorse.TabIndex = 0;
|
||||
labelNameOfHorse.Text = "Кличка лошади";
|
||||
//
|
||||
// labelSex
|
||||
//
|
||||
labelSex.AutoSize = true;
|
||||
labelSex.Location = new Point(18, 81);
|
||||
labelSex.Name = "labelSex";
|
||||
labelSex.Size = new Size(30, 15);
|
||||
labelSex.TabIndex = 1;
|
||||
labelSex.Text = "Пол";
|
||||
//
|
||||
// labelDateOfBirthday
|
||||
//
|
||||
labelDateOfBirthday.AutoSize = true;
|
||||
labelDateOfBirthday.Location = new Point(12, 120);
|
||||
labelDateOfBirthday.Name = "labelDateOfBirthday";
|
||||
labelDateOfBirthday.Size = new Size(90, 15);
|
||||
labelDateOfBirthday.TabIndex = 2;
|
||||
labelDateOfBirthday.Text = "Дата рождения";
|
||||
//
|
||||
// textBoxNameOfHorse
|
||||
//
|
||||
textBoxNameOfHorse.Location = new Point(112, 38);
|
||||
textBoxNameOfHorse.Name = "textBoxNameOfHorse";
|
||||
textBoxNameOfHorse.Size = new Size(100, 23);
|
||||
textBoxNameOfHorse.TabIndex = 3;
|
||||
//
|
||||
// dateTimePickerDateOfBirthday
|
||||
//
|
||||
dateTimePickerDateOfBirthday.Location = new Point(112, 120);
|
||||
dateTimePickerDateOfBirthday.Name = "dateTimePickerDateOfBirthday";
|
||||
dateTimePickerDateOfBirthday.Size = new Size(200, 23);
|
||||
dateTimePickerDateOfBirthday.TabIndex = 9;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(72, 149);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 10;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonExit
|
||||
//
|
||||
buttonExit.Location = new Point(203, 149);
|
||||
buttonExit.Name = "buttonExit";
|
||||
buttonExit.Size = new Size(75, 23);
|
||||
buttonExit.TabIndex = 11;
|
||||
buttonExit.Text = "Отмена";
|
||||
buttonExit.UseVisualStyleBackColor = true;
|
||||
buttonExit.Click += ButtonExit_Click;
|
||||
//
|
||||
// labelOwner
|
||||
//
|
||||
labelOwner.AutoSize = true;
|
||||
labelOwner.Location = new Point(12, 9);
|
||||
labelOwner.Name = "labelOwner";
|
||||
labelOwner.Size = new Size(59, 15);
|
||||
labelOwner.TabIndex = 12;
|
||||
labelOwner.Text = "Владелец";
|
||||
//
|
||||
// comboBoxOwner
|
||||
//
|
||||
comboBoxOwner.FormattingEnabled = true;
|
||||
comboBoxOwner.Location = new Point(112, 9);
|
||||
comboBoxOwner.Name = "comboBoxOwner";
|
||||
comboBoxOwner.Size = new Size(121, 23);
|
||||
comboBoxOwner.TabIndex = 13;
|
||||
//
|
||||
// comboBoxSex
|
||||
//
|
||||
comboBoxSex.FormattingEnabled = true;
|
||||
comboBoxSex.Location = new Point(62, 77);
|
||||
comboBoxSex.Name = "comboBoxSex";
|
||||
comboBoxSex.Size = new Size(121, 23);
|
||||
comboBoxSex.TabIndex = 16;
|
||||
//
|
||||
// FormHorse
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(328, 184);
|
||||
Controls.Add(comboBoxSex);
|
||||
Controls.Add(comboBoxOwner);
|
||||
Controls.Add(labelOwner);
|
||||
Controls.Add(buttonExit);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(dateTimePickerDateOfBirthday);
|
||||
Controls.Add(textBoxNameOfHorse);
|
||||
Controls.Add(labelDateOfBirthday);
|
||||
Controls.Add(labelSex);
|
||||
Controls.Add(labelNameOfHorse);
|
||||
Name = "FormHorse";
|
||||
Text = "Лошадь";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelNameOfHorse;
|
||||
private Label labelSex;
|
||||
private Label labelDateOfBirthday;
|
||||
private TextBox textBoxNameOfHorse;
|
||||
private DateTimePicker dateTimePickerDateOfBirthday;
|
||||
private Button buttonSave;
|
||||
private Button buttonExit;
|
||||
private Label labelOwner;
|
||||
private ComboBox comboBoxOwner;
|
||||
private ComboBox comboBoxSex;
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
using ProjectRacing.Entities.Enums;
|
||||
using ProjectRacing.Repositories;
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
public partial class FormHorse : Form
|
||||
{
|
||||
private readonly IHorseRepository _horseRepository;
|
||||
private int? _horseId;
|
||||
public int ID
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var horse = _horseRepository.GetHorseById(value);
|
||||
if (horse == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(horse));
|
||||
}
|
||||
textBoxNameOfHorse.Text = horse.NameOfHorse;
|
||||
dateTimePickerDateOfBirthday.Text = horse.Birthday.ToString();
|
||||
comboBoxOwner.SelectedValue = horse.OwnerId;
|
||||
comboBoxSex.SelectedValue = horse.Sex;
|
||||
_horseId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormHorse(IHorseRepository horseRepository, IOwnerRepository ownerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_horseRepository = horseRepository ?? throw new ArgumentNullException(nameof(horseRepository));
|
||||
comboBoxOwner.DataSource = ownerRepository.GetOwners();
|
||||
comboBoxOwner.DisplayMember = "NameOfOwner";
|
||||
comboBoxOwner.ValueMember = "Id";
|
||||
var healthStatusValues = Enum.GetValues(typeof(HealthStatus));
|
||||
var genders = Enum.GetValues(typeof(Gender));
|
||||
foreach (var gender in genders)
|
||||
{
|
||||
comboBoxSex.Items.Add(gender);
|
||||
}
|
||||
comboBoxSex.SelectedIndex = 0;
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(comboBoxOwner.SelectedIndex < 0) throw new Exception("Не выбран владелец");
|
||||
if (string.IsNullOrWhiteSpace(textBoxNameOfHorse.Text)) throw new Exception("Кличка не заполнена");
|
||||
if (comboBoxSex.SelectedIndex<0) throw new Exception("Не выбран пол");
|
||||
if (_horseId.HasValue)
|
||||
{
|
||||
_horseRepository.UpdateHorse(_horseId.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_horseRepository.CreateHorse(CreateHorse(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonExit_Click(object sender, EventArgs e) => Close();
|
||||
private Horse CreateHorse(int id)=> Horse.CreateEntity(id, textBoxNameOfHorse.Text, (Gender)comboBoxSex.SelectedValue!, DateOnly.FromDateTime(dateTimePickerDateOfBirthday.Value), (int)comboBoxOwner.SelectedValue!);
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
126
ProjectRacing/Forms/Horses/FormHorses.Designer.cs
generated
126
ProjectRacing/Forms/Horses/FormHorses.Designer.cs
generated
@ -1,126 +0,0 @@
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
partial class FormHorses
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
buttonUpdate = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewHorses = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewHorses).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonDelete);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(660, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(116, 428);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.BackgroundImage = Properties.Resources.icons8_update_64;
|
||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpdate.Location = new Point(16, 146);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(75, 61);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.icons8_delete_480;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(16, 79);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(75, 61);
|
||||
buttonDelete.TabIndex = 1;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += ButtonDelete_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.icons8_add_100;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(16, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 61);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewHorses
|
||||
//
|
||||
dataGridViewHorses.AllowUserToAddRows = false;
|
||||
dataGridViewHorses.AllowUserToDeleteRows = false;
|
||||
dataGridViewHorses.AllowUserToResizeColumns = false;
|
||||
dataGridViewHorses.AllowUserToResizeRows = false;
|
||||
dataGridViewHorses.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewHorses.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewHorses.Dock = DockStyle.Fill;
|
||||
dataGridViewHorses.Location = new Point(0, 0);
|
||||
dataGridViewHorses.MultiSelect = false;
|
||||
dataGridViewHorses.Name = "dataGridViewHorses";
|
||||
dataGridViewHorses.ReadOnly = true;
|
||||
dataGridViewHorses.RowHeadersVisible = false;
|
||||
dataGridViewHorses.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewHorses.Size = new Size(660, 428);
|
||||
dataGridViewHorses.TabIndex = 3;
|
||||
//
|
||||
// FormHorses
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(776, 428);
|
||||
Controls.Add(dataGridViewHorses);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormHorses";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Лошади";
|
||||
Load += FormHorses_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewHorses).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonDelete;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewHorses;
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
using ProjectRacing.Repositories;
|
||||
using Unity;
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
public partial class FormHorses : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IHorseRepository _horseRepository;
|
||||
public FormHorses(IUnityContainer container, IHorseRepository horseRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_horseRepository = horseRepository ?? throw new ArgumentNullException(nameof(horseRepository));
|
||||
}
|
||||
private void FormHorses_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<FormHorse>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_horseRepository.DeleteHorse(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormHorse>();
|
||||
form.ID = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridViewHorses.DataSource = _horseRepository.GetHorses();
|
||||
private bool TryGetIdentifierFromsSelectRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewHorses.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewHorses.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
190
ProjectRacing/Forms/Jockeys/FormJockey.Designer.cs
generated
190
ProjectRacing/Forms/Jockeys/FormJockey.Designer.cs
generated
@ -1,190 +0,0 @@
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
partial class FormJockey
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
textBoxNameOfJockey = new TextBox();
|
||||
numericUpDownAgeOfJockey = new NumericUpDown();
|
||||
numericUpDownRateOfJockey = new NumericUpDown();
|
||||
textBoxAdressOfJockey = new TextBox();
|
||||
textBoxNumberOfJockey = new TextBox();
|
||||
labelNameOfJockey = new Label();
|
||||
labelAdressOfJockey = new Label();
|
||||
labelNumberOfJockey = new Label();
|
||||
labelAgeOfJockey = new Label();
|
||||
labelRateOfJockey = new Label();
|
||||
buttonExit = new Button();
|
||||
buttonSave = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownAgeOfJockey).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownRateOfJockey).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// textBoxNameOfJockey
|
||||
//
|
||||
textBoxNameOfJockey.Location = new Point(67, 9);
|
||||
textBoxNameOfJockey.Name = "textBoxNameOfJockey";
|
||||
textBoxNameOfJockey.Size = new Size(100, 23);
|
||||
textBoxNameOfJockey.TabIndex = 0;
|
||||
//
|
||||
// numericUpDownAgeOfJockey
|
||||
//
|
||||
numericUpDownAgeOfJockey.Location = new Point(67, 94);
|
||||
numericUpDownAgeOfJockey.Minimum = new decimal(new int[] { 18, 0, 0, 0 });
|
||||
numericUpDownAgeOfJockey.Name = "numericUpDownAgeOfJockey";
|
||||
numericUpDownAgeOfJockey.Size = new Size(120, 23);
|
||||
numericUpDownAgeOfJockey.TabIndex = 1;
|
||||
numericUpDownAgeOfJockey.Value = new decimal(new int[] { 18, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownRateOfJockey
|
||||
//
|
||||
numericUpDownRateOfJockey.DecimalPlaces = 1;
|
||||
numericUpDownRateOfJockey.Location = new Point(67, 123);
|
||||
numericUpDownRateOfJockey.Name = "numericUpDownRateOfJockey";
|
||||
numericUpDownRateOfJockey.Size = new Size(120, 23);
|
||||
numericUpDownRateOfJockey.TabIndex = 2;
|
||||
//
|
||||
// textBoxAdressOfJockey
|
||||
//
|
||||
textBoxAdressOfJockey.Location = new Point(67, 36);
|
||||
textBoxAdressOfJockey.Name = "textBoxAdressOfJockey";
|
||||
textBoxAdressOfJockey.Size = new Size(100, 23);
|
||||
textBoxAdressOfJockey.TabIndex = 3;
|
||||
//
|
||||
// textBoxNumberOfJockey
|
||||
//
|
||||
textBoxNumberOfJockey.Location = new Point(67, 65);
|
||||
textBoxNumberOfJockey.Name = "textBoxNumberOfJockey";
|
||||
textBoxNumberOfJockey.Size = new Size(100, 23);
|
||||
textBoxNumberOfJockey.TabIndex = 4;
|
||||
//
|
||||
// labelNameOfJockey
|
||||
//
|
||||
labelNameOfJockey.AutoSize = true;
|
||||
labelNameOfJockey.Location = new Point(12, 9);
|
||||
labelNameOfJockey.Name = "labelNameOfJockey";
|
||||
labelNameOfJockey.Size = new Size(31, 15);
|
||||
labelNameOfJockey.TabIndex = 5;
|
||||
labelNameOfJockey.Text = "Имя";
|
||||
//
|
||||
// labelAdressOfJockey
|
||||
//
|
||||
labelAdressOfJockey.AutoSize = true;
|
||||
labelAdressOfJockey.Location = new Point(12, 39);
|
||||
labelAdressOfJockey.Name = "labelAdressOfJockey";
|
||||
labelAdressOfJockey.Size = new Size(40, 15);
|
||||
labelAdressOfJockey.TabIndex = 6;
|
||||
labelAdressOfJockey.Text = "Адрес";
|
||||
//
|
||||
// labelNumberOfJockey
|
||||
//
|
||||
labelNumberOfJockey.AutoSize = true;
|
||||
labelNumberOfJockey.Location = new Point(12, 68);
|
||||
labelNumberOfJockey.Name = "labelNumberOfJockey";
|
||||
labelNumberOfJockey.Size = new Size(56, 15);
|
||||
labelNumberOfJockey.TabIndex = 7;
|
||||
labelNumberOfJockey.Text = "Телефон";
|
||||
//
|
||||
// labelAgeOfJockey
|
||||
//
|
||||
labelAgeOfJockey.AutoSize = true;
|
||||
labelAgeOfJockey.Location = new Point(12, 96);
|
||||
labelAgeOfJockey.Name = "labelAgeOfJockey";
|
||||
labelAgeOfJockey.Size = new Size(50, 15);
|
||||
labelAgeOfJockey.TabIndex = 8;
|
||||
labelAgeOfJockey.Text = "Возраст";
|
||||
//
|
||||
// labelRateOfJockey
|
||||
//
|
||||
labelRateOfJockey.AutoSize = true;
|
||||
labelRateOfJockey.Location = new Point(12, 125);
|
||||
labelRateOfJockey.Name = "labelRateOfJockey";
|
||||
labelRateOfJockey.Size = new Size(51, 15);
|
||||
labelRateOfJockey.TabIndex = 9;
|
||||
labelRateOfJockey.Text = "Рейтинг";
|
||||
//
|
||||
// buttonExit
|
||||
//
|
||||
buttonExit.Location = new Point(144, 167);
|
||||
buttonExit.Name = "buttonExit";
|
||||
buttonExit.Size = new Size(75, 23);
|
||||
buttonExit.TabIndex = 11;
|
||||
buttonExit.Text = "Отмена";
|
||||
buttonExit.UseVisualStyleBackColor = true;
|
||||
buttonExit.Click += ButtonExit_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(12, 167);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 10;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// FormJockey
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(239, 217);
|
||||
Controls.Add(buttonExit);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(labelRateOfJockey);
|
||||
Controls.Add(labelAgeOfJockey);
|
||||
Controls.Add(labelNumberOfJockey);
|
||||
Controls.Add(labelAdressOfJockey);
|
||||
Controls.Add(labelNameOfJockey);
|
||||
Controls.Add(textBoxNumberOfJockey);
|
||||
Controls.Add(textBoxAdressOfJockey);
|
||||
Controls.Add(numericUpDownRateOfJockey);
|
||||
Controls.Add(numericUpDownAgeOfJockey);
|
||||
Controls.Add(textBoxNameOfJockey);
|
||||
Name = "FormJockey";
|
||||
Text = "Жокей";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownAgeOfJockey).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownRateOfJockey).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TextBox textBoxNameOfJockey;
|
||||
private NumericUpDown numericUpDownAgeOfJockey;
|
||||
private NumericUpDown numericUpDownRateOfJockey;
|
||||
private TextBox textBoxAdressOfJockey;
|
||||
private TextBox textBoxNumberOfJockey;
|
||||
private Label labelNameOfJockey;
|
||||
private Label labelAdressOfJockey;
|
||||
private Label labelNumberOfJockey;
|
||||
private Label labelAgeOfJockey;
|
||||
private Label labelRateOfJockey;
|
||||
private Button buttonExit;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
using ProjectRacing.Repositories;
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
public partial class FormJockey : Form
|
||||
{
|
||||
private readonly IJockeyRepository _jockeyRepository;
|
||||
private int? _jockeyId;
|
||||
public int ID
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var jockey = _jockeyRepository.GetJockeyById(value);
|
||||
if (jockey == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(jockey));
|
||||
}
|
||||
textBoxNumberOfJockey.Text = jockey.Number;
|
||||
numericUpDownAgeOfJockey.Value = jockey.Age;
|
||||
textBoxNameOfJockey.Text = jockey.NameOfJockey;
|
||||
_jockeyId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormJockey(IJockeyRepository jockeyRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_jockeyRepository = jockeyRepository ?? throw new ArgumentNullException(nameof(jockeyRepository));
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxAdressOfJockey.Text)) throw new Exception("Адрес жокея не заполнен");
|
||||
if (string.IsNullOrWhiteSpace(textBoxNameOfJockey.Text)) throw new Exception("Имя не заполнено");
|
||||
if (string.IsNullOrWhiteSpace(textBoxNumberOfJockey.Text)) throw new Exception("Номер не заполнен");
|
||||
if (_jockeyId.HasValue)
|
||||
{
|
||||
_jockeyRepository.UpdateJockey(_jockeyId.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_jockeyRepository.CreateJockey(CreateJockey(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonExit_Click(object sender, EventArgs e) => Close();
|
||||
private Entities.Jockey CreateJockey(int id) => Entities.Jockey.CreateEntity(id, textBoxNameOfJockey.Text, (int)numericUpDownAgeOfJockey.Value, (int)numericUpDownRateOfJockey.Value, textBoxNumberOfJockey.Text);
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
125
ProjectRacing/Forms/Jockeys/FormJockeys.Designer.cs
generated
125
ProjectRacing/Forms/Jockeys/FormJockeys.Designer.cs
generated
@ -1,125 +0,0 @@
|
||||
namespace ProjectRacing.Forms.Jockeys
|
||||
{
|
||||
partial class FormJockeys
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
buttonUpdate = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewHorses = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewHorses).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonDelete);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(684, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(116, 450);
|
||||
panel1.TabIndex = 6;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.BackgroundImage = Properties.Resources.icons8_update_64;
|
||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpdate.Location = new Point(16, 146);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(75, 61);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.icons8_delete_480;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(16, 79);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(75, 61);
|
||||
buttonDelete.TabIndex = 1;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += ButtonDelete_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.icons8_add_100;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(16, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 61);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewHorses
|
||||
//
|
||||
dataGridViewHorses.AllowUserToAddRows = false;
|
||||
dataGridViewHorses.AllowUserToDeleteRows = false;
|
||||
dataGridViewHorses.AllowUserToResizeColumns = false;
|
||||
dataGridViewHorses.AllowUserToResizeRows = false;
|
||||
dataGridViewHorses.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewHorses.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewHorses.Dock = DockStyle.Fill;
|
||||
dataGridViewHorses.Location = new Point(0, 0);
|
||||
dataGridViewHorses.MultiSelect = false;
|
||||
dataGridViewHorses.Name = "dataGridViewHorses";
|
||||
dataGridViewHorses.ReadOnly = true;
|
||||
dataGridViewHorses.RowHeadersVisible = false;
|
||||
dataGridViewHorses.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewHorses.Size = new Size(800, 450);
|
||||
dataGridViewHorses.TabIndex = 7;
|
||||
//
|
||||
// FormJockeys
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(dataGridViewHorses);
|
||||
Name = "FormJockeys";
|
||||
Text = "Жокеи";
|
||||
Load += FormJockeys_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewHorses).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonDelete;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewHorses;
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
using ProjectRacing.Repositories;
|
||||
using Unity;
|
||||
namespace ProjectRacing.Forms.Jockeys
|
||||
{
|
||||
public partial class FormJockeys : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IJockeyRepository _jockeyRepository;
|
||||
public FormJockeys(IUnityContainer container, IJockeyRepository jockeyRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_jockeyRepository = jockeyRepository ?? throw new ArgumentNullException(nameof(_jockeyRepository));
|
||||
}
|
||||
private void FormJockeys_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<FormJockey>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_jockeyRepository.DeleteJockey(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormJockey>();
|
||||
form.ID = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridViewHorses.DataSource = _jockeyRepository.GetJockeys();
|
||||
private bool TryGetIdentifierFromsSelectRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewHorses.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewHorses.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,139 +0,0 @@
|
||||
namespace ProjectRacing.Forms.MedicalExamination
|
||||
{
|
||||
partial class FormMedicalExamination
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelHorse = new Label();
|
||||
labelResult = new Label();
|
||||
labelDate = new Label();
|
||||
comboBoxHorses = new ComboBox();
|
||||
button1 = new Button();
|
||||
button2 = new Button();
|
||||
dateTimePickerMedicalExamination = new DateTimePicker();
|
||||
comboBoxResult = new ComboBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelHorse
|
||||
//
|
||||
labelHorse.AutoSize = true;
|
||||
labelHorse.Location = new Point(12, 12);
|
||||
labelHorse.Name = "labelHorse";
|
||||
labelHorse.Size = new Size(51, 15);
|
||||
labelHorse.TabIndex = 0;
|
||||
labelHorse.Text = "Лошадь";
|
||||
//
|
||||
// labelResult
|
||||
//
|
||||
labelResult.AutoSize = true;
|
||||
labelResult.Location = new Point(12, 88);
|
||||
labelResult.Name = "labelResult";
|
||||
labelResult.Size = new Size(60, 15);
|
||||
labelResult.TabIndex = 1;
|
||||
labelResult.Text = "Результат";
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(12, 53);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(32, 15);
|
||||
labelDate.TabIndex = 2;
|
||||
labelDate.Text = "Дата";
|
||||
//
|
||||
// comboBoxHorses
|
||||
//
|
||||
comboBoxHorses.FormattingEnabled = true;
|
||||
comboBoxHorses.Location = new Point(78, 12);
|
||||
comboBoxHorses.Name = "comboBoxHorses";
|
||||
comboBoxHorses.Size = new Size(121, 23);
|
||||
comboBoxHorses.TabIndex = 3;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.Location = new Point(12, 120);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(75, 23);
|
||||
button1.TabIndex = 4;
|
||||
button1.Text = "Сохранить";
|
||||
button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
button2.Location = new Point(124, 120);
|
||||
button2.Name = "button2";
|
||||
button2.Size = new Size(75, 23);
|
||||
button2.TabIndex = 5;
|
||||
button2.Text = "Отмена";
|
||||
button2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// dateTimePickerMedicalExamination
|
||||
//
|
||||
dateTimePickerMedicalExamination.Location = new Point(78, 53);
|
||||
dateTimePickerMedicalExamination.Name = "dateTimePickerMedicalExamination";
|
||||
dateTimePickerMedicalExamination.Size = new Size(200, 23);
|
||||
dateTimePickerMedicalExamination.TabIndex = 6;
|
||||
//
|
||||
// comboBoxResult
|
||||
//
|
||||
comboBoxResult.FormattingEnabled = true;
|
||||
comboBoxResult.Location = new Point(78, 85);
|
||||
comboBoxResult.Name = "comboBoxResult";
|
||||
comboBoxResult.Size = new Size(121, 23);
|
||||
comboBoxResult.TabIndex = 7;
|
||||
//
|
||||
// FormMedicalExamination
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(339, 220);
|
||||
Controls.Add(comboBoxResult);
|
||||
Controls.Add(dateTimePickerMedicalExamination);
|
||||
Controls.Add(button2);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(comboBoxHorses);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(labelResult);
|
||||
Controls.Add(labelHorse);
|
||||
Name = "FormMedicalExamination";
|
||||
Text = "Медицинское обследование";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelHorse;
|
||||
private Label labelResult;
|
||||
private Label labelDate;
|
||||
private ComboBox comboBoxHorses;
|
||||
private Button button1;
|
||||
private Button button2;
|
||||
private DateTimePicker dateTimePickerMedicalExamination;
|
||||
private ComboBox comboBoxResult;
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
using ProjectRacing.Entities;
|
||||
using ProjectRacing.Entities.Enums;
|
||||
using ProjectRacing.Repositories;
|
||||
|
||||
namespace ProjectRacing.Forms.MedicalExamination
|
||||
{
|
||||
public partial class FormMedicalExamination : Form
|
||||
{
|
||||
private readonly IMedicalExaminationRepository _medicalExaminationRepository;
|
||||
private int? _medicalExaminationId;
|
||||
public int ID
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var medicalExamination = _medicalExaminationRepository.GetMedicalExaminationById(value);
|
||||
if (medicalExamination == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(medicalExamination));
|
||||
}
|
||||
comboBoxHorses.SelectedValue = medicalExamination.HorseId;
|
||||
comboBoxResult.SelectedValue = medicalExamination.HealthStatus;
|
||||
_medicalExaminationId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormMedicalExamination(IHorseRepository horseRepository, IMedicalExaminationRepository medicalExamination)
|
||||
{
|
||||
InitializeComponent();
|
||||
_medicalExaminationRepository = medicalExamination ?? throw new ArgumentNullException(nameof(horseRepository));
|
||||
comboBoxHorses.DataSource = horseRepository.GetHorses();
|
||||
comboBoxHorses.DisplayMember = "NameOfHorse";
|
||||
comboBoxHorses.ValueMember = "Id";
|
||||
var healthStatusValues = Enum.GetValues(typeof(HealthStatus));
|
||||
foreach (var value in healthStatusValues)
|
||||
{
|
||||
comboBoxResult.Items.Add(value);
|
||||
}
|
||||
comboBoxResult.SelectedIndex = 0;
|
||||
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (_medicalExaminationId.HasValue)
|
||||
{
|
||||
_medicalExaminationRepository.UpdateMedicalExamination(_medicalExaminationId.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_medicalExaminationRepository.CreateMedicalExamination(CreateMedicalExamination(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonExit_Click(object sender, EventArgs e) => Close();
|
||||
private Entities.MedicalExamination CreateMedicalExamination(int id) => Entities.MedicalExamination.CreateEntity(id, DateOnly.FromDateTime(dateTimePickerMedicalExamination.Value),(HealthStatus)comboBoxResult.SelectedValue!, (int)comboBoxHorses.SelectedValue!);
|
||||
}
|
||||
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,125 +0,0 @@
|
||||
namespace ProjectRacing.Forms.MedicalExamination
|
||||
{
|
||||
partial class FormMedicalExaminations
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
buttonUpdate = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewHorses = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewHorses).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonDelete);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(684, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(116, 450);
|
||||
panel1.TabIndex = 8;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.BackgroundImage = Properties.Resources.icons8_update_64;
|
||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpdate.Location = new Point(16, 146);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(75, 61);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.icons8_delete_480;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(16, 79);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(75, 61);
|
||||
buttonDelete.TabIndex = 1;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += ButtonDelete_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.icons8_add_100;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(16, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 61);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewHorses
|
||||
//
|
||||
dataGridViewHorses.AllowUserToAddRows = false;
|
||||
dataGridViewHorses.AllowUserToDeleteRows = false;
|
||||
dataGridViewHorses.AllowUserToResizeColumns = false;
|
||||
dataGridViewHorses.AllowUserToResizeRows = false;
|
||||
dataGridViewHorses.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewHorses.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewHorses.Dock = DockStyle.Fill;
|
||||
dataGridViewHorses.Location = new Point(0, 0);
|
||||
dataGridViewHorses.MultiSelect = false;
|
||||
dataGridViewHorses.Name = "dataGridViewHorses";
|
||||
dataGridViewHorses.ReadOnly = true;
|
||||
dataGridViewHorses.RowHeadersVisible = false;
|
||||
dataGridViewHorses.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewHorses.Size = new Size(800, 450);
|
||||
dataGridViewHorses.TabIndex = 9;
|
||||
//
|
||||
// FormMedicalExaminations
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(dataGridViewHorses);
|
||||
Name = "FormMedicalExaminations";
|
||||
Text = "Медицинские обследования";
|
||||
Load += FormMedicalExaminations_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewHorses).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonDelete;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewHorses;
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
using ProjectRacing.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectRacing.Forms.MedicalExamination
|
||||
{
|
||||
public partial class FormMedicalExaminations : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IMedicalExaminationRepository _medicalExaminationRepository;
|
||||
public FormMedicalExaminations(IUnityContainer container, IMedicalExaminationRepository medicalExaminationRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_medicalExaminationRepository = medicalExaminationRepository ?? throw new ArgumentNullException(nameof(medicalExaminationRepository));
|
||||
}
|
||||
private void FormMedicalExaminations_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<FormMedicalExamination>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_medicalExaminationRepository.DeleteMedicalExamination(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormMedicalExamination>();
|
||||
form.ID = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridViewHorses.DataSource = _medicalExaminationRepository.GetMedicalExaminations();
|
||||
private bool TryGetIdentifierFromsSelectRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewHorses.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewHorses.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
139
ProjectRacing/Forms/Owners/FormOwner.Designer.cs
generated
139
ProjectRacing/Forms/Owners/FormOwner.Designer.cs
generated
@ -1,139 +0,0 @@
|
||||
namespace ProjectRacing.Forms.Owners
|
||||
{
|
||||
partial class FormOwner
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelNameOfOwner = new Label();
|
||||
labelNumberOfOwner = new Label();
|
||||
textBoxNumberOfOwner = new TextBox();
|
||||
textBoxNameOfOwner = new TextBox();
|
||||
labelAdressOfOwner = new Label();
|
||||
textBoxAdressOfOwner = new TextBox();
|
||||
buttonExit = new Button();
|
||||
buttonSave = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelNameOfOwner
|
||||
//
|
||||
labelNameOfOwner.AutoSize = true;
|
||||
labelNameOfOwner.Location = new Point(12, 15);
|
||||
labelNameOfOwner.Name = "labelNameOfOwner";
|
||||
labelNameOfOwner.Size = new Size(31, 15);
|
||||
labelNameOfOwner.TabIndex = 0;
|
||||
labelNameOfOwner.Text = "Имя";
|
||||
//
|
||||
// labelNumberOfOwner
|
||||
//
|
||||
labelNumberOfOwner.AutoSize = true;
|
||||
labelNumberOfOwner.Location = new Point(12, 58);
|
||||
labelNumberOfOwner.Name = "labelNumberOfOwner";
|
||||
labelNumberOfOwner.Size = new Size(56, 15);
|
||||
labelNumberOfOwner.TabIndex = 1;
|
||||
labelNumberOfOwner.Text = "Телефон";
|
||||
//
|
||||
// textBoxNumberOfOwner
|
||||
//
|
||||
textBoxNumberOfOwner.Location = new Point(74, 55);
|
||||
textBoxNumberOfOwner.Name = "textBoxNumberOfOwner";
|
||||
textBoxNumberOfOwner.Size = new Size(100, 23);
|
||||
textBoxNumberOfOwner.TabIndex = 2;
|
||||
//
|
||||
// textBoxNameOfOwner
|
||||
//
|
||||
textBoxNameOfOwner.Location = new Point(74, 15);
|
||||
textBoxNameOfOwner.Name = "textBoxNameOfOwner";
|
||||
textBoxNameOfOwner.Size = new Size(100, 23);
|
||||
textBoxNameOfOwner.TabIndex = 3;
|
||||
//
|
||||
// labelAdressOfOwner
|
||||
//
|
||||
labelAdressOfOwner.AutoSize = true;
|
||||
labelAdressOfOwner.Location = new Point(12, 90);
|
||||
labelAdressOfOwner.Name = "labelAdressOfOwner";
|
||||
labelAdressOfOwner.Size = new Size(40, 15);
|
||||
labelAdressOfOwner.TabIndex = 4;
|
||||
labelAdressOfOwner.Text = "Адрес";
|
||||
//
|
||||
// textBoxAdressOfOwner
|
||||
//
|
||||
textBoxAdressOfOwner.Location = new Point(74, 90);
|
||||
textBoxAdressOfOwner.Name = "textBoxAdressOfOwner";
|
||||
textBoxAdressOfOwner.Size = new Size(100, 23);
|
||||
textBoxAdressOfOwner.TabIndex = 5;
|
||||
//
|
||||
// buttonExit
|
||||
//
|
||||
buttonExit.Location = new Point(137, 134);
|
||||
buttonExit.Name = "buttonExit";
|
||||
buttonExit.Size = new Size(75, 23);
|
||||
buttonExit.TabIndex = 7;
|
||||
buttonExit.Text = "Отмена";
|
||||
buttonExit.UseVisualStyleBackColor = true;
|
||||
buttonExit.Click += ButtonExit_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(5, 134);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// FormOwner
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(215, 167);
|
||||
Controls.Add(buttonExit);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxAdressOfOwner);
|
||||
Controls.Add(labelAdressOfOwner);
|
||||
Controls.Add(textBoxNameOfOwner);
|
||||
Controls.Add(textBoxNumberOfOwner);
|
||||
Controls.Add(labelNumberOfOwner);
|
||||
Controls.Add(labelNameOfOwner);
|
||||
Name = "FormOwner";
|
||||
Text = "Владелец";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelNameOfOwner;
|
||||
private Label labelNumberOfOwner;
|
||||
private TextBox textBoxNumberOfOwner;
|
||||
private TextBox textBoxNameOfOwner;
|
||||
private Label labelAdressOfOwner;
|
||||
private TextBox textBoxAdressOfOwner;
|
||||
private Button buttonExit;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
using ProjectRacing.Repositories;
|
||||
namespace ProjectRacing.Forms.Owners
|
||||
{
|
||||
public partial class FormOwner : Form
|
||||
{
|
||||
private readonly IOwnerRepository _ownerRepository;
|
||||
private int? _ownerId;
|
||||
public int ID
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var owner = _ownerRepository.GetOwnerById(value);
|
||||
if (owner == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(owner));
|
||||
}
|
||||
textBoxAdressOfOwner.Text = owner.Adress;
|
||||
textBoxNameOfOwner.Text = owner.NameOfOwner;
|
||||
textBoxNumberOfOwner.Text = owner.Number;
|
||||
_ownerId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormOwner(IOwnerRepository ownerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_ownerRepository = ownerRepository ?? throw new ArgumentNullException(nameof(ownerRepository));
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxAdressOfOwner.Text)) throw new Exception("Адрес владельца не заполнен");
|
||||
if (string.IsNullOrWhiteSpace(textBoxNameOfOwner.Text)) throw new Exception("Имя не заполнено");
|
||||
if (string.IsNullOrWhiteSpace(textBoxNumberOfOwner.Text)) throw new Exception("Номер владельца не заполнен");
|
||||
|
||||
if (_ownerId.HasValue)
|
||||
{
|
||||
_ownerRepository.UpdateOwner(_ownerId.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ownerRepository.CreateOwner(CreateOwner(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonExit_Click(object sender, EventArgs e) => Close();
|
||||
private Entities.Owner CreateOwner(int id) => Entities.Owner.CreateEntity(id, textBoxNameOfOwner.Text, textBoxNumberOfOwner.Text, textBoxAdressOfOwner.Text);
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
125
ProjectRacing/Forms/Owners/FormOwners.Designer.cs
generated
125
ProjectRacing/Forms/Owners/FormOwners.Designer.cs
generated
@ -1,125 +0,0 @@
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
partial class FormOwners
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
buttonUpdate = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewHorses = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewHorses).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonDelete);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(684, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(116, 450);
|
||||
panel1.TabIndex = 6;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.BackgroundImage = Properties.Resources.icons8_update_64;
|
||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpdate.Location = new Point(16, 146);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(75, 61);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.icons8_delete_480;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(16, 79);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(75, 61);
|
||||
buttonDelete.TabIndex = 1;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += ButtonDelete_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.icons8_add_100;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(16, 12);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 61);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewHorses
|
||||
//
|
||||
dataGridViewHorses.AllowUserToAddRows = false;
|
||||
dataGridViewHorses.AllowUserToDeleteRows = false;
|
||||
dataGridViewHorses.AllowUserToResizeColumns = false;
|
||||
dataGridViewHorses.AllowUserToResizeRows = false;
|
||||
dataGridViewHorses.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewHorses.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewHorses.Dock = DockStyle.Fill;
|
||||
dataGridViewHorses.Location = new Point(0, 0);
|
||||
dataGridViewHorses.MultiSelect = false;
|
||||
dataGridViewHorses.Name = "dataGridViewHorses";
|
||||
dataGridViewHorses.ReadOnly = true;
|
||||
dataGridViewHorses.RowHeadersVisible = false;
|
||||
dataGridViewHorses.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewHorses.Size = new Size(800, 450);
|
||||
dataGridViewHorses.TabIndex = 7;
|
||||
//
|
||||
// FormOwners
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(dataGridViewHorses);
|
||||
Name = "FormOwners";
|
||||
Text = "Владельцы";
|
||||
Load += FormOwners_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewHorses).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonDelete;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewHorses;
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
using ProjectRacing.Forms.Owners;
|
||||
using ProjectRacing.Repositories;
|
||||
using Unity;
|
||||
namespace ProjectRacing.Forms
|
||||
{
|
||||
public partial class FormOwners : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IOwnerRepository _ownerRepository;
|
||||
public FormOwners(IUnityContainer container, IOwnerRepository ownerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_ownerRepository = ownerRepository ?? throw new ArgumentNullException(nameof(ownerRepository));
|
||||
}
|
||||
private void FormOwners_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<FormOwner>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_ownerRepository.DeleteOwner(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromsSelectRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormHorse>();
|
||||
form.ID = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridViewHorses.DataSource = _ownerRepository.GetOwners();
|
||||
private bool TryGetIdentifierFromsSelectRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewHorses.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewHorses.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,8 +1,3 @@
|
||||
|
||||
using ProjectRacing.Repositories;
|
||||
using ProjectRacing.Repositories.Implementations;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectRacing
|
||||
{
|
||||
internal static class Program
|
||||
@ -16,19 +11,7 @@ namespace ProjectRacing
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(CreateContainer().Resolve<FormRacing>());
|
||||
}
|
||||
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
container.RegisterType<ICompetitionsRepository, CompetitionsRepository>();
|
||||
container.RegisterType<IHorseRepository, HorseRepository>();
|
||||
container.RegisterType<IJockeyRepository, JockeyRepository>();
|
||||
container.RegisterType<IOwnerRepository, OwnerRepository>();
|
||||
container.RegisterType<IParticipantsRepository, ParticipantsRepository>();
|
||||
container.RegisterType < IMedicalExaminationRepository, MedicalExaminationRepository> ();
|
||||
return container;
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
@ -8,24 +8,4 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
<PackageReference Include="Unity.Container" Version="5.11.11" />
|
||||
</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
ProjectRacing/Properties/Resources.Designer.cs
generated
103
ProjectRacing/Properties/Resources.Designer.cs
generated
@ -1,103 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjectRacing.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("ProjectRacing.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 icons8_add_100 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-add-100", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_delete_480 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-delete-480", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_update_64 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-update-64", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap orig {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("orig", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="icons8-delete-480" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-delete-480.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="orig" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\orig.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-add-100" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-add-100.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-update-64" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-update-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
@ -1,10 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface ICompetitionsRepository
|
||||
{
|
||||
IEnumerable<Competitions> GetCompetitionses();
|
||||
Competitions GetCompetitionById(int id);
|
||||
void CreateCompetitions(Competitions competitions);
|
||||
void UpdateCompetitions(int id);
|
||||
void DeleteCompetitions(int id);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface IHorseRepository
|
||||
{
|
||||
IEnumerable<Horse> GetHorses();
|
||||
Horse GetHorseById(int id);
|
||||
void CreateHorse(Horse horse);
|
||||
void UpdateHorse(int id);
|
||||
void DeleteHorse(int id);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface IJockeyRepository
|
||||
{
|
||||
IEnumerable<Jockey> GetJockeys();
|
||||
Jockey GetJockeyById(int id);
|
||||
void CreateJockey(Jockey jockey);
|
||||
void UpdateJockey(int id);
|
||||
void DeleteJockey(int id);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface IMedicalExaminationRepository
|
||||
{
|
||||
IEnumerable<MedicalExamination> GetMedicalExaminations();
|
||||
MedicalExamination GetMedicalExaminationById(int id);
|
||||
void CreateMedicalExamination(MedicalExamination medicalExamination);
|
||||
void UpdateMedicalExamination(int id);
|
||||
void DeleteMedicalExamination(int id);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface IOwnerRepository
|
||||
{
|
||||
IEnumerable<Owner> GetOwners();
|
||||
Owner GetOwnerById(int id);
|
||||
void CreateOwner(Owner owner);
|
||||
void UpdateOwner(int id);
|
||||
void DeleteOwner(int id);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface IParticipantsRepository
|
||||
{
|
||||
IEnumerable<Participants> GetParticipants();
|
||||
Participants GetParticipantsById(int id);
|
||||
void CreateParticipants(Participants participants);
|
||||
void UpdateParticipants(int id);
|
||||
void DeleteParticipants(int id);
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
public class CompetitionsRepository : ICompetitionsRepository
|
||||
{
|
||||
public void CreateCompetitions(Competitions competitions)
|
||||
{
|
||||
|
||||
}
|
||||
public void DeleteCompetitions(int id)
|
||||
{
|
||||
|
||||
}
|
||||
public Competitions GetCompetitionById(int id)
|
||||
{
|
||||
return Competitions.CreateEntity(0, new DateOnly(0001,1,1), string.Empty, string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Competitions> GetCompetitionses()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
public void UpdateCompetitions(int id)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
public class HorseRepository : IHorseRepository
|
||||
{
|
||||
public void CreateHorse(Horse horse)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteHorse(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Horse GetHorseById(int id)
|
||||
{
|
||||
return Horse.CreateEntity(0, string.Empty, 0, new DateOnly(0001, 1, 1), 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Horse> GetHorses()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateHorse(int id)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
public class JockeyRepository : IJockeyRepository
|
||||
{
|
||||
public void CreateJockey(Jockey jockey)
|
||||
{
|
||||
|
||||
}
|
||||
public void DeleteJockey(int id)
|
||||
{
|
||||
|
||||
}
|
||||
public Jockey GetJockeyById(int id)
|
||||
{
|
||||
return Jockey.CreateEntity(0, string.Empty, 0, 0, string.Empty);
|
||||
}
|
||||
public IEnumerable<Jockey> GetJockeys()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
public void UpdateJockey(int id)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
public class MedicalExaminationRepository : IMedicalExaminationRepository
|
||||
{
|
||||
public void CreateMedicalExamination(Entities.MedicalExamination medicalExamination)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteMedicalExamination(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Entities.MedicalExamination GetMedicalExaminationById(int id)
|
||||
{
|
||||
return Entities.MedicalExamination.CreateEntity(0, new DateOnly(0001,1,1), 0, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Entities.MedicalExamination> GetMedicalExaminations()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateMedicalExamination(int id)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
public class OwnerRepository : IOwnerRepository
|
||||
{
|
||||
public void CreateOwner(Owner owner)
|
||||
{
|
||||
|
||||
}
|
||||
public void DeleteOwner(int id)
|
||||
{
|
||||
|
||||
}
|
||||
public IEnumerable<Owner> GetOwners()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
public Owner GetOwnerById(int id)
|
||||
{
|
||||
return Owner.CreateEntity(0, string.Empty, string.Empty, string.Empty);
|
||||
}
|
||||
public void UpdateOwner(int id)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
public class ParticipantsRepository : IParticipantsRepository
|
||||
{
|
||||
public void CreateParticipants(Participants participants)
|
||||
{
|
||||
|
||||
}
|
||||
public void DeleteParticipants(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<Participants> GetParticipants()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public Participants GetParticipantsById(int id)
|
||||
{
|
||||
return Participants.CreateEntity(0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void UpdateParticipants(int id)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 575 B |
Binary file not shown.
Before Width: | Height: | Size: 1.0 MiB |
Loading…
x
Reference in New Issue
Block a user