completed LabWork_04
This commit is contained in:
parent
ce35ed8f72
commit
ff43bf55eb
@ -34,9 +34,9 @@ namespace FishFactoryView
|
|||||||
dataGridView.Rows.Clear();
|
dataGridView.Rows.Clear();
|
||||||
foreach (var elem in dict)
|
foreach (var elem in dict)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { elem.ComponentName,
|
dataGridView.Rows.Add(new object[] { elem.CannedName,
|
||||||
"", "" });
|
"", "" });
|
||||||
foreach (var listElem in elem.Canneds)
|
foreach (var listElem in elem.Components)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { "",
|
dataGridView.Rows.Add(new object[] { "",
|
||||||
listElem.Item1, listElem.Item2 });
|
listElem.Item1, listElem.Item2 });
|
||||||
|
@ -29,7 +29,7 @@ namespace FishFactoryView
|
|||||||
{
|
{
|
||||||
Dock = DockStyle.Fill
|
Dock = DockStyle.Fill
|
||||||
};
|
};
|
||||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream(@"C:\Users\Admin\Desktop\RPP_Labs\Lab4\pibd-22_emelyanov_a.s._fishfactory\FishFactory\FishFactory\ReportOrders.rdlc", FileMode.Open));
|
reportViewer.LocalReport.LoadReportDefinition(new FileStream(@"C:\Users\Admin\source\repos\FishFactory\FishFactory\FishFactory\ReportOrders.rdlc", FileMode.Open));
|
||||||
Controls.Clear();
|
Controls.Clear();
|
||||||
Controls.Add(reportViewer);
|
Controls.Add(reportViewer);
|
||||||
Controls.Add(panel);
|
Controls.Add(panel);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<DataSets>
|
<DataSets>
|
||||||
<DataSet Name="DataSetOrders">
|
<DataSet Name="DataSetOrders">
|
||||||
<Query>
|
<Query>
|
||||||
<DataSourceName>FishFactoryContractsViewModels</DataSourceName>
|
<DataSourceName>FishFactoryContractsViewModels</DataSourceName>
|
||||||
<CommandText>/* Local Query */</CommandText>
|
<CommandText>/* Local Query */</CommandText>
|
||||||
</Query>
|
</Query>
|
||||||
<Fields>
|
<Fields>
|
||||||
@ -29,13 +29,17 @@
|
|||||||
<DataField>CannedName</DataField>
|
<DataField>CannedName</DataField>
|
||||||
<rd:TypeName>System.String</rd:TypeName>
|
<rd:TypeName>System.String</rd:TypeName>
|
||||||
</Field>
|
</Field>
|
||||||
|
<Field Name="OrderStatus">
|
||||||
|
<DataField>OrderStatus</DataField>
|
||||||
|
<rd:TypeName>System.String</rd:TypeName>
|
||||||
|
</Field>
|
||||||
<Field Name="Sum">
|
<Field Name="Sum">
|
||||||
<DataField>Sum</DataField>
|
<DataField>Sum</DataField>
|
||||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||||
</Field>
|
</Field>
|
||||||
</Fields>
|
</Fields>
|
||||||
<rd:DataSetInfo>
|
<rd:DataSetInfo>
|
||||||
<rd:DataSetName>FishFactoryContracts.ViewModels</rd:DataSetName>
|
<rd:DataSetName>FishFactoryContracts.ViewModels</rd:DataSetName>
|
||||||
<rd:TableName>ReportOrdersViewModel</rd:TableName>
|
<rd:TableName>ReportOrdersViewModel</rd:TableName>
|
||||||
<rd:ObjectDataSourceType>FishFactoryContracts.ViewModels.ReportOrdersViewModel, FishFactoryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
<rd:ObjectDataSourceType>FishFactoryContracts.ViewModels.ReportOrdersViewModel, FishFactoryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
||||||
</rd:DataSetInfo>
|
</rd:DataSetInfo>
|
||||||
@ -127,6 +131,9 @@
|
|||||||
<TablixColumn>
|
<TablixColumn>
|
||||||
<Width>2.5cm</Width>
|
<Width>2.5cm</Width>
|
||||||
</TablixColumn>
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
</TablixColumns>
|
</TablixColumns>
|
||||||
<TablixRows>
|
<TablixRows>
|
||||||
<TablixRow>
|
<TablixRow>
|
||||||
@ -205,7 +212,7 @@
|
|||||||
<Paragraph>
|
<Paragraph>
|
||||||
<TextRuns>
|
<TextRuns>
|
||||||
<TextRun>
|
<TextRun>
|
||||||
<Value>Изделие</Value>
|
<Value>Консерва</Value>
|
||||||
<Style>
|
<Style>
|
||||||
<FontWeight>Bold</FontWeight>
|
<FontWeight>Bold</FontWeight>
|
||||||
</Style>
|
</Style>
|
||||||
@ -228,6 +235,38 @@
|
|||||||
</Textbox>
|
</Textbox>
|
||||||
</CellContents>
|
</CellContents>
|
||||||
</TablixCell>
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox2">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Статус</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox2</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
<TablixCell>
|
<TablixCell>
|
||||||
<CellContents>
|
<CellContents>
|
||||||
<Textbox Name="Textbox7">
|
<Textbox Name="Textbox7">
|
||||||
@ -357,6 +396,36 @@
|
|||||||
</Textbox>
|
</Textbox>
|
||||||
</CellContents>
|
</CellContents>
|
||||||
</TablixCell>
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="OrderStatus">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!OrderStatus.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>OrderStatus</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
<TablixCell>
|
<TablixCell>
|
||||||
<CellContents>
|
<CellContents>
|
||||||
<Textbox Name="Sum">
|
<Textbox Name="Sum">
|
||||||
@ -397,6 +466,7 @@
|
|||||||
<TablixMember />
|
<TablixMember />
|
||||||
<TablixMember />
|
<TablixMember />
|
||||||
<TablixMember />
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
</TablixMembers>
|
</TablixMembers>
|
||||||
</TablixColumnHierarchy>
|
</TablixColumnHierarchy>
|
||||||
<TablixRowHierarchy>
|
<TablixRowHierarchy>
|
||||||
@ -413,7 +483,7 @@
|
|||||||
<Top>2.48391cm</Top>
|
<Top>2.48391cm</Top>
|
||||||
<Left>0.55245cm</Left>
|
<Left>0.55245cm</Left>
|
||||||
<Height>1.2cm</Height>
|
<Height>1.2cm</Height>
|
||||||
<Width>16.44755cm</Width>
|
<Width>18.94755cm</Width>
|
||||||
<ZIndex>2</ZIndex>
|
<ZIndex>2</ZIndex>
|
||||||
<Style>
|
<Style>
|
||||||
<Border>
|
<Border>
|
||||||
|
@ -44,22 +44,20 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
var components = _componentStorage.GetFullList();
|
var components = _componentStorage.GetFullList();
|
||||||
var canneds = _cannedStorage.GetFullList();
|
var canneds = _cannedStorage.GetFullList();
|
||||||
var list = new List<ReportCannedComponentViewModel>();
|
var list = new List<ReportCannedComponentViewModel>();
|
||||||
foreach (var component in components)
|
foreach (var canned in canneds)
|
||||||
{
|
{
|
||||||
var record = new ReportCannedComponentViewModel
|
var record = new ReportCannedComponentViewModel
|
||||||
{
|
{
|
||||||
ComponentName = component.ComponentName,
|
CannedName = canned.CannedName,
|
||||||
Canneds = new List<Tuple<string, int>>(),
|
Components = new (),
|
||||||
TotalCount = 0
|
TotalCount = 0
|
||||||
};
|
};
|
||||||
foreach (var canned in canneds)
|
foreach (var component in components)
|
||||||
{
|
{
|
||||||
if (canned.CannedComponents.ContainsKey(component.Id))
|
if (canned.CannedComponents.ContainsKey(component.Id))
|
||||||
{
|
{
|
||||||
record.Canneds.Add(new Tuple<string,
|
record.Components.Add(new (component.ComponentName, canned.CannedComponents[component.Id].Item2));
|
||||||
int>(canned.CannedName, canned.CannedComponents[component.Id].Item2));
|
record.TotalCount += canned.CannedComponents[component.Id].Item2;
|
||||||
record.TotalCount +=
|
|
||||||
canned.CannedComponents[component.Id].Item2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list.Add(record);
|
list.Add(record);
|
||||||
@ -75,8 +73,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
return _orderStorage.GetFilteredList(new OrderSearchModel
|
return _orderStorage.GetFilteredList(new OrderSearchModel
|
||||||
{
|
{
|
||||||
DateFrom
|
DateFrom = model.DateFrom,
|
||||||
= model.DateFrom,
|
|
||||||
DateTo = model.DateTo
|
DateTo = model.DateTo
|
||||||
})
|
})
|
||||||
.Select(x => new ReportOrdersViewModel
|
.Select(x => new ReportOrdersViewModel
|
||||||
@ -84,6 +81,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
DateCreate = x.DateCreate,
|
DateCreate = x.DateCreate,
|
||||||
CannedName = x.CannedName,
|
CannedName = x.CannedName,
|
||||||
|
OrderStatus = x.Status.ToString(),
|
||||||
Sum = x.Sum
|
Sum = x.Sum
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -97,8 +95,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
_saveToWord.CreateDoc(new WordInfo
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Список консерв",
|
||||||
Components = _componentStorage.GetFullList()
|
Canneds = _cannedStorage.GetFullList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -110,7 +108,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
_saveToExcel.CreateReport(new ExcelInfo
|
_saveToExcel.CreateReport(new ExcelInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Изделия и их комопоненты",
|
||||||
CannedComponents = GetCannedComponent()
|
CannedComponents = GetCannedComponent()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -36,27 +36,25 @@ namespace FishFactoryBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = pc.ComponentName,
|
Text = pc.CannedName,
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
foreach (var product in pc.Canneds)
|
foreach (var (Components, Count) in pc.Components)
|
||||||
{
|
{
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "B",
|
ColumnName = "B",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = product.Item1,
|
Text = Components,
|
||||||
StyleInfo =
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
});
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "C",
|
ColumnName = "C",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = product.Item2.ToString(),
|
Text = Count.ToString(),
|
||||||
StyleInfo =
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
|
@ -16,19 +16,16 @@ namespace FishFactoryBusinessLogic.OfficePackage
|
|||||||
CreateParagraph(new PdfParagraph
|
CreateParagraph(new PdfParagraph
|
||||||
{
|
{
|
||||||
Text = info.Title,
|
Text = info.Title,
|
||||||
Style =
|
Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
"NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
});
|
||||||
CreateParagraph(new PdfParagraph
|
CreateParagraph(new PdfParagraph
|
||||||
{
|
{
|
||||||
Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center
|
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
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие",
|
Texts = new List<string> { "Номер", "Дата заказа", "Консерва", "Статус", "Сумма" },
|
||||||
"Сумма" },
|
|
||||||
Style = "NormalTitle",
|
Style = "NormalTitle",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
@ -36,8 +33,7 @@ namespace FishFactoryBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { order.Id.ToString(),
|
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.CannedName, order.OrderStatus, order.Sum.ToString() },
|
||||||
order.DateCreate.ToShortDateString(), order.CannedName, order.Sum.ToString() },
|
|
||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
});
|
});
|
||||||
|
@ -23,12 +23,14 @@ WordTextProperties { Bold = true, Size = "24", }) },
|
|||||||
JustificationType = WordJustificationType.Center
|
JustificationType = WordJustificationType.Center
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
foreach (var component in info.Components)
|
foreach (var canned in info.Canneds)
|
||||||
{
|
{
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)> {
|
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
|
TextProperties = new WordTextProperties
|
||||||
{
|
{
|
||||||
Size = "24",
|
Size = "24",
|
||||||
|
@ -11,6 +11,6 @@ namespace FishFactoryBusinessLogic.OfficePackage.HelperModels.Word
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ namespace FishFactoryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ReportCannedComponentViewModel
|
public class ReportCannedComponentViewModel
|
||||||
{
|
{
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
public string CannedName { get; set; } = string.Empty;
|
||||||
public int TotalCount { get; set; }
|
public int TotalCount { get; set; }
|
||||||
public List<Tuple<string, int>> Canneds { get; set; } = new();
|
public List<(string Components, int Count)> Components { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ namespace FishFactoryContracts.ViewModels
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public DateTime DateCreate { get; set; }
|
public DateTime DateCreate { get; set; }
|
||||||
public string CannedName { get; set; } = string.Empty;
|
public string CannedName { get; set; } = string.Empty;
|
||||||
|
public string OrderStatus { get; set; } = string.Empty;
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ namespace FishFactoryFileImplement.Implements
|
|||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
|
|
||||||
return source.Orders.Where(x => x.Id == model.Id).Select(x => GetViewModel(x)).ToList();
|
return source.Orders.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo).Select(x => GetViewModel(x)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
|
@ -57,7 +57,7 @@ namespace FishFactoryListImplement.Implements
|
|||||||
}
|
}
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (order.Id == model.Id)
|
if (order.Id == model.Id || model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo)
|
||||||
{
|
{
|
||||||
result.Add(GetViewModel(order));
|
result.Add(GetViewModel(order));
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ namespace FishFactoryListImplement.Models
|
|||||||
|
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel? model)
|
public static Order? Create(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
|
Loading…
Reference in New Issue
Block a user