From 4c12ecf513926a0cbb0649e120d2bd9e0eaecd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=AF=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=B2?= Date: Wed, 29 May 2024 03:02:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BE=D1=82=D1=87=D0=B5=D1=82=D1=8B,=20=D1=83?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D1=83?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BC=D0=B0=D1=88=D0=B8=D0=BD=20=D0=BA=20=D0=BD=D0=B5=D0=B8?= =?UTF-8?q?=D1=81=D1=80=D0=BF=D0=B0=D0=B2=D0=BD=D0=BE=D1=81=D1=82=D1=8F?= =?UTF-8?q?=D0=BC,=20=D0=B4=D0=BE=D0=BF=D0=B8=D0=BB=D0=B8=D0=BB=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=BA=D0=B8=D0=BA=D1=83,=20=D0=BE=D1=82=D1=81?= =?UTF-8?q?=D0=B0=D0=BB=D0=BE=D1=81=D1=8C=20=D0=A2=D0=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/DefectLogic.cs | 6 +- .../BusinessLogics/ExecutorReportLogic.cs | 11 +- .../HelperModels/ExcelInfoExecutor.cs | 1 + .../HelperModels/WordInfoExecutor.cs | 1 + .../Implements/SaveToExcelExecutor.cs | 2 +- .../Implements/SaveToWordExecutor.cs | 2 +- .../BindingModels/PdfReportBindingModel.cs | 21 +++ .../ReportExecutorBindingModel.cs | 3 +- .../IExecutorReportLogic.cs | 4 +- .../Implements/DefectStorage.cs | 4 +- .../Models/Defect.cs | 3 +- .../Controllers/HomeController.cs | 124 +++++++----------- .../Views/Home/AddCarToDefect.cshtml | 53 -------- .../Views/Home/CreateDefect.cshtml | 31 ++++- .../Views/Home/ListDefects.cshtml | 2 - .../Views/Home/UpdateDefect.cshtml | 32 ++++- .../Controllers/MainController.cs | 1 + .../Controllers/ReportController.cs | 31 +---- 18 files changed, 144 insertions(+), 188 deletions(-) create mode 100644 ServiceStation/ServiceStationContracts/BindingModels/PdfReportBindingModel.cs delete mode 100644 ServiceStation/ServiceStationExecutorApp/Views/Home/AddCarToDefect.cshtml diff --git a/ServiceStation/ServiceStationBusinessLogic/BusinessLogics/DefectLogic.cs b/ServiceStation/ServiceStationBusinessLogic/BusinessLogics/DefectLogic.cs index 2413ece..9c97e18 100644 --- a/ServiceStation/ServiceStationBusinessLogic/BusinessLogics/DefectLogic.cs +++ b/ServiceStation/ServiceStationBusinessLogic/BusinessLogics/DefectLogic.cs @@ -100,12 +100,10 @@ namespace ServiceStationBusinessLogic.BusinessLogics _logger.LogInformation("AddCarToDefect find. Id:{Id}", element.Id); + element.DefectCars.Clear(); foreach(int car in cars) { - if (!element.DefectCars.Keys.Contains(car)) - { - element.DefectCars.Add(car, new CarViewModel() { Id = car }); - } + element.DefectCars.Add(car, new CarViewModel() { Id = car }); } _defectStorage.Update(new DefectBindingModel() diff --git a/ServiceStation/ServiceStationBusinessLogic/BusinessLogics/ExecutorReportLogic.cs b/ServiceStation/ServiceStationBusinessLogic/BusinessLogics/ExecutorReportLogic.cs index 6b33bc9..1f9248b 100644 --- a/ServiceStation/ServiceStationBusinessLogic/BusinessLogics/ExecutorReportLogic.cs +++ b/ServiceStation/ServiceStationBusinessLogic/BusinessLogics/ExecutorReportLogic.cs @@ -88,7 +88,7 @@ namespace ServiceStationBusinessLogic.BusinessLogics } return allList; } - public List GetCars(ReportExecutorBindingModel model) + public List GetCars(PdfReportBindingModel model) { List allList = new List(); @@ -122,7 +122,8 @@ namespace ServiceStationBusinessLogic.BusinessLogics int contains = 0; foreach (var defectt in defects) { - if (defectt.Item2 == car.Id && defect.DefectType == defectt.Item1.DefectType) + var carr = _carStorage.GetElement(new CarSearchModel { Id = defectt.Item2 }); + if (defectt.Item2 == car.Id && defectt.Item1.DefectType == defect.DefectType) { contains++; } @@ -161,13 +162,13 @@ namespace ServiceStationBusinessLogic.BusinessLogics { _saveToWord.CreateDoc(new WordInfoExecutor { - FileName = model.FileName, + FileStream = model.FileStream, Title = "Список работ", WorksByCar = GetWorks(model.Ids!) }); } - public void SaveTechWorkAndRepairsByCarsToPdfFile(ReportExecutorBindingModel model) + public void SaveTechWorkAndRepairsByCarsToPdfFile(PdfReportBindingModel model) { if(model.DateFrom == null) { @@ -192,7 +193,7 @@ namespace ServiceStationBusinessLogic.BusinessLogics { _saveToExcel.CreateReport(new ExcelInfoExecutor { - FileName = model.FileName, + FileStream = model.FileStream, Title = "Список работ", WorksByCar = GetWorks(model.Ids!) }); diff --git a/ServiceStation/ServiceStationBusinessLogic/OfficePackage/HelperModels/ExcelInfoExecutor.cs b/ServiceStation/ServiceStationBusinessLogic/OfficePackage/HelperModels/ExcelInfoExecutor.cs index dc3318c..d7bbe8a 100644 --- a/ServiceStation/ServiceStationBusinessLogic/OfficePackage/HelperModels/ExcelInfoExecutor.cs +++ b/ServiceStation/ServiceStationBusinessLogic/OfficePackage/HelperModels/ExcelInfoExecutor.cs @@ -10,6 +10,7 @@ namespace ServiceStationBusinessLogic.OfficePackage.HelperModels public class ExcelInfoExecutor { public string FileName { get; set; } = string.Empty; + public Stream FileStream { get; set; } = new MemoryStream(); public string Title { get; set; } = string.Empty; public List WorksByCar { get; set; } = new(); } diff --git a/ServiceStation/ServiceStationBusinessLogic/OfficePackage/HelperModels/WordInfoExecutor.cs b/ServiceStation/ServiceStationBusinessLogic/OfficePackage/HelperModels/WordInfoExecutor.cs index 1575bdb..e6b8164 100644 --- a/ServiceStation/ServiceStationBusinessLogic/OfficePackage/HelperModels/WordInfoExecutor.cs +++ b/ServiceStation/ServiceStationBusinessLogic/OfficePackage/HelperModels/WordInfoExecutor.cs @@ -10,6 +10,7 @@ namespace ServiceStationBusinessLogic.OfficePackage.HelperModels public class WordInfoExecutor { public string FileName { get; set; } = string.Empty; + public Stream FileStream { get; set; } = new MemoryStream(); public string Title { get; set; } = string.Empty; public List WorksByCar { get; set; } = new(); } diff --git a/ServiceStation/ServiceStationBusinessLogic/OfficePackage/Implements/SaveToExcelExecutor.cs b/ServiceStation/ServiceStationBusinessLogic/OfficePackage/Implements/SaveToExcelExecutor.cs index 00738ac..3821bd2 100644 --- a/ServiceStation/ServiceStationBusinessLogic/OfficePackage/Implements/SaveToExcelExecutor.cs +++ b/ServiceStation/ServiceStationBusinessLogic/OfficePackage/Implements/SaveToExcelExecutor.cs @@ -198,7 +198,7 @@ namespace ServiceStationBusinessLogic.OfficePackage.Implements protected override void CreateExcel(ExcelInfoExecutor info) { - _spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook); + _spreadsheetDocument = SpreadsheetDocument.Create(info.FileStream, SpreadsheetDocumentType.Workbook); var workbookpart = _spreadsheetDocument.AddWorkbookPart(); workbookpart.Workbook = new Workbook(); diff --git a/ServiceStation/ServiceStationBusinessLogic/OfficePackage/Implements/SaveToWordExecutor.cs b/ServiceStation/ServiceStationBusinessLogic/OfficePackage/Implements/SaveToWordExecutor.cs index 258a953..b98eea8 100644 --- a/ServiceStation/ServiceStationBusinessLogic/OfficePackage/Implements/SaveToWordExecutor.cs +++ b/ServiceStation/ServiceStationBusinessLogic/OfficePackage/Implements/SaveToWordExecutor.cs @@ -74,7 +74,7 @@ namespace ServiceStationBusinessLogic.OfficePackage.Implements protected override void CreateWord(WordInfoExecutor info) { - _wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document); + _wordDocument = WordprocessingDocument.Create(info.FileStream, WordprocessingDocumentType.Document); MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart(); mainPart.Document = new Document(); _docBody = mainPart.Document.AppendChild(new Body()); diff --git a/ServiceStation/ServiceStationContracts/BindingModels/PdfReportBindingModel.cs b/ServiceStation/ServiceStationContracts/BindingModels/PdfReportBindingModel.cs new file mode 100644 index 0000000..3f34429 --- /dev/null +++ b/ServiceStation/ServiceStationContracts/BindingModels/PdfReportBindingModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ServiceStationContracts.BindingModels +{ + public class PdfReportBindingModel + { + public string FileName { get; set; } = string.Empty; + + public int ExecutorId { get; set; } + + public DateTime? DateFrom { get; set; } + + public DateTime? DateTo { get; set; } + + public List? Ids { get; set; } + } +} diff --git a/ServiceStation/ServiceStationContracts/BindingModels/ReportExecutorBindingModel.cs b/ServiceStation/ServiceStationContracts/BindingModels/ReportExecutorBindingModel.cs index 4415d10..1e00154 100644 --- a/ServiceStation/ServiceStationContracts/BindingModels/ReportExecutorBindingModel.cs +++ b/ServiceStation/ServiceStationContracts/BindingModels/ReportExecutorBindingModel.cs @@ -2,13 +2,14 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json.Serialization; using System.Threading.Tasks; namespace ServiceStationContracts.BindingModels { public class ReportExecutorBindingModel { - public string FileName { get; set; } = string.Empty; + public Stream FileStream { get; set; } = new MemoryStream(); public int ExecutorId { get; set; } diff --git a/ServiceStation/ServiceStationContracts/BusinessLogicsContracts/IExecutorReportLogic.cs b/ServiceStation/ServiceStationContracts/BusinessLogicsContracts/IExecutorReportLogic.cs index d65c394..e508373 100644 --- a/ServiceStation/ServiceStationContracts/BusinessLogicsContracts/IExecutorReportLogic.cs +++ b/ServiceStation/ServiceStationContracts/BusinessLogicsContracts/IExecutorReportLogic.cs @@ -11,12 +11,12 @@ namespace ServiceStationContracts.BusinessLogicsContracts public interface IExecutorReportLogic { List GetWorks(List Ids); - List GetCars(ReportExecutorBindingModel model); + List GetCars(PdfReportBindingModel model); void SaveWorkByCarsWordFile(ReportExecutorBindingModel model); void SaveWorkByCarsToExcelFile(ReportExecutorBindingModel model); - void SaveTechWorkAndRepairsByCarsToPdfFile(ReportExecutorBindingModel model); + void SaveTechWorkAndRepairsByCarsToPdfFile(PdfReportBindingModel model); } } diff --git a/ServiceStation/ServiceStationDatabaseImplement/Implements/DefectStorage.cs b/ServiceStation/ServiceStationDatabaseImplement/Implements/DefectStorage.cs index 5e06dfa..fbcf969 100644 --- a/ServiceStation/ServiceStationDatabaseImplement/Implements/DefectStorage.cs +++ b/ServiceStation/ServiceStationDatabaseImplement/Implements/DefectStorage.cs @@ -18,15 +18,15 @@ namespace ServiceStationDatabaseImplement.Implements public List GetFullList() { using var context = new ServiceStationDatabase(); - return context.Defects + var defects = context.Defects .Include(x => x.Cars) .ThenInclude(x => x.Car) .ThenInclude(x => x.CarTechnicalWorks) .ThenInclude(x => x.TechnicalWork) - .Include(x => x.Repair) .Include(x => x.Executor) .Select(x => x.GetViewModel) .ToList(); + return defects; } public List GetFilteredList(DefectSearchModel model) diff --git a/ServiceStation/ServiceStationDatabaseImplement/Models/Defect.cs b/ServiceStation/ServiceStationDatabaseImplement/Models/Defect.cs index 05618c7..aad66db 100644 --- a/ServiceStation/ServiceStationDatabaseImplement/Models/Defect.cs +++ b/ServiceStation/ServiceStationDatabaseImplement/Models/Defect.cs @@ -81,7 +81,8 @@ namespace ServiceStationDatabaseImplement.Models DefectType = DefectType, DefectPrice = DefectPrice, ExecutorId = ExecutorId, - DefectCars = DefectCars + DefectCars = DefectCars, + RepairId = RepairId }; public void UpdateCars(ServiceStationDatabase context, DefectBindingModel model) diff --git a/ServiceStation/ServiceStationExecutorApp/Controllers/HomeController.cs b/ServiceStation/ServiceStationExecutorApp/Controllers/HomeController.cs index ad3960d..a5661e0 100644 --- a/ServiceStation/ServiceStationExecutorApp/Controllers/HomeController.cs +++ b/ServiceStation/ServiceStationExecutorApp/Controllers/HomeController.cs @@ -1,8 +1,10 @@ -using Microsoft.AspNetCore.Mvc; +using DocumentFormat.OpenXml.Wordprocessing; +using Microsoft.AspNetCore.Mvc; using ServiceStationContracts.BindingModels; using ServiceStationContracts.BusinessLogicsContracts; using ServiceStationContracts.SearchModels; using ServiceStationContracts.ViewModels; +using ServiceStationDatabaseImplement.Models; using ServiceStationExecutorApp.Models; using System.Collections.Generic; using System.Diagnostics; @@ -128,7 +130,7 @@ namespace ServiceStationExecutorApp.Controllers var result = APIExecutor.GetRequest>>>($"api/main/getdefect?defectId={defectId}"); if (result == null) return default; string table = ""; - for(int i = 0; i < result.Item2.Count; i++) + for (int i = 0; i < result.Item2.Count; i++) { var carNumber = result.Item2[i].Item1; var carBrand = result.Item2[i].Item2; @@ -137,6 +139,7 @@ namespace ServiceStationExecutorApp.Controllers table += $"{carBrand}"; table += ""; } + return Tuple.Create(result.Item1, table); } [HttpGet] @@ -260,10 +263,10 @@ namespace ServiceStationExecutorApp.Controllers return RedirectToAction("Enter"); } ViewBag.Defects = APIExecutor.GetRequest>($"api/main/getdefectlist?executorId={APIExecutor.Executor.Id}"); - return View(); + return View(APIExecutor.GetRequest>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}")); } [HttpPost] - public void UpdateDefect(int defect, string DefectType, double DefectPrice) + public void UpdateDefect(int defect, string DefectType, double DefectPrice, int[] car) { if (APIExecutor.Executor == null) { @@ -284,6 +287,10 @@ namespace ServiceStationExecutorApp.Controllers DefectType = DefectType, DefectPrice = DefectPrice }); + APIExecutor.PostRequest("api/main/addcartodefect", Tuple.Create( + new DefectSearchModel() { Id = defect }, + car + )); Response.Redirect("ListDefects"); } public IActionResult UpdateTechnicalWork() @@ -348,10 +355,10 @@ namespace ServiceStationExecutorApp.Controllers { return RedirectToAction("Enter"); } - return View(); + return View(APIExecutor.GetRequest>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}")); } [HttpPost] - public void CreateDefect(string defectType, double defectPrice) + public void CreateDefect(string defectType, double defectPrice, int[] car) { if (APIExecutor.Executor == null) { @@ -363,6 +370,10 @@ namespace ServiceStationExecutorApp.Controllers DefectType = defectType, DefectPrice = defectPrice }); + APIExecutor.PostRequest("api/main/addcartodefect", Tuple.Create( + new DefectSearchModel() { DefectType = defectType }, + car + )); Response.Redirect("ListDefects"); } public IActionResult CreateTechnicalWork() @@ -389,50 +400,6 @@ namespace ServiceStationExecutorApp.Controllers }); Response.Redirect("ListTechnicalWorks"); } - public IActionResult AddCarToDefect() - { - if (APIExecutor.Executor == null) - { - return RedirectToAction("Enter"); - } - return View(Tuple.Create(APIExecutor.GetRequest>($"api/main/getdefectlist?executorId={APIExecutor.Executor.Id}"), - APIExecutor.GetRequest>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}"))); - } - [HttpPost] - public void AddCarToDefect(int defect, int[] car) - { - if(APIExecutor.Executor == null) - { - throw new Exception("Авторизироваться не забыли?"); - } - APIExecutor.PostRequest("api/main/addcartodefect", Tuple.Create( - new DefectSearchModel() { Id = defect }, - car - )); - Response.Redirect("ListDefects"); - } - public IActionResult AddCarToTechnicalWork() - { - if (APIExecutor.Executor == null) - { - return RedirectToAction("Enter"); - } - return View(Tuple.Create(APIExecutor.GetRequest>($"api/main/gettechnicalworklist?executorId={APIExecutor.Executor.Id}"), - APIExecutor.GetRequest>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}"))); - } - [HttpPost] - public void AddCarToTechnicalWork(int technicalWork, int[] car) - { - if (APIExecutor.Executor == null) - { - throw new Exception("Авторизироваться не забыли?"); - } - APIExecutor.PostRequest("api/main/addcartotechnicalwork", Tuple.Create( - new TechnicalWorkSearchModel() { Id = technicalWork }, - car - )); - Response.Redirect("ListTechnicalWorks"); - } public IActionResult BindingTechnicalWorkToWork() { if (APIExecutor.Executor == null) @@ -464,60 +431,57 @@ namespace ServiceStationExecutorApp.Controllers } return View(APIExecutor.GetRequest>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}")); } + [HttpPost] - public void ListWorkToFile(int[] Ids, string type) + public IActionResult ListWorkToFile(int[] Ids, string type) { if (APIExecutor.Executor == null) { throw new Exception("Авторизироваться не забыли?"); } - if(Ids.Length <= 0) + if (Ids.Length <= 0) { throw new Exception("Кол-во меньше нуля"); } - if(string.IsNullOrEmpty(type)) + if (string.IsNullOrEmpty(type)) { throw new Exception("Неопознанный тип"); } List res = new List(); - foreach(var id in Ids) + foreach (var id in Ids) { res.Add(id); } - if(type == "docx") + if (type == "docx") { - APIExecutor.PostRequest("api/report/createexecutorreporttoword", new ReportExecutorBindingModel + using (var stream = new MemoryStream()) { - Ids = res, - FileName = Directory.GetCurrentDirectory() + "\\Reports\\wordfile.docx" - }); - Response.Redirect("GetWordFile"); + _report.SaveWorkByCarsWordFile(new ReportExecutorBindingModel + { + FileStream = stream, + Ids = res + }); + stream.Seek(0, SeekOrigin.Begin); + return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "wordfile.docx"); + } } else { - APIExecutor.PostRequest("api/report/createexecutorreporttoexcel", new ReportExecutorBindingModel + using (var stream = new MemoryStream()) { - Ids = res, - FileName = Directory.GetCurrentDirectory() + "\\Reports\\excelfile.xlsx" - }); - Response.Redirect("GetExcelFile"); + _report.SaveWorkByCarsToExcelFile(new ReportExecutorBindingModel + { + FileStream = stream, + Ids = res + }); + stream.Seek(0, SeekOrigin.Begin); + return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "excelfile.xlsx"); + } } } - public IActionResult GetWordFile() - { - return new PhysicalFileResult(Directory.GetCurrentDirectory() + "\\Reports\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); - } - public IActionResult GetExcelFile() - { - return new PhysicalFileResult(Directory.GetCurrentDirectory() + "\\Reports\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - } - //public IActionResult GetPdfFile() - //{ - // return new PhysicalFileResult(Directory.GetCurrentDirectory() + "\\Reports\\pdffile.pdf", "application/pdf"); - //} public IActionResult ListCarsToPdf() { if (APIExecutor.Executor == null) @@ -537,13 +501,13 @@ namespace ServiceStationExecutorApp.Controllers { throw new Exception("Email пуст"); } - APIExecutor.PostRequest("api/report/createexecutorreporttopdf", new ReportExecutorBindingModel + APIExecutor.PostRequest("api/report/createexecutorreporttopdf", new PdfReportBindingModel { FileName = Directory.GetCurrentDirectory() + "\\Reports\\pdffile.pdf", DateFrom = dateFrom, DateTo = dateTo, ExecutorId = APIExecutor.Executor.Id, - }); + }) ; APIExecutor.PostRequest("api/report/sendpdftomail", new MailSendInfoBindingModel { MailAddress = executorEmail, @@ -563,7 +527,7 @@ namespace ServiceStationExecutorApp.Controllers List cars; try { - cars = _report.GetCars(new ReportExecutorBindingModel + cars = _report.GetCars(new PdfReportBindingModel { ExecutorId = APIExecutor.Executor.Id, DateFrom = dateFrom, diff --git a/ServiceStation/ServiceStationExecutorApp/Views/Home/AddCarToDefect.cshtml b/ServiceStation/ServiceStationExecutorApp/Views/Home/AddCarToDefect.cshtml deleted file mode 100644 index 8b358bf..0000000 --- a/ServiceStation/ServiceStationExecutorApp/Views/Home/AddCarToDefect.cshtml +++ /dev/null @@ -1,53 +0,0 @@ -@using ServiceStationContracts.ViewModels; -@using ServiceStationDataModels.Models; - -@{ - ViewData["Title"] = "AddCarToDefect"; -} - -@model Tuple, List> - -
-

Добавление машин к неисправностям:

-
-
- - -
-
- - - - - - - - - - - @foreach (var car in Model.Item2) - { - - - - - - } - -
НомерМарка
-
- -
-
@Html.DisplayFor(modelItem => car.CarNumber)@Html.DisplayFor(modelItem => car.CarBrand)
-
-
-
- -
-
-
diff --git a/ServiceStation/ServiceStationExecutorApp/Views/Home/CreateDefect.cshtml b/ServiceStation/ServiceStationExecutorApp/Views/Home/CreateDefect.cshtml index 600a614..c66b4f8 100644 --- a/ServiceStation/ServiceStationExecutorApp/Views/Home/CreateDefect.cshtml +++ b/ServiceStation/ServiceStationExecutorApp/Views/Home/CreateDefect.cshtml @@ -1,9 +1,11 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ +@using ServiceStationContracts.ViewModels + @{ ViewData["Title"] = "CreateDefect"; } + +@model List +
@@ -14,6 +16,29 @@
+ + + + + + + + + + @foreach (var car in Model) + { + + + + + + } + +
Номер машиныМарка машины
+
+ +
+
@Html.DisplayFor(modelItem => car.CarNumber)@Html.DisplayFor(modelItem => car.CarBrand)

diff --git a/ServiceStation/ServiceStationExecutorApp/Views/Home/ListDefects.cshtml b/ServiceStation/ServiceStationExecutorApp/Views/Home/ListDefects.cshtml index 723536f..d56876b 100644 --- a/ServiceStation/ServiceStationExecutorApp/Views/Home/ListDefects.cshtml +++ b/ServiceStation/ServiceStationExecutorApp/Views/Home/ListDefects.cshtml @@ -42,8 +42,6 @@   Изменить   - Добавить машину -   Удалить
\ No newline at end of file diff --git a/ServiceStation/ServiceStationExecutorApp/Views/Home/UpdateDefect.cshtml b/ServiceStation/ServiceStationExecutorApp/Views/Home/UpdateDefect.cshtml index 7e17002..11cb5ba 100644 --- a/ServiceStation/ServiceStationExecutorApp/Views/Home/UpdateDefect.cshtml +++ b/ServiceStation/ServiceStationExecutorApp/Views/Home/UpdateDefect.cshtml @@ -1,6 +1,6 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ +@using ServiceStationContracts.ViewModels + +@model List @{ ViewData["Title"] = "UpdateDefect"; } @@ -19,6 +19,7 @@
+
Уже привязанные машины
@@ -30,6 +31,30 @@ @* полученные машины *@
+
Изменить машины
+ + + + + + + + + + @foreach (var car in Model) + { + + + + + + } + +
Номер машиныМарка машины
+
+ +
+
@Html.DisplayFor(modelItem => car.CarNumber)@Html.DisplayFor(modelItem => car.CarBrand)

@@ -49,7 +74,6 @@ url: "/Home/GetDefect", data: { defectId: defect }, success: function (result) { - $('#defectType').val(result.item1.defectType); $('#table-elements').html(result.item2); } }); diff --git a/ServiceStation/ServiceStationRestApi/Controllers/MainController.cs b/ServiceStation/ServiceStationRestApi/Controllers/MainController.cs index e82a25f..91b20b4 100644 --- a/ServiceStation/ServiceStationRestApi/Controllers/MainController.cs +++ b/ServiceStation/ServiceStationRestApi/Controllers/MainController.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using ServiceStationContracts.BindingModels; using ServiceStationContracts.BusinessLogicsContracts; using ServiceStationContracts.SearchModels; diff --git a/ServiceStation/ServiceStationRestApi/Controllers/ReportController.cs b/ServiceStation/ServiceStationRestApi/Controllers/ReportController.cs index f8d40cb..d91d120 100644 --- a/ServiceStation/ServiceStationRestApi/Controllers/ReportController.cs +++ b/ServiceStation/ServiceStationRestApi/Controllers/ReportController.cs @@ -21,39 +21,12 @@ namespace ServiceStationRestApi.Controllers _mailWorker = abstractMailWorker; _guarantorReportLogic = guarantorReportLogic; } - [HttpPost] - public void CreateExecutorReportToWord(ReportExecutorBindingModel model) + public void CreateExecutorReportToPdf(PdfReportBindingModel model) { try { - _executorReportLogic.SaveWorkByCarsWordFile(model); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка создания отчета"); - throw; - } - } - [HttpPost] - public void CreateExecutorReportToExcel(ReportExecutorBindingModel model) - { - try - { - _executorReportLogic.SaveWorkByCarsToExcelFile(model); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка создания отчета"); - throw; - } - } - [HttpPost] - public void CreateExecutorReportToPdf(ReportExecutorBindingModel model) - { - try - { - _executorReportLogic.SaveTechWorkAndRepairsByCarsToPdfFile(new ReportExecutorBindingModel + _executorReportLogic.SaveTechWorkAndRepairsByCarsToPdfFile(new PdfReportBindingModel { FileName = model.FileName, DateFrom = model.DateFrom,