Presnyakova V.V Lab_1_Hard #5

Closed
Victoria_Presnyakova wants to merge 6 commits from Lab_1_Hard into Lab_1
3 changed files with 48 additions and 104 deletions
Showing only changes of commit 244e5a811f - Show all commits

View File

@ -31,7 +31,7 @@
this.StoreNameLabel = new System.Windows.Forms.Label();
this.StoreAdressLabel = new System.Windows.Forms.Label();
this.OpeningDateLabel = new System.Windows.Forms.Label();
this.NameComboBox = new System.Windows.Forms.ComboBox();
this.NameTextBox = new System.Windows.Forms.TextBox();
this.AdressTextBox = new System.Windows.Forms.TextBox();
this.DataGridView = new System.Windows.Forms.DataGridView();
this.JewelName = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -46,44 +46,47 @@
// StoreNameLabel
//
this.StoreNameLabel.AutoSize = true;
this.StoreNameLabel.Location = new System.Drawing.Point(12, 9);
this.StoreNameLabel.Location = new System.Drawing.Point(17, 15);
this.StoreNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.StoreNameLabel.Name = "StoreNameLabel";
this.StoreNameLabel.Size = new System.Drawing.Size(119, 15);
this.StoreNameLabel.Size = new System.Drawing.Size(179, 25);
this.StoreNameLabel.TabIndex = 0;
this.StoreNameLabel.Text = "Название магазина: ";
//
// StoreAdressLabel
//
this.StoreAdressLabel.AutoSize = true;
this.StoreAdressLabel.Location = new System.Drawing.Point(12, 40);
this.StoreAdressLabel.Location = new System.Drawing.Point(17, 67);
this.StoreAdressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.StoreAdressLabel.Name = "StoreAdressLabel";
this.StoreAdressLabel.Size = new System.Drawing.Size(100, 15);
this.StoreAdressLabel.Size = new System.Drawing.Size(151, 25);
this.StoreAdressLabel.TabIndex = 1;
this.StoreAdressLabel.Text = "Адрес магазина: ";
//
// OpeningDateLabel
//
this.OpeningDateLabel.AutoSize = true;
this.OpeningDateLabel.Location = new System.Drawing.Point(12, 72);
this.OpeningDateLabel.Location = new System.Drawing.Point(17, 120);
this.OpeningDateLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.OpeningDateLabel.Name = "OpeningDateLabel";
this.OpeningDateLabel.Size = new System.Drawing.Size(93, 15);
this.OpeningDateLabel.Size = new System.Drawing.Size(140, 25);
this.OpeningDateLabel.TabIndex = 2;
this.OpeningDateLabel.Text = "Дата открытия: ";
//
// NameComboBox
// NameTextBox
//
this.NameComboBox.FormattingEnabled = true;
this.NameComboBox.Location = new System.Drawing.Point(137, 6);
this.NameComboBox.Name = "NameComboBox";
this.NameComboBox.Size = new System.Drawing.Size(174, 23);
this.NameComboBox.TabIndex = 3;
this.NameComboBox.SelectedIndexChanged += new System.EventHandler(this.NameComboBox_SelectedIndexChanged);
this.NameTextBox.Location = new System.Drawing.Point(196, 10);
this.NameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.NameTextBox.Name = "NameTextBox";
this.NameTextBox.Size = new System.Drawing.Size(247, 31);
this.NameTextBox.TabIndex = 3;
//
// AdressTextBox
//
this.AdressTextBox.Location = new System.Drawing.Point(137, 37);
this.AdressTextBox.Location = new System.Drawing.Point(196, 62);
this.AdressTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.AdressTextBox.Name = "AdressTextBox";
this.AdressTextBox.Size = new System.Drawing.Size(174, 23);
this.AdressTextBox.Size = new System.Drawing.Size(247, 31);
this.AdressTextBox.TabIndex = 4;
//
// DataGridView
@ -93,33 +96,41 @@
this.JewelName,
this.JewelPrice,
this.JewelCount});
this.DataGridView.Location = new System.Drawing.Point(12, 109);
this.DataGridView.Location = new System.Drawing.Point(17, 182);
this.DataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.DataGridView.Name = "DataGridView";
this.DataGridView.RowHeadersWidth = 62;
this.DataGridView.RowTemplate.Height = 25;
this.DataGridView.Size = new System.Drawing.Size(776, 288);
this.DataGridView.Size = new System.Drawing.Size(1109, 480);
this.DataGridView.TabIndex = 6;
//
// JewelName
//
this.JewelName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.JewelName.HeaderText = "Название изделия";
this.JewelName.MinimumWidth = 8;
this.JewelName.Name = "JewelName";
//
// JewelPrice
//
this.JewelPrice.HeaderText = "Цена";
this.JewelPrice.MinimumWidth = 8;
this.JewelPrice.Name = "JewelPrice";
this.JewelPrice.Width = 150;
//
// JewelCount
//
this.JewelCount.HeaderText = "Количество";
this.JewelCount.MinimumWidth = 8;
this.JewelCount.Name = "JewelCount";
this.JewelCount.Width = 150;
//
// SaveButton
//
this.SaveButton.Location = new System.Drawing.Point(552, 403);
this.SaveButton.Location = new System.Drawing.Point(789, 672);
this.SaveButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.SaveButton.Name = "SaveButton";
this.SaveButton.Size = new System.Drawing.Size(115, 35);
this.SaveButton.Size = new System.Drawing.Size(164, 58);
this.SaveButton.TabIndex = 7;
this.SaveButton.Text = "Сохранить";
this.SaveButton.UseVisualStyleBackColor = true;
@ -127,9 +138,10 @@
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(673, 403);
this.ButtonCancel.Location = new System.Drawing.Point(961, 672);
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(115, 35);
this.ButtonCancel.Size = new System.Drawing.Size(164, 58);
this.ButtonCancel.TabIndex = 8;
this.ButtonCancel.Text = "Отменить";
this.ButtonCancel.UseVisualStyleBackColor = true;
@ -137,25 +149,27 @@
//
// OpeningDatePicker
//
this.OpeningDatePicker.Location = new System.Drawing.Point(137, 66);
this.OpeningDatePicker.Location = new System.Drawing.Point(196, 110);
this.OpeningDatePicker.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.OpeningDatePicker.Name = "OpeningDatePicker";
this.OpeningDatePicker.Size = new System.Drawing.Size(174, 23);
this.OpeningDatePicker.Size = new System.Drawing.Size(247, 31);
this.OpeningDatePicker.TabIndex = 9;
//
// FormStore
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.ClientSize = new System.Drawing.Size(1143, 750);
this.Controls.Add(this.OpeningDatePicker);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.SaveButton);
this.Controls.Add(this.DataGridView);
this.Controls.Add(this.AdressTextBox);
this.Controls.Add(this.NameComboBox);
this.Controls.Add(this.NameTextBox);
this.Controls.Add(this.OpeningDateLabel);
this.Controls.Add(this.StoreAdressLabel);
this.Controls.Add(this.StoreNameLabel);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "FormStore";
this.Text = "Изделия магазина";
this.Load += new System.EventHandler(this.FormStore_Load);
@ -170,7 +184,7 @@
private Label StoreNameLabel;
private Label StoreAdressLabel;
private Label OpeningDateLabel;
private ComboBox NameComboBox;
private TextBox NameTextBox;
private TextBox AdressTextBox;
private DataGridView DataGridView;
private Button SaveButton;

