Добавлена функциональность форм. (Лаба 1усл. готова)

This commit is contained in:
Андрей Байгулов 2024-02-29 22:07:10 +04:00
parent c61f016d73
commit f879c63415
10 changed files with 474 additions and 114 deletions

View File

@ -28,12 +28,115 @@
/// </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 = "FormCreateSupply";
labelShop = new Label();
labelSushi = new Label();
labelCount = new Label();
comboBoxShop = new ComboBox();
comboBoxSushi = new ComboBox();
textBoxCount = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// labelShop
//
labelShop.AutoSize = true;
labelShop.Location = new Point(12, 25);
labelShop.Name = "labelShop";
labelShop.Size = new Size(57, 15);
labelShop.TabIndex = 0;
labelShop.Text = "Магазин:";
//
// labelSushi
//
labelSushi.AutoSize = true;
labelSushi.Location = new Point(12, 62);
labelSushi.Name = "labelSushi";
labelSushi.Size = new Size(56, 15);
labelSushi.TabIndex = 1;
labelSushi.Text = "Изделие:";
//
// labelCount
//
labelCount.AutoSize = true;
labelCount.Location = new Point(12, 99);
labelCount.Name = "labelCount";
labelCount.Size = new Size(75, 15);
labelCount.TabIndex = 2;
labelCount.Text = "Количество:";
//
// comboBoxShop
//
comboBoxShop.FormattingEnabled = true;
comboBoxShop.Location = new Point(100, 22);
comboBoxShop.Name = "comboBoxShop";
comboBoxShop.Size = new Size(239, 23);
comboBoxShop.TabIndex = 3;
//
// comboBoxSushi
//
comboBoxSushi.FormattingEnabled = true;
comboBoxSushi.Location = new Point(100, 59);
comboBoxSushi.Name = "comboBoxSushi";
comboBoxSushi.Size = new Size(239, 23);
comboBoxSushi.TabIndex = 4;
//
// textBoxCount
//
textBoxCount.Location = new Point(100, 96);
textBoxCount.Name = "textBoxCount";
textBoxCount.Size = new Size(239, 23);
textBoxCount.TabIndex = 5;
//
// buttonSave
//
buttonSave.Location = new Point(39, 138);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(118, 44);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(199, 138);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(118, 44);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormCreateSupply
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(351, 194);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxCount);
Controls.Add(comboBoxSushi);
Controls.Add(comboBoxShop);
Controls.Add(labelCount);
Controls.Add(labelSushi);
Controls.Add(labelShop);
Name = "FormCreateSupply";
Text = "Создание поставки";
Load += FormCreateSupply_Load;
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelShop;
private Label labelSushi;
private Label labelCount;
private ComboBox comboBoxShop;
private ComboBox comboBoxSushi;
private TextBox textBoxCount;
private Button buttonSave;
private Button buttonCancel;
}
}

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

