PIbd-22 Isaeva A.I. Lab work 4 Base #5

Closed
dex_moth wants to merge 4 commits from lab4 into lab3
17 changed files with 123 additions and 110 deletions
Showing only changes of commit f0589c577f - Show all commits

View File

@ -53,7 +53,7 @@
toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripDropDownButton1, toolStripDropDownButton2 });
toolStrip1.Location = new Point(0, 0);
toolStrip1.Name = "toolStrip1";
toolStrip1.Size = new Size(1107, 27);
toolStrip1.Size = new Size(969, 25);
toolStrip1.TabIndex = 0;
toolStrip1.Text = "toolStrip1";
//
@ -64,20 +64,20 @@
toolStripDropDownButton1.Image = (Image)resources.GetObject("toolStripDropDownButton1.Image");
toolStripDropDownButton1.ImageTransparentColor = Color.Magenta;
toolStripDropDownButton1.Name = "toolStripDropDownButton1";
toolStripDropDownButton1.Size = new Size(108, 24);
toolStripDropDownButton1.Size = new Size(88, 22);
toolStripDropDownButton1.Text = "Справочник";
//
// компонентыToolStripMenuItem
//
компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
компонентыToolStripMenuItem.Size = new Size(182, 26);
компонентыToolStripMenuItem.Size = new Size(145, 22);
компонентыToolStripMenuItem.Text = "Компоненты";
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
//
// консервыToolStripMenuItem
//
консервыToolStripMenuItem.Name = онсервыToolStripMenuItem";
консервыToolStripMenuItem.Size = new Size(182, 26);
консервыToolStripMenuItem.Size = new Size(145, 22);
консервыToolStripMenuItem.Text = "Консервы";
консервыToolStripMenuItem.Click += консервыToolStripMenuItem_Click;
//
@ -88,37 +88,36 @@
toolStripDropDownButton2.Image = (Image)resources.GetObject("toolStripDropDownButton2.Image");
toolStripDropDownButton2.ImageTransparentColor = Color.Magenta;
toolStripDropDownButton2.Name = "toolStripDropDownButton2";
toolStripDropDownButton2.Size = new Size(73, 24);
toolStripDropDownButton2.Size = new Size(61, 22);
toolStripDropDownButton2.Text = "Отчёты";
//
// списокКомпонентовToolStripMenuItem
//
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
списокКомпонентовToolStripMenuItem.Size = new Size(284, 26);
списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
списокКомпонентовToolStripMenuItem.Size = new Size(225, 22);
списокКомпонентовToolStripMenuItem.Text = "Список консерв";
списокКомпонентовToolStripMenuItem.Click += списокКомпонентовToolStripMenuItem_Click;
//
// компонентыПоКонсервамToolStripMenuItem
//
компонентыПоКонсервамToolStripMenuItem.Name = омпонентыПоКонсервамToolStripMenuItem";
компонентыПоКонсервамToolStripMenuItem.Size = new Size(284, 26);
компонентыПоКонсервамToolStripMenuItem.Size = new Size(225, 22);
компонентыПоКонсервамToolStripMenuItem.Text = "Компоненты по консервам";
компонентыПоКонсервамToolStripMenuItem.Click += компонентыПоИзделиямToolStripMenuItem_Click;
//
// списокЗаказовToolStripMenuItem
//
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
списокЗаказовToolStripMenuItem.Size = new Size(284, 26);
списокЗаказовToolStripMenuItem.Size = new Size(225, 22);
списокЗаказовToolStripMenuItem.Text = "Список заказов";
списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
//
// buttonCreateOrder
//
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonCreateOrder.Location = new Point(914, 75);
buttonCreateOrder.Margin = new Padding(3, 4, 3, 4);
buttonCreateOrder.Location = new Point(800, 56);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(161, 32);
buttonCreateOrder.Size = new Size(141, 24);
buttonCreateOrder.TabIndex = 1;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = true;
@ -127,10 +126,9 @@
// buttonTakeOrderInWork
//
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonTakeOrderInWork.Location = new Point(914, 133);
buttonTakeOrderInWork.Margin = new Padding(3, 4, 3, 4);
buttonTakeOrderInWork.Location = new Point(800, 100);
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
buttonTakeOrderInWork.Size = new Size(161, 32);
buttonTakeOrderInWork.Size = new Size(141, 24);
buttonTakeOrderInWork.TabIndex = 2;
buttonTakeOrderInWork.Text = "Отдать на выполнение";
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
@ -139,10 +137,9 @@
// buttonOrderReady
//
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonOrderReady.Location = new Point(914, 189);
buttonOrderReady.Margin = new Padding(3, 4, 3, 4);
buttonOrderReady.Location = new Point(800, 142);
buttonOrderReady.Name = "buttonOrderReady";
buttonOrderReady.Size = new Size(161, 32);
buttonOrderReady.Size = new Size(141, 24);
buttonOrderReady.TabIndex = 3;
buttonOrderReady.Text = "Заказ готов";
buttonOrderReady.UseVisualStyleBackColor = true;
@ -151,10 +148,9 @@
// buttonIssuedOrder
//
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonIssuedOrder.Location = new Point(914, 241);
buttonIssuedOrder.Margin = new Padding(3, 4, 3, 4);
buttonIssuedOrder.Location = new Point(800, 181);
buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.Size = new Size(161, 32);
buttonIssuedOrder.Size = new Size(141, 24);
buttonIssuedOrder.TabIndex = 4;
buttonIssuedOrder.Text = "Заказ выдан";
buttonIssuedOrder.UseVisualStyleBackColor = true;
@ -163,10 +159,9 @@
// buttonRef
//
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonRef.Location = new Point(914, 296);
buttonRef.Margin = new Padding(3, 4, 3, 4);
buttonRef.Location = new Point(800, 222);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(161, 32);
buttonRef.Size = new Size(141, 24);
buttonRef.TabIndex = 5;
buttonRef.Text = "Обновить список";
buttonRef.UseVisualStyleBackColor = true;
@ -175,21 +170,20 @@
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(0, 27);
dataGridView.Margin = new Padding(3, 4, 3, 4);
dataGridView.Location = new Point(0, 20);
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 24;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(872, 588);
dataGridView.Size = new Size(763, 441);
dataGridView.TabIndex = 6;
//
// FormMain
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1107, 615);
ClientSize = new Size(969, 461);
Controls.Add(dataGridView);
Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder);
@ -197,7 +191,6 @@
Controls.Add(buttonTakeOrderInWork);
Controls.Add(buttonCreateOrder);
Controls.Add(toolStrip1);
Margin = new Padding(3, 4, 3, 4);
Name = "FormMain";
Text = "Рыбный завод";
Load += FormMain_Load;

