diff --git a/SoftwareInstallation/FormComponent.Designer.cs b/SoftwareInstallation/FormComponent.Designer.cs index fae63e4..75584c3 100644 --- a/SoftwareInstallation/FormComponent.Designer.cs +++ b/SoftwareInstallation/FormComponent.Designer.cs @@ -1,4 +1,4 @@ -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { partial class FormComponent { @@ -28,95 +28,97 @@ /// private void InitializeComponent() { - buttonSave = new Button(); - buttonCancel = new Button(); - label1 = new Label(); - label2 = new Label(); - textBoxName = new TextBox(); - textBoxCost = new TextBox(); - SuspendLayout(); + this.labelName = new System.Windows.Forms.Label(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.textBoxCost = new System.Windows.Forms.TextBox(); + this.labelCost = new System.Windows.Forms.Label(); + this.buttonSave = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.SuspendLayout(); // - // buttonSave + // labelName // - buttonSave.Location = new Point(217, 119); - buttonSave.Margin = new Padding(3, 4, 3, 4); - buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(98, 34); - buttonSave.TabIndex = 0; - buttonSave.Text = "Сохранить"; - buttonSave.UseVisualStyleBackColor = true; - buttonSave.Click += buttonSave_Click; - // - // buttonCancel - // - buttonCancel.Location = new Point(325, 119); - buttonCancel.Margin = new Padding(3, 4, 3, 4); - buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(98, 34); - buttonCancel.TabIndex = 1; - buttonCancel.Text = "Отмена"; - buttonCancel.UseVisualStyleBackColor = true; - buttonCancel.Click += buttonCancel_Click; - // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(24, 30); - label1.Name = "label1"; - label1.Size = new Size(80, 20); - label1.TabIndex = 2; - label1.Text = "Название:"; - // - // label2 - // - label2.AutoSize = true; - label2.Location = new Point(24, 69); - label2.Name = "label2"; - label2.Size = new Size(48, 20); - label2.TabIndex = 3; - label2.Text = "Цена:"; + this.labelName.AutoSize = true; + this.labelName.Location = new System.Drawing.Point(10, 7); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(62, 15); + this.labelName.TabIndex = 0; + this.labelName.Text = "Название:"; // // textBoxName // - textBoxName.Location = new Point(118, 26); - textBoxName.Margin = new Padding(3, 4, 3, 4); - textBoxName.Name = "textBoxName"; - textBoxName.Size = new Size(305, 27); - textBoxName.TabIndex = 4; + this.textBoxName.Location = new System.Drawing.Point(86, 7); + this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(275, 23); + this.textBoxName.TabIndex = 1; // // textBoxCost // - textBoxCost.Location = new Point(118, 65); - textBoxCost.Margin = new Padding(3, 4, 3, 4); - textBoxCost.Name = "textBoxCost"; - textBoxCost.Size = new Size(186, 27); - textBoxCost.TabIndex = 5; + this.textBoxCost.Location = new System.Drawing.Point(86, 32); + this.textBoxCost.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxCost.Name = "textBoxCost"; + this.textBoxCost.Size = new System.Drawing.Size(122, 23); + this.textBoxCost.TabIndex = 3; + // + // labelCost + // + this.labelCost.AutoSize = true; + this.labelCost.Location = new System.Drawing.Point(10, 32); + this.labelCost.Name = "labelCost"; + this.labelCost.Size = new System.Drawing.Size(38, 15); + this.labelCost.TabIndex = 2; + this.labelCost.Text = "Цена:"; + // + // buttonSave + // + this.buttonSave.Location = new System.Drawing.Point(143, 72); + this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonSave.Name = "buttonSave"; + this.buttonSave.Size = new System.Drawing.Size(96, 26); + this.buttonSave.TabIndex = 4; + this.buttonSave.Text = "Сохранить"; + this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click); + // + // buttonCancel + // + this.buttonCancel.Location = new System.Drawing.Point(245, 72); + this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(97, 26); + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "Отмена"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); // // FormComponent // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(462, 174); - Controls.Add(textBoxCost); - Controls.Add(textBoxName); - Controls.Add(label2); - Controls.Add(label1); - Controls.Add(buttonCancel); - Controls.Add(buttonSave); - Margin = new Padding(3, 4, 3, 4); - Name = "FormComponent"; - Text = "Компонент"; - ResumeLayout(false); - PerformLayout(); + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(373, 106); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonSave); + this.Controls.Add(this.textBoxCost); + this.Controls.Add(this.labelCost); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.labelName); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "FormComponent"; + this.Text = "Компонент"; + this.Load += new System.EventHandler(this.FormComponent_Load); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion - private Button buttonSave; - private Button buttonCancel; - private Label label1; - private Label label2; + private Label labelName; private TextBox textBoxName; private TextBox textBoxCost; + private Label labelCost; + private Button buttonSave; + private Button buttonCancel; } } \ No newline at end of file diff --git a/SoftwareInstallation/FormComponent.cs b/SoftwareInstallation/FormComponent.cs index 30b4bc0..b3ab464 100644 --- a/SoftwareInstallation/FormComponent.cs +++ b/SoftwareInstallation/FormComponent.cs @@ -1,4 +1,8 @@ -using System; +using Microsoft.Extensions.Logging; +using SoftwareInstallationContracts.BindingModels; +using SoftwareInstallationContracts.BusinessLogicsContracts; +using SoftwareInstallationContracts.SearchModels; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,13 +11,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using Microsoft.Extensions.Logging; -using SoftwareInstallationContracts.BusinessLogicsContracts; -using Microsoft.VisualBasic.Logging; -using SoftwareInstallationContracts.SearchModels; -using SoftwareInstallationContracts.BindingModels; -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { public partial class FormComponent : Form { @@ -27,7 +26,6 @@ namespace SoftwareInstallation.Forms _logger = logger; _logic = logic; } - private void FormComponent_Load(object sender, EventArgs e) { if (_id.HasValue) @@ -48,13 +46,11 @@ namespace SoftwareInstallation.Forms catch (Exception ex) { _logger.LogError(ex, "Ошибка получения компонента"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, - MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } - - private void buttonSave_Click(object sender, EventArgs e) + private void ButtonSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxName.Text)) { @@ -73,7 +69,7 @@ namespace SoftwareInstallation.Forms var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); if (!operationResult) { - throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");//При обновлении, может быть, тоже ошибка появиться.. } MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; @@ -85,8 +81,7 @@ namespace SoftwareInstallation.Forms MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - - private void buttonCancel_Click(object sender, EventArgs e) + private void ButtonCancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); diff --git a/SoftwareInstallation/FormComponent.resx b/SoftwareInstallation/FormComponent.resx index af32865..f298a7b 100644 --- a/SoftwareInstallation/FormComponent.resx +++ b/SoftwareInstallation/FormComponent.resx @@ -1,64 +1,4 @@ - - - + diff --git a/SoftwareInstallation/FormComponents.Designer.cs b/SoftwareInstallation/FormComponents.Designer.cs index 8be76d3..00e7b3f 100644 --- a/SoftwareInstallation/FormComponents.Designer.cs +++ b/SoftwareInstallation/FormComponents.Designer.cs @@ -1,4 +1,4 @@ -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { partial class FormComponents { @@ -28,94 +28,111 @@ /// private void InitializeComponent() { - dataGridView = new DataGridView(); - buttonAdd = new Button(); - buttonUpd = new Button(); - buttonDel = new Button(); - buttonRef = new Button(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); - SuspendLayout(); + this.dataGridView = new System.Windows.Forms.DataGridView(); + this.ToolsPanel = new System.Windows.Forms.Panel(); + this.buttonRef = new System.Windows.Forms.Button(); + this.buttonDel = new System.Windows.Forms.Button(); + this.buttonUpd = new System.Windows.Forms.Button(); + this.buttonAdd = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.ToolsPanel.SuspendLayout(); + this.SuspendLayout(); // // dataGridView // - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(-1, -2); - dataGridView.Margin = new Padding(3, 4, 3, 4); - dataGridView.Name = "dataGridView"; - dataGridView.ReadOnly = true; - dataGridView.RowHeadersWidth = 51; - dataGridView.RowTemplate.Height = 24; - dataGridView.Size = new Size(499, 568); - dataGridView.TabIndex = 0; + this.dataGridView.AllowUserToAddRows = false; + this.dataGridView.AllowUserToDeleteRows = false; + this.dataGridView.BackgroundColor = System.Drawing.Color.White; + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Location = new System.Drawing.Point(0, 2); + this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.ReadOnly = true; + this.dataGridView.RowHeadersWidth = 51; + this.dataGridView.RowTemplate.Height = 29; + this.dataGridView.Size = new System.Drawing.Size(519, 360); + this.dataGridView.TabIndex = 0; // - // buttonAdd + // ToolsPanel // - buttonAdd.Location = new Point(525, 48); - buttonAdd.Margin = new Padding(3, 4, 3, 4); - buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(125, 35); - buttonAdd.TabIndex = 1; - buttonAdd.Text = "Добавить"; - buttonAdd.UseVisualStyleBackColor = true; - buttonAdd.Click += buttonAdd_Click; - // - // buttonUpd - // - buttonUpd.Location = new Point(525, 98); - buttonUpd.Margin = new Padding(3, 4, 3, 4); - buttonUpd.Name = "buttonUpd"; - buttonUpd.Size = new Size(125, 35); - buttonUpd.TabIndex = 2; - buttonUpd.Text = "Изменить"; - buttonUpd.UseVisualStyleBackColor = true; - buttonUpd.Click += buttonUpd_Click; - // - // buttonDel - // - buttonDel.Location = new Point(525, 150); - buttonDel.Margin = new Padding(3, 4, 3, 4); - buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(125, 35); - buttonDel.TabIndex = 3; - buttonDel.Text = "Удалить"; - buttonDel.UseVisualStyleBackColor = true; - buttonDel.Click += buttonDel_Click; + this.ToolsPanel.Controls.Add(this.dataGridView); + this.ToolsPanel.Controls.Add(this.buttonRef); + this.ToolsPanel.Controls.Add(this.buttonDel); + this.ToolsPanel.Controls.Add(this.buttonUpd); + this.ToolsPanel.Controls.Add(this.buttonAdd); + this.ToolsPanel.Location = new System.Drawing.Point(-1, -1); + this.ToolsPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.ToolsPanel.Name = "ToolsPanel"; + this.ToolsPanel.Size = new System.Drawing.Size(675, 364); + this.ToolsPanel.TabIndex = 1; // // buttonRef // - buttonRef.Location = new Point(525, 201); - buttonRef.Margin = new Padding(3, 4, 3, 4); - buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(125, 35); - buttonRef.TabIndex = 4; - buttonRef.Text = "Обновить"; - buttonRef.UseVisualStyleBackColor = true; - buttonRef.Click += buttonRef_Click; + this.buttonRef.Location = new System.Drawing.Point(528, 155); + this.buttonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonRef.Name = "buttonRef"; + this.buttonRef.Size = new System.Drawing.Size(110, 27); + this.buttonRef.TabIndex = 3; + this.buttonRef.Text = "Обновить"; + this.buttonRef.UseVisualStyleBackColor = true; + this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click); + // + // buttonDel + // + this.buttonDel.Location = new System.Drawing.Point(528, 107); + this.buttonDel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonDel.Name = "buttonDel"; + this.buttonDel.Size = new System.Drawing.Size(110, 27); + this.buttonDel.TabIndex = 2; + this.buttonDel.Text = "Удалить"; + this.buttonDel.UseVisualStyleBackColor = true; + this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click); + // + // buttonUpd + // + this.buttonUpd.Location = new System.Drawing.Point(528, 58); + this.buttonUpd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonUpd.Name = "buttonUpd"; + this.buttonUpd.Size = new System.Drawing.Size(110, 27); + this.buttonUpd.TabIndex = 1; + this.buttonUpd.Text = "Изменить"; + this.buttonUpd.UseVisualStyleBackColor = true; + this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click); + // + // buttonAdd + // + this.buttonAdd.Location = new System.Drawing.Point(528, 13); + this.buttonAdd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonAdd.Name = "buttonAdd"; + this.buttonAdd.Size = new System.Drawing.Size(110, 27); + this.buttonAdd.TabIndex = 0; + this.buttonAdd.Text = "Добавить"; + this.buttonAdd.UseVisualStyleBackColor = true; + this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click); // // FormComponents // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(676, 562); - Controls.Add(buttonRef); - Controls.Add(buttonDel); - Controls.Add(buttonUpd); - Controls.Add(buttonAdd); - Controls.Add(dataGridView); - Margin = new Padding(3, 4, 3, 4); - Name = "FormComponents"; - Text = "Список компонентов"; - Load += FormComponents_Load; - ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); - ResumeLayout(false); + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(673, 361); + this.Controls.Add(this.ToolsPanel); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "FormComponents"; + this.Text = "Компоненты"; + this.Load += new System.EventHandler(this.FormComponents_Load); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ToolsPanel.ResumeLayout(false); + this.ResumeLayout(false); + } #endregion private DataGridView dataGridView; - private Button buttonAdd; - private Button buttonUpd; - private Button buttonDel; + private Panel ToolsPanel; private Button buttonRef; + private Button buttonDel; + private Button buttonUpd; + private Button buttonAdd; } } \ No newline at end of file diff --git a/SoftwareInstallation/FormComponents.cs b/SoftwareInstallation/FormComponents.cs index b79da69..c39d1e7 100644 --- a/SoftwareInstallation/FormComponents.cs +++ b/SoftwareInstallation/FormComponents.cs @@ -1,6 +1,6 @@ -using SoftwareInstallationContracts.BindingModels; +using Microsoft.Extensions.Logging; +using SoftwareInstallationContracts.BindingModels; using SoftwareInstallationContracts.BusinessLogicsContracts; -using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.ComponentModel; @@ -11,7 +11,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { public partial class FormComponents : Form { @@ -23,12 +23,10 @@ namespace SoftwareInstallation.Forms _logger = logger; _logic = logic; } - private void FormComponents_Load(object sender, EventArgs e) { LoadData(); } - private void LoadData() { try @@ -38,18 +36,19 @@ namespace SoftwareInstallation.Forms { dataGridView.DataSource = list; dataGridView.Columns["Id"].Visible = false; - dataGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["ComponentName"].AutoSizeMode = + DataGridViewAutoSizeColumnMode.Fill; } _logger.LogInformation("Загрузка компонентов"); } catch (Exception ex) { _logger.LogError(ex, "Ошибка загрузки компонентов"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); } } - - private void buttonAdd_Click(object sender, EventArgs e) + private void ButtonAdd_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormComponent)); if (service is FormComponent form) @@ -60,15 +59,15 @@ namespace SoftwareInstallation.Forms } } } - - private void buttonUpd_Click(object sender, EventArgs e) + private void ButtonUpd_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { var service = Program.ServiceProvider?.GetService(typeof(FormComponent)); if (service is FormComponent form) { - form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + form.Id = + Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); if (form.ShowDialog() == DialogResult.OK) { LoadData(); @@ -76,15 +75,15 @@ namespace SoftwareInstallation.Forms } } } - - private void buttonDel_Click(object sender, EventArgs e) + private void ButtonDel_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { - if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + if (MessageBox.Show("Удалить запись?", "Вопрос", + MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int id = - Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); _logger.LogInformation("Удаление компонента"); try { @@ -100,12 +99,13 @@ namespace SoftwareInstallation.Forms catch (Exception ex) { _logger.LogError(ex, "Ошибка удаления компонента"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } - private void buttonRef_Click(object sender, EventArgs e) + private void ButtonRef_Click(object sender, EventArgs e) { LoadData(); } diff --git a/SoftwareInstallation/FormComponents.resx b/SoftwareInstallation/FormComponents.resx index af32865..f298a7b 100644 --- a/SoftwareInstallation/FormComponents.resx +++ b/SoftwareInstallation/FormComponents.resx @@ -1,64 +1,4 @@ - - - + diff --git a/SoftwareInstallation/FormCreateOrder.Designer.cs b/SoftwareInstallation/FormCreateOrder.Designer.cs index dedb200..139cc22 100644 --- a/SoftwareInstallation/FormCreateOrder.Designer.cs +++ b/SoftwareInstallation/FormCreateOrder.Designer.cs @@ -1,4 +1,4 @@ -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { partial class FormCreateOrder { @@ -28,101 +28,103 @@ /// private void InitializeComponent() { - label1 = new Label(); - label2 = new Label(); - label3 = new Label(); + labelSoftware = new Label(); + comboBoxSoftware = new ComboBox(); + labelCount = new Label(); textBoxCount = new TextBox(); - comboBoxPackage= new ComboBox(); + labelSumm = new Label(); textBoxSum = new TextBox(); - buttonSave = new Button(); buttonCancel = new Button(); + buttonSave = new Button(); SuspendLayout(); // - // label1 + // labelSoftware // - label1.AutoSize = true; - label1.Location = new Point(19, 12); - label1.Name = "label1"; - label1.Size = new Size(56, 15); - label1.TabIndex = 0; - label1.Text = "Изделие:"; + labelSoftware.AutoSize = true; + labelSoftware.Location = new Point(11, 15); + labelSoftware.Name = "labelSoftware"; + labelSoftware.Size = new Size(38, 20); + labelSoftware.TabIndex = 0; + labelSoftware.Text = "ПО: "; // - // label2 + // comboBoxSoftware // - label2.AutoSize = true; - label2.Location = new Point(19, 44); - label2.Name = "label2"; - label2.Size = new Size(75, 15); - label2.TabIndex = 1; - label2.Text = "Количество:"; + comboBoxSoftware.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxSoftware.FormattingEnabled = true; + comboBoxSoftware.Location = new Point(115, 12); + comboBoxSoftware.Name = "comboBoxSoftware"; + comboBoxSoftware.Size = new Size(228, 28); + comboBoxSoftware.TabIndex = 1; + comboBoxSoftware.SelectedIndexChanged += ComboBoxSoftware_SelectedIndexChanged; // - // label3 + // labelCount // - label3.AutoSize = true; - label3.Location = new Point(19, 70); - label3.Name = "label3"; - label3.Size = new Size(48, 15); - label3.TabIndex = 2; - label3.Text = "Сумма:"; + labelCount.AutoSize = true; + labelCount.Location = new Point(11, 49); + labelCount.Name = "labelCount"; + labelCount.Size = new Size(97, 20); + labelCount.TabIndex = 2; + labelCount.Text = "Количество: "; // // textBoxCount // - textBoxCount.Location = new Point(103, 41); + textBoxCount.Location = new Point(115, 45); textBoxCount.Name = "textBoxCount"; - textBoxCount.Size = new Size(246, 23); + textBoxCount.Size = new Size(228, 27); textBoxCount.TabIndex = 3; - textBoxCount.TextChanged += textBoxCount_TextChanged; + textBoxCount.TextChanged += TextBoxCount_TextChanged; // - // comboBoxPackage + // labelSumm // - comboBoxPackage.FormattingEnabled = true; - comboBoxPackage.Location = new Point(103, 10); - comboBoxPackage.Name = "comboBoxPackage"; - comboBoxPackage.Size = new Size(246, 23); - comboBoxPackage.TabIndex = 4; - comboBoxPackage.SelectedIndexChanged += ComboBoxPackage_SelectedIndexChanged; + labelSumm.AutoSize = true; + labelSumm.Location = new Point(11, 80); + labelSumm.Name = "labelSumm"; + labelSumm.Size = new Size(62, 20); + labelSumm.TabIndex = 4; + labelSumm.Text = "Сумма: "; // // textBoxSum // - textBoxSum.Location = new Point(103, 70); + textBoxSum.Location = new Point(115, 80); textBoxSum.Name = "textBoxSum"; textBoxSum.ReadOnly = true; - textBoxSum.Size = new Size(246, 23); + textBoxSum.Size = new Size(228, 27); textBoxSum.TabIndex = 5; - // - // buttonSave - // - buttonSave.Location = new Point(150, 101); - buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(94, 26); - buttonSave.TabIndex = 6; - buttonSave.Text = "Сохранить"; - buttonSave.UseVisualStyleBackColor = true; - buttonSave.Click += buttonSave_Click; + textBoxSum.Click += TextBoxCount_TextChanged; // // buttonCancel // - buttonCancel.Location = new Point(249, 101); + buttonCancel.Location = new Point(232, 116); buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(94, 26); - buttonCancel.TabIndex = 7; + buttonCancel.Size = new Size(110, 32); + buttonCancel.TabIndex = 6; buttonCancel.Text = "Отмена"; buttonCancel.UseVisualStyleBackColor = true; - buttonCancel.Click += buttonCancel_Click; + buttonCancel.Click += ButtonCancel_Click; + // + // buttonSave + // + buttonSave.Location = new Point(115, 116); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(110, 32); + buttonSave.TabIndex = 7; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; // // FormCreateOrder // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(374, 136); - Controls.Add(buttonCancel); + ClientSize = new Size(360, 157); Controls.Add(buttonSave); + Controls.Add(buttonCancel); Controls.Add(textBoxSum); - Controls.Add(comboBoxPackage); + Controls.Add(labelSumm); Controls.Add(textBoxCount); - Controls.Add(label3); - Controls.Add(label2); - Controls.Add(label1); + Controls.Add(labelCount); + Controls.Add(comboBoxSoftware); + Controls.Add(labelSoftware); Name = "FormCreateOrder"; Text = "Заказ"; Load += FormCreateOrder_Load; @@ -132,13 +134,13 @@ #endregion - private Label label1; - private Label label2; - private Label label3; + private Label labelSoftware; + private ComboBox comboBoxSoftware; + private Label labelCount; private TextBox textBoxCount; - private ComboBox comboBoxPackage; + private Label labelSumm; private TextBox textBoxSum; - private Button buttonSave; private Button buttonCancel; + private Button buttonSave; } } \ No newline at end of file diff --git a/SoftwareInstallation/FormCreateOrder.cs b/SoftwareInstallation/FormCreateOrder.cs index 2779d64..6b964aa 100644 --- a/SoftwareInstallation/FormCreateOrder.cs +++ b/SoftwareInstallation/FormCreateOrder.cs @@ -1,7 +1,8 @@ -using SoftwareInstallationContracts.BindingModels; +using Microsoft.Extensions.Logging; +using SoftwareInstallationContracts.BindingModels; using SoftwareInstallationContracts.BusinessLogicsContracts; using SoftwareInstallationContracts.SearchModels; -using Microsoft.Extensions.Logging; +using SoftwareInstallationContracts.ViewModels; using System; using System.Collections.Generic; using System.ComponentModel; @@ -12,53 +13,58 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { public partial class FormCreateOrder : Form { private readonly ILogger _logger; - private readonly IPackageLogic _logicP; + private readonly IPackageLogic _logicR; private readonly IOrderLogic _logicO; - public FormCreateOrder(ILogger logger, IPackageLogic logicP, IOrderLogic logicO) + public FormCreateOrder(ILogger logger, IPackageLogic logicR, IOrderLogic logicO) { InitializeComponent(); _logger = logger; - _logicP = logicP; + _logicR = logicR; _logicO = logicO; } - private void FormCreateOrder_Load(object sender, EventArgs e) + { + LoadData(); + } + private void LoadData() { try { - var list = _logicP.ReadList(null); + var list = _logicR.ReadList(null); if (list != null) { - comboBoxPackage.DisplayMember = "PackageName"; - comboBoxPackage.ValueMember = "Id"; - comboBoxPackage.DataSource = list; - comboBoxPackage.SelectedItem = null; - _logger.LogInformation("Загрузка изделий для заказа"); + comboBoxSoftware.DisplayMember = "SoftwareName"; + comboBoxSoftware.ValueMember = "Id"; + comboBoxSoftware.DataSource = list; + comboBoxSoftware.SelectedItem = null; } + _logger.LogInformation("Загрузка изделий для заказа"); } catch (Exception ex) { - _logger.LogError(ex, "Ошибка загрузки списка изделий"); + _logger.LogError(ex, "Ошибка загрузки изделий для заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); } } private void CalcSum() { - if (comboBoxPackage.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text)) + if (comboBoxSoftware.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text)) { try { - int id = Convert.ToInt32(comboBoxPackage.SelectedValue); - var Package = _logicP.ReadElement(new PackageSearchModel + int id = Convert.ToInt32(comboBoxSoftware.SelectedValue); + var Software = _logicR.ReadElement(new PackageSearchModel { Id = id }); int count = Convert.ToInt32(textBoxCount.Text); - textBoxSum.Text = Math.Round(count * (Package?.Price ?? 0), 2).ToString(); + textBoxSum.Text = Math.Round(count * (Software?.Price ?? 0), 2).ToString(); _logger.LogInformation("Расчет суммы заказа"); } catch (Exception ex) @@ -68,24 +74,22 @@ namespace SoftwareInstallation.Forms } } } - private void textBoxCount_TextChanged(object sender, EventArgs e) + private void TextBoxCount_TextChanged(object sender, EventArgs e) { CalcSum(); } - - private void ComboBoxPackage_SelectedIndexChanged(object sender, EventArgs e) + private void ComboBoxSoftware_SelectedIndexChanged(object sender, EventArgs e) { CalcSum(); } - - private void buttonSave_Click(object sender, EventArgs e) + private void ButtonSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxCount.Text)) { MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } - if (comboBoxPackage.SelectedValue == null) + if (comboBoxSoftware.SelectedValue == null) { MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; @@ -95,7 +99,7 @@ namespace SoftwareInstallation.Forms { var operationResult = _logicO.CreateOrder(new OrderBindingModel { - PackageId = Convert.ToInt32(comboBoxPackage.SelectedValue), + SoftwareId = Convert.ToInt32(comboBoxSoftware.SelectedValue), Count = Convert.ToInt32(textBoxCount.Text), Sum = Convert.ToDouble(textBoxSum.Text) }); @@ -109,15 +113,14 @@ namespace SoftwareInstallation.Forms } catch (Exception ex) { - _logger.LogError(ex, "Ошибка создания заказа"); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + _logger.LogError(ex, "Ошибка создания заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - - private void buttonCancel_Click(object sender, EventArgs e) + private void ButtonCancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); } - } } diff --git a/SoftwareInstallation/FormMain.Designer.cs b/SoftwareInstallation/FormMain.Designer.cs index ddf56f8..2fb3dc1 100644 --- a/SoftwareInstallation/FormMain.Designer.cs +++ b/SoftwareInstallation/FormMain.Designer.cs @@ -1,4 +1,4 @@ -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { partial class FormMain { @@ -28,141 +28,166 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain)); - toolStrip1 = new ToolStrip(); - toolStripDropDownButton1 = new ToolStripDropDownButton(); + menuStrip1 = new MenuStrip(); + справочникToolStripMenuItem = new ToolStripMenuItem(); компонентыToolStripMenuItem = new ToolStripMenuItem(); - ПутёвкиToolStripMenuItem = new ToolStripMenuItem(); + изделияToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + списокИзделийToolStripMenuItem = new ToolStripMenuItem(); + изделияПоКомпонентамToolStripMenuItem = new ToolStripMenuItem(); + списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); + dataGridView = new DataGridView(); buttonCreateOrder = new Button(); buttonTakeOrderInWork = new Button(); buttonOrderReady = new Button(); buttonIssuedOrder = new Button(); buttonRef = new Button(); - dataGridView = new DataGridView(); - toolStrip1.SuspendLayout(); + menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); // - // toolStrip1 + // menuStrip1 // - toolStrip1.ImageScalingSize = new Size(20, 20); - toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripDropDownButton1 }); - toolStrip1.Location = new Point(0, 0); - toolStrip1.Name = "toolStrip1"; - toolStrip1.Size = new Size(1107, 27); - toolStrip1.TabIndex = 0; - toolStrip1.Text = "toolStrip1"; + menuStrip1.ImageScalingSize = new Size(20, 20); + menuStrip1.Items.AddRange(new ToolStripItem[] { справочникToolStripMenuItem, отчетыToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Padding = new Padding(6, 3, 0, 3); + menuStrip1.Size = new Size(1256, 30); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "menuStrip1"; // - // toolStripDropDownButton1 + // справочникToolStripMenuItem // - toolStripDropDownButton1.DisplayStyle = ToolStripItemDisplayStyle.Text; - toolStripDropDownButton1.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, ПутёвкиToolStripMenuItem }); - toolStripDropDownButton1.Image = (Image)resources.GetObject("toolStripDropDownButton1.Image"); - toolStripDropDownButton1.ImageTransparentColor = Color.Magenta; - toolStripDropDownButton1.Name = "toolStripDropDownButton1"; - toolStripDropDownButton1.Size = new Size(108, 24); - toolStripDropDownButton1.Text = "Справочник"; + справочникToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem }); + справочникToolStripMenuItem.Name = "справочникToolStripMenuItem"; + справочникToolStripMenuItem.Size = new Size(117, 24); + справочникToolStripMenuItem.Text = "Справочники"; // // компонентыToolStripMenuItem // компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; компонентыToolStripMenuItem.Size = new Size(224, 26); компонентыToolStripMenuItem.Text = "Компоненты"; - компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click; + компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click; // - // ПутёвкиToolStripMenuItem + // изделияToolStripMenuItem // - ПутёвкиToolStripMenuItem.Name = "ПутёвкиToolStripMenuItem"; - ПутёвкиToolStripMenuItem.Size = new Size(224, 26); - ПутёвкиToolStripMenuItem.Text = "ПО"; - ПутёвкиToolStripMenuItem.Click += консервыToolStripMenuItem_Click; + изделияToolStripMenuItem.Name = "изделияToolStripMenuItem"; + изделияToolStripMenuItem.Size = new Size(224, 26); + изделияToolStripMenuItem.Text = "ПО"; + изделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click; // - // buttonCreateOrder + // отчетыToolStripMenuItem // - buttonCreateOrder.Location = new Point(914, 75); - buttonCreateOrder.Margin = new Padding(3, 4, 3, 4); - buttonCreateOrder.Name = "buttonCreateOrder"; - buttonCreateOrder.Size = new Size(161, 32); - buttonCreateOrder.TabIndex = 1; - buttonCreateOrder.Text = "Создать заказ"; - buttonCreateOrder.UseVisualStyleBackColor = true; - buttonCreateOrder.Click += buttonCreateOrder_Click; + отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокИзделийToolStripMenuItem, изделияПоКомпонентамToolStripMenuItem, списокЗаказовToolStripMenuItem }); + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(73, 24); + отчетыToolStripMenuItem.Text = "Отчеты"; // - // buttonTakeOrderInWork + // списокИзделийToolStripMenuItem // - buttonTakeOrderInWork.Location = new Point(914, 133); - buttonTakeOrderInWork.Margin = new Padding(3, 4, 3, 4); - buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; - buttonTakeOrderInWork.Size = new Size(161, 32); - buttonTakeOrderInWork.TabIndex = 2; - buttonTakeOrderInWork.Text = "Отдать на выполнение"; - buttonTakeOrderInWork.UseVisualStyleBackColor = true; - buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click; + списокИзделийToolStripMenuItem.Name = "списокИзделийToolStripMenuItem"; + списокИзделийToolStripMenuItem.Size = new Size(240, 26); + списокИзделийToolStripMenuItem.Text = "Список компонентов"; + списокИзделийToolStripMenuItem.Click += списокИзделийToolStripMenuItem_Click; // - // buttonOrderReady + // изделияПоКомпонентамToolStripMenuItem // - buttonOrderReady.Location = new Point(914, 189); - buttonOrderReady.Margin = new Padding(3, 4, 3, 4); - buttonOrderReady.Name = "buttonOrderReady"; - buttonOrderReady.Size = new Size(161, 32); - buttonOrderReady.TabIndex = 3; - buttonOrderReady.Text = "Заказ готов"; - buttonOrderReady.UseVisualStyleBackColor = true; - buttonOrderReady.Click += buttonOrderReady_Click; + изделияПоКомпонентамToolStripMenuItem.Name = "изделияПоКомпонентамToolStripMenuItem"; + изделияПоКомпонентамToolStripMenuItem.Size = new Size(240, 26); + изделияПоКомпонентамToolStripMenuItem.Text = "ПО по компонентам"; + изделияПоКомпонентамToolStripMenuItem.Click += компонентыПоИзделиямToolStripMenuItem_Click; // - // buttonIssuedOrder + // списокЗаказовToolStripMenuItem // - buttonIssuedOrder.Location = new Point(914, 241); - buttonIssuedOrder.Margin = new Padding(3, 4, 3, 4); - buttonIssuedOrder.Name = "buttonIssuedOrder"; - buttonIssuedOrder.Size = new Size(161, 32); - buttonIssuedOrder.TabIndex = 4; - buttonIssuedOrder.Text = "Заказ выдан"; - buttonIssuedOrder.UseVisualStyleBackColor = true; - buttonIssuedOrder.Click += buttonIssuedOrder_Click; - // - // buttonRef - // - buttonRef.Location = new Point(914, 296); - buttonRef.Margin = new Padding(3, 4, 3, 4); - buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(161, 32); - buttonRef.TabIndex = 5; - buttonRef.Text = "Обновить список"; - buttonRef.UseVisualStyleBackColor = true; - buttonRef.Click += buttonRef_Click; + списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; + списокЗаказовToolStripMenuItem.Size = new Size(240, 26); + списокЗаказовToolStripMenuItem.Text = "Список заказов"; + списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click; // // dataGridView // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.BackgroundColor = Color.White; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(0, 35); - dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.Location = new Point(0, 31); dataGridView.Name = "dataGridView"; dataGridView.ReadOnly = true; dataGridView.RowHeadersWidth = 51; - dataGridView.RowTemplate.Height = 24; - dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(872, 580); - dataGridView.TabIndex = 6; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(984, 396); + dataGridView.TabIndex = 1; + // + // buttonCreateOrder + // + buttonCreateOrder.Location = new Point(991, 53); + buttonCreateOrder.Name = "buttonCreateOrder"; + buttonCreateOrder.Size = new Size(247, 29); + buttonCreateOrder.TabIndex = 2; + buttonCreateOrder.Text = "Создать заказ"; + buttonCreateOrder.UseVisualStyleBackColor = true; + buttonCreateOrder.Click += ButtonCreateOrder_Click; + // + // buttonTakeOrderInWork + // + buttonTakeOrderInWork.Location = new Point(991, 121); + buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; + buttonTakeOrderInWork.Size = new Size(247, 29); + buttonTakeOrderInWork.TabIndex = 3; + buttonTakeOrderInWork.Text = "Отдать на выполнение"; + buttonTakeOrderInWork.UseVisualStyleBackColor = true; + buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click; + // + // buttonOrderReady + // + buttonOrderReady.Location = new Point(991, 191); + buttonOrderReady.Name = "buttonOrderReady"; + buttonOrderReady.Size = new Size(247, 29); + buttonOrderReady.TabIndex = 4; + buttonOrderReady.Text = "Заказ готов"; + buttonOrderReady.UseVisualStyleBackColor = true; + buttonOrderReady.Click += ButtonOrderReady_Click; + // + // buttonIssuedOrder + // + buttonIssuedOrder.Location = new Point(991, 255); + buttonIssuedOrder.Name = "buttonIssuedOrder"; + buttonIssuedOrder.Size = new Size(247, 29); + buttonIssuedOrder.TabIndex = 5; + buttonIssuedOrder.Text = "Заказ выдан"; + buttonIssuedOrder.UseVisualStyleBackColor = true; + buttonIssuedOrder.Click += ButtonIssuedOrder_Click; + // + // buttonRef + // + buttonRef.Location = new Point(991, 309); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(247, 29); + buttonRef.TabIndex = 6; + buttonRef.Text = "Обновить список"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += ButtonRef_Click; // // FormMain // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1107, 615); - Controls.Add(dataGridView); + ClientSize = new Size(1256, 427); Controls.Add(buttonRef); Controls.Add(buttonIssuedOrder); Controls.Add(buttonOrderReady); Controls.Add(buttonTakeOrderInWork); Controls.Add(buttonCreateOrder); - Controls.Add(toolStrip1); - Margin = new Padding(3, 4, 3, 4); + Controls.Add(dataGridView); + Controls.Add(menuStrip1); + MainMenuStrip = menuStrip1; Name = "FormMain"; Text = "Установка ПО"; Load += FormMain_Load; - toolStrip1.ResumeLayout(false); - toolStrip1.PerformLayout(); + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); PerformLayout(); @@ -170,15 +195,19 @@ #endregion - private ToolStrip toolStrip1; + private MenuStrip menuStrip1; + private ToolStripMenuItem справочникToolStripMenuItem; + private ToolStripMenuItem компонентыToolStripMenuItem; + private ToolStripMenuItem изделияToolStripMenuItem; + private DataGridView dataGridView; private Button buttonCreateOrder; private Button buttonTakeOrderInWork; private Button buttonOrderReady; private Button buttonIssuedOrder; private Button buttonRef; - private DataGridView dataGridView; - private ToolStripDropDownButton toolStripDropDownButton1; - private ToolStripMenuItem компонентыToolStripMenuItem; - private ToolStripMenuItem ПутёвкиToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem; + private ToolStripMenuItem списокИзделийToolStripMenuItem; + private ToolStripMenuItem изделияПоКомпонентамToolStripMenuItem; + private ToolStripMenuItem списокЗаказовToolStripMenuItem; } } \ No newline at end of file diff --git a/SoftwareInstallation/FormMain.cs b/SoftwareInstallation/FormMain.cs index fa780a1..f9c6ee8 100644 --- a/SoftwareInstallation/FormMain.cs +++ b/SoftwareInstallation/FormMain.cs @@ -1,6 +1,7 @@ -using SoftwareInstallationContracts.BindingModels; +using Microsoft.Extensions.Logging; +using SoftwareInstallationBusinessLogic.BusinessLogics; +using SoftwareInstallationContracts.BindingModels; using SoftwareInstallationContracts.BusinessLogicsContracts; -using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.ComponentModel; @@ -11,17 +12,19 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { public partial class FormMain : Form { private readonly ILogger _logger; private readonly IOrderLogic _orderLogic; - public FormMain(ILogger logger, IOrderLogic orderLogic) + private readonly IReportLogic _reportLogic; + public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic) { InitializeComponent(); _logger = logger; _orderLogic = orderLogic; + _reportLogic = reportLogic; } private void FormMain_Load(object sender, EventArgs e) { @@ -29,26 +32,25 @@ namespace SoftwareInstallation.Forms } private void LoadData() { - _logger.LogInformation("Загрузка заказов"); try { var list = _orderLogic.ReadList(null); - if (list != null) { dataGridView.DataSource = list; - dataGridView.Columns["PackageId"].Visible = false; - dataGridView.Columns["PackageName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["SoftwareId"].Visible = false; + dataGridView.Columns["SoftwareName"].AutoSizeMode = + DataGridViewAutoSizeColumnMode.Fill; } - _logger.LogInformation("Загрузка заказов"); } catch (Exception ex) { _logger.LogError(ex, "Ошибка загрузки заказов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void компонентыToolStripMenuItem_Click(object sender, EventArgs e) + private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); if (service is FormComponents form) @@ -56,16 +58,15 @@ namespace SoftwareInstallation.Forms form.ShowDialog(); } } - private void консервыToolStripMenuItem_Click(object sender, EventArgs e) + private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e) { - var service = Program.ServiceProvider?.GetService(typeof(FormPackages)); - - if (service is FormPackages form) + var service = Program.ServiceProvider?.GetService(typeof(FormSoftwares)); + if (service is FormSoftwares form) { form.ShowDialog(); } } - private void buttonCreateOrder_Click(object sender, EventArgs e) + private void ButtonCreateOrder_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); if (service is FormCreateOrder form) @@ -74,17 +75,17 @@ namespace SoftwareInstallation.Forms LoadData(); } } - private void buttonTakeOrderInWork_Click(object sender, EventArgs e) + private void ButtonTakeOrderInWork_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); + _logger.LogInformation("Заказ No{id}. Меняется статус на 'В работе'", id); try { var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { - Id = id, + Id = id }); if (!operationResult) { @@ -99,16 +100,18 @@ namespace SoftwareInstallation.Forms } } } - private void buttonOrderReady_Click(object sender, EventArgs e) + private void ButtonOrderReady_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { - int id = - Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id); + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ No{id}. Меняется статус на 'Готов'", id); try { - var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id }); + var operationResult = _orderLogic.FinishOrder(new OrderBindingModel + { + Id = id + }); if (!operationResult) { throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); @@ -122,12 +125,12 @@ namespace SoftwareInstallation.Forms } } } - private void buttonIssuedOrder_Click(object sender, EventArgs e) + private void ButtonIssuedOrder_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id); + _logger.LogInformation("Заказ No{id}. Меняется статус на 'Выдан'", id); try { var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel @@ -138,18 +141,46 @@ namespace SoftwareInstallation.Forms { throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); } - _logger.LogInformation("Заказ №{id} выдан", id); + _logger.LogInformation("Заказ No{id} выдан", id); LoadData(); } catch (Exception ex) { - _logger.LogError(ex, "Ошибка отметки о выдачи заказа"); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + _logger.LogError(ex, "Ошибка отметки о выдачи заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } - private void buttonRef_Click(object sender, EventArgs e) + private void ButtonRef_Click(object sender, EventArgs e) { LoadData(); } + private void списокИзделийToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveSoftwaresToWordFile(new ReportBindingModel { FileName = dialog.FileName }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + + private void компонентыПоИзделиямToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportSoftwareComponents)); + if (service is FormReportSoftwareComponents form) + { + form.ShowDialog(); + } + } + + private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); + if (service is FormReportOrders form) + { + form.ShowDialog(); + } + } } } diff --git a/SoftwareInstallation/FormMain.resx b/SoftwareInstallation/FormMain.resx index 672dbc1..a0623c8 100644 --- a/SoftwareInstallation/FormMain.resx +++ b/SoftwareInstallation/FormMain.resx @@ -117,26 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG - YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 - 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw - bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc - VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 - c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 - Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo - mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ - kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D - TgDQASA1MVpwzwAAAABJRU5ErkJggg== - - - - 56 - \ No newline at end of file diff --git a/SoftwareInstallation/FormPackage.Designer.cs b/SoftwareInstallation/FormPackage.Designer.cs index 70b2169..a1ff41d 100644 --- a/SoftwareInstallation/FormPackage.Designer.cs +++ b/SoftwareInstallation/FormPackage.Designer.cs @@ -1,6 +1,6 @@ -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { - partial class FormPackage + partial class FormSoftware { /// /// Required designer variable. @@ -28,109 +28,134 @@ /// private void InitializeComponent() { - label1 = new Label(); - label2 = new Label(); - buttonAdd = new Button(); - buttonUpd = new Button(); - buttonDel = new Button(); + labelName = new Label(); + textBoxName = new TextBox(); + labelPrice = new Label(); + textBoxPrice = new TextBox(); + groupBoxComponents = new GroupBox(); buttonRef = new Button(); + buttonDel = new Button(); + buttonUpd = new Button(); + buttonAdd = new Button(); dataGridView = new DataGridView(); - Number = new DataGridViewTextBoxColumn(); + id = new DataGridViewTextBoxColumn(); Component = new DataGridViewTextBoxColumn(); Count = new DataGridViewTextBoxColumn(); - textBoxName = new TextBox(); - textBoxPrice = new TextBox(); - groupBox1 = new GroupBox(); - buttonSave = new Button(); buttonCancel = new Button(); + buttonSave = new Button(); + groupBoxComponents.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); - groupBox1.SuspendLayout(); SuspendLayout(); // - // label1 + // labelName // - label1.AutoSize = true; - label1.Location = new Point(18, 20); - label1.Name = "label1"; - label1.Size = new Size(80, 20); - label1.TabIndex = 0; - label1.Text = "Название:"; + labelName.AutoSize = true; + labelName.Location = new Point(16, 15); + labelName.Name = "labelName"; + labelName.Size = new Size(84, 20); + labelName.TabIndex = 0; + labelName.Text = "Название: "; // - // label2 + // textBoxName // - label2.AutoSize = true; - label2.Location = new Point(18, 55); - label2.Name = "label2"; - label2.Size = new Size(86, 20); - label2.TabIndex = 1; - label2.Text = "Стоимость:"; + textBoxName.Location = new Point(112, 12); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(281, 27); + textBoxName.TabIndex = 1; // - // buttonAdd + // labelPrice // - buttonAdd.Location = new Point(656, 59); - buttonAdd.Margin = new Padding(3, 4, 3, 4); - buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(111, 37); - buttonAdd.TabIndex = 0; - buttonAdd.Text = "Добавить"; - buttonAdd.UseVisualStyleBackColor = true; - buttonAdd.Click += buttonAdd_Click; + labelPrice.AutoSize = true; + labelPrice.Location = new Point(16, 51); + labelPrice.Name = "labelPrice"; + labelPrice.Size = new Size(90, 20); + labelPrice.TabIndex = 2; + labelPrice.Text = "Стоимость: "; // - // buttonUpd + // textBoxPrice // - buttonUpd.Location = new Point(656, 120); - buttonUpd.Margin = new Padding(3, 4, 3, 4); - buttonUpd.Name = "buttonUpd"; - buttonUpd.Size = new Size(111, 37); - buttonUpd.TabIndex = 1; - buttonUpd.Text = "Изменить"; - buttonUpd.UseVisualStyleBackColor = true; - buttonUpd.Click += buttonUpd_Click; + textBoxPrice.Location = new Point(112, 51); + textBoxPrice.Name = "textBoxPrice"; + textBoxPrice.Size = new Size(154, 27); + textBoxPrice.TabIndex = 3; // - // buttonDel + // groupBoxComponents // - buttonDel.Location = new Point(656, 179); - buttonDel.Margin = new Padding(3, 4, 3, 4); - buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(111, 37); - buttonDel.TabIndex = 2; - buttonDel.Text = "Удалить"; - buttonDel.UseVisualStyleBackColor = true; - buttonDel.Click += buttonDel_Click; + groupBoxComponents.Controls.Add(buttonRef); + groupBoxComponents.Controls.Add(buttonDel); + groupBoxComponents.Controls.Add(buttonUpd); + groupBoxComponents.Controls.Add(buttonAdd); + groupBoxComponents.Controls.Add(dataGridView); + groupBoxComponents.Location = new Point(11, 84); + groupBoxComponents.Name = "groupBoxComponents"; + groupBoxComponents.Size = new Size(642, 319); + groupBoxComponents.TabIndex = 4; + groupBoxComponents.TabStop = false; + groupBoxComponents.Text = "Компоненты"; // // buttonRef // - buttonRef.Location = new Point(656, 231); - buttonRef.Margin = new Padding(3, 4, 3, 4); + buttonRef.Location = new Point(502, 211); buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(111, 37); - buttonRef.TabIndex = 3; + buttonRef.Size = new Size(126, 35); + buttonRef.TabIndex = 4; buttonRef.Text = "Обновить"; buttonRef.UseVisualStyleBackColor = true; - buttonRef.Click += buttonRef_Click; + buttonRef.Click += ButtonRef_Click; + // + // buttonDel + // + buttonDel.Location = new Point(502, 157); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(126, 35); + buttonDel.TabIndex = 3; + buttonDel.Text = "Удалить"; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // buttonUpd + // + buttonUpd.Location = new Point(502, 101); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(126, 35); + buttonUpd.TabIndex = 2; + buttonUpd.Text = "Изменить"; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += ButtonUpd_Click; + // + // buttonAdd + // + buttonAdd.Location = new Point(502, 47); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(126, 35); + buttonAdd.TabIndex = 1; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; // // dataGridView // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.BackgroundColor = Color.White; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Columns.AddRange(new DataGridViewColumn[] { Number, Component, Count }); - dataGridView.Location = new Point(0, 27); - dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.Columns.AddRange(new DataGridViewColumn[] { id, Component, Count }); + dataGridView.Location = new Point(6, 27); dataGridView.Name = "dataGridView"; dataGridView.ReadOnly = true; dataGridView.RowHeadersWidth = 51; - dataGridView.RowTemplate.Height = 24; - dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.ShowEditingIcon = false; - dataGridView.Size = new Size(627, 443); - dataGridView.TabIndex = 4; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(475, 287); + dataGridView.TabIndex = 0; // - // Number + // id // - Number.HeaderText = "Номер"; - Number.MinimumWidth = 6; - Number.Name = "Number"; - Number.ReadOnly = true; - Number.Width = 60; + id.HeaderText = "id"; + id.MinimumWidth = 6; + id.Name = "id"; + id.ReadOnly = true; + id.Visible = false; // // Component // @@ -138,110 +163,71 @@ Component.MinimumWidth = 6; Component.Name = "Component"; Component.ReadOnly = true; - Component.Width = 125; // // Count // - Count.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; Count.HeaderText = "Количество"; Count.MinimumWidth = 6; Count.Name = "Count"; Count.ReadOnly = true; // - // textBoxName + // buttonCancel // - textBoxName.Location = new Point(107, 19); - textBoxName.Margin = new Padding(3, 4, 3, 4); - textBoxName.Name = "textBoxName"; - textBoxName.Size = new Size(281, 27); - textBoxName.TabIndex = 3; - // - // textBoxPrice - // - textBoxPrice.Location = new Point(107, 52); - textBoxPrice.Margin = new Padding(3, 4, 3, 4); - textBoxPrice.Name = "textBoxPrice"; - textBoxPrice.ReadOnly = true; - textBoxPrice.Size = new Size(97, 27); - textBoxPrice.TabIndex = 4; - textBoxPrice.TabStop = false; - // - // groupBox1 - // - groupBox1.Controls.Add(buttonRef); - groupBox1.Controls.Add(buttonDel); - groupBox1.Controls.Add(dataGridView); - groupBox1.Controls.Add(buttonUpd); - groupBox1.Controls.Add(buttonAdd); - groupBox1.Location = new Point(16, 95); - groupBox1.Margin = new Padding(3, 4, 3, 4); - groupBox1.Name = "groupBox1"; - groupBox1.Padding = new Padding(3, 4, 3, 4); - groupBox1.Size = new Size(787, 489); - groupBox1.TabIndex = 5; - groupBox1.TabStop = false; - groupBox1.Text = "Компоненты"; + buttonCancel.Location = new Point(413, 417); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(126, 35); + buttonCancel.TabIndex = 5; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; // // buttonSave // - buttonSave.Location = new Point(454, 605); - buttonSave.Margin = new Padding(3, 4, 3, 4); + buttonSave.Location = new Point(280, 417); buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(130, 37); - buttonSave.TabIndex = 0; + buttonSave.Size = new Size(126, 35); + buttonSave.TabIndex = 6; buttonSave.Text = "Сохранить"; buttonSave.UseVisualStyleBackColor = true; - buttonSave.Click += buttonSave_Click; + buttonSave.Click += ButtonSave_Click; // - // buttonCancel - // - buttonCancel.Location = new Point(609, 605); - buttonCancel.Margin = new Padding(3, 4, 3, 4); - buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(130, 37); - buttonCancel.TabIndex = 0; - buttonCancel.Text = "Отмена"; - buttonCancel.UseVisualStyleBackColor = true; - buttonCancel.Click += buttonCancel_Click; - // - // FormPackage + // FormSoftware // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(813, 663); - Controls.Add(groupBox1); - Controls.Add(textBoxPrice); - Controls.Add(textBoxName); - Controls.Add(label2); - Controls.Add(buttonCancel); + ClientSize = new Size(685, 463); Controls.Add(buttonSave); - Controls.Add(label1); - Margin = new Padding(3, 4, 3, 4); - Name = "FormPackage"; + Controls.Add(buttonCancel); + Controls.Add(groupBoxComponents); + Controls.Add(textBoxPrice); + Controls.Add(labelPrice); + Controls.Add(textBoxName); + Controls.Add(labelName); + Name = "FormSoftware"; Text = "ПО"; - Load += FormPackage_Load; + Load += FormSoftware_Load; + groupBoxComponents.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); - groupBox1.ResumeLayout(false); ResumeLayout(false); PerformLayout(); } #endregion - private Label label1; - private Label label2; + private Label labelName; + private TextBox textBoxName; + private Label labelPrice; + private TextBox textBoxPrice; + private GroupBox groupBoxComponents; private Button buttonRef; private Button buttonDel; private Button buttonUpd; private Button buttonAdd; private DataGridView dataGridView; - private TextBox textBoxName; - private TextBox textBoxPrice; - private GroupBox groupBox1; - private DataGridViewTextBoxColumn Number; private DataGridViewTextBoxColumn Component; private DataGridViewTextBoxColumn Count; - private Button buttonSave; private Button buttonCancel; + private Button buttonSave; + private DataGridViewTextBoxColumn id; } } \ No newline at end of file diff --git a/SoftwareInstallation/FormPackage.cs b/SoftwareInstallation/FormPackage.cs index 3ead7fd..74db5c8 100644 --- a/SoftwareInstallation/FormPackage.cs +++ b/SoftwareInstallation/FormPackage.cs @@ -1,5 +1,8 @@ -using SoftwareInstallationDataModels.Models; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; +using SoftwareInstallationContracts.BindingModels; +using SoftwareInstallationContracts.BusinessLogicsContracts; +using SoftwareInstallationContracts.SearchModels; +using SoftwareInstallationDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel; @@ -9,29 +12,24 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using SoftwareInstallationContracts.BusinessLogicsContracts; -using SoftwareInstallationContracts.SearchModels; -using SoftwareInstallationContracts.BindingModels; -using SoftwareInstallation; -using SoftwareInstallationDataModels.Models; -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { - public partial class FormPackage : Form + public partial class FormSoftware : Form { private readonly ILogger _logger; private readonly IPackageLogic _logic; private int? _id; - private Dictionary _productComponents; + private Dictionary _SoftwareComponents; public int Id { set { _id = value; } } - public FormPackage(ILogger logger, IPackageLogic logic) + public FormSoftware(ILogger logger, IPackageLogic logic) { InitializeComponent(); _logger = logger; _logic = logic; - _productComponents = new Dictionary(); + _SoftwareComponents = new Dictionary(); } - private void FormPackage_Load(object sender, EventArgs e) + private void FormSoftware_Load(object sender, EventArgs e) { if (_id.HasValue) { @@ -44,15 +42,18 @@ namespace SoftwareInstallation.Forms }); if (view != null) { - textBoxName.Text = view.PackageName; + textBoxName.Text = view.SoftwareName; textBoxPrice.Text = view.Price.ToString(); - _productComponents = view.PackageComponents ?? new Dictionary(); + _SoftwareComponents = view.SoftwareComponents ?? new + Dictionary(); LoadData(); } } catch (Exception ex) { _logger.LogError(ex, "Ошибка загрузки изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); } } } @@ -61,10 +62,10 @@ namespace SoftwareInstallation.Forms _logger.LogInformation("Загрузка компонент изделия"); try { - if (_productComponents != null) + if (_SoftwareComponents != null) { dataGridView.Rows.Clear(); - foreach (var pc in _productComponents) + foreach (var pc in _SoftwareComponents) { dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.ComponentName, pc.Value.Item2 }); } @@ -74,9 +75,11 @@ namespace SoftwareInstallation.Forms catch (Exception ex) { _logger.LogError(ex, "Ошибка загрузки компонент изделия"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); } } - private void buttonAdd_Click(object sender, EventArgs e) + private void ButtonAdd_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormPackageComponent)); if (service is FormPackageComponent form) @@ -87,20 +90,22 @@ namespace SoftwareInstallation.Forms { return; } - _logger.LogInformation("Добавление нового компонента: { ComponentName} - { Count} ", form.ComponentModel.ComponentName, form.Count); - if (_productComponents.ContainsKey(form.Id)) + _logger.LogInformation("Добавление нового компонента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count); + if (_SoftwareComponents.ContainsKey(form.Id)) { - _productComponents[form.Id] = (form.ComponentModel, form.Count); + _SoftwareComponents[form.Id] = (form.ComponentModel, + form.Count); } else { - _productComponents.Add(form.Id, (form.ComponentModel, form.Count)); + _SoftwareComponents.Add(form.Id, (form.ComponentModel, + form.Count)); } LoadData(); } } } - private void buttonUpd_Click(object sender, EventArgs e) + private void ButtonUpd_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { @@ -109,21 +114,21 @@ namespace SoftwareInstallation.Forms { int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value); form.Id = id; - form.Count = _productComponents[id].Item2; + form.Count = _SoftwareComponents[id].Item2; if (form.ShowDialog() == DialogResult.OK) { if (form.ComponentModel == null) { return; } - _logger.LogInformation("Изменение компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count); - _productComponents[form.Id] = (form.ComponentModel, form.Count); + _logger.LogInformation("Изменение компонента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count); + _SoftwareComponents[form.Id] = (form.ComponentModel, form.Count); LoadData(); } } } } - private void buttonDel_Click(object sender, EventArgs e) + private void ButtonDel_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { @@ -131,22 +136,23 @@ namespace SoftwareInstallation.Forms { try { - _logger.LogInformation("Удаление компонента: { ComponentName} - { Count}", dataGridView.SelectedRows[0].Cells[1].Value); - _productComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value)); + _logger.LogInformation("Удаление компонента:{ ComponentName}-{ Count}", dataGridView.SelectedRows[0].Cells[1].Value); + _SoftwareComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value)); } catch (Exception ex) { - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); } LoadData(); } } } - private void buttonRef_Click(object sender, EventArgs e) + private void ButtonRef_Click(object sender, EventArgs e) { LoadData(); } - private void buttonSave_Click(object sender, EventArgs e) + private void ButtonSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxName.Text)) { @@ -158,7 +164,7 @@ namespace SoftwareInstallation.Forms MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } - if (_productComponents == null || _productComponents.Count == 0) + if (_SoftwareComponents == null || _SoftwareComponents.Count == 0) { MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; @@ -169,16 +175,18 @@ namespace SoftwareInstallation.Forms var model = new PackageBindingModel { Id = _id ?? 0, - PackageName = textBoxName.Text, + SoftwareName = textBoxName.Text, Price = Convert.ToDouble(textBoxPrice.Text), - PackageComponents = _productComponents + SoftwareComponents = _SoftwareComponents }; - var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); + var operationResult = _id.HasValue ? _logic.Update(model) : + _logic.Create(model); if (!operationResult) { throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); } - MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; + MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); + DialogResult = DialogResult.OK; Close(); } catch (Exception ex) @@ -187,21 +195,19 @@ namespace SoftwareInstallation.Forms MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - - private void buttonCancel_Click(object sender, EventArgs e) + private void ButtonCancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); } - private double CalcPrice() { double price = 0; - foreach (var elem in _productComponents) + foreach (var elem in _SoftwareComponents) { price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2); } return Math.Round(price * 1.1, 2); } } -} \ No newline at end of file +} diff --git a/SoftwareInstallation/FormPackage.resx b/SoftwareInstallation/FormPackage.resx index 27104e8..af32865 100644 --- a/SoftwareInstallation/FormPackage.resx +++ b/SoftwareInstallation/FormPackage.resx @@ -117,22 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - True - - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/SoftwareInstallation/FormPackageComponent.Designer.cs b/SoftwareInstallation/FormPackageComponent.Designer.cs index c9af534..06760d6 100644 --- a/SoftwareInstallation/FormPackageComponent.Designer.cs +++ b/SoftwareInstallation/FormPackageComponent.Designer.cs @@ -1,4 +1,4 @@ -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { partial class FormPackageComponent { @@ -28,96 +28,98 @@ /// private void InitializeComponent() { - buttonSave = new Button(); - buttonCancel = new Button(); - label1 = new Label(); - label2 = new Label(); - comboBoxComponent = new ComboBox(); - textBoxCount = new TextBox(); - SuspendLayout(); + this.labelComponent = new System.Windows.Forms.Label(); + this.comboBoxComponent = new System.Windows.Forms.ComboBox(); + this.labelCount = new System.Windows.Forms.Label(); + this.textBoxCount = new System.Windows.Forms.TextBox(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonSave = new System.Windows.Forms.Button(); + this.SuspendLayout(); // - // buttonSave + // labelComponent // - buttonSave.Location = new Point(199, 100); - buttonSave.Margin = new Padding(3, 4, 3, 4); - buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(98, 36); - buttonSave.TabIndex = 0; - buttonSave.Text = "Сохранить"; - buttonSave.UseVisualStyleBackColor = true; - buttonSave.Click += this.buttonSave_Click; - // - // buttonCancel - // - buttonCancel.Location = new Point(309, 100); - buttonCancel.Margin = new Padding(3, 4, 3, 4); - buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(98, 36); - buttonCancel.TabIndex = 1; - buttonCancel.Text = "Отмена"; - buttonCancel.UseVisualStyleBackColor = true; - buttonCancel.Click += this.buttonCancel_Click; - // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(14, 19); - label1.Name = "label1"; - label1.Size = new Size(91, 20); - label1.TabIndex = 2; - label1.Text = "Компонент:"; - // - // label2 - // - label2.AutoSize = true; - label2.Location = new Point(14, 59); - label2.Name = "label2"; - label2.Size = new Size(93, 20); - label2.TabIndex = 3; - label2.Text = "Количество:"; + this.labelComponent.AutoSize = true; + this.labelComponent.Location = new System.Drawing.Point(10, 7); + this.labelComponent.Name = "labelComponent"; + this.labelComponent.Size = new System.Drawing.Size(72, 15); + this.labelComponent.TabIndex = 0; + this.labelComponent.Text = "Компонент:"; // // comboBoxComponent // - comboBoxComponent.FormattingEnabled = true; - comboBoxComponent.Location = new Point(121, 12); - comboBoxComponent.Margin = new Padding(3, 4, 3, 4); - comboBoxComponent.Name = "comboBoxComponent"; - comboBoxComponent.Size = new Size(285, 28); - comboBoxComponent.TabIndex = 4; + this.comboBoxComponent.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxComponent.FormattingEnabled = true; + this.comboBoxComponent.Location = new System.Drawing.Point(104, 7); + this.comboBoxComponent.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBoxComponent.Name = "comboBoxComponent"; + this.comboBoxComponent.Size = new System.Drawing.Size(235, 23); + this.comboBoxComponent.TabIndex = 1; + // + // labelCount + // + this.labelCount.AutoSize = true; + this.labelCount.Location = new System.Drawing.Point(10, 38); + this.labelCount.Name = "labelCount"; + this.labelCount.Size = new System.Drawing.Size(75, 15); + this.labelCount.TabIndex = 2; + this.labelCount.Text = "Количество:"; // // textBoxCount // - textBoxCount.Location = new Point(121, 59); - textBoxCount.Margin = new Padding(3, 4, 3, 4); - textBoxCount.Name = "textBoxCount"; - textBoxCount.Size = new Size(285, 27); - textBoxCount.TabIndex = 5; + this.textBoxCount.Location = new System.Drawing.Point(104, 38); + this.textBoxCount.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxCount.Name = "textBoxCount"; + this.textBoxCount.Size = new System.Drawing.Size(235, 23); + this.textBoxCount.TabIndex = 3; // - // FormPackage + // buttonCancel // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(426, 149); - Controls.Add(textBoxCount); - Controls.Add(comboBoxComponent); - Controls.Add(label2); - Controls.Add(label1); - Controls.Add(buttonCancel); - Controls.Add(buttonSave); - Margin = new Padding(3, 4, 3, 4); - Name = "FormPackage"; - Text = "Компонент ПО"; - ResumeLayout(false); - PerformLayout(); + this.buttonCancel.Location = new System.Drawing.Point(253, 70); + this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(86, 31); + this.buttonCancel.TabIndex = 4; + this.buttonCancel.Text = "Отмена"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + // + // buttonSave + // + this.buttonSave.Location = new System.Drawing.Point(168, 70); + this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonSave.Name = "buttonSave"; + this.buttonSave.Size = new System.Drawing.Size(79, 31); + this.buttonSave.TabIndex = 5; + this.buttonSave.Text = "Сохранить"; + this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click); + // + // FormPackageComponent + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(373, 110); + this.Controls.Add(this.buttonSave); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.textBoxCount); + this.Controls.Add(this.labelCount); + this.Controls.Add(this.comboBoxComponent); + this.Controls.Add(this.labelComponent); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "FormPackageComponent"; + this.Text = "Компонент изделия"; + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion - private Button buttonSave; - private Button buttonCancel; - private Label label1; - private Label label2; + private Label labelComponent; private ComboBox comboBoxComponent; + private Label labelCount; private TextBox textBoxCount; + private Button buttonCancel; + private Button buttonSave; } } \ No newline at end of file diff --git a/SoftwareInstallation/FormPackageComponent.cs b/SoftwareInstallation/FormPackageComponent.cs index 96a8f17..b335011 100644 --- a/SoftwareInstallation/FormPackageComponent.cs +++ b/SoftwareInstallation/FormPackageComponent.cs @@ -11,7 +11,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { public partial class FormPackageComponent : Form { @@ -45,12 +45,7 @@ namespace SoftwareInstallation.Forms return null; } } - public int Count - { - get { return Convert.ToInt32(textBoxCount.Text); } - set { textBoxCount.Text = value.ToString(); } - } - + public int Count { get { return Convert.ToInt32(textBoxCount.Text); } set { textBoxCount.Text = value.ToString(); } } public FormPackageComponent(IComponentLogic logic) { InitializeComponent(); @@ -64,8 +59,7 @@ namespace SoftwareInstallation.Forms comboBoxComponent.SelectedItem = null; } } - - private void buttonSave_Click(object sender, EventArgs e) + private void ButtonSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxCount.Text)) { @@ -80,7 +74,7 @@ namespace SoftwareInstallation.Forms DialogResult = DialogResult.OK; Close(); } - private void buttonCancel_Click(object sender, EventArgs e) + private void ButtonCancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); diff --git a/SoftwareInstallation/FormPackageComponent.resx b/SoftwareInstallation/FormPackageComponent.resx index af32865..f298a7b 100644 --- a/SoftwareInstallation/FormPackageComponent.resx +++ b/SoftwareInstallation/FormPackageComponent.resx @@ -1,64 +1,4 @@ - - - + diff --git a/SoftwareInstallation/FormPackages.Designer.cs b/SoftwareInstallation/FormPackages.Designer.cs index 49839d2..9281763 100644 --- a/SoftwareInstallation/FormPackages.Designer.cs +++ b/SoftwareInstallation/FormPackages.Designer.cs @@ -1,6 +1,6 @@ -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { - partial class FormPackages + partial class FormSoftwares { /// /// Required designer variable. @@ -28,89 +28,99 @@ /// private void InitializeComponent() { + ToolsPanel = new Panel(); + dataGridView = new DataGridView(); buttonRef = new Button(); buttonDel = new Button(); buttonUpd = new Button(); buttonAdd = new Button(); - dataGridView = new DataGridView(); + ToolsPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); // - // buttonRef + // ToolsPanel // - buttonRef.Location = new Point(741, 180); - buttonRef.Margin = new Padding(3, 4, 3, 4); - buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(128, 35); - buttonRef.TabIndex = 9; - buttonRef.Text = "Обновить"; - buttonRef.UseVisualStyleBackColor = true; - buttonRef.Click += buttonRef_Click; - // - // buttonDel - // - buttonDel.Location = new Point(741, 129); - buttonDel.Margin = new Padding(3, 4, 3, 4); - buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(128, 35); - buttonDel.TabIndex = 8; - buttonDel.Text = "Удалить"; - buttonDel.UseVisualStyleBackColor = true; - buttonDel.Click += buttonDel_Click; - // - // buttonUpd - // - buttonUpd.Location = new Point(741, 77); - buttonUpd.Margin = new Padding(3, 4, 3, 4); - buttonUpd.Name = "buttonUpd"; - buttonUpd.Size = new Size(128, 35); - buttonUpd.TabIndex = 7; - buttonUpd.Text = "Изменить"; - buttonUpd.UseVisualStyleBackColor = true; - buttonUpd.Click += buttonUpd_Click; - // - // buttonAdd - // - buttonAdd.Location = new Point(741, 27); - buttonAdd.Margin = new Padding(3, 4, 3, 4); - buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(128, 35); - buttonAdd.TabIndex = 6; - buttonAdd.Text = "Добавить"; - buttonAdd.UseVisualStyleBackColor = true; - buttonAdd.Click += buttonAdd_Click; + ToolsPanel.Controls.Add(dataGridView); + ToolsPanel.Controls.Add(buttonRef); + ToolsPanel.Controls.Add(buttonDel); + ToolsPanel.Controls.Add(buttonUpd); + ToolsPanel.Controls.Add(buttonAdd); + ToolsPanel.Location = new Point(-1, -1); + ToolsPanel.Name = "ToolsPanel"; + ToolsPanel.Size = new Size(819, 481); + ToolsPanel.TabIndex = 3; // // dataGridView // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.BackgroundColor = Color.White; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(-1, 0); - dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.Location = new Point(0, 0); dataGridView.Name = "dataGridView"; dataGridView.ReadOnly = true; dataGridView.RowHeadersWidth = 51; - dataGridView.RowTemplate.Height = 24; - dataGridView.Size = new Size(709, 568); - dataGridView.TabIndex = 5; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(590, 479); + dataGridView.TabIndex = 2; // - // SoftwareInstallation + // buttonRef + // + buttonRef.Location = new Point(610, 231); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(126, 36); + buttonRef.TabIndex = 3; + buttonRef.Text = "Обновить"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += ButtonRef_Click; + // + // buttonDel + // + buttonDel.Location = new Point(610, 167); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(126, 36); + buttonDel.TabIndex = 2; + buttonDel.Text = "Удалить"; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // buttonUpd + // + buttonUpd.Location = new Point(610, 101); + buttonUpd.Name = "buttonUpd"; + buttonUpd.Size = new Size(126, 36); + buttonUpd.TabIndex = 1; + buttonUpd.Text = "Изменить"; + buttonUpd.UseVisualStyleBackColor = true; + buttonUpd.Click += ButtonUpd_Click; + // + // buttonAdd + // + buttonAdd.Location = new Point(610, 41); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(126, 36); + buttonAdd.TabIndex = 0; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // FormSoftwares // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(895, 571); - Controls.Add(buttonRef); - Controls.Add(buttonDel); - Controls.Add(buttonUpd); - Controls.Add(buttonAdd); - Controls.Add(dataGridView); - Name = "SoftwareInstallation"; - Text = "Список пакетов установок"; - Load += FormPackages_Load; + ClientSize = new Size(808, 479); + Controls.Add(ToolsPanel); + Name = "FormSoftwares"; + Text = "ПО"; + Load += FormSoftwarees_Load; + ToolsPanel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); } #endregion + private Panel ToolsPanel; private Button buttonRef; private Button buttonDel; private Button buttonUpd; diff --git a/SoftwareInstallation/FormPackages.cs b/SoftwareInstallation/FormPackages.cs index 0e330db..0bd8473 100644 --- a/SoftwareInstallation/FormPackages.cs +++ b/SoftwareInstallation/FormPackages.cs @@ -1,4 +1,7 @@ -using System; +using Microsoft.Extensions.Logging; +using SoftwareInstallationContracts.BindingModels; +using SoftwareInstallationContracts.BusinessLogicsContracts; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,29 +10,23 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using SoftwareInstallation; -using SoftwareInstallationContracts.BindingModels; -using SoftwareInstallationContracts.BusinessLogicsContracts; -using Microsoft.Extensions.Logging; -namespace SoftwareInstallation.Forms +namespace SoftwareInstallationView { - public partial class FormPackages : Form + public partial class FormSoftwares : Form { private readonly ILogger _logger; private readonly IPackageLogic _logic; - public FormPackages(ILogger logger, IPackageLogic logic) + public FormSoftwares(ILogger logger, IPackageLogic logic) { InitializeComponent(); _logger = logger; _logic = logic; } - - private void FormPackages_Load(object sender, EventArgs e) + private void FormSoftwarees_Load(object sender, EventArgs e) { LoadData(); } - private void LoadData() { try @@ -39,21 +36,22 @@ namespace SoftwareInstallation.Forms { dataGridView.DataSource = list; dataGridView.Columns["Id"].Visible = false; - dataGridView.Columns["PackageComponents"].Visible = false; - dataGridView.Columns["PackageName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["SoftwareComponents"].Visible = false; + dataGridView.Columns["SoftwareName"].AutoSizeMode = + DataGridViewAutoSizeColumnMode.Fill; } - _logger.LogInformation("Загрузка консерв"); + _logger.LogInformation("Загрузка изделий"); } catch (Exception ex) { - _logger.LogError(ex, "Ошибка загрузки компонентов"); + _logger.LogError(ex, "Ошибка загрузки изделий"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - - private void buttonAdd_Click(object sender, EventArgs e) + private void ButtonAdd_Click(object sender, EventArgs e) { - var service = Program.ServiceProvider?.GetService(typeof(FormPackage)); - if (service is FormPackage form) + var service = Program.ServiceProvider?.GetService(typeof(FormSoftware)); + if (service is FormSoftware form) { if (form.ShowDialog() == DialogResult.OK) { @@ -61,13 +59,12 @@ namespace SoftwareInstallation.Forms } } } - - private void buttonUpd_Click(object sender, EventArgs e) + private void ButtonUpd_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { - var service = Program.ServiceProvider?.GetService(typeof(FormPackage)); - if (service is FormPackage form) + var service = Program.ServiceProvider?.GetService(typeof(FormSoftware)); + if (service is FormSoftware form) { form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); if (form.ShowDialog() == DialogResult.OK) @@ -77,16 +74,14 @@ namespace SoftwareInstallation.Forms } } } - - private void buttonDel_Click(object sender, EventArgs e) + private void ButtonDel_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - int id = - Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Удаление консервы"); + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Удаление изделия"); try { if (!_logic.Delete(new PackageBindingModel @@ -100,14 +95,13 @@ namespace SoftwareInstallation.Forms } catch (Exception ex) { - _logger.LogError(ex, "Ошибка удаления консервы"); + _logger.LogError(ex, "Ошибка удаления изделия"); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } - - private void buttonRef_Click(object sender, EventArgs e) + private void ButtonRef_Click(object sender, EventArgs e) { LoadData(); } diff --git a/SoftwareInstallation/FormReportOrders.Designer.cs b/SoftwareInstallation/FormReportOrders.Designer.cs new file mode 100644 index 0000000..0f39fc9 --- /dev/null +++ b/SoftwareInstallation/FormReportOrders.Designer.cs @@ -0,0 +1,137 @@ +namespace SoftwareInstallationView +{ + partial class FormReportOrders + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel = new System.Windows.Forms.Panel(); + this.buttonCreateToPdf = new System.Windows.Forms.Button(); + this.buttonCreateReport = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.dateTimePickerEnd = new System.Windows.Forms.DateTimePicker(); + this.dateTimePickerStart = new System.Windows.Forms.DateTimePicker(); + this.panel.SuspendLayout(); + this.SuspendLayout(); + // + // panel + // + this.panel.Controls.Add(this.buttonCreateToPdf); + this.panel.Controls.Add(this.buttonCreateReport); + this.panel.Controls.Add(this.label2); + this.panel.Controls.Add(this.label1); + this.panel.Controls.Add(this.dateTimePickerEnd); + this.panel.Controls.Add(this.dateTimePickerStart); + this.panel.Dock = System.Windows.Forms.DockStyle.Top; + this.panel.Location = new System.Drawing.Point(0, 0); + this.panel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.panel.Name = "panel"; + this.panel.Size = new System.Drawing.Size(861, 56); + this.panel.TabIndex = 0; + // + // buttonCreateToPdf + // + this.buttonCreateToPdf.Location = new System.Drawing.Point(684, 29); + this.buttonCreateToPdf.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCreateToPdf.Name = "buttonCreateToPdf"; + this.buttonCreateToPdf.Size = new System.Drawing.Size(166, 23); + this.buttonCreateToPdf.TabIndex = 5; + this.buttonCreateToPdf.Text = "PDF"; + this.buttonCreateToPdf.UseVisualStyleBackColor = true; + this.buttonCreateToPdf.Click += new System.EventHandler(this.buttonCreateToPdf_Click); + // + // buttonCreateReport + // + this.buttonCreateReport.Location = new System.Drawing.Point(485, 29); + this.buttonCreateReport.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCreateReport.Name = "buttonCreateReport"; + this.buttonCreateReport.Size = new System.Drawing.Size(166, 23); + this.buttonCreateReport.TabIndex = 4; + this.buttonCreateReport.Text = "Сформировать"; + this.buttonCreateReport.UseVisualStyleBackColor = true; + this.buttonCreateReport.Click += new System.EventHandler(this.buttonCreateReport_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(323, 7); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(44, 15); + this.label2.TabIndex = 3; + this.label2.Text = "Конец:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(76, 4); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(52, 15); + this.label1.TabIndex = 2; + this.label1.Text = "Начало:"; + // + // dateTimePickerEnd + // + this.dateTimePickerEnd.Location = new System.Drawing.Point(269, 29); + this.dateTimePickerEnd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.dateTimePickerEnd.Name = "dateTimePickerEnd"; + this.dateTimePickerEnd.Size = new System.Drawing.Size(164, 23); + this.dateTimePickerEnd.TabIndex = 1; + // + // dateTimePickerStart + // + this.dateTimePickerStart.Location = new System.Drawing.Point(31, 29); + this.dateTimePickerStart.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.dateTimePickerStart.Name = "dateTimePickerStart"; + this.dateTimePickerStart.Size = new System.Drawing.Size(164, 23); + this.dateTimePickerStart.TabIndex = 0; + // + // FormReportOrders + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(861, 338); + this.Controls.Add(this.panel); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "FormReportOrders"; + this.Text = "Заказы"; + this.panel.ResumeLayout(false); + this.panel.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private Panel panel; + private DateTimePicker dateTimePickerEnd; + private DateTimePicker dateTimePickerStart; + private Button buttonCreateToPdf; + private Button buttonCreateReport; + private Label label2; + private Label label1; + } +} \ No newline at end of file diff --git a/SoftwareInstallation/FormReportOrders.cs b/SoftwareInstallation/FormReportOrders.cs new file mode 100644 index 0000000..e1b304b --- /dev/null +++ b/SoftwareInstallation/FormReportOrders.cs @@ -0,0 +1,102 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Reporting.WinForms; +using SoftwareInstallationContracts.BindingModels; +using SoftwareInstallationContracts.BusinessLogicsContracts; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SoftwareInstallationView +{ + public partial class FormReportOrders : Form + { + private readonly ReportViewer reportViewer; + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public FormReportOrders(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + reportViewer = new ReportViewer + { + Dock = DockStyle.Fill + }; + reportViewer.LocalReport.LoadReportDefinition(new FileStream("C:\\Users\\днс\\Desktop\\РПП 2 семестр\\доп инфа\\4 лаба\\PrecastConcretePlant\\PrecastConcretePlantView\\ReportOrders.rdlc", FileMode.Open)); + Controls.Clear(); + Controls.Add(reportViewer); + Controls.Add(panel); + } + + private void buttonCreateReport_Click(object sender, EventArgs e) + { + if (dateTimePickerStart.Value.Date >= dateTimePickerEnd.Value.Date) + { + MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + try + { + var dataSource = _logic.GetOrders(new ReportBindingModel + { + DateFrom = dateTimePickerStart.Value, + DateTo = dateTimePickerEnd.Value + }); + var source = new ReportDataSource("DataSetOrders", dataSource); + reportViewer.LocalReport.DataSources.Clear(); + reportViewer.LocalReport.DataSources.Add(source); + var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c{dateTimePickerStart.Value.ToShortDateString()} по {dateTimePickerEnd.Value.ToShortDateString()}") }; + reportViewer.LocalReport.SetParameters(parameters); + reportViewer.RefreshReport(); + _logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePickerStart.Value.ToShortDateString(), dateTimePickerEnd.Value.ToShortDateString()); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка заказов на период"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + + } + + private void buttonCreateToPdf_Click(object sender, EventArgs e) + { + if (dateTimePickerStart.Value.Date >= dateTimePickerEnd.Value.Date) + { + MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + using var dialog = new SaveFileDialog + { + Filter = "pdf|*.pdf" + }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SaveOrdersToPdfFile(new ReportBindingModel + { + FileName = dialog.FileName, + DateFrom = dateTimePickerStart.Value, + DateTo = dateTimePickerEnd.Value + }); + _logger.LogInformation("Сохранение списка заказов на период { From} -{ To}", dateTimePickerStart.Value.ToShortDateString(), dateTimePickerEnd.Value.ToShortDateString()); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения списка заказов на период"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + } +} diff --git a/SoftwareInstallation/FormReportOrders.resx b/SoftwareInstallation/FormReportOrders.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/SoftwareInstallation/FormReportOrders.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SoftwareInstallation/FormReportPackageComponents.Designer.cs b/SoftwareInstallation/FormReportPackageComponents.Designer.cs new file mode 100644 index 0000000..68c6c14 --- /dev/null +++ b/SoftwareInstallation/FormReportPackageComponents.Designer.cs @@ -0,0 +1,109 @@ +namespace SoftwareInstallationView +{ + partial class FormReportSoftwareComponents + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonSaveToExcel = new Button(); + dataGridView = new DataGridView(); + Изделие = new DataGridViewTextBoxColumn(); + Компонент = new DataGridViewTextBoxColumn(); + Количество = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // buttonSaveToExcel + // + buttonSaveToExcel.Location = new Point(14, 31); + buttonSaveToExcel.Margin = new Padding(3, 4, 3, 4); + buttonSaveToExcel.Name = "buttonSaveToExcel"; + buttonSaveToExcel.Size = new Size(229, 31); + buttonSaveToExcel.TabIndex = 0; + buttonSaveToExcel.Text = "Сохранить в excel"; + buttonSaveToExcel.UseVisualStyleBackColor = true; + buttonSaveToExcel.Click += ButtonSaveToExcel_Click; + // + // dataGridView + // + dataGridView.BackgroundColor = SystemColors.ButtonFace; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { Изделие, Компонент, Количество }); + dataGridView.Dock = DockStyle.Bottom; + dataGridView.Location = new Point(0, 69); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 25; + dataGridView.Size = new Size(515, 531); + dataGridView.TabIndex = 1; + dataGridView.CellContentClick += dataGridView_CellContentClick; + // + // Изделие + // + Изделие.HeaderText = "изделие"; + Изделие.MinimumWidth = 6; + Изделие.Name = "Изделие"; + Изделие.Width = 150; + // + // Компонент + // + Компонент.HeaderText = "Компонент"; + Компонент.MinimumWidth = 6; + Компонент.Name = "Компонент"; + Компонент.Width = 150; + // + // Количество + // + Количество.HeaderText = "Количество"; + Количество.MinimumWidth = 6; + Количество.Name = "Количество"; + Количество.Width = 150; + // + // FormReportSoftwareComponents + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(515, 600); + Controls.Add(dataGridView); + Controls.Add(buttonSaveToExcel); + Margin = new Padding(3, 4, 3, 4); + Name = "FormReportSoftwareComponents"; + Text = "ПО по компонентам"; + Load += FormReportSoftwareComponents_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Button buttonSaveToExcel; + private DataGridView dataGridView; + private DataGridViewTextBoxColumn Изделие; + private DataGridViewTextBoxColumn Компонент; + private DataGridViewTextBoxColumn Количество; + } +} \ No newline at end of file diff --git a/SoftwareInstallation/FormReportPackageComponents.cs b/SoftwareInstallation/FormReportPackageComponents.cs new file mode 100644 index 0000000..99a9365 --- /dev/null +++ b/SoftwareInstallation/FormReportPackageComponents.cs @@ -0,0 +1,83 @@ +using Microsoft.Extensions.Logging; +using SoftwareInstallationContracts.BindingModels; +using SoftwareInstallationContracts.BusinessLogicsContracts; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SoftwareInstallationView +{ + public partial class FormReportSoftwareComponents : Form + { + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public FormReportSoftwareComponents(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + private void FormReportSoftwareComponents_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetSoftwareComponents(); + if (dict != null) + { + dataGridView.Rows.Clear(); + foreach (var elem in dict) + { + dataGridView.Rows.Add(new object[] { elem.SoftwareName, "", "" }); + foreach (var listElem in elem.Components) + { + dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); + } + dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount }); + dataGridView.Rows.Add(Array.Empty()); + } + } + _logger.LogInformation("Загрузка списка изделий по компонентам"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonSaveToExcel_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SavePackageComponentToExcelFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + _logger.LogInformation("Сохранение списка изделий по компонентам"); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + } +} diff --git a/SoftwareInstallation/FormReportPackageComponents.resx b/SoftwareInstallation/FormReportPackageComponents.resx new file mode 100644 index 0000000..50eb094 --- /dev/null +++ b/SoftwareInstallation/FormReportPackageComponents.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/SoftwareInstallation/Program.cs b/SoftwareInstallation/Program.cs index e73efc2..b1ccb01 100644 --- a/SoftwareInstallation/Program.cs +++ b/SoftwareInstallation/Program.cs @@ -1,13 +1,15 @@ -using SoftwareInstallation.Forms; -using SoftwareInstallationContracts.BusinessLogicsContracts; -using SoftwareInstallationBusinessLogic.BusinessLogic; -using SoftwareInstallationContracts.StoragesContracts; -using SoftwareInstallationDatabaseImplement.Implements; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; +using SoftwareInstallationBusinessLogic.BusinessLogics; +using SoftwareInstallationBusinessLogic.OfficePackage.Implements; +using SoftwareInstallationBusinessLogic.OfficePackage; +using SoftwareInstallationContracts.BusinessLogicsContracts; +using SoftwareInstallationContracts.StoragesContracts; +using SoftwareInstallationDatabaseImplement.Implements; +using System; -namespace SoftwareInstallation +namespace SoftwareInstallationView { internal static class Program { @@ -25,7 +27,6 @@ namespace SoftwareInstallation var services = new ServiceCollection(); ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); - Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) @@ -35,19 +36,29 @@ namespace SoftwareInstallation option.SetMinimumLevel(LogLevel.Information); option.AddNLog("nlog.config"); }); + services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/SoftwareInstallation/ReportOrders.rdlc b/SoftwareInstallation/ReportOrders.rdlc new file mode 100644 index 0000000..05726ab --- /dev/null +++ b/SoftwareInstallation/ReportOrders.rdlc @@ -0,0 +1,599 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 10791c83-cee8-4a38-bbd0-245fc17cefb3 + + + + + + SoftwareInstallationContractsViewModels + /* Local Query */ + + + + Id + System.Int32 + + + DateCreate + System.DateTime + + + SoftwareName + System.String + + + Sum + System.Decimal + + + Status + System.String + + + + SoftwareInstallationContracts.ViewModels + ReportOrdersViewModel + SoftwareInstallationContracts.ViewModels.ReportOrdersViewModel, SoftwareInstallationContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + + + + + + + true + true + + + + + =Parameters!ReportParameterPeriod.Value + + + + + + + ReportParameterPeriod + 1cm + 1cm + 21cm + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Заказы + + + + + + + 1cm + 21cm + 1 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + 2.5cm + + + 3.21438cm + + + 8.23317cm + + + 2.5cm + + + 2.5cm + + + + + 0.6cm + + + + + true + true + + + + + Номер + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Дата создания + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Железные изделия + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Сумма + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Статус + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + =Fields!Id.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!DateCreate.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!SoftwareName.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Status.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetOrders + 2.48391cm + 0.55245cm + 1.2cm + 18.94755cm + 2 + + + + + + true + true + + + + + Итого: + + + + + + + 4cm + 12cm + 0.6cm + 2.5cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!Sum.Value, "DataSetOrders") + + + + + + + 4cm + 14.5cm + 0.6cm + 2.5cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + 5.72875cm +