@ -38,6 +38,9 @@
toolStripMenuItem = new ToolStripMenuItem();
componentsToolStripMenuItem = new ToolStripMenuItem();
sushiToolStripMenuItem = new ToolStripMenuItem();
shopsToolStripMenuItem = new ToolStripMenuItem();
othersToolStripMenuItem = new ToolStripMenuItem();
supplyToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip.SuspendLayout();
SuspendLayout();
@ -49,12 +52,12 @@
dataGridView.Location = new Point(1, 29);
dataGridView.Name = "dataGridView";
dataGridView.RowTemplate.Height = 25;
dataGridView.Size = new Size(1080, 307);
dataGridView.Size = new Size(792, 307);
dataGridView.TabIndex = 0;
//
// ButtonCreateOrder
//
ButtonCreateOrder.Location = new Point(1087, 41);
ButtonCreateOrder.Location = new Point(818, 29);
ButtonCreateOrder.Name = "ButtonCreateOrder";
ButtonCreateOrder.Size = new Size(147, 33);
ButtonCreateOrder.TabIndex = 1;
@ -64,7 +67,7 @@
//
// ButtonTakeOrderInWork
//
ButtonTakeOrderInWork.Location = new Point(1087, 80);
ButtonTakeOrderInWork.Location = new Point(818, 68);
ButtonTakeOrderInWork.Name = "ButtonTakeOrderInWork";
ButtonTakeOrderInWork.Size = new Size(147, 33);
ButtonTakeOrderInWork.TabIndex = 2;
@ -74,7 +77,7 @@
//
// ButtonOrderReady
//
ButtonOrderReady.Location = new Point(1087, 119);
ButtonOrderReady.Location = new Point(818, 107);
ButtonOrderReady.Name = "ButtonOrderReady";
ButtonOrderReady.Size = new Size(147, 33);
ButtonOrderReady.TabIndex = 3;
@ -84,7 +87,7 @@
//
// ButtonIssuedOrder
//
ButtonIssuedOrder.Location = new Point(1087, 158);
ButtonIssuedOrder.Location = new Point(818, 146);
ButtonIssuedOrder.Name = "ButtonIssuedOrder";
ButtonIssuedOrder.Size = new Size(147, 33);
ButtonIssuedOrder.TabIndex = 4;
@ -94,7 +97,7 @@
//
// ButtonRef
//
ButtonRef.Location = new Point(1087, 197);
ButtonRef.Location = new Point(818, 185);
ButtonRef.Name = "ButtonRef";
ButtonRef.Size = new Size(147, 33);
ButtonRef.TabIndex = 5;
@ -104,16 +107,16 @@
//
// menuStrip
//
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem });
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, othersToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(1265, 24);
menuStrip.Size = new Size(1014, 24);
menuStrip.TabIndex = 6;
menuStrip.Text = "menuStrip1";
//
// toolStripMenuItem
//
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, sushiToolStripMenuItem });
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, sushiToolStripMenuItem, shopsToolStripMenuItem });
toolStripMenuItem.Name = "toolStripMenuItem";
toolStripMenuItem.Size = new Size(94, 20);
toolStripMenuItem.Text = "Справочники";
@ -121,22 +124,43 @@
// componentsToolStripMenuItem
//
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
componentsToolStripMenuItem.Size = new Size(145, 22);
componentsToolStripMenuItem.Size = new Size(180, 22);
componentsToolStripMenuItem.Text = "Компоненты";
componentsToolStripMenuItem.Click += componentsToolStripMenuItem_Click;
//
// sushiToolStripMenuItem
//
sushiToolStripMenuItem.Name = "sushiToolStripMenuItem";
sushiToolStripMenuItem.Size = new Size(145, 22);
sushiToolStripMenuItem.Size = new Size(180, 22);
sushiToolStripMenuItem.Text = "Суши";
sushiToolStripMenuItem.Click += sushiToolStripMenuItem_Click;
//
// shopsToolStripMenuItem
//
shopsToolStripMenuItem.Name = "shopsToolStripMenuItem";
shopsToolStripMenuItem.Size = new Size(180, 22);
shopsToolStripMenuItem.Text = "Магазины";
this.shopsToolStripMenuItem.Click += new System.EventHandler(this.shopsToolStripMenuItem_Click);
//
// othersToolStripMenuItem
//
othersToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { supplyToolStripMenuItem });
othersToolStripMenuItem.Name = "othersToolStripMenuItem";
othersToolStripMenuItem.Size = new Size(61, 20);
othersToolStripMenuItem.Text = "Прочее";
//
// supplyToolStripMenuItem
//
supplyToolStripMenuItem.Name = "supplyToolStripMenuItem";
supplyToolStripMenuItem.Size = new Size(198, 22);
supplyToolStripMenuItem.Text = "Пополнение магазина";
this.supplyToolStripMenuItem.Click += new System.EventHandler(this.supplyToolStripMenuItem_Click);
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1265, 337);
ClientSize = new Size(1014, 337);
Controls.Add(ButtonRef);
Controls.Add(ButtonIssuedOrder);
Controls.Add(ButtonOrderReady);
@ -167,5 +191,8 @@
private ToolStripMenuItem toolStripMenuItem;
private ToolStripMenuItem componentsToolStripMenuItem;
private ToolStripMenuItem sushiToolStripMenuItem;
private ToolStripMenuItem shopsToolStripMenuItem;
private ToolStripMenuItem othersToolStripMenuItem;
private ToolStripMenuItem supplyToolStripMenuItem;
}
}

View File

@ -169,7 +169,7 @@ namespace SushiBarView
}
}
private void transactionToolStripMenuItem_Click(object sender, EventArgs e)
private void supplyToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCreateSupply));
if (service is FormCreateSupply form)

View File

