From 886cfe9f3a651aa42e05a655d739eb8f435a2fb9 Mon Sep 17 00:00:00 2001 From: Ivan_Starostin Date: Sun, 2 Jun 2024 16:41:31 +0400 Subject: [PATCH 01/17] Upload files to 'ShipyardFileImplement' --- ShipyardFileImplement/OrderStorage.cs | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/ShipyardFileImplement/OrderStorage.cs b/ShipyardFileImplement/OrderStorage.cs index 1122256..a1e2b2e 100644 --- a/ShipyardFileImplement/OrderStorage.cs +++ b/ShipyardFileImplement/OrderStorage.cs @@ -24,14 +24,16 @@ namespace ShipyardFileImplement.Implements } public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue) - { - return new(); - } + return source.Orders - .Where(x => x.Id == model.Id) - .Select(x => AccessShipStorage(x.GetViewModel)) - .ToList(); + .Where(x => ( + (!model.Id.HasValue || x.Id == model.Id) && + (!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) && + (!model.DateTo.HasValue || x.DateCreate <= model.DateTo) + ) + ) + .Select(x => AccessShipStorage(x.GetViewModel)) + .ToList(); } public OrderViewModel? GetElement(OrderSearchModel model) { @@ -82,7 +84,14 @@ namespace ShipyardFileImplement.Implements { if (model == null) return null; - model = source.Ships.Where(x => x.Id == model.ShipId).FirstOrDefault(); + foreach (var Ship in source.Ships) + { + if (Ship.Id == model.ShipId) + { + model.ShipName = Ship.ShipName; + break; + } + } return model; } } -- 2.25.1 From f41966f4d4e1f6167ba6a36fc398ab32f643699f Mon Sep 17 00:00:00 2001 From: Ivan_Starostin Date: Sun, 2 Jun 2024 16:43:14 +0400 Subject: [PATCH 02/17] Upload files to 'ShipyardView' --- .../FormReportShipComponents.Designer.cs | 101 ++++++++++++++ ShipyardView/FormReportShipComponents.cs | 84 ++++++++++++ ShipyardView/FormReportShipComponents.resx | 129 ++++++++++++++++++ 3 files changed, 314 insertions(+) create mode 100644 ShipyardView/FormReportShipComponents.Designer.cs create mode 100644 ShipyardView/FormReportShipComponents.cs create mode 100644 ShipyardView/FormReportShipComponents.resx diff --git a/ShipyardView/FormReportShipComponents.Designer.cs b/ShipyardView/FormReportShipComponents.Designer.cs new file mode 100644 index 0000000..d6cd552 --- /dev/null +++ b/ShipyardView/FormReportShipComponents.Designer.cs @@ -0,0 +1,101 @@ +namespace ShipyardView +{ + partial class FormReportShipComponents + { + /// + /// 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() + { + dataGridView = new DataGridView(); + ComponentColumn = new DataGridViewTextBoxColumn(); + ShipColumn = new DataGridViewTextBoxColumn(); + CountColumn = new DataGridViewTextBoxColumn(); + buttonSave = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ComponentColumn, ShipColumn, CountColumn }); + dataGridView.Location = new Point(12, 93); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(908, 343); + dataGridView.TabIndex = 0; + // + // ComponentColumn + // + ComponentColumn.HeaderText = "компонент"; + ComponentColumn.MinimumWidth = 6; + ComponentColumn.Name = "ComponentColumn"; + // + // ShipColumn + // + ShipColumn.HeaderText = "корабль"; + ShipColumn.MinimumWidth = 6; + ShipColumn.Name = "ShipColumn"; + // + // CountColumn + // + CountColumn.HeaderText = "количество"; + CountColumn.MinimumWidth = 6; + CountColumn.Name = "CountColumn"; + // + // buttonSave + // + buttonSave.Location = new Point(352, 12); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(189, 46); + buttonSave.TabIndex = 1; + buttonSave.Text = "сохранить в excel"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += SaveButton_Click; + // + // FormReportShipComponents + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(932, 464); + Controls.Add(buttonSave); + Controls.Add(dataGridView); + Name = "FormReportShipComponents"; + Text = "FormReportShipComponents"; + Load += FormReportShipComponents_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Button buttonSave; + private DataGridViewTextBoxColumn ComponentColumn; + private DataGridViewTextBoxColumn ShipColumn; + private DataGridViewTextBoxColumn CountColumn; + } +} \ No newline at end of file diff --git a/ShipyardView/FormReportShipComponents.cs b/ShipyardView/FormReportShipComponents.cs new file mode 100644 index 0000000..5c4f7d1 --- /dev/null +++ b/ShipyardView/FormReportShipComponents.cs @@ -0,0 +1,84 @@ +using Microsoft.Extensions.Logging; +using ShipyardContracts.BindingModels; +using ShipyardContracts.BusinessLogicContracts; +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 ShipyardView +{ + public partial class FormReportShipComponents : Form + { + private readonly ILogger _logger; + private readonly IReportLogic _logic; + public FormReportShipComponents( + ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + + } + + private void SaveButton_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog + { + Filter = "xlsx|*.xlsx" + }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SaveShipComponentToExcelFile( + 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 FormReportShipComponents_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetShipComponent(); + if (dict != null) + { + dataGridView.Rows.Clear(); + foreach (var elem in dict) + { + dataGridView.Rows.Add(new object[] { elem.ShipName, "", "" }); + 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); + } + } + } +} diff --git a/ShipyardView/FormReportShipComponents.resx b/ShipyardView/FormReportShipComponents.resx new file mode 100644 index 0000000..de3c3a4 --- /dev/null +++ b/ShipyardView/FormReportShipComponents.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file -- 2.25.1 From 8003f6b5c21bcf8bc89019324845c6a78b9d8dc2 Mon Sep 17 00:00:00 2001 From: Ivan_Starostin Date: Sun, 2 Jun 2024 16:44:15 +0400 Subject: [PATCH 03/17] Upload files to 'ShipyardView' --- ShipyardView/FormCreateOrder.Designer.cs | 143 ++++++++++++++ ShipyardView/FormMain.Designer.cs | 215 +++++++++++++++++++++ ShipyardView/FormReportOrders.Designer.cs | 102 ++++++++++ ShipyardView/FormShipComponent.Designer.cs | 118 +++++++++++ ShipyardView/FormShips.Designer.cs | 116 +++++++++++ 5 files changed, 694 insertions(+) create mode 100644 ShipyardView/FormCreateOrder.Designer.cs create mode 100644 ShipyardView/FormMain.Designer.cs create mode 100644 ShipyardView/FormReportOrders.Designer.cs create mode 100644 ShipyardView/FormShipComponent.Designer.cs create mode 100644 ShipyardView/FormShips.Designer.cs diff --git a/ShipyardView/FormCreateOrder.Designer.cs b/ShipyardView/FormCreateOrder.Designer.cs new file mode 100644 index 0000000..209cfff --- /dev/null +++ b/ShipyardView/FormCreateOrder.Designer.cs @@ -0,0 +1,143 @@ +namespace ShipyardView +{ + partial class FormCreateOrder + { + /// + /// 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() + { + textBoxCount = new TextBox(); + textBoxSum = new TextBox(); + ComboBoxManufacture = new ComboBox(); + ButtonCancel = new Button(); + ButtonSave = new Button(); + labelItem = new Label(); + labelcount = new Label(); + labeltotal = new Label(); + SuspendLayout(); + // + // textBoxCount + // + textBoxCount.Location = new Point(455, 56); + textBoxCount.Name = "textBoxCount"; + textBoxCount.Size = new Size(125, 27); + textBoxCount.TabIndex = 1; + textBoxCount.TextChanged += textBoxCount_TextChanged; + // + // textBoxSum + // + textBoxSum.Location = new Point(377, 109); + textBoxSum.Name = "textBoxSum"; + textBoxSum.ReadOnly = true; + textBoxSum.Size = new Size(125, 27); + textBoxSum.TabIndex = 2; + // + // ComboBoxManufacture + // + ComboBoxManufacture.FormattingEnabled = true; + ComboBoxManufacture.Location = new Point(271, 55); + ComboBoxManufacture.Name = "ComboBoxManufacture"; + ComboBoxManufacture.Size = new Size(151, 28); + ComboBoxManufacture.TabIndex = 3; + ComboBoxManufacture.SelectedIndexChanged += ComboBoxManufacture_SelectedIndexChanged; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(440, 168); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(94, 29); + ButtonCancel.TabIndex = 4; + ButtonCancel.Text = "отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // ButtonSave + // + ButtonSave.Location = new Point(307, 168); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(94, 29); + ButtonSave.TabIndex = 5; + ButtonSave.Text = "сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // labelItem + // + labelItem.AutoSize = true; + labelItem.Location = new Point(271, 22); + labelItem.Name = "labelItem"; + labelItem.Size = new Size(67, 20); + labelItem.TabIndex = 6; + labelItem.Text = "корабль"; + // + // labelcount + // + labelcount.AutoSize = true; + labelcount.Location = new Point(455, 22); + labelcount.Name = "labelcount"; + labelcount.Size = new Size(88, 20); + labelcount.TabIndex = 7; + labelcount.Text = "количество"; + // + // labeltotal + // + labeltotal.AutoSize = true; + labeltotal.Location = new Point(307, 112); + labeltotal.Name = "labeltotal"; + labeltotal.Size = new Size(51, 20); + labeltotal.TabIndex = 8; + labeltotal.Text = "итого:"; + // + // FormCreateOrder + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 209); + Controls.Add(labeltotal); + Controls.Add(labelcount); + Controls.Add(labelItem); + Controls.Add(ButtonSave); + Controls.Add(ButtonCancel); + Controls.Add(ComboBoxManufacture); + Controls.Add(textBoxSum); + Controls.Add(textBoxCount); + Name = "FormCreateOrder"; + Text = "FormCreateOrder"; + Load += FormCreateOrder_Load; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + private TextBox textBoxCount; + private TextBox textBoxSum; + private ComboBox ComboBoxManufacture; + private Button ButtonCancel; + private Button ButtonSave; + private Label labelItem; + private Label labelcount; + private Label labeltotal; + } +} \ No newline at end of file diff --git a/ShipyardView/FormMain.Designer.cs b/ShipyardView/FormMain.Designer.cs new file mode 100644 index 0000000..b03acd6 --- /dev/null +++ b/ShipyardView/FormMain.Designer.cs @@ -0,0 +1,215 @@ +namespace ShipyardView +{ + partial class FormMain + { + /// + /// 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() + { + dataGridView = new DataGridView(); + ShipId = new DataGridViewTextBoxColumn(); + ButtonRef = new Button(); + ButtonCreateOrder = new Button(); + ButtonTakeOrderInWork = new Button(); + ButtonOrderReady = new Button(); + ButtonIssuedOrder = new Button(); + menuStrip1 = new MenuStrip(); + ReportstoolStrip = new ToolStripMenuItem(); + ComponentListToolStripMenuItem = new ToolStripMenuItem(); + ComponentsShipToolStripMenuItem = new ToolStripMenuItem(); + OrderListToolStripMenuItem = new ToolStripMenuItem(); + GuidesToolStripMenuItem = new ToolStripMenuItem(); + ShipsToolStripMenuItem = new ToolStripMenuItem(); + ComponentsToolStripMenuItem = new ToolStripMenuItem(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + menuStrip1.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(0, 117); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(1000, 387); + dataGridView.TabIndex = 0; + // + // ShipId + // + ShipId.MinimumWidth = 6; + ShipId.Name = "ShipId"; + ShipId.Width = 125; + // + // ButtonRef + // + ButtonRef.Location = new Point(1079, 429); + ButtonRef.Name = "ButtonRef"; + ButtonRef.Size = new Size(94, 34); + ButtonRef.TabIndex = 3; + ButtonRef.Text = "обновить"; + ButtonRef.UseVisualStyleBackColor = true; + ButtonRef.Click += ButtonRef_Click; + // + // ButtonCreateOrder + // + ButtonCreateOrder.Location = new Point(1027, 94); + ButtonCreateOrder.Name = "ButtonCreateOrder"; + ButtonCreateOrder.Size = new Size(146, 43); + ButtonCreateOrder.TabIndex = 5; + ButtonCreateOrder.Text = "создать"; + ButtonCreateOrder.UseVisualStyleBackColor = true; + ButtonCreateOrder.Click += ButtonCreateOrder_Click; + // + // ButtonTakeOrderInWork + // + ButtonTakeOrderInWork.Location = new Point(1027, 143); + ButtonTakeOrderInWork.Name = "ButtonTakeOrderInWork"; + ButtonTakeOrderInWork.Size = new Size(146, 47); + ButtonTakeOrderInWork.TabIndex = 6; + ButtonTakeOrderInWork.Text = "выполняется"; + ButtonTakeOrderInWork.UseVisualStyleBackColor = true; + ButtonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click; + // + // ButtonOrderReady + // + ButtonOrderReady.Location = new Point(1027, 196); + ButtonOrderReady.Name = "ButtonOrderReady"; + ButtonOrderReady.Size = new Size(146, 36); + ButtonOrderReady.TabIndex = 7; + ButtonOrderReady.Text = "заказ готов"; + ButtonOrderReady.UseVisualStyleBackColor = true; + ButtonOrderReady.Click += ButtonOrderReady_Click; + // + // ButtonIssuedOrder + // + ButtonIssuedOrder.Location = new Point(1027, 238); + ButtonIssuedOrder.Name = "ButtonIssuedOrder"; + ButtonIssuedOrder.Size = new Size(146, 35); + ButtonIssuedOrder.TabIndex = 8; + ButtonIssuedOrder.Text = "заказ отдан"; + ButtonIssuedOrder.UseVisualStyleBackColor = true; + ButtonIssuedOrder.Click += ButtonIssuedOrder_Click; + // + // menuStrip1 + // + menuStrip1.ImageScalingSize = new Size(20, 20); + menuStrip1.Items.AddRange(new ToolStripItem[] { ReportstoolStrip, GuidesToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Size = new Size(1185, 28); + menuStrip1.TabIndex = 10; + menuStrip1.Text = "menuStrip1"; + // + // ReportstoolStrip + // + ReportstoolStrip.DropDownItems.AddRange(new ToolStripItem[] { ComponentListToolStripMenuItem, ComponentsShipToolStripMenuItem, OrderListToolStripMenuItem }); + ReportstoolStrip.Name = "ReportstoolStrip"; + ReportstoolStrip.Size = new Size(71, 24); + ReportstoolStrip.Text = "отчеты"; + // + // ComponentListToolStripMenuItem + // + ComponentListToolStripMenuItem.Name = "ComponentListToolStripMenuItem"; + ComponentListToolStripMenuItem.Size = new Size(275, 26); + ComponentListToolStripMenuItem.Text = "список кораблей"; + ComponentListToolStripMenuItem.Click += ComponentListToolStripMenuItem_Click; + // + // ComponentsShipToolStripMenuItem + // + ComponentsShipToolStripMenuItem.Name = "ComponentsShipToolStripMenuItem"; + ComponentsShipToolStripMenuItem.Size = new Size(275, 26); + ComponentsShipToolStripMenuItem.Text = "компоненты по кораблям"; + ComponentsShipToolStripMenuItem.Click += ComponentsShipToolStripMenuItem_Click; + // + // OrderListToolStripMenuItem + // + OrderListToolStripMenuItem.Name = "OrderListToolStripMenuItem"; + OrderListToolStripMenuItem.Size = new Size(275, 26); + OrderListToolStripMenuItem.Text = "список заказов"; + OrderListToolStripMenuItem.Click += OrderListToolStripMenuItem_Click; + // + // GuidesToolStripMenuItem + // + GuidesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ShipsToolStripMenuItem, ComponentsToolStripMenuItem }); + GuidesToolStripMenuItem.Name = "GuidesToolStripMenuItem"; + GuidesToolStripMenuItem.Size = new Size(115, 24); + GuidesToolStripMenuItem.Text = "справочники"; + // + // ShipsToolStripMenuItem + // + ShipsToolStripMenuItem.Name = "ShipsToolStripMenuItem"; + ShipsToolStripMenuItem.Size = new Size(224, 26); + ShipsToolStripMenuItem.Text = "корабли"; + ShipsToolStripMenuItem.Click += ShipsToolStripMenuItem_Click; + // + // ComponentsToolStripMenuItem + // + ComponentsToolStripMenuItem.Name = "ComponentsToolStripMenuItem"; + ComponentsToolStripMenuItem.Size = new Size(224, 26); + ComponentsToolStripMenuItem.Text = "компоненты"; + ComponentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click; + // + // FormMain + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1185, 516); + Controls.Add(ButtonIssuedOrder); + Controls.Add(ButtonOrderReady); + Controls.Add(ButtonTakeOrderInWork); + Controls.Add(ButtonCreateOrder); + Controls.Add(ButtonRef); + Controls.Add(menuStrip1); + Controls.Add(dataGridView); + Name = "FormMain"; + Text = "FormMain"; + Load += FormMain_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private DataGridView dataGridView; + private Button ButtonRef; + private Button ButtonCreateOrder; + private Button ButtonTakeOrderInWork; + private Button ButtonOrderReady; + private Button ButtonIssuedOrder; + private DataGridViewTextBoxColumn ShipId; + private MenuStrip menuStrip1; + private ToolStripMenuItem ReportstoolStrip; + private ToolStripMenuItem ComponentListToolStripMenuItem; + private ToolStripMenuItem ComponentsShipToolStripMenuItem; + private ToolStripMenuItem OrderListToolStripMenuItem; + private ToolStripMenuItem GuidesToolStripMenuItem; + private ToolStripMenuItem ShipsToolStripMenuItem; + private ToolStripMenuItem ComponentsToolStripMenuItem; + } +} \ No newline at end of file diff --git a/ShipyardView/FormReportOrders.Designer.cs b/ShipyardView/FormReportOrders.Designer.cs new file mode 100644 index 0000000..2ab61ed --- /dev/null +++ b/ShipyardView/FormReportOrders.Designer.cs @@ -0,0 +1,102 @@ +namespace ShipyardView +{ + 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() + { + panelReport = new Panel(); + buttonToPDF = new Button(); + MakeButton = new Button(); + dateTimePickerTo = new DateTimePicker(); + dateTimePickerFrom = new DateTimePicker(); + SuspendLayout(); + // + // panelReport + // + panelReport.Location = new Point(12, 80); + panelReport.Name = "panelReport"; + panelReport.Size = new Size(944, 394); + panelReport.TabIndex = 0; + // + // buttonToPDF + // + buttonToPDF.Location = new Point(785, 38); + buttonToPDF.Name = "buttonToPDF"; + buttonToPDF.Size = new Size(94, 29); + buttonToPDF.TabIndex = 3; + buttonToPDF.Text = "в PDF"; + buttonToPDF.UseVisualStyleBackColor = true; + buttonToPDF.Click += ButtonToPdf_Click; + // + // MakeButton + // + MakeButton.Location = new Point(581, 30); + MakeButton.Name = "MakeButton"; + MakeButton.Size = new Size(122, 44); + MakeButton.TabIndex = 2; + MakeButton.Text = "сформировать"; + MakeButton.UseVisualStyleBackColor = true; + MakeButton.Click += MakeButton_Click; + // + // dateTimePickerTo + // + dateTimePickerTo.Location = new Point(287, 37); + dateTimePickerTo.Name = "dateTimePickerTo"; + dateTimePickerTo.Size = new Size(250, 27); + dateTimePickerTo.TabIndex = 1; + // + // dateTimePickerFrom + // + dateTimePickerFrom.Location = new Point(12, 37); + dateTimePickerFrom.Name = "dateTimePickerFrom"; + dateTimePickerFrom.Size = new Size(250, 27); + dateTimePickerFrom.TabIndex = 0; + // + // FormReportOrders + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(968, 486); + Controls.Add(buttonToPDF); + Controls.Add(MakeButton); + Controls.Add(dateTimePickerFrom); + Controls.Add(dateTimePickerTo); + Controls.Add(panelReport); + Name = "FormReportOrders"; + Text = "FormReportOrders"; + ResumeLayout(false); + } + + #endregion + + private Panel panelReport; + private DateTimePicker dateTimePickerTo; + private DateTimePicker dateTimePickerFrom; + private Button buttonToPDF; + private Button MakeButton; + } +} \ No newline at end of file diff --git a/ShipyardView/FormShipComponent.Designer.cs b/ShipyardView/FormShipComponent.Designer.cs new file mode 100644 index 0000000..559ddd4 --- /dev/null +++ b/ShipyardView/FormShipComponent.Designer.cs @@ -0,0 +1,118 @@ +namespace ShipyardView +{ + partial class FormShipComponent + { + /// + /// 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() + { + comboBoxComponent = new ComboBox(); + textBoxCount = new TextBox(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + label1 = new Label(); + label2 = new Label(); + SuspendLayout(); + // + // comboBoxComponent + // + comboBoxComponent.FormattingEnabled = true; + comboBoxComponent.Location = new Point(300, 76); + comboBoxComponent.Name = "comboBoxComponent"; + comboBoxComponent.Size = new Size(260, 28); + comboBoxComponent.TabIndex = 0; + // + // textBoxCount + // + textBoxCount.Location = new Point(300, 158); + textBoxCount.Name = "textBoxCount"; + textBoxCount.Size = new Size(260, 27); + textBoxCount.TabIndex = 1; + // + // ButtonSave + // + ButtonSave.Location = new Point(300, 218); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(94, 29); + ButtonSave.TabIndex = 2; + ButtonSave.Text = "сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(466, 218); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(94, 29); + ButtonCancel.TabIndex = 3; + ButtonCancel.Text = "отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(300, 53); + label1.Name = "label1"; + label1.Size = new Size(157, 20); + label1.TabIndex = 4; + label1.Text = "выберете компонент"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(300, 135); + label2.Name = "label2"; + label2.Size = new Size(88, 20); + label2.TabIndex = 5; + label2.Text = "количество"; + // + // FormShipComponent + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 276); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Controls.Add(textBoxCount); + Controls.Add(comboBoxComponent); + Name = "FormShipComponent"; + Text = "FormShipComponent"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBoxComponent; + private TextBox textBoxCount; + private Button ButtonSave; + private Button ButtonCancel; + private Label label1; + private Label label2; + } +} \ No newline at end of file diff --git a/ShipyardView/FormShips.Designer.cs b/ShipyardView/FormShips.Designer.cs new file mode 100644 index 0000000..601edec --- /dev/null +++ b/ShipyardView/FormShips.Designer.cs @@ -0,0 +1,116 @@ +using System.Windows.Forms; + +namespace ShipyardView +{ + partial class FormShips + { + /// + /// 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() + { + AddButton = new Button(); + DeleteButton = new Button(); + UpdateButton = new Button(); + RefreshButton = new Button(); + dataGridView = new DataGridView(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // AddButton + // + AddButton.Location = new Point(667, 43); + AddButton.Name = "AddButton"; + AddButton.Size = new Size(94, 46); + AddButton.TabIndex = 0; + AddButton.Text = "добавить"; + AddButton.UseVisualStyleBackColor = true; + AddButton.Click += AddButton_Click; + // + // DeleteButton + // + DeleteButton.Location = new Point(667, 111); + DeleteButton.Name = "DeleteButton"; + DeleteButton.Size = new Size(94, 44); + DeleteButton.TabIndex = 1; + DeleteButton.Text = "удалить"; + DeleteButton.UseVisualStyleBackColor = true; + DeleteButton.Click += DeleteButton_Click; + // + // UpdateButton + // + UpdateButton.Location = new Point(667, 177); + UpdateButton.Name = "UpdateButton"; + UpdateButton.Size = new Size(94, 42); + UpdateButton.TabIndex = 2; + UpdateButton.Text = "изменить"; + UpdateButton.UseVisualStyleBackColor = true; + UpdateButton.Click += UpdateButton_Click; + // + // RefreshButton + // + RefreshButton.Location = new Point(667, 392); + RefreshButton.Name = "RefreshButton"; + RefreshButton.Size = new Size(94, 29); + RefreshButton.TabIndex = 3; + RefreshButton.Text = "обновить"; + RefreshButton.UseVisualStyleBackColor = true; + RefreshButton.Click += RefreshButton_Click; + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(12, 43); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(609, 395); + dataGridView.TabIndex = 4; + // + // FormShips + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(RefreshButton); + Controls.Add(UpdateButton); + Controls.Add(DeleteButton); + Controls.Add(AddButton); + Name = "FormShips"; + Text = "Ships"; + Load += FormShips_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Button AddButton; + private Button DeleteButton; + private Button UpdateButton; + private Button RefreshButton; + private DataGridView dataGridView; + } +} \ No newline at end of file -- 2.25.1 From b3bb77e0b69c32725f5a6e659f0bb90b333dab6b Mon Sep 17 00:00:00 2001 From: Ivan_Starostin Date: Sun, 2 Jun 2024 16:44:34 +0400 Subject: [PATCH 04/17] Upload files to 'ShipyardView' --- ShipyardView/FormComponent.Designer.cs | 118 +++++++++++++ ShipyardView/FormComponents.Designer.cs | 114 +++++++++++++ ShipyardView/FormShip.Designer.cs | 215 ++++++++++++++++++++++++ 3 files changed, 447 insertions(+) create mode 100644 ShipyardView/FormComponent.Designer.cs create mode 100644 ShipyardView/FormComponents.Designer.cs create mode 100644 ShipyardView/FormShip.Designer.cs diff --git a/ShipyardView/FormComponent.Designer.cs b/ShipyardView/FormComponent.Designer.cs new file mode 100644 index 0000000..1d1be47 --- /dev/null +++ b/ShipyardView/FormComponent.Designer.cs @@ -0,0 +1,118 @@ +namespace ShipyardView +{ + partial class FormComponent + { + /// + /// 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() + { + textBoxName = new TextBox(); + textBoxCost = new TextBox(); + buttonCancel = new Button(); + ButtonSave = new Button(); + labelName = new Label(); + labelCost = new Label(); + SuspendLayout(); + // + // textBoxName + // + textBoxName.Location = new Point(326, 42); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(171, 27); + textBoxName.TabIndex = 0; + // + // textBoxCost + // + textBoxCost.Location = new Point(329, 100); + textBoxCost.Name = "textBoxCost"; + textBoxCost.Size = new Size(168, 27); + textBoxCost.TabIndex = 1; + // + // buttonCancel + // + buttonCancel.Location = new Point(429, 158); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(94, 29); + buttonCancel.TabIndex = 2; + buttonCancel.Text = "отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // ButtonSave + // + ButtonSave.Location = new Point(312, 158); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(94, 29); + ButtonSave.TabIndex = 3; + ButtonSave.Text = "сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(235, 42); + labelName.Name = "labelName"; + labelName.Size = new Size(75, 20); + labelName.TabIndex = 4; + labelName.Text = "название"; + // + // labelCost + // + labelCost.AutoSize = true; + labelCost.Location = new Point(249, 103); + labelCost.Name = "labelCost"; + labelCost.Size = new Size(43, 20); + labelCost.TabIndex = 5; + labelCost.Text = "цена"; + // + // FormComponent + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 210); + Controls.Add(labelCost); + Controls.Add(labelName); + Controls.Add(ButtonSave); + Controls.Add(buttonCancel); + Controls.Add(textBoxCost); + Controls.Add(textBoxName); + Name = "FormComponent"; + Text = "Form1"; + Load += FormComponent_Load; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private TextBox textBoxName; + private TextBox textBoxCost; + private Button buttonCancel; + private Button ButtonSave; + private Label labelName; + private Label labelCost; + } +} \ No newline at end of file diff --git a/ShipyardView/FormComponents.Designer.cs b/ShipyardView/FormComponents.Designer.cs new file mode 100644 index 0000000..6f4970c --- /dev/null +++ b/ShipyardView/FormComponents.Designer.cs @@ -0,0 +1,114 @@ +namespace ShipyardView +{ + partial class FormComponents + { + /// + /// 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() + { + ButtonAdd = new Button(); + ButtonUpd = new Button(); + ButtonDel = new Button(); + ButtonRef = new Button(); + dataGridView = new DataGridView(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // ButtonAdd + // + ButtonAdd.Location = new Point(678, 34); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(94, 47); + ButtonAdd.TabIndex = 0; + ButtonAdd.Text = "добавить"; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // ButtonUpd + // + ButtonUpd.Location = new Point(678, 106); + ButtonUpd.Name = "ButtonUpd"; + ButtonUpd.Size = new Size(94, 45); + ButtonUpd.TabIndex = 1; + ButtonUpd.Text = "изменить"; + ButtonUpd.UseVisualStyleBackColor = true; + ButtonUpd.Click += ButtonUpd_Click; + // + // ButtonDel + // + ButtonDel.Location = new Point(678, 176); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(94, 51); + ButtonDel.TabIndex = 2; + ButtonDel.Text = "удалить"; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonRef + // + ButtonRef.Location = new Point(678, 262); + ButtonRef.Name = "ButtonRef"; + ButtonRef.Size = new Size(94, 49); + ButtonRef.TabIndex = 3; + ButtonRef.Text = "обновить"; + ButtonRef.UseVisualStyleBackColor = true; + ButtonRef.Click += ButtonRef_Click; + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(12, 22); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(622, 416); + dataGridView.TabIndex = 4; + // + // FormComponents + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(ButtonRef); + Controls.Add(ButtonDel); + Controls.Add(ButtonUpd); + Controls.Add(ButtonAdd); + Name = "FormComponents"; + Text = "FormComponents"; + Load += FormComponents_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Button ButtonAdd; + private Button ButtonUpd; + private Button ButtonDel; + private Button ButtonRef; + private DataGridView dataGridView; + } +} \ No newline at end of file diff --git a/ShipyardView/FormShip.Designer.cs b/ShipyardView/FormShip.Designer.cs new file mode 100644 index 0000000..d7d2eec --- /dev/null +++ b/ShipyardView/FormShip.Designer.cs @@ -0,0 +1,215 @@ +namespace ShipyardView +{ + partial class FormShip + { + /// + /// 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() + { + dataGridView = new DataGridView(); + ColumnId = new DataGridViewTextBoxColumn(); + Component = new DataGridViewTextBoxColumn(); + number = new DataGridViewTextBoxColumn(); + textBoxPrice = new TextBox(); + textBoxName = new TextBox(); + ButtonAdd = new Button(); + ButtonDel = new Button(); + ButtonUpd = new Button(); + ButtonRef = new Button(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + labeltotal = new Label(); + labelName = new Label(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnId, Component, number }); + dataGridView.Location = new Point(12, 29); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(565, 382); + dataGridView.TabIndex = 0; + // + // ColumnId + // + ColumnId.HeaderText = "id"; + ColumnId.MinimumWidth = 6; + ColumnId.Name = "ColumnId"; + ColumnId.Visible = false; + ColumnId.Width = 125; + // + // Component + // + Component.HeaderText = "component"; + Component.MinimumWidth = 6; + Component.Name = "Component"; + Component.Width = 125; + // + // number + // + number.HeaderText = "number"; + number.MinimumWidth = 6; + number.Name = "number"; + number.Width = 125; + // + // textBoxPrice + // + textBoxPrice.Location = new Point(634, 259); + textBoxPrice.Name = "textBoxPrice"; + textBoxPrice.ReadOnly = true; + textBoxPrice.Size = new Size(125, 27); + textBoxPrice.TabIndex = 1; + // + // textBoxName + // + textBoxName.Location = new Point(634, 52); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(125, 27); + textBoxName.TabIndex = 2; + // + // ButtonAdd + // + ButtonAdd.Location = new Point(649, 85); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(94, 29); + ButtonAdd.TabIndex = 3; + ButtonAdd.Text = "добавить"; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // ButtonDel + // + ButtonDel.Location = new Point(649, 176); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(94, 29); + ButtonDel.TabIndex = 4; + ButtonDel.Text = "удалить"; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonUpd + // + ButtonUpd.Location = new Point(649, 130); + ButtonUpd.Name = "ButtonUpd"; + ButtonUpd.Size = new Size(94, 29); + ButtonUpd.TabIndex = 5; + ButtonUpd.Text = "изменить"; + ButtonUpd.UseVisualStyleBackColor = true; + ButtonUpd.Click += ButtonUpd_Click; + // + // ButtonRef + // + ButtonRef.Location = new Point(694, 409); + ButtonRef.Name = "ButtonRef"; + ButtonRef.Size = new Size(94, 29); + ButtonRef.TabIndex = 6; + ButtonRef.Text = "обновить"; + ButtonRef.UseVisualStyleBackColor = true; + ButtonRef.Click += ButtonRef_Click; + // + // ButtonSave + // + ButtonSave.Location = new Point(594, 347); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(94, 29); + ButtonSave.TabIndex = 7; + ButtonSave.Text = "сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(694, 347); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(94, 29); + ButtonCancel.TabIndex = 8; + ButtonCancel.Text = "отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // labeltotal + // + labeltotal.AutoSize = true; + labeltotal.Location = new Point(607, 236); + labeltotal.Name = "labeltotal"; + labeltotal.Size = new Size(51, 20); + labeltotal.TabIndex = 9; + labeltotal.Text = "итого:"; + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(634, 29); + labelName.Name = "labelName"; + labelName.Size = new Size(37, 20); + labelName.TabIndex = 10; + labelName.Text = "имя"; + // + // FormShip + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(labelName); + Controls.Add(labeltotal); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Controls.Add(ButtonRef); + Controls.Add(ButtonUpd); + Controls.Add(ButtonDel); + Controls.Add(ButtonAdd); + Controls.Add(textBoxName); + Controls.Add(textBoxPrice); + Controls.Add(dataGridView); + Name = "FormShip"; + Text = "FormShip"; + Load += FormShip_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private DataGridView dataGridView; + private TextBox textBoxPrice; + private TextBox textBoxName; + private Button ButtonAdd; + private Button ButtonDel; + private Button ButtonUpd; + private Button ButtonRef; + private Button ButtonSave; + private Button ButtonCancel; + private DataGridViewTextBoxColumn ColumnId; + private DataGridViewTextBoxColumn Component; + private DataGridViewTextBoxColumn number; + private Label labeltotal; + private Label labelName; + } +} \ No newline at end of file -- 2.25.1 From e2c082a374ba924998e99e618e5c53d4f780219d Mon Sep 17 00:00:00 2001 From: Ivan_Starostin Date: Sun, 2 Jun 2024 16:46:12 +0400 Subject: [PATCH 05/17] Upload files to 'ShipyardView' --- ShipyardView/FormMain.cs | 34 +++++++++++- ShipyardView/FormReportOrders.cs | 92 ++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 ShipyardView/FormReportOrders.cs diff --git a/ShipyardView/FormMain.cs b/ShipyardView/FormMain.cs index ada1fa0..fbfa087 100644 --- a/ShipyardView/FormMain.cs +++ b/ShipyardView/FormMain.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.Logging; using ShipyardContracts.BindingModels; +using ShipyardContracts.BusinessLogicContracts; using ShipyardContracts.BusinessLogicsContracts; using ShipyardDataModels.Enums; using ShipyardView; @@ -11,11 +12,13 @@ namespace ShipyardView { 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) { @@ -161,9 +164,36 @@ namespace ShipyardView }; } - private void shipToolStripMenuItem_Click(object sender, EventArgs e) + private void ComponentListToolStripMenuItem_Click(object sender, EventArgs e) { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveShipsToWordFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + } + private void ComponentsShipToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportShipComponents)); + if (service is FormReportShipComponents form) + { + form.ShowDialog(); + } + } + + private void OrderListToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); + if (service is FormReportOrders form) + { + form.ShowDialog(); + } } } } \ No newline at end of file diff --git a/ShipyardView/FormReportOrders.cs b/ShipyardView/FormReportOrders.cs new file mode 100644 index 0000000..5df64f9 --- /dev/null +++ b/ShipyardView/FormReportOrders.cs @@ -0,0 +1,92 @@ +using Microsoft.Extensions.Logging; +using ShipyardContracts.BindingModels; +using ShipyardContracts.BusinessLogicContracts; +using Microsoft.Reporting.WinForms; + +namespace ShipyardView +{ + 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("ReportOrder.rdlc", FileMode.Open)); + panelReport.Controls.Add(reportViewer); + } + + private void MakeButton_Click(object sender, EventArgs e) + { + if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date) + { + MessageBox.Show("Дата начала должна быть меньше даты окончания", + "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + try + { + var dataSource = _logic.GetOrders(new ReportBindingModel + { + DateFrom = dateTimePickerFrom.Value, + DateTo = dateTimePickerTo.Value + }); + var source = new ReportDataSource("DataSetOrders", dataSource); + reportViewer.LocalReport.DataSources.Clear(); + reportViewer.LocalReport.DataSources.Add(source); + var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") }; + reportViewer.LocalReport.SetParameters(parameters); + reportViewer.RefreshReport(); + _logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(), + dateTimePickerTo.Value.ToShortDateString()); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка заказов на период"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonToPdf_Click(object sender, EventArgs e) + { + if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.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 = dateTimePickerFrom.Value, + DateTo = dateTimePickerTo.Value + }); + _logger.LogInformation("Сохранение списка заказов на период { From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(), + dateTimePickerTo.Value.ToShortDateString()); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения списка заказов на период"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + } +} -- 2.25.1 From c5144b87e4db11b23ef0f9f9f42448dffbb26719 Mon Sep 17 00:00:00 2001 From: Ivan_Starostin Date: Sun, 2 Jun 2024 16:47:06 +0400 Subject: [PATCH 06/17] Upload files to 'ShipyardView' --- ShipyardView/Program.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ShipyardView/Program.cs b/ShipyardView/Program.cs index c5f801c..e7f70a7 100644 --- a/ShipyardView/Program.cs +++ b/ShipyardView/Program.cs @@ -7,6 +7,9 @@ using NLog.Extensions.Logging; using System; using ShipyardBusinessLogic; using ShipyardDatabaseImplement.Implements; +using ShipyardContracts.BusinessLogicContracts; +using ShipyardBusinessLogic.OfficePackage.Implements; +using ShipyardBusinessLogic.OfficePackage; namespace ShipyardView { @@ -48,6 +51,12 @@ namespace ShipyardView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file -- 2.25.1 From a1401d5d31a00ef5e16fd943bcff44773114dd99 Mon Sep 17 00:00:00 2001 From: Ivan_Starostin Date: Sun, 2 Jun 2024 16:47:28 +0400 Subject: [PATCH 07/17] Upload files to 'ShipyardView' --- ShipyardView/ReportOrder.rdlc | 600 ++++++++++++++++++++++++++++++++++ 1 file changed, 600 insertions(+) create mode 100644 ShipyardView/ReportOrder.rdlc diff --git a/ShipyardView/ReportOrder.rdlc b/ShipyardView/ReportOrder.rdlc new file mode 100644 index 0000000..b27a445 --- /dev/null +++ b/ShipyardView/ReportOrder.rdlc @@ -0,0 +1,600 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 47cb53f0-7dde-4717-ba03-866a0bc4f4dd + + + + + + ShipyardContractsViewModels + /* Local Query */ + + + + Id + System.Int32 + + + DateCreate + System.DateTime + + + ShipName + System.String + + + Sum + System.Decimal + + + OrderStatus + ShipyardDataModels.OrderStatus + + + + ShipyardContracts.ViewModels + ReportOrdersViewModel + AbstractShopContracts.ViewModels.ReportOrdersViewModel, ShipyardContracts, 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!ShipName.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!OrderStatus.Value + + + 2pt + 2pt + 2pt + 2pt + + + true + + + + + + + + + + + + + + + + + + + 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 +