Compare commits
2 Commits
ffe926af5d
...
45fd65dbd2
Author | SHA1 | Date | |
---|---|---|---|
45fd65dbd2 | |||
b59f5ac4a8 |
@ -1,5 +1,6 @@
|
||||
using LawFirmBusinessLogic.OfficePackages.HelperEnums;
|
||||
using LawFirmBusinessLogic.OfficePackages.HelperModels;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LawFirmBusinessLogic.OfficePackages
|
||||
{
|
||||
@ -19,44 +20,66 @@ namespace LawFirmBusinessLogic.OfficePackages
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 2,
|
||||
Text = "Клиент",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = 2,
|
||||
Text = "Дата консультации",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = 2,
|
||||
Text = "Цена консультации",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
uint rowIndex = 2;
|
||||
foreach (var ch in info.ClientsConsultation)
|
||||
uint rowIndex = 4;
|
||||
|
||||
foreach (var vl in info.ClientsConsultation)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = ch.ClientFIO,
|
||||
Text = vl.ClientFIO,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var consultation in ch.Consultations)
|
||||
foreach (var cons in vl.Consultations)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = consultation.Cost.ToString(),
|
||||
Text = cons.ConsultationDate.ToShortDateString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
ExcelStyleInfoType.Text
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = consultation.ConsultationDate.ToString(),
|
||||
Text = cons.Cost.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
SaveExcel(info);
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -89,8 +89,7 @@ namespace LawFirmBusinessLogic.OfficePackages.Implements
|
||||
var cellFormatStyle = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId
|
||||
= 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U
|
||||
};
|
||||
@ -99,8 +98,7 @@ namespace LawFirmBusinessLogic.OfficePackages.Implements
|
||||
var cellFormatFont = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId =
|
||||
0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U,
|
||||
FormatId = 0U,
|
||||
@ -119,8 +117,7 @@ namespace LawFirmBusinessLogic.OfficePackages.Implements
|
||||
var cellFormatTitle = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId
|
||||
= 1U,
|
||||
FontId = 1U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U,
|
||||
FormatId = 0U,
|
||||
@ -298,7 +295,7 @@ namespace LawFirmBusinessLogic.OfficePackages.Implements
|
||||
}
|
||||
// вставляем новый текст
|
||||
_shareStringPart.SharedStringTable.AppendChild(new
|
||||
SharedStringItem(new DocumentFormat.OpenXml.Drawing.Text(excelParams.Text)));
|
||||
SharedStringItem(new Text(excelParams.Text)));
|
||||
_shareStringPart.SharedStringTable.Save();
|
||||
cell.CellValue = new
|
||||
CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count(
|
||||
|
@ -11,9 +11,9 @@ namespace LawFirmDatabaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
//optionsBuilder.UseSqlServer(@"Data Source=ZIRAEL\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=ZIRAEL\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
|
||||
optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
//optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace LawFirmExecutorApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult UpdateClient()
|
||||
{
|
||||
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?guarantorid={APIClient.Executor.Id}");
|
||||
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?executorid={APIClient.Executor.Id}");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
@ -73,5 +73,64 @@ namespace LawFirmExecutorApp.Controllers
|
||||
});
|
||||
Response.Redirect("/Home/Clients");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetFile()
|
||||
{
|
||||
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?executorid={APIClient.Executor.Id}");
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void GetFile(int clientId, string type)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
if (clientId == 0)
|
||||
{
|
||||
throw new Exception("Выберите клиента");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(type))
|
||||
{
|
||||
throw new Exception("Неверный тип отчета");
|
||||
}
|
||||
|
||||
if (type == "docx")
|
||||
{
|
||||
APIClient.PostRequest("api/ReportExecutor/SaveClientsWordFile", new ReportBindingModel
|
||||
{
|
||||
ClientId = clientId,
|
||||
ExecutorId = APIClient.Executor.Id,
|
||||
FileName = "E:\\reports\\wordfileTest.docx"
|
||||
});
|
||||
Response.Redirect("GetWordFile");
|
||||
}
|
||||
else
|
||||
{
|
||||
APIClient.PostRequest("api/ReportExecutor/SaveClientsExcelFile", new ReportBindingModel
|
||||
{
|
||||
ClientId = clientId,
|
||||
ExecutorId = APIClient.Executor.Id,
|
||||
FileName = "E:\\reports\\excelfileTest.xlsx"
|
||||
});
|
||||
Response.Redirect("GetExcelFile");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetWordFile()
|
||||
{
|
||||
return new PhysicalFileResult("E:\\reports\\wordclientsreport.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
}
|
||||
|
||||
public IActionResult GetExcelFile()
|
||||
{
|
||||
return new PhysicalFileResult("E:\\reports\\excelclientsreport.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
31
LawFim/LawFirmExecutorApp/Views/Client/GetFile.cshtml
Normal file
31
LawFim/LawFirmExecutorApp/Views/Client/GetFile.cshtml
Normal file
@ -0,0 +1,31 @@
|
||||
@using LawFirmContracts.ViewModels;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Слушания по клиентам";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создать списки слушаний по клиентам</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Клиент:</div>
|
||||
<div class="col-8">
|
||||
<select id="clientId" name="clientId" class="form-control" asp-items="@(new SelectList(@ViewBag.Clients,"Id", "FIO"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="file-format">
|
||||
<label class="form-label">Выберите формат файла:</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="type" value="docx" id="docx">
|
||||
<label class="form-check-label" for="docx">Word-файл</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="type" value="xlsx" id="xlsx" checked>
|
||||
<label class="form-check-label" for="xlsx">Excel-файл</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button type="submit" class="btn btn-block btn-outline-dark w-100">Создать</button>
|
||||
</div>
|
||||
</form>
|
@ -69,5 +69,12 @@
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<tr>
|
||||
<td>
|
||||
<form action="/Client/GetFile">
|
||||
<button type="submit" class="btn btn-danger">Получить docx/xlsx файл</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</div>
|
@ -34,6 +34,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Report">Отчеты</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user