This commit is contained in:
leonteva.v 2024-03-27 03:48:46 +04:00
parent fa04cf732c
commit 4961ed46c9
10 changed files with 67 additions and 69 deletions

View File

@ -124,6 +124,7 @@
Controls.Add(labelPrinted);
Name = "FormCreateOrder";
Text = "Заказ";
Load += FormCreateOrder_Load;
ResumeLayout(false);
PerformLayout();
}

View File

@ -17,18 +17,6 @@ namespace TypographyView
_logicP = logicP;
_logicO = logicO;
}
private void FormCreateOrder_Load(object sender, EventArgs e)
{
_logger.LogInformation("Загрузка изделий для заказа");
var _list = _logicP.ReadList(null);
if (_list != null)
{
comboBoxPrinted.DisplayMember = "PrintedName";
comboBoxPrinted.ValueMember = "Id";
comboBoxPrinted.DataSource = _list;
comboBoxPrinted.SelectedItem = null;
}
}
private void CalcSum()
{
if (comboBoxPrinted.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
@ -99,5 +87,17 @@ namespace TypographyView
DialogResult = DialogResult.Cancel;
Close();
}
private void FormCreateOrder_Load(object sender, EventArgs e)
{
_logger.LogInformation("Загрузка изделий для заказа");
var _list = _logicP.ReadList(null);
if (_list != null)
{
comboBoxPrinted.DisplayMember = "PrintedName";
comboBoxPrinted.ValueMember = "Id";
comboBoxPrinted.DataSource = _list;
comboBoxPrinted.SelectedItem = null;
}
}
}
}

View File

@ -29,7 +29,7 @@
private void InitializeComponent()
{
dataGridViewOrders = new DataGridView();
menuStrip1 = new MenuStrip();
menuStrip = new MenuStrip();
directoriesToolStripMenuItem = new ToolStripMenuItem();
componentsToolStripMenuItem = new ToolStripMenuItem();
printedsToolStripMenuItem = new ToolStripMenuItem();
@ -39,7 +39,7 @@
buttonIssuedOrder = new Button();
buttonRef = new Button();
((System.ComponentModel.ISupportInitialize)dataGridViewOrders).BeginInit();
menuStrip1.SuspendLayout();
menuStrip.SuspendLayout();
SuspendLayout();
//
// dataGridViewOrders
@ -51,18 +51,19 @@
dataGridViewOrders.RowHeadersVisible = false;
dataGridViewOrders.RowHeadersWidth = 51;
dataGridViewOrders.RowTemplate.Height = 29;
dataGridViewOrders.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewOrders.Size = new Size(1080, 424);
dataGridViewOrders.TabIndex = 3;
//
// menuStrip1
// menuStrip
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { directoriesToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(1331, 28);
menuStrip1.TabIndex = 4;
menuStrip1.Text = "menuStrip1";
menuStrip.ImageScalingSize = new Size(20, 20);
menuStrip.Items.AddRange(new ToolStripItem[] { directoriesToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(1331, 28);
menuStrip.TabIndex = 6;
menuStrip.Text = "menuStrip";
//
// directoriesToolStripMenuItem
//
@ -146,13 +147,14 @@
Controls.Add(buttonTakeOrderInWork);
Controls.Add(buttonCreateOrder);
Controls.Add(dataGridViewOrders);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
Name = "FormMain";
Text = "Типография";
Load += FormMain_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewOrders).EndInit();
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
@ -160,7 +162,7 @@
#endregion
private DataGridView dataGridViewOrders;
private MenuStrip menuStrip1;
private MenuStrip menuStrip;
private ToolStripMenuItem directoriesToolStripMenuItem;
private ToolStripMenuItem componentsToolStripMenuItem;
private ToolStripMenuItem printedsToolStripMenuItem;

View File

@ -15,10 +15,6 @@ namespace TypographyView
_logger = logger;
_orderLogic = orderLogic;
}
private void FormMain_Load(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
try
@ -134,5 +130,9 @@ namespace TypographyView
{
LoadData();
}
private void FormMain_Load(object sender, EventArgs e)
{
LoadData();
}
}
}

View File

@ -117,7 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -167,6 +167,7 @@
//
textBoxPrice.Location = new Point(143, 49);
textBoxPrice.Name = "textBoxPrice";
textBoxPrice.ReadOnly = true;
textBoxPrice.Size = new Size(214, 27);
textBoxPrice.TabIndex = 4;
//
@ -203,7 +204,8 @@
Controls.Add(labelName);
Controls.Add(groupBoxComponents);
Name = "FormPrinted";
Text = "FormPrinted";
Text = "Печатная продукция";
Load += FormPrinted_Load;
groupBoxComponents.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewComponents).EndInit();
ResumeLayout(false);

View File

@ -20,29 +20,6 @@ namespace TypographyView
_logic = logic;
_printedComponents = new Dictionary<int, (IComponentModel, int)>();
}
private void FormPrinted_Load(object sender, EventArgs e)
{
if (_id.HasValue)
{
_logger.LogInformation("Загрузка изделия");
try
{
var view = _logic.ReadElement(new PrintedSearchModel { Id = _id.Value });
if (view != null)
{
textBoxName.Text = view.PrintedName;
textBoxPrice.Text = view.Price.ToString();
_printedComponents = view.PrintedComponents ?? new Dictionary<int, (IComponentModel, int)>();
LoadData();
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки изделия");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void LoadData()
{
_logger.LogInformation("Загрузка компонент изделия");
@ -195,5 +172,29 @@ namespace TypographyView
DialogResult = DialogResult.Cancel;
Close();
}
private void FormPrinted_Load(object sender, EventArgs e)
{
if (_id.HasValue)
{
_logger.LogInformation("Загрузка изделия");
try
{
var view = _logic.ReadElement(new PrintedSearchModel { Id = _id.Value });
if (view != null)
{
textBoxName.Text = view.PrintedName;
textBoxPrice.Text = view.Price.ToString();
_printedComponents = view.PrintedComponents ?? new Dictionary<int, (IComponentModel, int)>();
LoadData();
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки изделия");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}

View File

@ -126,13 +126,4 @@
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnComponentName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -101,6 +101,7 @@
Controls.Add(dataGridViewPrinteds);
Name = "FormPrinteds";
Text = "Печатная продукция";
Load += FormPrinteds_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewPrinteds).EndInit();
ResumeLayout(false);
}

View File

@ -15,10 +15,6 @@ namespace TypographyView
_logger = logger;
_logic = logic;
}
private void FormPrinteds_Load(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
try
@ -94,5 +90,9 @@ namespace TypographyView
{
LoadData();
}
private void FormPrinteds_Load(object sender, EventArgs e)
{
LoadData();
}
}
}