LabWork01_Hard: Лабраторная сдана, фиксы даты основания магазина
This commit is contained in:
parent
e40428438f
commit
bb968d63f9
61
AutomobilePlant/AutomobilePlant/FormShop.Designer.cs
generated
61
AutomobilePlant/AutomobilePlant/FormShop.Designer.cs
generated
@ -38,40 +38,40 @@
|
||||
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.foundingDateLabel = new System.Windows.Forms.Label();
|
||||
this.foundingDateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBoxAddress
|
||||
//
|
||||
this.textBoxAddress.Location = new System.Drawing.Point(88, 34);
|
||||
this.textBoxAddress.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.textBoxAddress.Location = new System.Drawing.Point(101, 45);
|
||||
this.textBoxAddress.Name = "textBoxAddress";
|
||||
this.textBoxAddress.Size = new System.Drawing.Size(276, 23);
|
||||
this.textBoxAddress.Size = new System.Drawing.Size(315, 27);
|
||||
this.textBoxAddress.TabIndex = 7;
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
this.textBoxName.Location = new System.Drawing.Point(88, 9);
|
||||
this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.textBoxName.Location = new System.Drawing.Point(101, 12);
|
||||
this.textBoxName.Name = "textBoxName";
|
||||
this.textBoxName.Size = new System.Drawing.Size(276, 23);
|
||||
this.textBoxName.Size = new System.Drawing.Size(315, 27);
|
||||
this.textBoxName.TabIndex = 6;
|
||||
//
|
||||
// labelAddress
|
||||
//
|
||||
this.labelAddress.AutoSize = true;
|
||||
this.labelAddress.Location = new System.Drawing.Point(12, 38);
|
||||
this.labelAddress.Location = new System.Drawing.Point(14, 51);
|
||||
this.labelAddress.Name = "labelAddress";
|
||||
this.labelAddress.Size = new System.Drawing.Size(43, 15);
|
||||
this.labelAddress.Size = new System.Drawing.Size(54, 20);
|
||||
this.labelAddress.TabIndex = 5;
|
||||
this.labelAddress.Text = "Адрес:";
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
this.labelName.AutoSize = true;
|
||||
this.labelName.Location = new System.Drawing.Point(12, 11);
|
||||
this.labelName.Location = new System.Drawing.Point(14, 15);
|
||||
this.labelName.Name = "labelName";
|
||||
this.labelName.Size = new System.Drawing.Size(62, 15);
|
||||
this.labelName.Size = new System.Drawing.Size(80, 20);
|
||||
this.labelName.TabIndex = 4;
|
||||
this.labelName.Text = "Название:";
|
||||
//
|
||||
@ -82,12 +82,11 @@
|
||||
this.ColumnId,
|
||||
this.ColumnCarName,
|
||||
this.ColumnCount});
|
||||
this.dataGridView.Location = new System.Drawing.Point(12, 61);
|
||||
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.dataGridView.Location = new System.Drawing.Point(14, 127);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(351, 251);
|
||||
this.dataGridView.Size = new System.Drawing.Size(401, 289);
|
||||
this.dataGridView.TabIndex = 10;
|
||||
//
|
||||
// ColumnId
|
||||
@ -114,10 +113,9 @@
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(200, 327);
|
||||
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonCancel.Location = new System.Drawing.Point(229, 436);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(136, 31);
|
||||
this.buttonCancel.Size = new System.Drawing.Size(155, 41);
|
||||
this.buttonCancel.TabIndex = 12;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
@ -125,20 +123,37 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(42, 327);
|
||||
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonSave.Location = new System.Drawing.Point(48, 436);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(136, 31);
|
||||
this.buttonSave.Size = new System.Drawing.Size(155, 41);
|
||||
this.buttonSave.TabIndex = 11;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
|
||||
//
|
||||
// foundingDateLabel
|
||||
//
|
||||
this.foundingDateLabel.AutoSize = true;
|
||||
this.foundingDateLabel.Location = new System.Drawing.Point(14, 83);
|
||||
this.foundingDateLabel.Name = "foundingDateLabel";
|
||||
this.foundingDateLabel.Size = new System.Drawing.Size(121, 20);
|
||||
this.foundingDateLabel.TabIndex = 13;
|
||||
this.foundingDateLabel.Text = "Дата основания";
|
||||
//
|
||||
// foundingDateTimePicker
|
||||
//
|
||||
this.foundingDateTimePicker.Location = new System.Drawing.Point(141, 78);
|
||||
this.foundingDateTimePicker.Name = "foundingDateTimePicker";
|
||||
this.foundingDateTimePicker.Size = new System.Drawing.Size(274, 27);
|
||||
this.foundingDateTimePicker.TabIndex = 14;
|
||||
//
|
||||
// FormShop
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(389, 367);
|
||||
this.ClientSize = new System.Drawing.Size(445, 489);
|
||||
this.Controls.Add(this.foundingDateTimePicker);
|
||||
this.Controls.Add(this.foundingDateLabel);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
@ -146,13 +161,13 @@
|
||||
this.Controls.Add(this.textBoxName);
|
||||
this.Controls.Add(this.labelAddress);
|
||||
this.Controls.Add(this.labelName);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormShop";
|
||||
this.Text = "Магазин";
|
||||
this.Load += new System.EventHandler(this.FormShop_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -167,5 +182,7 @@
|
||||
private DataGridViewTextBoxColumn ColumnId;
|
||||
private DataGridViewTextBoxColumn ColumnCarName;
|
||||
private DataGridViewTextBoxColumn ColumnCount;
|
||||
private Label foundingDateLabel;
|
||||
private DateTimePicker foundingDateTimePicker;
|
||||
}
|
||||
}
|
@ -45,6 +45,7 @@ namespace AutomobilePlant
|
||||
{
|
||||
textBoxName.Text = view.Name;
|
||||
textBoxAddress.Text = view.Address;
|
||||
foundingDateTimePicker.Value = view.FoundingDate;
|
||||
_shopCars = view.ShopCars ?? new Dictionary<int, (ICarModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
@ -102,7 +103,8 @@ namespace AutomobilePlant
|
||||
Id = _id ?? 0,
|
||||
Name = textBoxName.Text,
|
||||
Address = textBoxAddress.Text,
|
||||
OpeningDate = DateTime.Now
|
||||
FoundingDate = foundingDateTimePicker.Value.Date,
|
||||
ShopCars= _shopCars
|
||||
};
|
||||
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
|
@ -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">
|
||||
|
@ -104,7 +104,6 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
|
||||
Id = shopElement.Id,
|
||||
Name = shopElement.Name,
|
||||
Address = shopElement.Address,
|
||||
OpeningDate = shopElement.OpeningDate,
|
||||
ShopCars = shopElement.ShopCars
|
||||
});
|
||||
|
||||
|
@ -14,8 +14,8 @@ namespace AutomobilePlantContracts.BindingModels
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public string Address { get; set; } = string.Empty;
|
||||
|
||||
public DateTime OpeningDate { get; set; }
|
||||
|
||||
public DateTime FoundingDate { get; set; }
|
||||
|
||||
public Dictionary<int, (ICarModel, int)> ShopCars { get; set; }
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ namespace AutomobilePlantContracts.ViewModels
|
||||
[DisplayName("Адрес")]
|
||||
public string Address { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата открытия")]
|
||||
public DateTime OpeningDate { get; set; }
|
||||
[DisplayName("Дата основания")]
|
||||
public DateTime FoundingDate { get; set; }
|
||||
|
||||
public Dictionary<int, (ICarModel, int)> ShopCars { get; set; } = new();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace AutomobilePlantDataModels.Models
|
||||
{
|
||||
string Name { get; }
|
||||
string Address { get; }
|
||||
DateTime OpeningDate { get; }
|
||||
DateTime FoundingDate { get; }
|
||||
Dictionary<int, (ICarModel, int)> ShopCars { get; }
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ namespace AutomobilePlantListImplements.Models
|
||||
public string Address { get; private set; } = string.Empty;
|
||||
|
||||
public DateTime OpeningDate { get; private set; }
|
||||
|
||||
public DateTime FoundingDate { get; private set; }
|
||||
|
||||
public Dictionary<int, (ICarModel, int)> ShopCars { get; private set; } = new();
|
||||
|
||||
@ -33,7 +35,7 @@ namespace AutomobilePlantListImplements.Models
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
Address = model.Address,
|
||||
OpeningDate = model.OpeningDate,
|
||||
FoundingDate = model.FoundingDate,
|
||||
ShopCars = new()
|
||||
};
|
||||
}
|
||||
@ -55,7 +57,7 @@ namespace AutomobilePlantListImplements.Models
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Address = Address,
|
||||
OpeningDate = OpeningDate,
|
||||
FoundingDate = FoundingDate,
|
||||
ShopCars = ShopCars
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user