ПИбд-23 Насыров Артур Газинурович Лабораторная работа №4 #7
@ -36,17 +36,17 @@ namespace FlowerShopBusinessLogic.OfficePackage
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.ComponentName,
|
||||
Text = pc.FlowerName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var product in pc.Flowers)
|
||||
foreach (var component in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = product.Item1,
|
||||
Text = component.Item1,
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
@ -54,7 +54,7 @@ namespace FlowerShopBusinessLogic.OfficePackage
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = product.Item2.ToString(),
|
||||
Text = component.Item2.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
@ -22,11 +22,11 @@ namespace FlowerShopBusinessLogic.OfficePackage
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
foreach (var component in info.Components)
|
||||
foreach (var flower in info.Flowers)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) },
|
||||
Texts = new List<(string, WordTextProperties)> { (flower.FlowerName, new WordTextProperties { Size = "24", }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
|
@ -11,6 +11,6 @@ namespace FlowerShopBusinessLogic.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<FlowerViewModel> Flowers { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -39,24 +39,23 @@ namespace FlowerShopBusinessLogic
|
||||
/// <returns></returns>
|
||||
public List<ReportFlowerComponentViewModel> GetFlowerComponent()
|
||||
{
|
||||
var components = _componentStorage.GetFullList();
|
||||
//var components = _componentStorage.GetFullList();
|
||||
|
||||
var flowers = _flowerStorage.GetFullList();
|
||||
var list = new List<ReportFlowerComponentViewModel>();
|
||||
foreach (var component in components)
|
||||
foreach (var flower in flowers)
|
||||
{
|
||||
var record = new ReportFlowerComponentViewModel
|
||||
{
|
||||
ComponentName = component.ComponentName,
|
||||
Flowers = new List<Tuple<string, int>>(),
|
||||
FlowerName = flower.FlowerName,
|
||||
Components = new List<Tuple<string, int>>(),
|
||||
TotalCount = 0
|
||||
};
|
||||
foreach (var flower in flowers)
|
||||
foreach (var component in flower.FlowerComponents)
|
||||
{
|
||||
if (flower.FlowerComponents.ContainsKey(component.Id))
|
||||
{
|
||||
record.Flowers.Add(new Tuple<string,int>(flower.FlowerName, flower.FlowerComponents[component.Id].Item2));
|
||||
record.TotalCount +=flower.FlowerComponents[component.Id].Item2;
|
||||
}
|
||||
record.Components.Add(new Tuple<string,
|
||||
int>(component.Value.Item1.ComponentName, component.Value.Item2));
|
||||
record.TotalCount +=
|
||||
component.Value.Item2;
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
@ -94,8 +93,8 @@ namespace FlowerShopBusinessLogic
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Components = _componentStorage.GetFullList()
|
||||
Title = "Список цветов",
|
||||
Flowers = _flowerStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
@ -107,7 +106,7 @@ namespace FlowerShopBusinessLogic
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Title = "Список компонентов",
|
||||
FlowerComponents = GetFlowerComponent()
|
||||
});
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ namespace FlowerShopContracts.ViewModels
|
||||
{
|
||||
public class ReportFlowerComponentViewModel
|
||||
{
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public string FlowerName { get; set; } = string.Empty;
|
||||
public int TotalCount { get; set; }
|
||||
public List<Tuple<string, int>> Flowers { get; set; } = new();
|
||||
public List<Tuple<string, int>> Components { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,8 @@ namespace FlowerShopDatabaseImplement.Implements
|
||||
}
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
|
||||
using var context = new FlowerShopDataBase();
|
||||
return context.Orders.Include(x => x.Flower)
|
||||
.Where(x => ((!model.Id.HasValue || x.Id == model.Id) &&
|
||||
|
@ -34,7 +34,9 @@ namespace FlowerShopFileImplement.Implements
|
||||
return new();
|
||||
}
|
||||
return source.Orders
|
||||
.Where(x => x.Id == model.Id)
|
||||
.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 => AccessFlowerStorage(x.GetViewModel))
|
||||
.ToList();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace FlowerShopListImplement.Implements
|
||||
}
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
if (order.Id == model.Id)
|
||||
if (order.Id == model.Id && model.DateFrom <= order.DateCreate && model.DateTo >= order.DateCreate)
|
||||
{
|
||||
result.Add(AccessFlowerStorage(order.GetViewModel));
|
||||
}
|
||||
|
@ -30,8 +30,8 @@
|
||||
{
|
||||
buttonSaveToExcel = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
Flowerr = new DataGridViewTextBoxColumn();
|
||||
Component = new DataGridViewTextBoxColumn();
|
||||
Flower = new DataGridViewTextBoxColumn();
|
||||
Count = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -49,7 +49,7 @@
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Component, Flower, Count });
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Flowerr, Component, Count });
|
||||
dataGridView.Location = new Point(12, 65);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
@ -57,6 +57,13 @@
|
||||
dataGridView.Size = new Size(812, 359);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// Flowerr
|
||||
//
|
||||
Flowerr.HeaderText = "Цветок";
|
||||
Flowerr.MinimumWidth = 6;
|
||||
Flowerr.Name = "Flowerr";
|
||||
Flowerr.Width = 250;
|
||||
//
|
||||
// Component
|
||||
//
|
||||
Component.HeaderText = "Компонент";
|
||||
@ -64,13 +71,6 @@
|
||||
Component.Name = "Component";
|
||||
Component.Width = 250;
|
||||
//
|
||||
// Flower
|
||||
//
|
||||
Flower.HeaderText = "Изделие";
|
||||
Flower.MinimumWidth = 6;
|
||||
Flower.Name = "Flower";
|
||||
Flower.Width = 250;
|
||||
//
|
||||
// Count
|
||||
//
|
||||
Count.HeaderText = "Количество";
|
||||
@ -86,7 +86,7 @@
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(buttonSaveToExcel);
|
||||
Name = "FormReportFlowerComponent";
|
||||
Text = "FormReportFlowerComponent";
|
||||
Text = "Компоненты цветов";
|
||||
Load += FormReportFlowerComponent_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
@ -96,8 +96,8 @@
|
||||
|
||||
private Button buttonSaveToExcel;
|
||||
private DataGridView dataGridView;
|
||||
private DataGridViewTextBoxColumn Flowerr;
|
||||
private DataGridViewTextBoxColumn Component;
|
||||
private DataGridViewTextBoxColumn Flower;
|
||||
private DataGridViewTextBoxColumn Count;
|
||||
}
|
||||
}
|
@ -42,14 +42,14 @@ namespace ProjectFlowerShop
|
||||
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);
|
||||
}
|
||||
@ -66,8 +66,8 @@ namespace ProjectFlowerShop
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" });
|
||||
foreach (var listElem in elem.Flowers)
|
||||
dataGridView.Rows.Add(new object[] { elem.FlowerName, "", "" });
|
||||
foreach (var listElem in elem.Components)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||
}
|
||||
|
@ -117,21 +117,12 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="Component.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Flower.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Flowerr.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Component.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Flower.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
2
ProjectFlowerShop/FormReportOrders.Designer.cs
generated
2
ProjectFlowerShop/FormReportOrders.Designer.cs
generated
@ -119,7 +119,7 @@
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(panel);
|
||||
Name = "FormReportOrders";
|
||||
Text = "FormReportOrders";
|
||||
Text = "Отчет по заказам";
|
||||
panel.ResumeLayout(false);
|
||||
panel.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
|
Loading…
Reference in New Issue
Block a user
Закомментированного кода быть не должно