first form competitions

This commit is contained in:
Леонид Малафеев 2024-04-23 22:13:09 +04:00
parent 31b6c507a0
commit 86c241d5d5
91 changed files with 1130 additions and 90 deletions

Binary file not shown.

View File

@ -12,8 +12,8 @@ using SportCompetitionsDatabaseImplement;
namespace SportCompetitionsDatabaseImplement.Migrations
{
[DbContext(typeof(SportCompetitionsDatabase))]
[Migration("20240423155956_InitialCreate")]
partial class InitialCreate
[Migration("20240423180214_last")]
partial class last
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -117,6 +117,10 @@ namespace SportCompetitionsDatabaseImplement.Migrations
b.Property<int>("CompetitionId")
.HasColumnType("integer");
b.Property<string>("ResultName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ResultPosition")
.HasColumnType("integer");

View File

@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace SportCompetitionsDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
public partial class last : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -66,6 +66,7 @@ namespace SportCompetitionsDatabaseImplement.Migrations
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ResultName = table.Column<string>(type: "text", nullable: false),
CompetitionId = table.Column<int>(type: "integer", nullable: false),
TeamId = table.Column<int>(type: "integer", nullable: false),
ResultPosition = table.Column<int>(type: "integer", nullable: false)

View File

@ -114,6 +114,10 @@ namespace SportCompetitionsDatabaseImplement.Migrations
b.Property<int>("CompetitionId")
.HasColumnType("integer");
b.Property<string>("ResultName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ResultPosition")
.HasColumnType("integer");

View File

@ -21,4 +21,8 @@
<ProjectReference Include="..\SportCompetitionsDataModels\SportCompetitionsDataModels.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View File

@ -1 +1 @@
47b165a32d1f49cb0cbb35cfdd70c8678d128c43
dce225f560b6b8a2a84a1ab842296c141b60b367

View File

@ -1,39 +0,0 @@
namespace SportCompetitionsView
{
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
}
}

View File

