4 лаба без задания

This commit is contained in:
Николай 2023-03-10 16:29:13 +04:00
parent 2ea936cd05
commit dc15fc10f3
9 changed files with 107 additions and 82 deletions

View File

@ -27,4 +27,10 @@
<ProjectReference Include="..\FoodOrdersListImplement\FoodOrdersListImplement.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="ReportOrders.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -32,6 +32,10 @@
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.БлюдаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.наборблюдToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.componentDishesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonUpdate = new System.Windows.Forms.Button();
this.buttonSetToFinish = new System.Windows.Forms.Button();
this.buttonSetToDone = new System.Windows.Forms.Button();
@ -45,7 +49,8 @@
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.справочникиToolStripMenuItem});
this.справочникиToolStripMenuItem,
this.отчётыToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(975, 24);
@ -64,17 +69,48 @@
// БлюдаToolStripMenuItem
//
this.БлюдаToolStripMenuItem.Name = "БлюдаToolStripMenuItem";
this.БлюдаToolStripMenuItem.Size = new System.Drawing.Size(148, 22);
this.БлюдаToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.БлюдаToolStripMenuItem.Text = "Блюда";
this.БлюдаToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
//
// набор блюдToolStripMenuItem
// наборблюдToolStripMenuItem
//
this.наборблюдToolStripMenuItem.Name = "набор блюдToolStripMenuItem";
this.наборблюдToolStripMenuItem.Size = new System.Drawing.Size(148, 22);
this.наборблюдToolStripMenuItem.Name = "наборблюдToolStripMenuItem";
this.наборблюдToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.наборблюдToolStripMenuItem.Text = "Набор блюд";
this.наборблюдToolStripMenuItem.Click += new System.EventHandler(this.DishToolStripMenuItem_Click);
//
// отчётыToolStripMenuItem
//
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.componentsToolStripMenuItem,
this.componentDishesToolStripMenuItem,
this.ordersToolStripMenuItem});
this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчётыToolStripMenuItem.Text = "Отчёты";
//
// componentsToolStripMenuItem
//
this.componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
this.componentsToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.componentsToolStripMenuItem.Text = "Список Компонентов";
this.componentsToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// componentDishesToolStripMenuItem
//
this.componentDishesToolStripMenuItem.Name = "componentDishesToolStripMenuItem";
this.componentDishesToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.componentDishesToolStripMenuItem.Text = "Компоненты по изделиям";
this.componentDishesToolStripMenuItem.Click += new System.EventHandler(this.ComponentDishesToolStripMenuItem_Click);
//
// ordersToolStripMenuItem
//
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.ordersToolStripMenuItem.Text = "Список заказов";
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
//
// buttonUpdate
//
this.buttonUpdate.Location = new System.Drawing.Point(780, 314);
@ -178,5 +214,9 @@
private Button buttonSetToWork;
private Button buttonCreateOrder;
private DataGridView dataGridView;
private ToolStripMenuItem отчётыToolStripMenuItem;
private ToolStripMenuItem componentsToolStripMenuItem;
private ToolStripMenuItem componentDishesToolStripMenuItem;
private ToolStripMenuItem ordersToolStripMenuItem;
}
}

View File

@ -1,4 +1,5 @@
using FoodOrdersContracts.BindingModels;
using FoodOrdersBusinessLogic.BusinessLogics;
using FoodOrdersContracts.BindingModels;
using FoodOrdersContracts.BusinessLogicsContracts;
using FoodOrdersDataModels.Enums;
using Microsoft.Extensions.Logging;
@ -8,12 +9,16 @@ namespace FoodOrdersView
public partial class FormMain : Form
{
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
_reportLogic = reportLogic;
}
private void FormMain_Load(object sender, EventArgs e)
{
@ -157,5 +162,33 @@ namespace FoodOrdersView
{
LoadData();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void ComponentDishesToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportDishComponents));
if (service is FormReportDishComponents form)
{
form.ShowDialog();
}
}
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
}
}

View File

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

View File

@ -50,19 +50,21 @@
this.ColumnDish,
this.ColumnCount});
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
this.dataGridView.Location = new System.Drawing.Point(0, 41);
this.dataGridView.Location = new System.Drawing.Point(0, 47);
this.dataGridView.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.dataGridView.MultiSelect = false;
this.dataGridView.Name = "dataGridView";
this.dataGridView.ReadOnly = true;
this.dataGridView.RowHeadersVisible = false;
this.dataGridView.Size = new System.Drawing.Size(528, 442);
this.dataGridView.Size = new System.Drawing.Size(616, 510);
this.dataGridView.TabIndex = 0;
//
// buttonSaveToExcel
//
this.buttonSaveToExcel.Location = new System.Drawing.Point(12, 12);
this.buttonSaveToExcel.Location = new System.Drawing.Point(14, 14);
this.buttonSaveToExcel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.buttonSaveToExcel.Name = "buttonSaveToExcel";
this.buttonSaveToExcel.Size = new System.Drawing.Size(159, 23);
this.buttonSaveToExcel.Size = new System.Drawing.Size(186, 27);
this.buttonSaveToExcel.TabIndex = 1;
this.buttonSaveToExcel.Text = "Сохранить в Excel";
this.buttonSaveToExcel.UseVisualStyleBackColor = true;
@ -77,7 +79,7 @@
//
// ColumnDish
//
this.ColumnDish.HeaderText = "Изделие";
this.ColumnDish.HeaderText = "Блюдо";
this.ColumnDish.Name = "ColumnDish";
this.ColumnDish.ReadOnly = true;
this.ColumnDish.Width = 200;
@ -90,13 +92,14 @@
//
// FormReportDishComponents
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(528, 483);
this.ClientSize = new System.Drawing.Size(616, 557);
this.Controls.Add(this.buttonSaveToExcel);
this.Controls.Add(this.dataGridView);
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.Name = "FormReportDishComponents";
this.Text = "Компоненты по изделиям";
this.Text = "Компоненты по блюдам";
this.Load += new System.EventHandler(this.FormReportDishComponents_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
@ -107,8 +110,8 @@
private System.Windows.Forms.DataGridView dataGridView;
private System.Windows.Forms.Button buttonSaveToExcel;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnComponent;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnDish;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnCount;
private DataGridViewTextBoxColumn ColumnComponent;
private DataGridViewTextBoxColumn ColumnDish;
private DataGridViewTextBoxColumn ColumnCount;
}
}

View File

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

View File

@ -205,7 +205,7 @@
<Paragraph>
<TextRuns>
<TextRun>
<Value>Изделие</Value>
<Value>Блюдо</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>

View File

@ -15,7 +15,7 @@ namespace FoodOrdersBusinessLogic.OfficePackage
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма" },
Texts = new List<string> { "Номер", "Дата заказа", "Блюдо", "Сумма" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});

View File

@ -6,7 +6,7 @@ namespace FoodOrdersContracts.ViewModels
public class DishViewModel : IDishModel
{
public int Id { get; set; }
[DisplayName("Название изделия")]
[DisplayName("Название блюда")]
public string DishName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }