PIbd-21_Kudrinsky_O.S._LabWork_3 #6
@ -12,7 +12,6 @@ public class Product
|
||||
|
||||
public ProductType ProductType { get; private set; }
|
||||
|
||||
|
||||
public static Product CreateEntity(int id, string productName, double price, ProductType productType)
|
||||
{
|
||||
return new Product
|
||||
|
@ -30,62 +30,66 @@
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonAdd = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
dataGridViewAssemblerShifts = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewAssemblerShifts).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(1081, 0);
|
||||
panel.Location = new Point(582, 0);
|
||||
panel.Margin = new Padding(2, 1, 2, 1);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(265, 783);
|
||||
panel.Size = new Size(143, 367);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.plus;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(65, 47);
|
||||
buttonAdd.Location = new Point(35, 22);
|
||||
buttonAdd.Margin = new Padding(2, 1, 2, 1);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(152, 145);
|
||||
buttonAdd.Size = new Size(82, 68);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridView
|
||||
// dataGridViewAssemblerShifts
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 82;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(1081, 783);
|
||||
dataGridView.TabIndex = 1;
|
||||
dataGridViewAssemblerShifts.AllowUserToAddRows = false;
|
||||
dataGridViewAssemblerShifts.AllowUserToDeleteRows = false;
|
||||
dataGridViewAssemblerShifts.AllowUserToResizeColumns = false;
|
||||
dataGridViewAssemblerShifts.AllowUserToResizeRows = false;
|
||||
dataGridViewAssemblerShifts.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewAssemblerShifts.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewAssemblerShifts.Dock = DockStyle.Fill;
|
||||
dataGridViewAssemblerShifts.Location = new Point(0, 0);
|
||||
dataGridViewAssemblerShifts.Margin = new Padding(2, 1, 2, 1);
|
||||
dataGridViewAssemblerShifts.MultiSelect = false;
|
||||
dataGridViewAssemblerShifts.Name = "dataGridViewAssemblerShifts";
|
||||
dataGridViewAssemblerShifts.ReadOnly = true;
|
||||
dataGridViewAssemblerShifts.RowHeadersVisible = false;
|
||||
dataGridViewAssemblerShifts.RowHeadersWidth = 82;
|
||||
dataGridViewAssemblerShifts.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewAssemblerShifts.Size = new Size(582, 367);
|
||||
dataGridViewAssemblerShifts.TabIndex = 1;
|
||||
//
|
||||
// FormAssemblerShifts
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1346, 783);
|
||||
Controls.Add(dataGridView);
|
||||
ClientSize = new Size(725, 367);
|
||||
Controls.Add(dataGridViewAssemblerShifts);
|
||||
Controls.Add(panel);
|
||||
Margin = new Padding(2, 1, 2, 1);
|
||||
Name = "FormAssemblerShifts";
|
||||
Text = "Выходы на смену";
|
||||
Load += FormAssemblerShifts_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewAssemblerShifts).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -93,6 +97,6 @@
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridView;
|
||||
private DataGridView dataGridViewAssemblerShifts;
|
||||
}
|
||||
}
|
@ -49,6 +49,6 @@ namespace ProjectWorkshop.Forms
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridView.DataSource = _assemblerShiftRepository.ReadAssemblerShifts();
|
||||
private void LoadList() => dataGridViewAssemblerShifts.DataSource = _assemblerShiftRepository.ReadAssemblerShifts();
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,9 @@
|
||||
panel = new Panel();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
dataGridViewAssemblies = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewAssemblies).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
@ -41,18 +41,20 @@
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(1062, 0);
|
||||
panel.Location = new Point(572, 0);
|
||||
panel.Margin = new Padding(2, 1, 2, 1);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(279, 798);
|
||||
panel.Size = new Size(150, 374);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.minus;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(67, 305);
|
||||
buttonDel.Location = new Point(36, 143);
|
||||
buttonDel.Margin = new Padding(2, 1, 2, 1);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(150, 151);
|
||||
buttonDel.Size = new Size(81, 71);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
@ -61,44 +63,47 @@
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.plus;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(67, 40);
|
||||
buttonAdd.Location = new Point(36, 19);
|
||||
buttonAdd.Margin = new Padding(2, 1, 2, 1);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(150, 151);
|
||||
buttonAdd.Size = new Size(81, 71);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridView
|
||||
// dataGridViewAssemblies
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 82;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(1062, 798);
|
||||
dataGridView.TabIndex = 1;
|
||||
dataGridViewAssemblies.AllowUserToAddRows = false;
|
||||
dataGridViewAssemblies.AllowUserToDeleteRows = false;
|
||||
dataGridViewAssemblies.AllowUserToResizeColumns = false;
|
||||
dataGridViewAssemblies.AllowUserToResizeRows = false;
|
||||
dataGridViewAssemblies.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewAssemblies.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewAssemblies.Dock = DockStyle.Fill;
|
||||
dataGridViewAssemblies.Location = new Point(0, 0);
|
||||
dataGridViewAssemblies.Margin = new Padding(2, 1, 2, 1);
|
||||
dataGridViewAssemblies.MultiSelect = false;
|
||||
dataGridViewAssemblies.Name = "dataGridViewAssemblies";
|
||||
dataGridViewAssemblies.ReadOnly = true;
|
||||
dataGridViewAssemblies.RowHeadersVisible = false;
|
||||
dataGridViewAssemblies.RowHeadersWidth = 82;
|
||||
dataGridViewAssemblies.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewAssemblies.Size = new Size(572, 374);
|
||||
dataGridViewAssemblies.TabIndex = 1;
|
||||
//
|
||||
// FormAssemblies
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1341, 798);
|
||||
Controls.Add(dataGridView);
|
||||
ClientSize = new Size(722, 374);
|
||||
Controls.Add(dataGridViewAssemblies);
|
||||
Controls.Add(panel);
|
||||
Margin = new Padding(2, 1, 2, 1);
|
||||
Name = "FormAssemblies";
|
||||
Text = "Сборки";
|
||||
Load += FormAssemblies_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewAssemblies).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -107,6 +112,6 @@
|
||||
private Panel panel;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridView;
|
||||
private DataGridView dataGridViewAssemblies;
|
||||
}
|
||||
}
|
@ -74,18 +74,18 @@ namespace ProjectWorkshop.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridView.DataSource = _assemblyRepository.ReadAssemblies();
|
||||
private void LoadList() => dataGridViewAssemblies.DataSource = _assemblyRepository.ReadAssemblies();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
if (dataGridViewAssemblies.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ID"].Value);
|
||||
id = Convert.ToInt32(dataGridViewAssemblies.SelectedRows[0].Cells["ID"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user