@ -1,10 +0,0 @@
namespace SportCompetitionsView
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,140 @@
namespace SportCompetitionsView
{
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()
{
label1 = new Label();
label2 = new Label();
label3 = new Label();
textBoxName = new TextBox();
textBoxCity = new TextBox();
dateTimePicker1 = new DateTimePicker();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(22, 22);
label1.Name = "label1";
label1.Size = new Size(59, 15);
label1.TabIndex = 0;
label1.Text = "Название";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(22, 47);
label2.Name = "label2";
label2.Size = new Size(100, 15);
label2.TabIndex = 1;
label2.Text = "Дата проведения";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(22, 75);
label3.Name = "label3";
label3.Size = new Size(40, 15);
label3.TabIndex = 2;
label3.Text = "Город";
//
// textBoxName
//
textBoxName.Location = new Point(140, 19);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(149, 23);
textBoxName.TabIndex = 3;
//
// textBoxCity
//
textBoxCity.Location = new Point(140, 75);
textBoxCity.Name = "textBoxCity";
textBoxCity.Size = new Size(149, 23);
textBoxCity.TabIndex = 4;
//
// dateTimePicker1
//
dateTimePicker1.Location = new Point(140, 46);
dateTimePicker1.Name = "dateTimePicker1";
dateTimePicker1.Size = new Size(149, 23);
dateTimePicker1.TabIndex = 5;
//
// buttonSave
//
buttonSave.Location = new Point(133, 123);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(75, 23);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(214, 123);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(75, 23);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отменить";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// FormCompetition
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(320, 158);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(dateTimePicker1);
Controls.Add(textBoxCity);
Controls.Add(textBoxName);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Name = "FormCompetition";
Text = "Соревнование";
Load += FormCompetition_Load;
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label label1;
private Label label2;
private Label label3;
private TextBox textBoxName;
private TextBox textBoxCity;
private DateTimePicker dateTimePicker1;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,90 @@
using SportCompetitionsContracts.BindingModels;
using SportCompetitionsContracts.BusinessLogicsContracts;
using SportCompetitionsContracts.SearchModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SportCompetitionsView
{
public partial class FormCompetition : Form
{
private readonly ICompetitionLogic _logic;
private int? _id;
public int Id
{
set { _id = value; }
}
public FormCompetition(ICompetitionLogic logic)
{
InitializeComponent();
_logic = logic;
}
private void FormCompetition_Load(object sender, EventArgs e)
{
if (_id.HasValue)
{
try
{
var view = _logic.ReadElement(new CompetitionSearchModel { Id = _id.Value });
if (view != null)
{
textBoxName.Text = view.CompetitionName;
dateTimePicker1.Value = (DateTime)view.CompetitionDateHolding;
textBoxCity.Text = view.CompetitionCity;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void buttonSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxName.Text))
{
MessageBox.Show("Заполните Имя", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
try
{
var model = new CompetitionBindingModel
{
Id = _id ?? 0,
CompetitionName = textBoxName.Text,
CompetitionDateHolding = dateTimePicker1.Value,
CompetitionCity = textBoxCity.Text,
};
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Доп информация в логах.");
}
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

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

View File

@ -0,0 +1,100 @@
namespace SportCompetitionsView
{
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()
{
dataGridView1 = new DataGridView();
buttonAdd = new Button();
buttonEdit = new Button();
buttonDel = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// dataGridView1
//
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Location = new Point(12, 12);
dataGridView1.Name = "dataGridView1";
dataGridView1.RowTemplate.Height = 25;
dataGridView1.Size = new Size(510, 426);
dataGridView1.TabIndex = 0;
//
// buttonAdd
//
buttonAdd.Location = new Point(561, 12);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(128, 43);
buttonAdd.TabIndex = 1;
buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// buttonEdit
//
buttonEdit.Location = new Point(561, 74);
buttonEdit.Name = "buttonEdit";
buttonEdit.Size = new Size(128, 44);
buttonEdit.TabIndex = 2;
buttonEdit.Text = "Изменить";
buttonEdit.UseVisualStyleBackColor = true;
buttonEdit.Click += buttonUpd_Click;
//
// buttonDel
//
buttonDel.Location = new Point(561, 137);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(128, 42);
buttonDel.TabIndex = 3;
buttonDel.Text = "Удалить";
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += buttonDel_Click;
//
// FormCompetitions
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(705, 450);
Controls.Add(buttonDel);
Controls.Add(buttonEdit);
Controls.Add(buttonAdd);
Controls.Add(dataGridView1);
Name = "FormCompetitions";
Text = "FormCompetitions";
Load += FormCompetitions_Load;
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView1;
private Button buttonAdd;
private Button buttonEdit;
private Button buttonDel;
}
}

View File

@ -0,0 +1,98 @@
using SportCompetitionsContracts.BindingModels;
using SportCompetitionsContracts.BusinessLogicsContracts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SportCompetitionsView
{
public partial class FormCompetitions : Form
{
private readonly ICompetitionLogic _logic;
public FormCompetitions(ICompetitionLogic logic)
{
InitializeComponent();
_logic = logic;
}
private void FormCompetitions_Load(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
dataGridView1.DataSource = list;
dataGridView1.Columns["Id"].Visible = false;
dataGridView1.Columns["CompetitionName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCompetition));
if (service is FormCompetition form)
{
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
private void buttonUpd_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCompetition));
if (service is FormCompetition form)
{
form.Id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
}
private void buttonDel_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count == 1)
{
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
try
{
if (!_logic.Delete(new CompetitionBindingModel { Id = id }))
{
throw new Exception("Ошибка при удалении. Доп информация в логах");
}
LoadData();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

106
SportCompetitionsView/FormMain.Designer.cs generated Normal file
View File

@ -0,0 +1,106 @@
namespace SportCompetitionsView
{
partial class FormMain
{
/// <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()
{
dataGridView1 = new DataGridView();
menuStrip1 = new MenuStrip();
toolStripMenuItem1 = new ToolStripMenuItem();
toolStripMenuItem2 = new ToolStripMenuItem();
button1 = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// dataGridView1
//
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Location = new Point(12, 41);
dataGridView1.Name = "dataGridView1";
dataGridView1.RowTemplate.Height = 25;
dataGridView1.Size = new Size(583, 397);
dataGridView1.TabIndex = 0;
//
// menuStrip1
//
menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem1, toolStripMenuItem2 });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(800, 24);
menuStrip1.TabIndex = 1;
menuStrip1.Text = "menuStrip1";
//
// toolStripMenuItem1
//
toolStripMenuItem1.Name = "toolStripMenuItem1";
toolStripMenuItem1.Size = new Size(99, 20);
toolStripMenuItem1.Text = "Соревнования";
toolStripMenuItem1.Click += CompetitionToolStripMenuItem_Click;
//
// toolStripMenuItem2
//
toolStripMenuItem2.Name = "toolStripMenuItem2";
toolStripMenuItem2.Size = new Size(125, 20);
toolStripMenuItem2.Text = "toolStripMenuItem2";
//
// button1
//
button1.Location = new Point(620, 41);
button1.Name = "button1";
button1.Size = new Size(138, 41);
button1.TabIndex = 2;
button1.Text = "button1";
button1.UseVisualStyleBackColor = true;
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(button1);
Controls.Add(dataGridView1);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Name = "FormMain";
Text = "Form1";
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private DataGridView dataGridView1;
private MenuStrip menuStrip1;
private ToolStripMenuItem toolStripMenuItem1;
private ToolStripMenuItem toolStripMenuItem2;
private Button button1;
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SportCompetitionsView
{
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
}
private void CompetitionToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCompetitions));
if (service is FormCompetitions form)
{
form.ShowDialog();
}
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,113 @@
namespace SportCompetitionsView
{
partial class FormMember
{
/// <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()
{
label1 = new Label();
textBoxFCs = new TextBox();
dateTimePicker1 = new DateTimePicker();
label2 = new Label();
textBoxGender = new TextBox();
label3 = new Label();
SuspendLayout();
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 25);
label1.Name = "label1";
label1.Size = new Size(37, 15);
label1.TabIndex = 0;
label1.Text = "ФИО:";
//
// textBoxFCs
//
textBoxFCs.Location = new Point(108, 22);
textBoxFCs.Name = "textBoxFCs";
textBoxFCs.Size = new Size(200, 23);
textBoxFCs.TabIndex = 1;
//
// dateTimePicker1
//
dateTimePicker1.Location = new Point(108, 57);
dateTimePicker1.Name = "dateTimePicker1";
dateTimePicker1.Size = new Size(200, 23);
dateTimePicker1.TabIndex = 2;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(9, 63);
label2.Name = "label2";
label2.Size = new Size(93, 15);
label2.TabIndex = 3;
label2.Text = "Дата рождения:";
//
// textBoxGender
//
textBoxGender.Location = new Point(108, 95);
textBoxGender.Name = "textBoxGender";
textBoxGender.Size = new Size(200, 23);
textBoxGender.TabIndex = 4;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(12, 98);
label3.Name = "label3";
label3.Size = new Size(45, 15);
label3.TabIndex = 5;
label3.Text = "Гендер";
//
// FormMember
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(label3);
Controls.Add(textBoxGender);
Controls.Add(label2);
Controls.Add(dateTimePicker1);
Controls.Add(textBoxFCs);
Controls.Add(label1);
Name = "FormMember";
Text = "FormMember";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label label1;
private TextBox textBoxFCs;
private DateTimePicker dateTimePicker1;
private Label label2;
private TextBox textBoxGender;
private Label label3;
}
}

View File

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

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection;
using SportCompetitionsBusinessLogic.BusinessLogics;
using SportCompetitionsContracts.BusinessLogicsContracts;
using SportCompetitionsContracts.StoragesContracts;
using SportCompetitionsDatabaseImplement.Implements;
namespace SportCompetitionsView
{
@ -22,16 +23,16 @@ namespace SportCompetitionsView
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<Form1>());
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
/*services.AddTransient<ICompetitionStorage, CompetitionStorage>();
services.AddTransient<ICompetitionStorage, CompetitionStorage>();
services.AddTransient<IMemberStorage, MemberStorage>();
services.AddTransient<IRecordStorage, RecordStorage>();
services.AddTransient<IResultStorage, ResultStorage>();
services.AddTransient<ITeamStorage, TeamStorage>();*/
services.AddTransient<ITeamStorage, TeamStorage>();
services.AddTransient<ICompetitionLogic, CompetitionLogic>();
services.AddTransient<IMemberLogic, MemberLogic>();
@ -39,7 +40,11 @@ namespace SportCompetitionsView
services.AddTransient<IResultLogic, ResultLogic>();
services.AddTransient<ITeamLogic, TeamLogic>();
services.AddTransient<Form1>();
services.AddTransient<FormMain>();
services.AddTransient<FormMember>();
services.AddTransient<FormCompetition>();
services.AddTransient<FormCompetitions>();
}
}

View File

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Update="Form1.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>
<ItemGroup>
<Compile Update="FormCompetition.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="FormCompetitions.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="FormMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="FormMember.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>

View File

@ -1 +1 @@
0d11500edfe4093694b064a1467527b62f0dc9bb
54f36bd89d9cc2f0e06afb0208063d327fcde358

View File

@ -19,7 +19,6 @@ F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\bin\Debug\net7.0-windows\Mi
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\bin\Debug\net7.0-windows\Microsoft.Extensions.Options.dll
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\bin\Debug\net7.0-windows\Microsoft.Extensions.Primitives.dll
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\bin\Debug\net7.0-windows\Mono.TextTemplating.dll
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\obj\Debug\net7.0-windows\SportCompetitionsView.Form1.resources
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\obj\Debug\net7.0-windows\SportCompetitionsView.csproj.GenerateResource.cache
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\obj\Debug\net7.0-windows\SportCompetitionsView.GeneratedMSBuildEditorConfig.editorconfig
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\obj\Debug\net7.0-windows\SportCompetitionsView.AssemblyInfoInputs.cache
@ -42,3 +41,7 @@ F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\bin\Debug\net7.0-windows\Sp
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\bin\Debug\net7.0-windows\SportCompetitionsDatabaseImplement.pdb
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\bin\Debug\net7.0-windows\SportCompetitionsDataModels.pdb
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\obj\Debug\net7.0-windows\SportCompetitionsView.csproj.AssemblyReference.cache
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\obj\Debug\net7.0-windows\SportCompetitionsView.FormCompetition.resources
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\obj\Debug\net7.0-windows\SportCompetitionsView.FormMain.resources
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\obj\Debug\net7.0-windows\SportCompetitionsView.FormMember.resources
F:\SUBD\lab4\SportCompetitions\SportCompetitionsView\obj\Debug\net7.0-windows\SportCompetitionsView.FormCompetitions.resources