@ -28,12 +28,156 @@
/// </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 = "FormShop";
ButtonSave = new Button();
ButtonCancel = new Button();
dataGridViewShop = new DataGridView();
id = new DataGridViewTextBoxColumn();
SushiName = new DataGridViewTextBoxColumn();
SushiCount = new DataGridViewTextBoxColumn();
labelName = new Label();
labelAdress = new Label();
labelOpenDate = new Label();
textBoxName = new TextBox();
textBoxAdress = new TextBox();
dateTimeOpenShop = new DateTimePicker();
((System.ComponentModel.ISupportInitialize)dataGridViewShop).BeginInit();
SuspendLayout();
//
// ButtonSave
//
ButtonSave.Location = new Point(351, 381);
ButtonSave.Name = "ButtonSave";
ButtonSave.Size = new Size(125, 45);
ButtonSave.TabIndex = 0;
ButtonSave.Text = "Сохранить";
ButtonSave.UseVisualStyleBackColor = true;
ButtonSave.Click += ButtonSave_Click;
//
// ButtonCancel
//
ButtonCancel.Location = new Point(486, 381);
ButtonCancel.Name = "ButtonCancel";
ButtonCancel.Size = new Size(125, 45);
ButtonCancel.TabIndex = 1;
ButtonCancel.Text = "Отмена";
ButtonCancel.UseVisualStyleBackColor = true;
ButtonCancel.Click += ButtonCancel_Click;
//
// dataGridViewShop
//
dataGridViewShop.AllowUserToAddRows = false;
dataGridViewShop.AllowUserToDeleteRows = false;
dataGridViewShop.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewShop.BackgroundColor = SystemColors.Control;
dataGridViewShop.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewShop.Columns.AddRange(new DataGridViewColumn[] { id, SushiName, SushiCount });
dataGridViewShop.GridColor = SystemColors.Control;
dataGridViewShop.Location = new Point(12, 135);
dataGridViewShop.Name = "dataGridViewShop";
dataGridViewShop.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders;
dataGridViewShop.RowTemplate.Height = 25;
dataGridViewShop.Size = new Size(611, 240);
dataGridViewShop.TabIndex = 2;
//
// id
//
id.HeaderText = "id";
id.Name = "id";
id.Visible = false;
//
// SushiName
//
SushiName.HeaderText = "Суши";
SushiName.Name = "SushiName";
//
// SushiCount
//
SushiCount.HeaderText = "Количество";
SushiCount.Name = "SushiCount";
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(23, 24);
labelName.Name = "labelName";
labelName.Size = new Size(62, 15);
labelName.TabIndex = 3;
labelName.Text = "Название:";
//
// labelAdress
//
labelAdress.AutoSize = true;
labelAdress.Location = new Point(23, 57);
labelAdress.Name = "labelAdress";
labelAdress.Size = new Size(43, 15);
labelAdress.TabIndex = 4;
labelAdress.Text = "Адрес:";
//
// labelOpenDate
//
labelOpenDate.AutoSize = true;
labelOpenDate.Location = new Point(23, 94);
labelOpenDate.Name = "labelOpenDate";
labelOpenDate.Size = new Size(90, 15);
labelOpenDate.TabIndex = 5;
labelOpenDate.Text = "Дата открытия:";
//
// textBoxName
//
textBoxName.Location = new Point(95, 21);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(491, 23);
textBoxName.TabIndex = 6;
//
// textBoxAdress
//
textBoxAdress.Location = new Point(95, 57);
textBoxAdress.Name = "textBoxAdress";
textBoxAdress.Size = new Size(491, 23);
textBoxAdress.TabIndex = 7;
//
// dateTimeOpenShop
//
dateTimeOpenShop.Location = new Point(119, 94);
dateTimeOpenShop.Name = "dateTimeOpenShop";
dateTimeOpenShop.Size = new Size(144, 23);
dateTimeOpenShop.TabIndex = 8;
//
// FormShop
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(635, 438);
Controls.Add(dateTimeOpenShop);
Controls.Add(textBoxAdress);
Controls.Add(textBoxName);
Controls.Add(labelOpenDate);
Controls.Add(labelAdress);
Controls.Add(labelName);
Controls.Add(dataGridViewShop);
Controls.Add(ButtonCancel);
Controls.Add(ButtonSave);
Name = "FormShop";
Text = "Магазин";
Load += FormShop_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewShop).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button ButtonSave;
private Button ButtonCancel;
private DataGridView dataGridViewShop;
private Label labelName;
private Label labelAdress;
private Label labelOpenDate;
private TextBox textBoxName;
private TextBox textBoxAdress;
private DateTimePicker dateTimeOpenShop;
private DataGridViewTextBoxColumn id;
private DataGridViewTextBoxColumn SushiName;
private DataGridViewTextBoxColumn SushiCount;
}
}

View File

