From 686c98f1e8959cda9f4df9fd8860f4640b4a349f Mon Sep 17 00:00:00 2001 From: ujijrujijr Date: Wed, 29 May 2024 12:43:21 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20namespace,=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=20=D1=81=D0=BA=D0=B0=D1=87=D0=B8=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/ReportImplementerLogic.cs | 6 +++--- .../AbstractSaveToExcelImplementer.cs | 8 +++---- .../AbstractSaveToPdfImplementer.cs | 6 +++--- .../AbstractSaveToWordImplementer.cs | 6 +++--- .../HelperEnums/ExcelStyleInfoType.cs | 2 +- .../HelperEnums/PdfParagraphAlignmentType.cs | 2 +- .../HelperEnums/WordJustificationType.cs | 2 +- .../HelperModels/ExcelCellParameters.cs | 4 ++-- .../HelperModels/ExcelInfoImplementer.cs | 2 +- .../HelperModels/ExcelMergeParameters.cs | 2 +- .../HelperModels/PdfInfoImplementer.cs | 2 +- .../HelperModels/PdfParagraph.cs | 4 ++-- .../HelperModels/PdfRowParameters.cs | 4 ++-- .../HelperModels/WordInfoImplementer.cs | 2 +- .../HelperModels/WordParagraph.cs | 2 +- .../HelperModels/WordTextProperties.cs | 4 ++-- .../Implements/SaveToExcelImplementer.cs | 6 +++--- .../Implements/SaveToPdfImplementer.cs | 6 +++--- .../Implements/SaveToWordImplementer.cs | 6 +++--- .../Controllers/HomeController.cs | 21 +++++++++++++++---- ComputerShopImplementerApp/Program.cs | 4 ++-- .../Home/ReportOrdersAssembliesToFile.cshtml | 2 +- ComputerShopRestApi/Program.cs | 4 ++-- 23 files changed, 60 insertions(+), 47 deletions(-) diff --git a/ComputerShopBusinessLogic/BusinessLogics/ReportImplementerLogic.cs b/ComputerShopBusinessLogic/BusinessLogics/ReportImplementerLogic.cs index 1d49c6c..b73c789 100644 --- a/ComputerShopBusinessLogic/BusinessLogics/ReportImplementerLogic.cs +++ b/ComputerShopBusinessLogic/BusinessLogics/ReportImplementerLogic.cs @@ -3,8 +3,8 @@ using ComputerShopContracts.BusinessLogicContracts; using ComputerShopContracts.SearchModels; using ComputerShopContracts.StorageContracts; using ComputerShopContracts.ViewModels; -using GarmentFactoryBusinessLogic.OfficePackage; -using GarmentFactoryBusinessLogic.OfficePackage.HelperModels; +using ComputerShopBusinessLogic.OfficePackage; +using ComputerShopBusinessLogic.OfficePackage.HelperModels; using System; using System.Collections.Generic; using System.Linq; @@ -55,7 +55,7 @@ namespace ComputerShopBusinessLogic.BusinessLogics _saveToWord.CreateDoc(new WordInfoImplementer { FileName = model.FileName, - Title = "Список сборок по выбранным заявкам", + Title = "Список сборок по выбранным заказам", OrderAssemblies = GetReportOrdersAssemblies(model.Ids) });; //throw new NotImplementedException(); diff --git a/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToExcelImplementer.cs b/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToExcelImplementer.cs index 879879b..8d9fdd1 100644 --- a/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToExcelImplementer.cs +++ b/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToExcelImplementer.cs @@ -1,12 +1,12 @@ -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; -using GarmentFactoryBusinessLogic.OfficePackage.HelperModels; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage +namespace ComputerShopBusinessLogic.OfficePackage { public abstract class AbstractSaveToExcelImplementer { @@ -143,7 +143,7 @@ namespace GarmentFactoryBusinessLogic.OfficePackage } } - rowIndex++; + //rowIndex++; // foreach (var (Component, Count) in tc.Components) // { diff --git a/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToPdfImplementer.cs b/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToPdfImplementer.cs index c584135..f3db536 100644 --- a/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToPdfImplementer.cs +++ b/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToPdfImplementer.cs @@ -1,12 +1,12 @@ -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; -using GarmentFactoryBusinessLogic.OfficePackage.HelperModels; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage +namespace ComputerShopBusinessLogic.OfficePackage { public abstract class AbstractSaveToPdfImplementer { diff --git a/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToWordImplementer.cs b/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToWordImplementer.cs index 5f7fa3e..b9493c7 100644 --- a/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToWordImplementer.cs +++ b/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToWordImplementer.cs @@ -1,12 +1,12 @@ -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; -using GarmentFactoryBusinessLogic.OfficePackage.HelperModels; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage +namespace ComputerShopBusinessLogic.OfficePackage { public abstract class AbstractSaveToWordImplementer { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs b/ComputerShopBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs index 400fd1e..aab4a0c 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperEnums +namespace ComputerShopBusinessLogic.OfficePackage.HelperEnums { public enum ExcelStyleInfoType { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs b/ComputerShopBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs index 1942bac..04711c4 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperEnums +namespace ComputerShopBusinessLogic.OfficePackage.HelperEnums { public enum PdfParagraphAlignmentType { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs b/ComputerShopBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs index 77144da..2f6e35e 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperEnums +namespace ComputerShopBusinessLogic.OfficePackage.HelperEnums { public enum WordJustificationType { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs index accfe64..b52ac72 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs @@ -1,11 +1,11 @@ -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels +namespace ComputerShopBusinessLogic.OfficePackage.HelperModels { public class ExcelCellParameters { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelInfoImplementer.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelInfoImplementer.cs index 885f224..5bc642a 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelInfoImplementer.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelInfoImplementer.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels +namespace ComputerShopBusinessLogic.OfficePackage.HelperModels { public class ExcelInfoImplementer { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs index fffd328..3614eb7 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels +namespace ComputerShopBusinessLogic.OfficePackage.HelperModels { public class ExcelMergeParameters { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfInfoImplementer.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfInfoImplementer.cs index 31129bd..cdf3d28 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfInfoImplementer.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfInfoImplementer.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels +namespace ComputerShopBusinessLogic.OfficePackage.HelperModels { public class PdfInfoImplementer { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs index d78b2f2..ad0aea4 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs @@ -1,11 +1,11 @@ -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels +namespace ComputerShopBusinessLogic.OfficePackage.HelperModels { public class PdfParagraph { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs index 0b04a46..f302562 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs @@ -1,11 +1,11 @@ -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels +namespace ComputerShopBusinessLogic.OfficePackage.HelperModels { public class PdfRowParameters { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordInfoImplementer.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordInfoImplementer.cs index c3e595c..b0eee0a 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordInfoImplementer.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordInfoImplementer.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels +namespace ComputerShopBusinessLogic.OfficePackage.HelperModels { public class WordInfoImplementer { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs index 4600728..6475004 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels +namespace ComputerShopBusinessLogic.OfficePackage.HelperModels { public class WordParagraph { diff --git a/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs b/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs index f5458ba..2a2c240 100644 --- a/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs +++ b/ComputerShopBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs @@ -1,11 +1,11 @@ -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels +namespace ComputerShopBusinessLogic.OfficePackage.HelperModels { public class WordTextProperties { diff --git a/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToExcelImplementer.cs b/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToExcelImplementer.cs index 68c71fb..473d8a7 100644 --- a/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToExcelImplementer.cs +++ b/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToExcelImplementer.cs @@ -3,15 +3,15 @@ using DocumentFormat.OpenXml.Office2013.Excel; using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml; -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; -using GarmentFactoryBusinessLogic.OfficePackage.HelperModels; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.Implements +namespace ComputerShopBusinessLogic.OfficePackage.Implements { public class SaveToExcelImplementer : AbstractSaveToExcelImplementer { diff --git a/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToPdfImplementer.cs b/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToPdfImplementer.cs index eb51978..d386fcb 100644 --- a/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToPdfImplementer.cs +++ b/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToPdfImplementer.cs @@ -1,5 +1,5 @@ -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; -using GarmentFactoryBusinessLogic.OfficePackage.HelperModels; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperModels; using MigraDoc.DocumentObjectModel; using MigraDoc.DocumentObjectModel.Tables; using MigraDoc.Rendering; @@ -9,7 +9,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.Implements +namespace ComputerShopBusinessLogic.OfficePackage.Implements { public class SaveToPdfImplementer : AbstractSaveToPdfImplementer { diff --git a/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToWordImplementer.cs b/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToWordImplementer.cs index e19fbff..dd4b694 100644 --- a/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToWordImplementer.cs +++ b/ComputerShopBusinessLogic/OfficePackage/Implements/SaveToWordImplementer.cs @@ -1,15 +1,15 @@ using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Wordprocessing; -using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums; -using GarmentFactoryBusinessLogic.OfficePackage.HelperModels; +using ComputerShopBusinessLogic.OfficePackage.HelperEnums; +using ComputerShopBusinessLogic.OfficePackage.HelperModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GarmentFactoryBusinessLogic.OfficePackage.Implements +namespace ComputerShopBusinessLogic.OfficePackage.Implements { public class SaveToWordImplementer : AbstractSaveToWordImplementer { diff --git a/ComputerShopImplementerApp/Controllers/HomeController.cs b/ComputerShopImplementerApp/Controllers/HomeController.cs index 100672d..acbfa0f 100644 --- a/ComputerShopImplementerApp/Controllers/HomeController.cs +++ b/ComputerShopImplementerApp/Controllers/HomeController.cs @@ -560,8 +560,19 @@ namespace ComputerShopImplementerApp.Controllers return View(); } + [HttpGet] + public IActionResult GetWordFile() + { + return PhysicalFile("C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Сборки по выбранным заказам.docx"); + } + + public IActionResult GetExcelFile() + { + return PhysicalFile("C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Сборки по выбранным заказам.xlsx"); + } + [HttpPost] - public void ReportOrdersAssembliesToFile(int[] orders, string type) + public IActionResult ReportOrdersAssembliesToFile(int[] orders, string type) { if (APIUser.User == null) { @@ -583,7 +594,8 @@ namespace ComputerShopImplementerApp.Controllers Ids = ids, FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.docx" }); - Response.Redirect("Index"); + return GetWordFile(); + //Response.Redirect("GetWordFile"); } if (type == "xlsx") @@ -593,10 +605,11 @@ namespace ComputerShopImplementerApp.Controllers Ids = ids, FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.xlsx" }); - Response.Redirect("Index"); + return GetExcelFile(); + //Response.Redirect("GetExcelFile"); } } - Response.Redirect("Index"); + return Redirect("Index"); } diff --git a/ComputerShopImplementerApp/Program.cs b/ComputerShopImplementerApp/Program.cs index ffba5e9..9f16856 100644 --- a/ComputerShopImplementerApp/Program.cs +++ b/ComputerShopImplementerApp/Program.cs @@ -5,8 +5,8 @@ using ComputerShopDatabaseImplement.Implements; using ComputerShopDatabaseImplement.Models; using ComputerShopDataModels.Models; using ComputerShopImplementerApp; -using GarmentFactoryBusinessLogic.OfficePackage; -using GarmentFactoryBusinessLogic.OfficePackage.Implements; +using ComputerShopBusinessLogic.OfficePackage; +using ComputerShopBusinessLogic.OfficePackage.Implements; var builder = WebApplication.CreateBuilder(args); diff --git a/ComputerShopImplementerApp/Views/Home/ReportOrdersAssembliesToFile.cshtml b/ComputerShopImplementerApp/Views/Home/ReportOrdersAssembliesToFile.cshtml index 4c5651e..153ade8 100644 --- a/ComputerShopImplementerApp/Views/Home/ReportOrdersAssembliesToFile.cshtml +++ b/ComputerShopImplementerApp/Views/Home/ReportOrdersAssembliesToFile.cshtml @@ -13,7 +13,7 @@ @* !!!ЕСЛИ НЕ БУДЕТ РАБОТАТЬ, УБРАТЬ ОТСЮДА @order.Sum *@ @foreach (var order in ViewBag.Orders) { - + } diff --git a/ComputerShopRestApi/Program.cs b/ComputerShopRestApi/Program.cs index 1def9a6..e0e3d6e 100644 --- a/ComputerShopRestApi/Program.cs +++ b/ComputerShopRestApi/Program.cs @@ -5,8 +5,8 @@ using ComputerShopDatabaseImplement.Implements; using ComputerShopBusinessLogic.MailWorker; using ComputerShopDatabaseImplement.Models; using ComputerShopDataModels.Models; -using GarmentFactoryBusinessLogic.OfficePackage; -using GarmentFactoryBusinessLogic.OfficePackage.Implements; +using ComputerShopBusinessLogic.OfficePackage; +using ComputerShopBusinessLogic.OfficePackage.Implements; using Microsoft.OpenApi.Models; using ComputerShopContracts.BindingModels;