View File

@ -28,13 +28,6 @@ namespace JewelryStore
_logger = logger;
_listStores = logic.ReadList(null);
_logic = logic;
if (_listStores != null)
{
NameComboBox.DisplayMember = "StoreName";
NameComboBox.ValueMember = "Id";
NameComboBox.DataSource = _listStores;
NameComboBox.SelectedItem = null;
}
}
private IStoreModel? GetStore(int id)
@ -55,7 +48,7 @@ namespace JewelryStore
private void SaveButton_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(NameComboBox.Text))
if (string.IsNullOrEmpty(NameTextBox.Text))
{
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
@ -74,7 +67,7 @@ namespace JewelryStore
DateTime.TryParse(OpeningDatePicker.Text, out var dateTime);
StoreBindingModel model = new()
{
StoreName = NameComboBox.Text,
StoreName = NameTextBox.Text,
StoreAdress = AdressTextBox.Text,
OpeningDate = dateTime
};
@ -121,10 +114,10 @@ namespace JewelryStore
{
try
{
var model = GetStore(extendDate ? Id : Convert.ToInt32(NameComboBox.SelectedValue));
var model = GetStore(extendDate ? Id : Convert.ToInt32(NameTextBox.Text));
if (model != null)
{
NameComboBox.Text = model.StoreName;
NameTextBox.Text = model.StoreName;
AdressTextBox.Text = model.StoreAdress;
OpeningDatePicker.Text = Convert.ToString(model.OpeningDate);
DataGridView.Rows.Clear();
@ -143,9 +136,6 @@ namespace JewelryStore
}
}
private void NameComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
LoadData(false);
}
}
}

View File

@ -1,64 +1,4 @@
<?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.
-->
<root>
<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">