View File

@ -124,7 +124,7 @@
<data name="toolStripDropDownButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
@ -139,7 +139,7 @@
<data name="toolStripDropDownButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEKSURBVEhL3ZG9DsFQHMXvczDZvIOtXsHObuhqkViI3Quw
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEKSURBVEhL3ZG9DsFQHMXvczDZvIOtXsHObuhqkViI3Quw
6CYmNoMYJJ0NBiFFIoIytOuf0+TeXP3yde+iyS+3OcP53Z4y3/dJJ4HAsiwyTVMp6BQCBIZhKAWdEcHV
vSlBmeB82NFy1KLluEWOPRC5MoHdMWhazwi4RJlALgf4EuT6BI+5kCsTrGddUY658E+QvyXYHq9UnRyC
U87f4aUApcXhnrI9Jzg/laQKFntXlHM+lSQK5psL5fvbp/JvJLGCQqmSWM5JkiCT84igXGtSrruKLQ0T

View File

@ -18,7 +18,7 @@ namespace FishFactory.Forms
{
try
{
var dict = _logic.GetCannedComponents();
var dict = _logic.GetCannedComponent();
if (dict != null)
{
dataGridView.Rows.Clear();

View File

@ -70,6 +70,7 @@ namespace FishFactory.Forms
{
try
{
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
_logic.SaveOrdersToPdfFile(new ReportBindingModel
{
FileName = dialog.FileName,

View File

@ -7,7 +7,7 @@
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>47cb53f0-7dde-4717-ba03-866a0bc4f4dd</rd:DataSourceID>
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
@ -29,19 +29,19 @@
<DataField>CannedName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Status">
<DataField>Status</DataField>
<rd:TypeName>FishFactoryDataModels.Status</rd:TypeName>
</Field>
<Field Name="Sum">
<DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="OrderStatus">
<DataField>OrderStatus</DataField>
<rd:TypeName>FishFactoryDataModels.OrderStatus</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>FishFactoryContracts.ViewModels</rd:DataSetName>
<rd:TableName>ReportOrderViewModel</rd:TableName>
<rd:ObjectDataSourceType>FishFactoryContracts.ViewModels.ReportOrderViewModel, FishFactoryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
<rd:TableName>ReportOrdersViewModel</rd:TableName>
<rd:ObjectDataSourceType>FishFactoryContracts.ViewModels.ReportOrdersViewModel, FishFactoryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo>
</DataSet>
</DataSets>
@ -59,7 +59,7 @@
<Value>=Parameters!ReportParameterPeriod.Value</Value>
<Style>
<FontSize>14pt</FontSize>
<FontWeight>Normal</FontWeight>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
@ -120,19 +120,19 @@
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>2.59525cm</Width>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.30963cm</Width>
<Width>3.21438cm</Width>
</TablixColumn>
<TablixColumn>
<Width>8.32842cm</Width>
<Width>8.23317cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.59525cm</Width>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.59525cm</Width>
<Width>2.5cm</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
@ -244,7 +244,7 @@
<Paragraph>
<TextRuns>
<TextRun>
<Value>Статус Заказа</Value>
<Value>Статус</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
@ -398,21 +398,21 @@
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="OrderStatus">
<Textbox Name="Status">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!OrderStatus.Value</Value>
<Value>=Fields!Status.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>OrderStatus</rd:DefaultName>
<rd:DefaultName>Status</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
@ -483,7 +483,7 @@
<Top>2.48391cm</Top>
<Left>0.55245cm</Left>
<Height>1.2cm</Height>
<Width>19.4238cm</Width>
<Width>18.94755cm</Width>
<ZIndex>2</ZIndex>
<Style>
<Border>
@ -509,8 +509,8 @@
</Style>
</Paragraph>
</Paragraphs>
<Top>4.21167cm</Top>
<Left>14.97625cm</Left>
<Top>4cm</Top>
<Left>12cm</Left>
<Height>0.6cm</Height>
<Width>2.5cm</Width>
<ZIndex>3</ZIndex>
@ -534,6 +534,7 @@
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
<Style>
<FontWeight>Bold</FontWeight>
<Format>0.00;(0.00)</Format>
</Style>
</TextRun>
</TextRuns>
@ -542,8 +543,8 @@
</Style>
</Paragraph>
</Paragraphs>
<Top>4.21167cm</Top>
<Left>17.47625cm</Left>
<Top>4cm</Top>
<Left>14.5cm</Left>
<Height>0.6cm</Height>
<Width>2.5cm</Width>
<ZIndex>4</ZIndex>
@ -583,7 +584,7 @@
</ReportParameters>
<ReportParametersLayout>
<GridLayoutDefinition>
<NumberOfColumns>5</NumberOfColumns>
<NumberOfColumns>4</NumberOfColumns>
<NumberOfRows>2</NumberOfRows>
<CellDefinitions>
<CellDefinition>
@ -595,5 +596,5 @@
</GridLayoutDefinition>
</ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>1c0c12af-b9e8-41db-8d1f-26d1acbf91cc</rd:ReportID>
<rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID>
</Report>

View File

@ -16,8 +16,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf;
public ReportLogic(ICannedStorage CannedStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
public ReportLogic(ICannedStorage CannedStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
{
_cannedStorage = CannedStorage;
_componentStorage = componentStorage;
@ -26,16 +25,24 @@ namespace FishFactoryBusinessLogic.BusinessLogic
_saveToWord = saveToWord;
_saveToPdf = saveToPdf;
}
public List<ReportCannedComponentViewModel> GetCannedComponents()
/// <summary>
/// Получение списка компонент с указанием, в каких изделиях используются
/// </summary>
/// <returns></returns>
public List<ReportCannedComponentViewModel> GetCannedComponent()
{
return _cannedStorage.GetFullList().Select( x => new ReportCannedComponentViewModel
return _cannedStorage.GetFullList().Select(x => new ReportCannedComponentViewModel
{
CannedName = x.CannedName,
Components = x.CannedComponents.Select(x => (x.Value.Item1.ComponentName, x.Value.Item2)).ToList(),
TotalCount = x.CannedComponents.Select(x => x.Value.Item2).Sum()
}).ToList();
}
/// <summary>
/// Получение списка заказов за определенный период
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
{
return _orderStorage.GetFilteredList(new OrderSearchModel
@ -48,8 +55,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic
Id = x.Id,
DateCreate = x.DateCreate,
CannedName = x.CannedName,
Sum = x.Sum,
Status = x.Status.ToString()
Status = x.Status.ToString(),
Sum = x.Sum
})
.ToList();
}
@ -60,7 +67,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
{
FileName = model.FileName,
Title = "Список консерв",
Components = _componentStorage.GetFullList()
Canneds = _cannedStorage.GetFullList()
});
}
@ -69,11 +76,14 @@ namespace FishFactoryBusinessLogic.BusinessLogic
_saveToExcel.CreateReport(new ExcelInfo
{
FileName = model.FileName,
Title = "Список консерв",
CannedComponents = GetCannedComponents()
Title = "Список компонент",
CannedComponents = GetCannedComponent()
});
}
/// <summary>
/// Сохранение заказов в файл-Pdf
/// </summary>
/// <param name="model"></param>
public void SaveOrdersToPdfFile(ReportBindingModel model)
{
_saveToPdf.CreateDoc(new PdfInfo

View File

@ -5,10 +5,13 @@ namespace FishFactoryBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToExcel
{
/// <summary>
/// Создание отчета
/// </summary>
/// <param name="info"></param>
public void CreateReport(ExcelInfo info)
{
CreateExcel(info);
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
@ -32,23 +35,24 @@ namespace FishFactoryBusinessLogic.OfficePackage
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
foreach (var Component in pc.Components)
foreach (var Canned in pc.Components)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = Component.Item1,
StyleInfo = ExcelStyleInfoType.TextWithBroder
Text = Canned.Item1,
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = Component.Item2.ToString(),
StyleInfo = ExcelStyleInfoType.TextWithBroder
Text = Canned.Item2.ToString(),
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
rowIndex++;
}
InsertCellInWorksheet(new ExcelCellParameters
@ -69,13 +73,27 @@ namespace FishFactoryBusinessLogic.OfficePackage
}
SaveExcel(info);
}
/// <summary>
/// Создание excel-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreateExcel(ExcelInfo info);
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
/// <summary>
/// Добавляем новую ячейку в лист
/// </summary>
/// <param name="cellParameters"></param>
protected abstract void InsertCellInWorksheet(ExcelCellParameters
excelParams);
/// <summary>
/// Объединение ячеек
/// </summary>
/// <param name="mergeParameters"></param>
protected abstract void MergeCells(ExcelMergeParameters excelParams);
/// <summary>
/// Сохранение файла
/// </summary>
/// <param name="info"></param>
protected abstract void SaveExcel(ExcelInfo info);
}
}

View File

@ -19,10 +19,10 @@ namespace FishFactoryBusinessLogic.OfficePackage
Text = $"с{ info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма" },
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус", "Сумма" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
@ -30,7 +30,7 @@ namespace FishFactoryBusinessLogic.OfficePackage
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.CannedName, order.Sum.ToString() },
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.CannedName, order.Status, order.Sum.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});

View File

@ -8,25 +8,24 @@ namespace FishFactoryBusinessLogic.OfficePackage
public void CreateDoc(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> {
(info.Title,
new WordTextProperties { Bold = true, Size = "24", })
},
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
foreach (var component in info.Components)
foreach (var canned in info.Canneds)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> {
(component.ComponentName,
new WordTextProperties { Size = "24", })
(canned.CannedName + ' ', new WordTextProperties { Size = "24", Bold = true }),
(canned.Price.ToString(), new WordTextProperties { Size = "24" })
},
TextProperties = new WordTextProperties
{

View File

@ -6,6 +6,6 @@ namespace FishFactoryBusinessLogic.OfficePackage.HelperModels
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public List<ComponentViewModel> Components { get; set; } = new();
public List<CannedViewModel> Canneds { get; set; } = new();
}
}

View File

@ -16,7 +16,8 @@ namespace FishFactoryBusinessLogic.OfficePackage.Implements
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
private static JustificationValues GetJustificationValues(WordJustificationType type)
private static JustificationValues
GetJustificationValues(WordJustificationType type)
{
return type switch
{
@ -60,7 +61,6 @@ namespace FishFactoryBusinessLogic.OfficePackage.Implements
LineRule = LineSpacingRuleValues.Auto
});
properties.AppendChild(new Indentation());
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
if (!string.IsNullOrEmpty(paragraphProperties.Size))
{

View File

@ -9,7 +9,7 @@ namespace FishFactoryContracts.BusinessLogicsContracts
/// Получение списка компонент с указанием, в каких изделиях используются
/// </summary>
/// <returns></returns>
List<ReportCannedComponentViewModel> GetCannedComponents();
List<ReportCannedComponentViewModel> GetCannedComponent();
/// <summary>
/// Получение списка заказов за определенный период
/// </summary>

View File

@ -6,7 +6,8 @@ namespace FishFactoryContracts.ViewModels
public int Id { get; set; }
public DateTime DateCreate { get; set; }
public string CannedName { get; set; } = string.Empty;
public double Sum { get; set; }
public string Status { get; set; } = string.Empty;
public double Sum { get; set; }
}
}

View File

@ -9,7 +9,7 @@ namespace FishFactoryDatabaseImplement
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory;Username=postgres;Password=postgres");
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory2;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

View File

@ -19,21 +19,11 @@ namespace FishFactoryDatabaseImplement.Implements
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue)
if (!model.Id.HasValue)
{
return new();
}
using var context = new FishFactoryDatabase();
if (model.DateFrom.HasValue)
{
return context.Orders
.Include(x => x.Canned)
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => x.GetViewModel)
.ToList();
}
return context.Orders
.Include(x => x.Canned)
.Where(x => x.Id == model.Id)

View File

@ -23,7 +23,7 @@ namespace FishFactoryFileImplement.Implements
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue)
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
{
return new();
}

View File

@ -33,13 +33,13 @@ namespace FishFactoryListImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
var result = new List<OrderViewModel>();
if (model == null || !model.Id.HasValue || !model.DateFrom.HasValue || !model.DateFrom.HasValue)
if (model == null || !model.Id.HasValue)
{
return result;
}
foreach (var order in _source.Orders)
{
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
if (order.Id == model.Id)
{
result.Add(AttachCannedName(order.GetViewModel));
}