Compare commits

..

No commits in common. "45fd65dbd26bc47a1c41a2a99e95bd8da7aaffd3" and "ffe926af5d6cce22da9b872a275ee455988fa1af" have entirely different histories.

7 changed files with 406 additions and 526 deletions

View File

@ -1,6 +1,5 @@
using LawFirmBusinessLogic.OfficePackages.HelperEnums; using LawFirmBusinessLogic.OfficePackages.HelperEnums;
using LawFirmBusinessLogic.OfficePackages.HelperModels; using LawFirmBusinessLogic.OfficePackages.HelperModels;
using System.Runtime.CompilerServices;
namespace LawFirmBusinessLogic.OfficePackages namespace LawFirmBusinessLogic.OfficePackages
{ {
@ -20,65 +19,43 @@ namespace LawFirmBusinessLogic.OfficePackages
Text = info.Title, Text = info.Title,
StyleInfo = ExcelStyleInfoType.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 MergeCells(new ExcelMergeParameters
{ {
CellFromName = "A1", CellFromName = "A1",
CellToName = "C1" CellToName = "C1"
}); });
uint rowIndex = 4; uint rowIndex = 2;
foreach (var ch in info.ClientsConsultation)
foreach (var vl in info.ClientsConsultation)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = vl.ClientFIO, Text = ch.ClientFIO,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
foreach (var cons in vl.Consultations) foreach (var consultation in ch.Consultations)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "B", ColumnName = "B",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = cons.ConsultationDate.ToShortDateString(), Text = consultation.Cost.ToString(),
StyleInfo = StyleInfo =
ExcelStyleInfoType.Text ExcelStyleInfoType.TextWithBroder
}); });
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "C", ColumnName = "C",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = cons.Cost.ToString(), Text = consultation.ConsultationDate.ToString(),
StyleInfo = StyleInfo =
ExcelStyleInfoType.Text ExcelStyleInfoType.TextWithBroder
}); });
rowIndex++; rowIndex++;
} }
} }
SaveExcel(info); SaveExcel(info);
} }

View File

@ -89,7 +89,8 @@ namespace LawFirmBusinessLogic.OfficePackages.Implements
var cellFormatStyle = new CellFormat() var cellFormatStyle = new CellFormat()
{ {
NumberFormatId = 0U, NumberFormatId = 0U,
FontId = 0U, FontId
= 0U,
FillId = 0U, FillId = 0U,
BorderId = 0U BorderId = 0U
}; };
@ -98,7 +99,8 @@ namespace LawFirmBusinessLogic.OfficePackages.Implements
var cellFormatFont = new CellFormat() var cellFormatFont = new CellFormat()
{ {
NumberFormatId = 0U, NumberFormatId = 0U,
FontId = 0U, FontId =
0U,
FillId = 0U, FillId = 0U,
BorderId = 0U, BorderId = 0U,
FormatId = 0U, FormatId = 0U,
@ -117,7 +119,8 @@ namespace LawFirmBusinessLogic.OfficePackages.Implements
var cellFormatTitle = new CellFormat() var cellFormatTitle = new CellFormat()
{ {
NumberFormatId = 0U, NumberFormatId = 0U,
FontId = 1U, FontId
= 1U,
FillId = 0U, FillId = 0U,
BorderId = 0U, BorderId = 0U,
FormatId = 0U, FormatId = 0U,
@ -295,7 +298,7 @@ namespace LawFirmBusinessLogic.OfficePackages.Implements
} }
// вставляем новый текст // вставляем новый текст
_shareStringPart.SharedStringTable.AppendChild(new _shareStringPart.SharedStringTable.AppendChild(new
SharedStringItem(new Text(excelParams.Text))); SharedStringItem(new DocumentFormat.OpenXml.Drawing.Text(excelParams.Text)));
_shareStringPart.SharedStringTable.Save(); _shareStringPart.SharedStringTable.Save();
cell.CellValue = new cell.CellValue = new
CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count( CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count(

View File

@ -11,9 +11,9 @@ namespace LawFirmDatabaseImplement
{ {
if (optionsBuilder.IsConfigured == false) 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); base.OnConfiguring(optionsBuilder);
} }

View File

@ -52,7 +52,7 @@ namespace LawFirmExecutorApp.Controllers
[HttpGet] [HttpGet]
public IActionResult UpdateClient() public IActionResult UpdateClient()
{ {
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?executorid={APIClient.Executor.Id}"); ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?guarantorid={APIClient.Executor.Id}");
return View(); return View();
} }
[HttpPost] [HttpPost]
@ -73,64 +73,5 @@ namespace LawFirmExecutorApp.Controllers
}); });
Response.Redirect("/Home/Clients"); 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");
}
} }
} }

View File

@ -1,31 +0,0 @@
@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>

View File

@ -69,12 +69,5 @@
} }
</tbody> </tbody>
</table> </table>
<tr>
<td>
<form action="/Client/GetFile">
<button type="submit" class="btn btn-danger">Получить docx/xlsx файл</button>
</form>
</td>
</tr>
} }
</div> </div>

View File

@ -34,9 +34,6 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li> </li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Report">Отчеты</a>
</li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li> </li>