@ -47,7 +47,7 @@ namespace SushiBarView
{
textBoxName.Text = view.ShopName;
textBoxAdress.Text = view.Adress;
dateTimeOpen.Value = view.OpeningDate;
dateTimeOpenShop.Value = view.OpeningDate;
_ShopSushis = view.ShopSushis ?? new Dictionary<int, (ISushiModel, int)>();
LoadData();
}
@ -67,10 +67,10 @@ namespace SushiBarView
{
if (_ShopSushis != null)
{
dataGridView.Rows.Clear();
dataGridViewShop.Rows.Clear();
foreach (var sr in _ShopSushis)
{
dataGridView.Rows.Add(new object[] { sr.Key, sr.Value.Item1.SushiName, sr.Value.Item2 });
dataGridViewShop.Rows.Add(new object[] { sr.Key, sr.Value.Item1.SushiName, sr.Value.Item2 });
}
}
}
@ -81,7 +81,7 @@ namespace SushiBarView
}
}
private void buttonSave_Click(object sender, EventArgs e)
private void ButtonSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxName.Text))
{
@ -101,7 +101,7 @@ namespace SushiBarView
Id = _id ?? 0,
ShopName = textBoxName.Text,
Adress = textBoxAdress.Text,
OpeningDate = dateTimeOpen.Value
OpeningDate = dateTimeOpenShop.Value
};
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
if (!operationResult)
@ -119,7 +119,7 @@ namespace SushiBarView
}
}
private void buttonCancel_Click(object sender, EventArgs e)
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.
-->
@ -117,4 +117,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SushiName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SushiCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -28,12 +28,89 @@
/// </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 = "FormShops";
dataGridViewShops = new DataGridView();
buttonAdd = new Button();
buttonUpd = new Button();
buttonDel = new Button();
buttonRef = new Button();
((System.ComponentModel.ISupportInitialize)dataGridViewShops).BeginInit();
SuspendLayout();
//
// dataGridViewShops
//
dataGridViewShops.AllowUserToAddRows = false;
dataGridViewShops.AllowUserToDeleteRows = false;
dataGridViewShops.BackgroundColor = SystemColors.Control;
dataGridViewShops.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewShops.Location = new Point(12, 12);
dataGridViewShops.Name = "dataGridViewShops";
dataGridViewShops.RowTemplate.Height = 25;
dataGridViewShops.Size = new Size(501, 342);
dataGridViewShops.TabIndex = 0;
//
// buttonAdd
//
buttonAdd.Location = new Point(548, 12);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(138, 38);
buttonAdd.TabIndex = 1;
buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// buttonUpd
//
buttonUpd.Location = new Point(548, 77);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(138, 38);
buttonUpd.TabIndex = 2;
buttonUpd.Text = "Изменить";
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += ButtonUpd_Click;
//
// buttonDel
//
buttonDel.Location = new Point(548, 140);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(138, 38);
buttonDel.TabIndex = 3;
buttonDel.Text = "Удалить";
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_Click;
//
// buttonRef
//
buttonRef.Location = new Point(548, 204);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(138, 38);
buttonRef.TabIndex = 4;
buttonRef.Text = "Обновить список";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click;
//
// FormShops
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(726, 366);
Controls.Add(buttonRef);
Controls.Add(buttonDel);
Controls.Add(buttonUpd);
Controls.Add(buttonAdd);
Controls.Add(dataGridViewShops);
Name = "FormShops";
Text = "Магазины";
Load += FormShops_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewShops).EndInit();
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewShops;
private Button buttonAdd;
private Button buttonUpd;
private Button buttonDel;
private Button buttonRef;
}
}

View File

@ -37,10 +37,10 @@ namespace SushiBarView
var list = _logic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["ShopSushis"].Visible = false;
dataGridView.Columns["ShopName"].AutoSizeMode =
dataGridViewShops.DataSource = list;
dataGridViewShops.Columns["Id"].Visible = false;
dataGridViewShops.Columns["ShopSushis"].Visible = false;
dataGridViewShops.Columns["ShopName"].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Загрузка магазинов");
@ -66,12 +66,12 @@ namespace SushiBarView
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
if (dataGridViewShops.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
if (service is FormShop form)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
form.Id = Convert.ToInt32(dataGridViewShops.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
@ -82,11 +82,11 @@ namespace SushiBarView
private void ButtonDel_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
if (dataGridViewShops.SelectedRows.Count == 1)
{
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
int id = Convert.ToInt32(dataGridViewShops.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Удаление магазина");
try
{

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