PIbd-22. Safiulova K.N. LabWork_02_hard #10

Closed
safiulova.k wants to merge 10 commits from LabWork_02_hard into LabWork_02
6 changed files with 96 additions and 77 deletions
Showing only changes of commit 9ce4882940 - Show all commits

View File

@ -28,46 +28,47 @@
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.labelName = new System.Windows.Forms.Label();
this.labelAddress = new System.Windows.Forms.Label();
this.labelDate = new System.Windows.Forms.Label();
this.textBoxName = new System.Windows.Forms.TextBox();
this.textBoxAddress = new System.Windows.Forms.TextBox();
this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.dataGridViewShop = new System.Windows.Forms.DataGridView();
this.buttonSave = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.Plane = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.ColumnID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnPlane = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewShop)).BeginInit();
this.SuspendLayout();
//
// label1
// labelName
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Название:";
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(12, 9);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(62, 15);
this.labelName.TabIndex = 0;
this.labelName.Text = "Название:";
//
// label2
// labelAddress
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 39);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(43, 15);
this.label2.TabIndex = 1;
this.label2.Text = "Адрес:";
this.labelAddress.AutoSize = true;
this.labelAddress.Location = new System.Drawing.Point(12, 39);
this.labelAddress.Name = "labelAddress";
this.labelAddress.Size = new System.Drawing.Size(43, 15);
this.labelAddress.TabIndex = 1;
this.labelAddress.Text = "Адрес:";
//
// label3
// labelDate
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 74);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(90, 15);
this.label3.TabIndex = 2;
this.label3.Text = "Дата открытия:";
this.labelDate.AutoSize = true;
this.labelDate.Location = new System.Drawing.Point(12, 74);
this.labelDate.Name = "labelDate";
this.labelDate.Size = new System.Drawing.Size(90, 15);
this.labelDate.TabIndex = 2;
this.labelDate.Text = "Дата открытия:";
//
// textBoxName
//
@ -90,17 +91,18 @@
this.dateTimePicker.Size = new System.Drawing.Size(200, 23);
this.dateTimePicker.TabIndex = 5;
//
// dataGridView
// dataGridViewShop
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Plane,
this.Count});
this.dataGridView.Location = new System.Drawing.Point(26, 118);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowTemplate.Height = 25;
this.dataGridView.Size = new System.Drawing.Size(446, 325);
this.dataGridView.TabIndex = 6;
this.dataGridViewShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ColumnID,
this.ColumnPlane,
this.ColumnCount});
this.dataGridViewShop.Location = new System.Drawing.Point(26, 118);
this.dataGridViewShop.Name = "dataGridViewShop";
this.dataGridViewShop.RowTemplate.Height = 25;
this.dataGridViewShop.Size = new System.Drawing.Size(446, 325);
this.dataGridViewShop.TabIndex = 6;
//
// buttonSave
//
@ -122,16 +124,22 @@
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// Plane
// ColumnID
//
this.Plane.HeaderText = "Изделие";
this.Plane.Name = "Plane";
this.Plane.Width = 300;
this.ColumnID.HeaderText = "ID";
this.ColumnID.Name = "ColumnID";
this.ColumnID.Visible = false;
//
// Count
// ColumnPlane
//
this.Count.HeaderText = "Количество";
this.Count.Name = "Count";
this.ColumnPlane.HeaderText = "Изделие";
this.ColumnPlane.Name = "ColumnPlane";
this.ColumnPlane.Width = 300;
//
// ColumnCount
//
this.ColumnCount.HeaderText = "Количество";
this.ColumnCount.Name = "ColumnCount";
//
// FormShop
//
@ -140,17 +148,17 @@
this.ClientSize = new System.Drawing.Size(481, 470);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonSave);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.dataGridViewShop);
this.Controls.Add(this.dateTimePicker);
this.Controls.Add(this.textBoxAddress);
this.Controls.Add(this.textBoxName);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.labelDate);
this.Controls.Add(this.labelAddress);
this.Controls.Add(this.labelName);
this.Name = "FormShop";
this.Text = "Магазин";
this.Load += new System.EventHandler(this.FormShop_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewShop)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -169,5 +177,13 @@
private DataGridViewTextBoxColumn Count;
private Button buttonSave;
private Button buttonCancel;
private Label labelName;
private Label labelAddress;
private Label labelDate;
private DataGridView dataGridViewShops;
private DataGridViewTextBoxColumn ColumnID;
private DataGridViewTextBoxColumn ColumnPlane;
private DataGridViewTextBoxColumn ColumnCount;
private DataGridView dataGridViewShop;
}
}

