diff --git a/RenovationWork/RenovationWork/FormMain.cs b/RenovationWork/RenovationWork/FormMain.cs
index 93cdb6c..66c5d10 100644
--- a/RenovationWork/RenovationWork/FormMain.cs
+++ b/RenovationWork/RenovationWork/FormMain.cs
@@ -10,6 +10,7 @@ using System.Windows.Forms;
using RenovationWorkContracts.BindingModels;
using RenovationWorkContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
+using RenovationWorkBusinessLogic.BusinessLogics;
namespace RenovationWorkView
{
diff --git a/RenovationWork/RenovationWork/FormReportOrders.Designer.cs b/RenovationWork/RenovationWork/FormReportOrders.Designer.cs
index d1cdeb3..2e064af 100644
--- a/RenovationWork/RenovationWork/FormReportOrders.Designer.cs
+++ b/RenovationWork/RenovationWork/FormReportOrders.Designer.cs
@@ -31,6 +31,8 @@
panel = new Panel();
buttonToPdf = new Button();
buttonMake = new Button();
+ labelTo = new Label();
+ labelFrom = new Label();
dateTimePickerTo = new DateTimePicker();
dateTimePickerFrom = new DateTimePicker();
labelTo = new Label();
@@ -42,6 +44,8 @@
//
panel.Controls.Add(buttonToPdf);
panel.Controls.Add(buttonMake);
+ panel.Controls.Add(labelTo);
+ panel.Controls.Add(labelFrom);
panel.Controls.Add(dateTimePickerTo);
panel.Controls.Add(dateTimePickerFrom);
panel.Controls.Add(labelTo);
@@ -104,6 +108,20 @@
labelFrom.TabIndex = 0;
labelFrom.Text = "С";
//
+ // dateTimePickerTo
+ //
+ dateTimePickerTo.Location = new Point(264, 6);
+ dateTimePickerTo.Name = "dateTimePickerTo";
+ dateTimePickerTo.Size = new Size(200, 23);
+ dateTimePickerTo.TabIndex = 1;
+ //
+ // dateTimePickerFrom
+ //
+ dateTimePickerFrom.Location = new Point(31, 5);
+ dateTimePickerFrom.Name = "dateTimePickerFrom";
+ dateTimePickerFrom.Size = new Size(200, 23);
+ dateTimePickerFrom.TabIndex = 0;
+ //
// FormReportOrders
//
AutoScaleDimensions = new SizeF(7F, 15F);
@@ -126,5 +144,6 @@
private Button buttonToPdf;
private Button buttonMake;
private DateTimePicker dateTimePickerTo;
+ private DateTimePicker dateTimePickerFrom;
}
}
\ No newline at end of file
diff --git a/RenovationWork/RenovationWork/FormReportOrders.cs b/RenovationWork/RenovationWork/FormReportOrders.cs
index cbc6ff2..2e5df93 100644
--- a/RenovationWork/RenovationWork/FormReportOrders.cs
+++ b/RenovationWork/RenovationWork/FormReportOrders.cs
@@ -11,6 +11,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using RenovationWorkContracts.BindingModels;
+using RenovationWorkContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+using Microsoft.Reporting.WinForms;
+
namespace RenovationWorkView
{
@@ -98,3 +103,4 @@ namespace RenovationWorkView
}
}
}
+
diff --git a/RenovationWork/RenovationWork/FormReportRepairComponents.cs b/RenovationWork/RenovationWork/FormReportRepairComponents.cs
index c92179e..82d6411 100644
--- a/RenovationWork/RenovationWork/FormReportRepairComponents.cs
+++ b/RenovationWork/RenovationWork/FormReportRepairComponents.cs
@@ -10,6 +10,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using Microsoft.Extensions.Logging;
+using RenovationWorkContracts.BindingModels;
+using RenovationWorkContracts.BusinessLogicsContracts;
namespace RenovationWorkView
{
diff --git a/RenovationWork/RenovationWork/Program.cs b/RenovationWork/RenovationWork/Program.cs
index fab88ea..186cd33 100644
--- a/RenovationWork/RenovationWork/Program.cs
+++ b/RenovationWork/RenovationWork/Program.cs
@@ -1,4 +1,6 @@
using RenovationWorkBusinessLogic.BusinessLogics;
+using RenovationWorkBusinessLogic.OfficePackage.Implements;
+using RenovationWorkBusinessLogic.OfficePackage;
using RenovationWorkContracts.BusinessLogicsContracts;
using RenovationWorkContracts.StoragesContracts;
using RenovationWorkDatabaseImplement.Implements;
diff --git a/RenovationWork/RenovationWork/Properties/DataSources/RenovationWorkContracts.BusinessLogicsContracts.IComponentLogic.datasource b/RenovationWork/RenovationWork/Properties/DataSources/RenovationWorkContracts.BusinessLogicsContracts.IComponentLogic.datasource
new file mode 100644
index 0000000..c58d1ce
--- /dev/null
+++ b/RenovationWork/RenovationWork/Properties/DataSources/RenovationWorkContracts.BusinessLogicsContracts.IComponentLogic.datasource
@@ -0,0 +1,10 @@
+
+
+
+ RenovationWorkContracts.BusinessLogicsContracts.IComponentLogic, RenovationWorkContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file
diff --git a/RenovationWork/RenovationWork/RenovationWorkView.csproj b/RenovationWork/RenovationWork/RenovationWorkView.csproj
index 5e3ee9b..a16925b 100644
--- a/RenovationWork/RenovationWork/RenovationWorkView.csproj
+++ b/RenovationWork/RenovationWork/RenovationWorkView.csproj
@@ -16,6 +16,7 @@
+
@@ -46,4 +47,10 @@
+
+
+ Always
+
+
+
\ No newline at end of file
diff --git a/RenovationWork/RenovationWork/ReportOrders.rdlc b/RenovationWork/RenovationWork/ReportOrders.rdlc
index 58944c4..828ff74 100644
--- a/RenovationWork/RenovationWork/ReportOrders.rdlc
+++ b/RenovationWork/RenovationWork/ReportOrders.rdlc
@@ -1,599 +1,599 @@
- 0
-
-
-
- System.Data.DataSet
- /* Local Connection */
-
- 47cb53f0-7dde-4717-ba03-866a0bc4f4dd
-
-
-
-
-
- RenovationWorkContractsViewModels
- /* Local Query */
-
-
-
- Id
- System.Int32
-
-
- DateCreate
- System.DateTime
-
+ 0
+
+
+
+ System.Data.DataSet
+ /* Local Connection */
+
+ 47cb53f0-7dde-4717-ba03-866a0bc4f4dd
+
+
+
+
+
+ RenovationWorkContractsViewModels
+ /* Local Query */
+
+
+
+ Id
+ System.Int32
+
+
+ DateCreate
+ System.DateTime
+
RepairName
- System.String
-
-
- Sum
- System.Decimal
-
+ System.String
+
+
+ Sum
+ System.Decimal
+
Status
RenovationWorkDataModels.Status
-
-
-
- RenovationWorkContracts.ViewModels
- ReportOrderViewModel
- RenovationWorkContracts.ViewModels.ReportOrderViewModel, RenovationWorkContracts, 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
-
-
-
-
- Номер
-
-
-
-
-
-
- Textbox5
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
-
- true
- true
-
-
-
-
- Дата заказа
-
-
-
-
-
-
- Textbox1
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
-
- true
- true
-
-
-
-
- Изделие
-
-
-
-
-
-
- Textbox3
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
-
- true
- true
-
-
-
-
- Сумма
-
-
-
-
-
-
- Textbox2
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
-
- true
- true
-
-
-
-
- Статус
-
-
-
-
-
-
- Textbox7
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
-
- 0.6cm
-
-
-
-
- true
- true
-
-
-
-
- =Fields!Id.Value
-
-
-
-
-
-
- Id
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
-
- true
- true
-
-
-
-
- =Fields!DateCreate.Value
-
-
-
-
-
-
- DateCreate
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
+
+
+
+ RenovationWorkContracts.ViewModels
+ ReportOrderViewModel
+ RenovationWorkContracts.ViewModels.ReportOrderViewModel, RenovationWorkContracts, 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
+
+
+
+
+ Номер
+
+
+
+
+
+
+ Textbox5
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Дата заказа
+
+
+
+
+
+
+ Textbox1
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Изделие
+
+
+
+
+
+
+ Textbox3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Сумма
+
+
+
+
+
+
+ Textbox2
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Статус
+
+
+
+
+
+
+ Textbox7
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.6cm
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Id.Value
+
+
+
+
+
+
+ Id
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DateCreate.Value
+
+
+
+
+
+
+ DateCreate
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
- true
- true
-
-
-
-
- =Fields!RepairName.Value
-
-
-
-
-
-
- RepairName
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
-
- true
- true
-
-
-
-
- =Fields!Sum.Value
-
-
-
-
-
-
- Sum1
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
+ true
+ true
+
+
+
+
+ =Fields!RepairName.Value
+
+
+
+
+
+
+ RepairName
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Sum.Value
+
+
+
+
+
+
+ Sum1
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
- true
- true
-
-
-
-
+ true
+ true
+
+
+
+
=Fields!Status.Value
-
-
-
-
-
-
+
+
+
+
+
+
Status
-
-
- 2pt
- 2pt
- 2pt
- 2pt
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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
-
-
- 21cm
-
- 29.7cm
- 21cm
- 2cm
- 2cm
- 2cm
- 2cm
- 0.13cm
-
-
-
-
-
-
- String
- true
- ReportParameter1
-
-
-
-
- 5
- 2
-
-
- 0
- 0
- ReportParameterPeriod
-
-
-
-
- Cm
- 1c0c12af-b9e8-41db-8d1f-26d1acbf91cc
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ 21cm
+
+ 29.7cm
+ 21cm
+ 2cm
+ 2cm
+ 2cm
+ 2cm
+ 0.13cm
+
+
+
+
+
+
+ String
+ true
+ ReportParameter1
+
+
+
+
+ 5
+ 2
+
+
+ 0
+ 0
+ ReportParameterPeriod
+
+
+
+
+ Cm
+ 1c0c12af-b9e8-41db-8d1f-26d1acbf91cc
\ No newline at end of file
diff --git a/RenovationWork/RenovationWorkBusinessLogic/BusinessLogics/ReportLogic.cs b/RenovationWork/RenovationWorkBusinessLogic/BusinessLogics/ReportLogic.cs
index 48e1718..a61ac7f 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/BusinessLogics/ReportLogic.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/BusinessLogics/ReportLogic.cs
@@ -21,12 +21,14 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf;
+
public ReportLogic(IRepairStorage repairStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
- AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
+ AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
{
_repairStorage = repairStorage;
_componentStorage = componentStorage;
_orderStorage = orderStorage;
+
_saveToExcel = saveToExcel;
_saveToWord = saveToWord;
_saveToPdf = saveToPdf;
@@ -40,22 +42,24 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
TotalCount = x.RepairComponents.Select(x => x.Value.Item2).Sum()
}).ToList();
}
+
public List GetOrders(ReportBindingModel model)
{
return _orderStorage.GetFilteredList(new OrderSearchModel
- {
+ {
DateFrom = model.DateFrom,
DateTo = model.DateTo
}).Select(x => new ReportOrdersViewModel
{
- Id = x.Id,
- DateCreate = x.DateCreate,
- RepairName = x.RepairName,
- Sum = x.Sum,
- Status = x.Status.ToString()
+ Id = x.Id,
+ DateCreate = x.DateCreate,
+ RepairName = x.RepairName,
+ Sum = x.Sum,
+ Status = x.Status.ToString()
}).ToList();
}
+
public void SaveRepairsToWordFile(ReportBindingModel model)
{
_saveToWord.CreateDoc(new WordInfo
@@ -65,6 +69,7 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
Repairs = _repairStorage.GetFullList()
});
}
+
public void SaveRepairComponentToExcelFile(ReportBindingModel model)
{
_saveToExcel.CreateReport(new ExcelInfo
@@ -74,6 +79,7 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
RepairComponents = GetRepairComponent()
});
}
+
public void SaveOrdersToPdfFile(ReportBindingModel model)
{
_saveToPdf.CreateDoc(new PdfInfo
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToExcel.cs
index a552ffc..d2847ed 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToExcel.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToExcel.cs
@@ -5,6 +5,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
+using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
namespace RenovationWorkBusinessLogic.OfficePackage
{
@@ -17,6 +19,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage
public void CreateReport(ExcelInfo info)
{
CreateExcel(info);
+
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
@@ -24,11 +27,13 @@ namespace RenovationWorkBusinessLogic.OfficePackage
Text = info.Title,
StyleInfo = ExcelStyleInfoType.Title
});
+
MergeCells(new ExcelMergeParameters
{
CellFromName = "A1",
CellToName = "C1"
});
+
uint rowIndex = 2;
foreach (var pc in info.RepairComponents)
{
@@ -40,6 +45,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
+
foreach (var (Component, Count) in pc.Components)
{
InsertCellInWorksheet(new ExcelCellParameters
@@ -49,6 +55,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage
Text = Component,
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
+
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
@@ -57,8 +64,10 @@ namespace RenovationWorkBusinessLogic.OfficePackage
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
+
rowIndex++;
}
+
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
@@ -75,6 +84,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage
});
rowIndex++;
}
+
SaveExcel(info);
}
protected abstract void CreateExcel(ExcelInfo info);
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
index 1ab5a54..87cec64 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
@@ -1,4 +1,6 @@
-using System;
+using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
+using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -6,6 +8,8 @@ using System.Threading.Tasks;
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
+
+
namespace RenovationWorkBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToPdf
@@ -56,4 +60,4 @@ namespace RenovationWorkBusinessLogic.OfficePackage
protected abstract void SavePdf(PdfInfo info);
}
-}
+}
\ No newline at end of file
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToWord.cs
index 9e82a6a..dd867e9 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToWord.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/AbstractSaveToWord.cs
@@ -5,6 +5,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
+using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
+using System.Collections.Generic;
+
namespace RenovationWorkBusinessLogic.OfficePackage
{
@@ -42,5 +46,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void SaveWord(WordInfo info);
}
+}
}
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs
index 80e80dc..b192841 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs
@@ -12,4 +12,5 @@ namespace RenovationWorkBusinessLogic.OfficePackage.HelperEnums
Text,
TextWithBroder
}
-}
\ No newline at end of file
+}
+
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs
index a434841..e0108cb 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs
@@ -13,3 +13,4 @@ namespace RenovationWorkBusinessLogic.OfficePackage.HelperEnums
Rigth
}
}
+
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs
index 35d9fa9..5ee999f 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs
@@ -15,4 +15,4 @@ namespace RenovationWorkBusinessLogic.OfficePackage.HelperModels
public string CellReference => $"{ColumnName}{RowIndex}";
public ExcelStyleInfoType StyleInfo { get; set; }
}
-}
+}
\ No newline at end of file
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
index da410f3..3724d0d 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
@@ -16,4 +16,4 @@ namespace RenovationWorkBusinessLogic.OfficePackage.HelperModels
public List Orders { get; set; } = new();
}
-}
\ No newline at end of file
+}
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs
index 907d4e2..7339c9e 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
+
namespace RenovationWorkBusinessLogic.OfficePackage.HelperModels
{
public class PdfParagraph
@@ -14,4 +15,4 @@ namespace RenovationWorkBusinessLogic.OfficePackage.HelperModels
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
index 9ec6930..43977d1 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
@@ -1,4 +1,5 @@
-using System;
+using RenovationWorkContracts.ViewModels;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs
index 57674a5..d275783 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs
@@ -11,4 +11,4 @@ namespace RenovationWorkBusinessLogic.OfficePackage.HelperModels
public List<(string, WordTextProperties)> Texts { get; set; } = new();
public WordTextProperties? TextProperties { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs
index adb1fd1..1621d67 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs
@@ -1,4 +1,5 @@
-using System;
+using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToExcel.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToExcel.cs
index eca767f..ad849e9 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToExcel.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToExcel.cs
@@ -1,4 +1,9 @@
-using DocumentFormat.OpenXml.Office2010.Excel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Office2013.Excel;
using DocumentFormat.OpenXml.Office2016.Excel;
using DocumentFormat.OpenXml.Packaging;
@@ -19,11 +24,14 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
private SpreadsheetDocument? _spreadsheetDocument;
private SharedStringTablePart? _shareStringPart;
private Worksheet? _worksheet;
+
private static void CreateStyles(WorkbookPart workbookpart)
{
var sp = workbookpart.AddNewPart();
sp.Stylesheet = new Stylesheet();
+
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
+
var fontUsual = new Font();
fontUsual.Append(new FontSize() { Val = 12D });
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
@@ -31,6 +39,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
fontUsual.Append(new FontName() { Val = "Times New Roman" });
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
+
var fontTitle = new Font();
fontTitle.Append(new Bold());
fontTitle.Append(new FontSize() { Val = 14D });
@@ -39,11 +48,15 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
fontTitle.Append(new FontName() { Val = "Times New Roman" });
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
+
fonts.Append(fontUsual);
fonts.Append(fontTitle);
+
var fills = new Fills() { Count = 2U };
+
var fill1 = new Fill();
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
+
var fill2 = new Fill();
fill2.Append(new PatternFill()
{
@@ -51,14 +64,18 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
});
fills.Append(fill1);
fills.Append(fill2);
+
var borders = new Borders() { Count = 2U };
+
var borderNoBorder = new Border();
borderNoBorder.Append(new LeftBorder());
borderNoBorder.Append(new RightBorder());
borderNoBorder.Append(new TopBorder());
borderNoBorder.Append(new BottomBorder());
borderNoBorder.Append(new DiagonalBorder());
+
var borderThin = new Border();
+
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{ Indexed = 64U });
@@ -82,8 +99,10 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
borderThin.Append(topBorder);
borderThin.Append(bottomBorder);
borderThin.Append(new DiagonalBorder());
+
borders.Append(borderNoBorder);
borders.Append(borderThin);
+
var cellStyleFormats = new CellStyleFormats() { Count = 1U };
var cellFormatStyle = new CellFormat()
{
@@ -93,6 +112,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
BorderId = 0U
};
cellStyleFormats.Append(cellFormatStyle);
+
var cellFormats = new CellFormats() { Count = 3U };
var cellFormatFont = new CellFormat()
{
@@ -131,6 +151,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
cellFormats.Append(cellFormatFont);
cellFormats.Append(cellFormatFontAndBorder);
cellFormats.Append(cellFormatTitle);
+
var cellStyles = new CellStyles() { Count = 1U };
cellStyles.Append(new CellStyle()
{
@@ -169,6 +190,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
});
stylesheetExtensionList.Append(stylesheetExtension1);
stylesheetExtensionList.Append(stylesheetExtension2);
+
sp.Stylesheet.Append(fonts);
sp.Stylesheet.Append(fills);
sp.Stylesheet.Append(borders);
@@ -179,6 +201,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
sp.Stylesheet.Append(tableStyles);
sp.Stylesheet.Append(stylesheetExtensionList);
}
+
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
{
return styleInfo switch
@@ -189,6 +212,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
_ => 0U,
};
}
+
protected override void CreateExcel(ExcelInfo info)
{
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
@@ -196,7 +220,9 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
// Создаем книгу (в ней хранятся листы)
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
workbookpart.Workbook = new Workbook();
+
CreateStyles(workbookpart);
+
// Получаем/создаем хранилище текстов для книги
_shareStringPart =
_spreadsheetDocument.WorkbookPart!.GetPartsOfType().Any()
@@ -209,9 +235,11 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
{
_shareStringPart.SharedStringTable = new SharedStringTable();
}
+
// Создаем лист в книгу
var worksheetPart = workbookpart.AddNewPart();
worksheetPart.Worksheet = new Worksheet(new SheetData());
+
// Добавляем лист в книгу
var sheets =
_spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
@@ -223,6 +251,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
Name = "Лист"
};
sheets.Append(sheet);
+
_worksheet = worksheetPart.Worksheet;
}
protected override void InsertCellInWorksheet(ExcelCellParameters
@@ -237,6 +266,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
{
return;
}
+
// Ищем строку, либо добавляем ее
Row row;
if (sheetData.Elements().Where(r => r.RowIndex! ==
@@ -250,7 +280,8 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
row = new Row() { RowIndex = excelParams.RowIndex };
sheetData.Append(row);
}
- // Ищем нужную ячейку
+
+ // Ищем нужную ячейку
Cell cell;
if (row.Elements().Where(c => c.CellReference!.Value ==
excelParams.CellReference).Any())
@@ -278,8 +309,10 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
excelParams.CellReference
};
row.InsertBefore(newCell, refCell);
+
cell = newCell;
}
+
// вставляем новый текст
_shareStringPart.SharedStringTable.AppendChild(new
SharedStringItem(new Text(excelParams.Text)));
@@ -290,6 +323,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
cell.DataType = new EnumValue(CellValues.SharedString);
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
}
+
protected override void MergeCells(ExcelMergeParameters excelParams)
{
if (_worksheet == null)
@@ -297,6 +331,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
return;
}
MergeCells mergeCells;
+
if (_worksheet.Elements().Any())
{
mergeCells = _worksheet.Elements().First();
@@ -304,6 +339,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
else
{
mergeCells = new MergeCells();
+
if (_worksheet.Elements().Any())
{
_worksheet.InsertAfter(mergeCells,
@@ -315,12 +351,14 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
_worksheet.Elements().First());
}
}
+
var mergeCell = new MergeCell()
{
Reference = new StringValue(excelParams.Merge)
};
mergeCells.Append(mergeCell);
}
+
protected override void SaveExcel(ExcelInfo info)
{
if (_spreadsheetDocument == null)
@@ -332,3 +370,5 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
}
}
}
+
+
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToPdf.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToPdf.cs
index 14e44b8..aab9944 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToPdf.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToPdf.cs
@@ -1,4 +1,6 @@
-using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
+using MigraDoc.DocumentObjectModel;
+using MigraDoc.Rendering;
+using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Tables;
@@ -8,6 +10,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using MigraDoc.DocumentObjectModel.Tables;
+
namespace RenovationWorkBusinessLogic.OfficePackage.Implements
{
@@ -99,3 +103,4 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
}
}
}
+
diff --git a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToWord.cs
index adcb51a..332ba33 100644
--- a/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToWord.cs
+++ b/RenovationWork/RenovationWorkBusinessLogic/OfficePackage/Implements/SaveToWord.cs
@@ -8,6 +8,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
+using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
+using DocumentFormat.OpenXml;
+using DocumentFormat.OpenXml.Packaging;
+using DocumentFormat.OpenXml.Wordprocessing;
namespace RenovationWorkBusinessLogic.OfficePackage.Implements
{
@@ -28,11 +33,14 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
private static SectionProperties CreateSectionProperties()
{
var properties = new SectionProperties();
+
var pageSize = new PageSize
{
Orient = PageOrientationValues.Portrait
};
+
properties.AppendChild(pageSize);
+
return properties;
}
private static ParagraphProperties?
@@ -42,17 +50,22 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
{
return null;
}
+
var properties = new ParagraphProperties();
+
properties.AppendChild(new Justification()
{
Val =
GetJustificationValues(paragraphProperties.JustificationType)
});
+
properties.AppendChild(new SpacingBetweenLines
{
LineRule = LineSpacingRuleValues.Auto
});
+
properties.AppendChild(new Indentation());
+
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
if (!string.IsNullOrEmpty(paragraphProperties.Size))
{
@@ -62,6 +75,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
});
}
properties.AppendChild(paragraphMarkRunProperties);
+
return properties;
}
protected override void CreateWord(WordInfo info)
@@ -81,9 +95,11 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
var docParagraph = new Paragraph();
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
+
foreach (var run in paragraph.Texts)
{
var docRun = new Run();
+
var properties = new RunProperties();
properties.AppendChild(new FontSize { Val = run.Item2.Size });
if (run.Item2.Bold)
@@ -99,6 +115,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
});
docParagraph.AppendChild(docRun);
}
+
_docBody.AppendChild(docParagraph);
}
protected override void SaveWord(WordInfo info)
@@ -108,8 +125,9 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
return;
}
_docBody.AppendChild(CreateSectionProperties());
+
_wordDocument.MainDocumentPart!.Document.Save();
_wordDocument.Close();
}
}
-}
\ No newline at end of file
+}
diff --git a/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IReportLogic.cs b/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IReportLogic.cs
index a3bd77c..08ea4c8 100644
--- a/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IReportLogic.cs
+++ b/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IReportLogic.cs
@@ -1,4 +1,6 @@
-using System;
+using RenovationWorkContracts.BindingModels;
+using RenovationWorkContracts.ViewModels;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -17,4 +19,4 @@ namespace RenovationWorkContracts.BusinessLogicsContracts
void SaveOrdersToPdfFile(ReportBindingModel model);
}
-}
+}
\ No newline at end of file
diff --git a/RenovationWork/RenovationWorkContracts/ViewModels/ReportRepairComponentViewModel.cs b/RenovationWork/RenovationWorkContracts/ViewModels/ReportRepairComponentViewModel.cs
index f6067c0..6f137d9 100644
--- a/RenovationWork/RenovationWorkContracts/ViewModels/ReportRepairComponentViewModel.cs
+++ b/RenovationWork/RenovationWorkContracts/ViewModels/ReportRepairComponentViewModel.cs
@@ -13,4 +13,4 @@ namespace RenovationWorkContracts.ViewModels
public List<(string, int)> Components { get; set; } = new();
}
-}
\ No newline at end of file
+}
|