View File

@ -141,10 +141,10 @@ namespace AircraftPlantView
{
if (_shopPlanes != null)
{
dataGridView.Rows.Clear();
dataGridViewShop.Rows.Clear();
foreach (var elem in _shopPlanes)
{
dataGridView.Rows.Add(new object[]
dataGridViewShop.Rows.Add(new object[]
{
elem.Key,
elem.Value.Item1.PlaneName,

View File

@ -57,16 +57,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Plane.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ColumnID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ColumnPlane.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Plane.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -28,22 +28,22 @@
/// </summary>
private void InitializeComponent()
{
this.dataGridView = new System.Windows.Forms.DataGridView();
this.dataGridViewShops = new System.Windows.Forms.DataGridView();
this.buttonAdd = new System.Windows.Forms.Button();
this.buttonUpdate = new System.Windows.Forms.Button();
this.buttonDelete = new System.Windows.Forms.Button();
this.buttonRefresh = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewShops)).BeginInit();
this.SuspendLayout();
//
// dataGridView
// dataGridViewShops
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(0, 0);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowTemplate.Height = 25;
this.dataGridView.Size = new System.Drawing.Size(495, 449);
this.dataGridView.TabIndex = 0;
this.dataGridViewShops.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewShops.Location = new System.Drawing.Point(0, 0);
this.dataGridViewShops.Name = "dataGridViewShops";
this.dataGridViewShops.RowTemplate.Height = 25;
this.dataGridViewShops.Size = new System.Drawing.Size(495, 449);
this.dataGridViewShops.TabIndex = 0;
//
// buttonAdd
//
@ -94,11 +94,11 @@
this.Controls.Add(this.buttonDelete);
this.Controls.Add(this.buttonUpdate);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.dataGridViewShops);
this.Name = "FormShops";
this.Text = "Магазины";
this.Load += new System.EventHandler(this.FormShops_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewShops)).EndInit();
this.ResumeLayout(false);
}
@ -110,5 +110,6 @@
private Button buttonUpdate;
private Button buttonDelete;
private Button buttonRefresh;
private DataGridView dataGridViewShops;
}
}

View File

@ -67,12 +67,12 @@ namespace AircraftPlantView
/// <param name="e"></param>
private void buttonUpdate_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();
@ -87,11 +87,11 @@ namespace AircraftPlantView
/// <param name="e"></param>
private void buttonDelete_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
{
@ -128,10 +128,10 @@ namespace AircraftPlantView
var list = _logic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["ShopPlanes"].Visible = false;
dataGridViewShops.DataSource = list;
dataGridViewShops.Columns["Id"].Visible = false;
dataGridViewShops.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridViewShops.Columns["ShopPlanes"].Visible = false;
}
_logger.LogInformation("Загрузка магазинов");
}

View File

@ -49,10 +49,12 @@ namespace AircraftPlantView
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IPlaneStorage, PlaneStorage>();
services.AddTransient<IShopStorage, ShopStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IPlaneLogic, PlaneLogic>();
services.AddTransient<IShopLogic, ShopLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
@ -61,6 +63,9 @@ namespace AircraftPlantView
services.AddTransient<FormPlane>();
services.AddTransient<FormPlaneComponent>();
services.AddTransient<FormPlanes>();
services.AddTransient<FormShops>();
services.AddTransient<FormShop>();
services.AddTransient<FormSupply>();
}
}
}