diff --git a/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/CaseLogic.cs b/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/CaseLogic.cs index d4f6ae9..f18fee6 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/CaseLogic.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/CaseLogic.cs @@ -76,6 +76,11 @@ namespace CaseAccountingBusinessLogic.BusinessLogics return list; } + public List GetSpecializationCases() + { + return _caseStorage.GetSpecializationCases() ?? new List(); + } + public bool Update(CaseBindingModel model) { CheckModel(model); diff --git a/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/MailSender.cs b/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/MailSender.cs new file mode 100644 index 0000000..04aba61 --- /dev/null +++ b/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/MailSender.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Mail; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using CaseAccountingContracts.BindingModels; + +namespace CaseAccountingBusinessLogic.BusinessLogics +{ + public class MailSender + { + private string mailLogin = string.Empty; + private string mailPassword = string.Empty; + private string smtpClientHost = string.Empty; + private int smtpClientPort; + + public MailSender(){} + + public void MailConfig(MailConfigBindingModel config) + { + mailLogin = config.MailLogin; + mailPassword = config.MailPassword; + smtpClientHost = config.SmtpClientHost; + smtpClientPort = config.SmtpClientPort; + } + + public async void SendMailAsync(MailSendInfoBindingModel info) + { + using var objMailMessage = new MailMessage(); + using var objSmtpClient = new SmtpClient(smtpClientHost, smtpClientPort); + try + { + objMailMessage.From = new MailAddress(mailLogin); + objMailMessage.To.Add(new MailAddress(info.MailAddress)); + objMailMessage.Subject = info.Subject; + objMailMessage.Body = info.Text; + objMailMessage.SubjectEncoding = Encoding.UTF8; + objMailMessage.BodyEncoding = Encoding.UTF8; + + MemoryStream ms = new(info.File); + objMailMessage.Attachments.Add(new Attachment(ms, "report.pdf", "application/pdf")); + + objSmtpClient.UseDefaultCredentials = false; + objSmtpClient.EnableSsl = true; + objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; + objSmtpClient.Credentials = new NetworkCredential(mailLogin, mailPassword); + + await Task.Run(() => objSmtpClient.Send(objMailMessage)); + } + catch (Exception) + { + throw; + } + } + } +} diff --git a/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/ReportCustomerLogic.cs b/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/ReportCustomerLogic.cs index f5e211f..12003e2 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/ReportCustomerLogic.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/ReportCustomerLogic.cs @@ -5,6 +5,7 @@ using CaseAccountingContracts.BusinessLogicContracts; using CaseAccountingContracts.SearchModels; using CaseAccountingContracts.StoragesContracts; using CaseAccountingContracts.ViewModels; +using CaseAccountingDataBaseImplement.Models; using System; using System.Collections.Generic; using System.Linq; @@ -54,36 +55,25 @@ namespace CaseAccountingBusinessLogic.BusinessLogics public List GetLawyersHearing(List lawyers) { - var reportRecords = new List(); + List list = new(); foreach (var lawyer in lawyers) { - var hearings = _lawyerStorage.GetLawyerCases(new() { Id = lawyer.Id }) - .SelectMany(_case => _caseStorage.GetCaseHearings(new() { Id = _case.Id })) - .Select(hearing => hearing.Information) - .ToList(); - ReportLawyerHearingViewModel reportRecord = new() + ReportLawyerHearingViewModel report = new ReportLawyerHearingViewModel { - Lawyer = lawyer.Name + " " + lawyer.Surname + ", " + lawyer.Patronymic, - Hearings = hearings + Lawyer = lawyer.Surname + " " + lawyer.Name + " " + lawyer.Patronymic, + Hearings = new() }; - reportRecords.Add(reportRecord); + var cases = _caseStorage.GetCaseMTM(lawyer.Id); + foreach (var caseModel in cases) + { + foreach (var hearing in _hearingStorage.GetFilteredList(new HearingSearchModel { CaseId = caseModel.Id })) + { + report.Hearings.Add("Номер слушания: " + hearing.Id.ToString()); + } + } + list.Add(report); } - return reportRecords; - } - - public void SaveHearingSpecializationToPdfFile(ReportBindingModel model) - { - throw new NotImplementedException(); - } - - public void SaveLawyerHearingToExcelFile(ReportBindingModel model) - { - throw new NotImplementedException(); - } - - public void SaveLawyerHearingToWordFile(ReportBindingModel model) - { - throw new NotImplementedException(); + return list; } public byte[] SaveListFile(LawyerHearingListBindingModel model) diff --git a/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/ReportProviderLogic.cs b/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/ReportProviderLogic.cs index 74cdacf..f89dcba 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/ReportProviderLogic.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/BusinessLogics/ReportProviderLogic.cs @@ -1,4 +1,6 @@ -using CaseAccountingContracts.BindingModels; +using CaseAccountingBusinessLogic.BusinessLogic.OfficePackage; +using CaseAccountingBusinessLogic.OfficePackage; +using CaseAccountingContracts.BindingModels; using CaseAccountingContracts.BusinessLogicContracts; using CaseAccountingContracts.SearchModels; using CaseAccountingContracts.StoragesContracts; @@ -17,68 +19,135 @@ namespace CaseAccountingBusinessLogic.BusinessLogics private readonly ISpecializationStorage _specializationStorage; private readonly IHearingStorage _hearingStorage; private readonly ILawyerStorage _lawyerStorage; + private readonly WordBuilderProvider _wordBuilder; + private readonly ExcelBuilderProvider _excelBuilder; + private readonly PdfBuilderProvider _pdfBuilder; + private readonly MailSender _mailSender; - public ReportProviderLogic(ICaseStorage caseStorage, ISpecializationStorage specializationStorage, IHearingStorage hearingStorage, ILawyerStorage lawyerStorage) + public ReportProviderLogic(ICaseStorage caseStorage, ISpecializationStorage specializationStorage, IHearingStorage hearingStorage, + ILawyerStorage lawyerStorage, WordBuilderProvider wordBuilder, ExcelBuilderProvider excelBuilder, + PdfBuilderProvider pdfBuilder, MailSender mailSender) { _caseStorage = caseStorage ?? throw new ArgumentNullException(nameof(caseStorage)); _specializationStorage = specializationStorage ?? throw new ArgumentNullException(nameof(specializationStorage)); _hearingStorage = hearingStorage ?? throw new ArgumentNullException(nameof(hearingStorage)); _lawyerStorage = lawyerStorage ?? throw new ArgumentNullException(nameof(lawyerStorage)); + _wordBuilder = wordBuilder ?? throw new ArgumentNullException(nameof(wordBuilder)); + _excelBuilder = excelBuilder ?? throw new ArgumentNullException(nameof(excelBuilder)); + _pdfBuilder = pdfBuilder ?? throw new ArgumentNullException(nameof(pdfBuilder)); + _mailSender = mailSender ?? throw new ArgumentNullException(nameof(mailSender)); } public List GetCaseSpecialization(List models) { - var сases = new List(); + List list = new(); foreach (var model in models) - сases.Add(_caseStorage.GetElement(new CaseSearchModel { Id = model.Id })); - return сases.Select(x => new ReportCaseSpecializationViewModel { - CaseName = x.Name, - Applicant = x.Applicant, - Defendant = x.Defendant, - Date = x.Date, - Specialization = x.Specialization, - }).ToList(); + { + var specialization = _specializationStorage.GetElement(new SpecializationSearchModel { Id = model.SpecializationId }); + var caseModel = _caseStorage.GetElement(new CaseSearchModel { Id = model.Id }); + if (specialization == null) + { + throw new Exception("Некоректные данные по специализации"); + } + if (caseModel == null) + { + throw new Exception("Некоректные данные по делу"); + } + + bool hasSpec = false; + if (list.Count > 0) + { + foreach (var report in list) + { + if (hasSpec = report.Specialization.Equals(specialization.Name)) + { + report.Cases.Add("Дело #" + caseModel.Id.ToString()); + break; + } + } + } + if (!hasSpec) + { + var newElement = new ReportCaseSpecializationViewModel + { + Specialization = specialization.Name, + Cases = new() + }; + newElement.Cases.Add("Дело #" + caseModel.Id.ToString()); + list.Add(newElement); + } + } + return list; } public List GetHearingLawyer(ReportBindingModel model) { var hearings = _hearingStorage - .GetFilteredList(new HearingSearchModel { UserId = model.UserId}) + .GetFilteredList(new HearingSearchModel { UserId = model.UserId }) .Where(x => model.DateFrom <= x.Date && model.DateTo >= x.Date); var list = new List(); foreach (var hearing in hearings) { var record = new ReportHearingLawyerViewModel { - Information = hearing.Information, - Date = hearing.Date, - Lawyers = new List<(string Surname, string Name, string Patronymic)>() + Hearing = "Номер слушания #" + hearing.Id.ToString(), + CaseLawyers = new() }; - foreach (var lawyer in _caseStorage.GetElement(new CaseSearchModel { Id = hearing.CaseId }).Lawyers.Values) + var caseId = _caseStorage.GetElement(new CaseSearchModel { Id = hearing.CaseId }).Id; + foreach (var lawyer in _lawyerStorage.GetLawyerMTM(caseId)) { - record.Lawyers.Add((lawyer.Surname, lawyer.Name, lawyer.Patronymic)); + record.CaseLawyers.Add(new CaseLawyerViewModel + { + Case = "Дело #" + caseId.ToString(), + Date = hearing.Date, + Lawyer = lawyer.Surname + " " + lawyer.Name + " " + lawyer.Patronymic + }); } list.Add(record); } return list; } - public void SaveCaseSpecializationToExcelFile(ReportBindingModel model) + public byte[] SaveListFile(CaseSpecializationListBindingModel model) { - throw new NotImplementedException(); - //TODO + byte[] file = Array.Empty(); + + string title = "Список специализаций по выбраным делам"; + + if (model.FileType == "docx") + { + _wordBuilder.CreateDocument(); + _wordBuilder.CreateTitle(title); + _wordBuilder.CreateCaseSpecializationTable(GetCaseSpecialization(model.Cases)); + file = _wordBuilder.GetFile(); + } + else if (model.FileType == "xlsx") + { + _excelBuilder.CreateDocument(); + _excelBuilder.CreateTitle(title); + _excelBuilder.CreateCaseSpecializationTable(GetCaseSpecialization(model.Cases)); + file = _excelBuilder.GetFile(); + } + return file; } - public void SaveCaseSpecializationToWordFile(ReportBindingModel model) + public void SendByMailStatusReport(ReportBindingModel reportModel) { - throw new NotImplementedException(); - //TODO - } - - public void SaveHearingLawyerToPdfFile(ReportBindingModel model) - { - throw new NotImplementedException(); - //TODO + byte[] file = _pdfBuilder.GetHearingLawyerReportFile(new() + { + Title = "Отчет по слушаниям", + DateFrom = reportModel.DateFrom, + DateTo = reportModel.DateTo, + Records = GetHearingLawyer(reportModel) + }); + _mailSender.SendMailAsync(new() + { + MailAddress = reportModel.UserEmail, + Subject = "Отчет по слушаниям", + Text = $"За период с {reportModel.DateFrom.ToShortDateString()} " + + $"по {reportModel.DateTo.ToShortDateString()}.", + File = file + }); } } } diff --git a/CaseAccounting/CaseAccountingBusinessLogics/CaseAccountingBusinessLogic.csproj b/CaseAccounting/CaseAccountingBusinessLogics/CaseAccountingBusinessLogic.csproj index d3fd3a1..3bb4601 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/CaseAccountingBusinessLogic.csproj +++ b/CaseAccounting/CaseAccountingBusinessLogics/CaseAccountingBusinessLogic.csproj @@ -9,6 +9,7 @@ + @@ -19,7 +20,9 @@ - + + + diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/ExcelBuilderProvider.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/ExcelBuilderProvider.cs new file mode 100644 index 0000000..907d785 --- /dev/null +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/ExcelBuilderProvider.cs @@ -0,0 +1,357 @@ +using CaseAccountingBusinessLogic.OfficePackage; +using CaseAccountingBusinessLogic.OfficePackage.HelperModels; +using CaseAccountingContracts.ViewModels; +using DocumentFormat.OpenXml; +using DocumentFormat.OpenXml.Packaging; +using DocumentFormat.OpenXml.Spreadsheet; + +namespace CaseAccountingBusinessLogic.OfficePackage +{ + public class ExcelBuilderProvider + { + private readonly string tempFileName = "temp.xlsx"; + private SpreadsheetDocument? spreadsheetDocument; + private SharedStringTablePart? shareStringPart; + private Worksheet? worksheet; + + private 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 }); + fonts.Append(fontUsual); + + var fontTitle = new Font(); + fontTitle.Append(new Bold()); + fontTitle.Append(new FontSize() { Val = 12D }); + fonts.Append(fontTitle); + + var fills = new Fills() { Count = 3U }; + + var fill1 = new Fill(); + fill1.Append(new PatternFill() + { + PatternType = PatternValues.None + }); + + var fill2 = new Fill(); + fill2.Append(new PatternFill() + { + PatternType = PatternValues.Gray125 + }); + + var fill3 = new Fill(); + fill3.Append(new PatternFill() + { + PatternType = PatternValues.Solid, + ForegroundColor = new() + { + Rgb = "e0e8ff" + } + }); + + var fill4 = new Fill(); + fill1.Append(new PatternFill() + { + PatternType = PatternValues.None + }); + + fills.Append(fill1); + fills.Append(fill2); + fills.Append(fill3); + fills.Append(fill4); + + 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 }); + var rightBorder = new RightBorder() { Style = BorderStyleValues.Thin }; + rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U }); + var topBorder = new TopBorder() { Style = BorderStyleValues.Thin }; + topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U }); + var bottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin }; + bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U }); + + borderThin.Append(leftBorder); + borderThin.Append(rightBorder); + borderThin.Append(topBorder); + borderThin.Append(bottomBorder); + borderThin.Append(new DiagonalBorder()); + + borders.Append(borderNoBorder); + borders.Append(borderThin); + + CellFormats cellFormats = new() { Count = 4U }; + CellFormat cellFormatEmpty = new() + { + FontId = 0U, + FillId = 0U, + BorderId = 1U, + ApplyFont = true + }; + CellFormat cellFormatDefault = new() + { + FontId = 0U, + FillId = 3U, + BorderId = 1U, + ApplyFont = true + }; + CellFormat cellFormatTitle = new() + { + FontId = 1U, + FillId = 2U, + BorderId = 1U, + ApplyFont = true, + ApplyBorder = true, + Alignment = new Alignment() + { + Vertical = VerticalAlignmentValues.Center, + Horizontal = HorizontalAlignmentValues.Center, + WrapText = true + } + }; + + cellFormats.Append(cellFormatEmpty); + cellFormats.Append(cellFormatDefault); + cellFormats.Append(cellFormatTitle); + + sp.Stylesheet.Append(fonts); + sp.Stylesheet.Append(fills); + sp.Stylesheet.Append(borders); + sp.Stylesheet.Append(cellFormats); + } + + public void CreateDocument() + { + spreadsheetDocument = SpreadsheetDocument.Create(tempFileName, + SpreadsheetDocumentType.Workbook); + WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart(); + workbookpart.Workbook = new Workbook(); + + CreateStyles(workbookpart); + + shareStringPart = spreadsheetDocument.WorkbookPart! + .GetPartsOfType() + .Any() + ? spreadsheetDocument.WorkbookPart + .GetPartsOfType() + .First() + : spreadsheetDocument.WorkbookPart + .AddNewPart(); + + if (shareStringPart.SharedStringTable == null) + { + shareStringPart.SharedStringTable = new SharedStringTable(); + } + + WorksheetPart worksheetPart = workbookpart.AddNewPart(); + worksheetPart.Worksheet = new Worksheet(new SheetData()); + + Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets()); + Sheet sheet = new() + { + Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart), + SheetId = 1, + Name = "Лист" + }; + sheets.Append(sheet); + + worksheet = worksheetPart.Worksheet; + } + + public void InsertCellInWorksheet(ExcelCellData cellData) + { + if (worksheet == null || shareStringPart == null) + { + return; + } + var sheetData = worksheet.GetFirstChild(); + if (sheetData == null) + { + return; + } + + Row? row = sheetData.Elements() + .Where(r => r.RowIndex! == cellData.RowIndex) + .FirstOrDefault(); + if (row == null) + { + row = new Row() { RowIndex = cellData.RowIndex }; + sheetData.Append(row); + } + + Cell? cell = row.Elements() + .Where(c => c.CellReference!.Value == cellData.CellReference) + .FirstOrDefault(); + if (cell == null) + { + Cell? refCell = null; + foreach (Cell rowCell in row.Elements()) + { + if (string.Compare(rowCell.CellReference!.Value, cellData.CellReference, true) > 0) + { + refCell = rowCell; + break; + } + } + var newCell = new Cell() + { + CellReference = cellData.CellReference + }; + row.InsertBefore(newCell, refCell); + cell = newCell; + } + + shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(cellData.Text))); + shareStringPart.SharedStringTable.Save(); + cell.CellValue = new CellValue((shareStringPart.SharedStringTable.Elements().Count() - 1).ToString()); + cell.DataType = new EnumValue(CellValues.SharedString); + cell.StyleIndex = cellData.StyleIndex; + } + + private void MergeCells(ExcelMergeParameters excelParams) + { + if (worksheet == null) + { + return; + } + MergeCells mergeCells; + if (worksheet.Elements().Any()) + { + mergeCells = worksheet.Elements().First(); + } + else + { + mergeCells = new MergeCells(); + if (worksheet.Elements().Any()) + { + worksheet.InsertAfter(mergeCells, worksheet.Elements().First()); + } + else + { + worksheet.InsertAfter(mergeCells, worksheet.Elements().First()); + } + } + var mergeCell = new MergeCell() + { + Reference = new StringValue(excelParams.Merge) + }; + mergeCells.Append(mergeCell); + } + + private void Save() + { + if (spreadsheetDocument == null) + { + return; + } + spreadsheetDocument.WorkbookPart!.Workbook.Save(); + spreadsheetDocument.Dispose(); + } + + public byte[] GetFile() + { + Save(); + byte[] file = File.ReadAllBytes(tempFileName); + File.Delete(tempFileName); + return file; + } + + public void CreateTitle(string text) + { + MergeCells(new ExcelMergeParameters + { + CellFromName = "A1", + CellToName = "B1" + }); + InsertCellInWorksheet(new ExcelCellData + { + ColumnName = "A", + RowIndex = 1, + Text = text, + StyleIndex = 0 + }); + } + + public void CreateCaseSpecializationTable(List data) + { + if (worksheet == null || shareStringPart == null) + { + return; + } + + Columns columns = new(); + Column columnA = new() { Min = 1, Max = 1, Width = 30, CustomWidth = true }; + columns.Append(columnA); + Column columnB = new() { Min = 2, Max = 2, Width = 30, CustomWidth = true }; + columns.Append(columnB); + worksheet.InsertAt(columns, 0); + + InsertCellInWorksheet(new ExcelCellData + { + ColumnName = "A", + RowIndex = 2, + Text = "Специализация:", + StyleIndex = 2 + }); + InsertCellInWorksheet(new ExcelCellData + { + ColumnName = "B", + RowIndex = 2, + Text = "Дела:", + StyleIndex = 2 + }); + + uint currentRow = 3; + foreach (ReportCaseSpecializationViewModel specialization in data) + { + InsertCellInWorksheet(new ExcelCellData + { + ColumnName = "A", + RowIndex = currentRow, + Text = specialization.Specialization, + StyleIndex = 1 + }); + InsertCellInWorksheet(new ExcelCellData + { + ColumnName = "B", + RowIndex = currentRow, + Text = "", + StyleIndex = 1 + }); + currentRow++; + foreach (string caseName in specialization.Cases) + { + InsertCellInWorksheet(new ExcelCellData + { + ColumnName = "A", + RowIndex = currentRow, + Text = "", + StyleIndex = 1 + }); + InsertCellInWorksheet(new ExcelCellData + { + ColumnName = "B", + RowIndex = currentRow, + Text = caseName, + StyleIndex = 1 + }); + currentRow++; + } + } + } + } +} diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/ExcelStyleInfoType.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/ExcelStyleInfoType.cs index 744d794..5fcd55f 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/ExcelStyleInfoType.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/ExcelStyleInfoType.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace ComputersShopBusinessLogic.OfficePackage.HelperEnums +namespace CaseAccountingBusinessLogic.OfficePackage.HelperEnums { public enum ExcelStyleInfoType { diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs index 89705ef..1423613 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace ComputersShopBusinessLogic.OfficePackage.HelperEnums +namespace CaseAccountingBusinessLogic.OfficePackage.HelperEnums { public enum PdfParagraphAlignmentType { diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/WordJustificationType.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/WordJustificationType.cs index 8d6e0c8..1dbd40b 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/WordJustificationType.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperEnums/WordJustificationType.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace ComputersShopBusinessLogic.OfficePackage.HelperEnums +namespace CaseAccountingBusinessLogic.OfficePackage.HelperEnums { public enum WordJustificationType { diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/ExcelCellParameters.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/ExcelCellParameters.cs index 6303cbb..267e22c 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/ExcelCellParameters.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/ExcelCellParameters.cs @@ -1,4 +1,4 @@ -using ComputersShopBusinessLogic.OfficePackage.HelperEnums; +using CaseAccountingBusinessLogic.OfficePackage.HelperEnums; using System; using System.Collections.Generic; using System.Linq; diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/PdfParagraph.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/PdfParagraph.cs index 1d4875e..6e9bb69 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/PdfParagraph.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/PdfParagraph.cs @@ -1,4 +1,4 @@ -using ComputersShopBusinessLogic.OfficePackage.HelperEnums; +using CaseAccountingBusinessLogic.OfficePackage.HelperEnums; using System; using System.Collections.Generic; using System.Linq; diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/PdfRowParameters.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/PdfRowParameters.cs index 7b0a0f5..10191ab 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/PdfRowParameters.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/PdfRowParameters.cs @@ -1,4 +1,4 @@ -using ComputersShopBusinessLogic.OfficePackage.HelperEnums; +using CaseAccountingBusinessLogic.OfficePackage.HelperEnums; using System; using System.Collections.Generic; using System.Linq; diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/WordTextProperties.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/WordTextProperties.cs index 422cf48..2d198c7 100644 --- a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/WordTextProperties.cs +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/HelperModels/WordTextProperties.cs @@ -1,4 +1,4 @@ -using ComputersShopBusinessLogic.OfficePackage.HelperEnums; +using CaseAccountingBusinessLogic.OfficePackage.HelperEnums; using System; using System.Collections.Generic; using System.Linq; diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/PdfBuilderProvider.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/PdfBuilderProvider.cs new file mode 100644 index 0000000..3d93fe6 --- /dev/null +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/PdfBuilderProvider.cs @@ -0,0 +1,183 @@ +using CaseAccountingBusinessLogic.OfficePackage; +using CaseAccountingBusinessLogic.OfficePackage.HelperEnums; +using CaseAccountingBusinessLogic.OfficePackage.HelperModels; +using CaseAccountingContracts.ViewModels; +using MigraDoc.DocumentObjectModel; +using MigraDoc.DocumentObjectModel.Tables; +using MigraDoc.Rendering; +using PdfSharp.Pdf; +using System.Text; + +namespace CaseAccountingBusinessLogic.BusinessLogic.OfficePackage +{ + public class PdfBuilderProvider + { + private readonly string tempFileName = "temp.pdf"; + private Document? document; + private Section? section; + private Table? table; + + private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type) + { + return type switch + { + PdfParagraphAlignmentType.Center => ParagraphAlignment.Center, + PdfParagraphAlignmentType.Left => ParagraphAlignment.Left, + _ => ParagraphAlignment.Justify, + }; + } + + private void DefineStyles(Document document) + { + var style = document.Styles["Normal"]; + style.Font.Name = "Times New Roman"; + style.Font.Size = 14; + + style = document.Styles.AddStyle("NormalTitle", "Normal"); + style.Font.Bold = true; + } + + public void CreateDocument() + { + document = new Document(); + DefineStyles(document); + section = document.AddSection(); + } + + public void CreateParagraph(PdfParagraph pdfParagraph) + { + if (section == null) + { + return; + } + var paragraph = section.AddParagraph(pdfParagraph.Text); + paragraph.Format.SpaceAfter = "1cm"; + paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment); + paragraph.Style = pdfParagraph.Style; + } + + public void CreateTable(List columns) + { + if (document == null) + { + return; + } + table = document.LastSection.AddTable(); + foreach (var elem in columns) + { + table.AddColumn(elem); + } + } + + public void CreateRow(PdfRowParameters rowParameters) + { + if (table == null) + { + return; + } + var row = table.AddRow(); + for (int i = 0; i < rowParameters.Texts.Count; ++i) + { + row.Cells[i].AddParagraph(rowParameters.Texts[i]); + if (!string.IsNullOrEmpty(rowParameters.Style)) + { + row.Cells[i].Style = rowParameters.Style; + } + Unit borderWidth = 0.5; + row.Cells[i].Borders.Left.Width = borderWidth; + row.Cells[i].Borders.Right.Width = borderWidth; + row.Cells[i].Borders.Top.Width = borderWidth; + row.Cells[i].Borders.Bottom.Width = borderWidth; + row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment); + row.Cells[i].VerticalAlignment = VerticalAlignment.Center; + } + } + + private void Save() + { + + // Регистрация провайдера кодировки для кодировки 1252, без этого ошибОчка была + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + + var renderer = new PdfDocumentRenderer(true) + { + Document = document + }; + renderer.RenderDocument(); + renderer.PdfDocument.Save(tempFileName); + } + + public byte[] GetFile() + { + Save(); + byte[] file = File.ReadAllBytes(tempFileName); + File.Delete(tempFileName); + return file; + } + + public byte[] GetHearingLawyerReportFile(PdfData data) + { + CreateDocument(); + + CreateParagraph(new PdfParagraph + { + Text = data.Title, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + + CreateParagraph(new PdfParagraph + { + Text = $"за период с {data.DateFrom.ToShortDateString()} " + + $"по {data.DateTo.ToShortDateString()}", + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + + CreateTable(new List { "4cm","5cm", "3cm", "3cm" }); + + CreateRow(new PdfRowParameters + { + Texts = new List { "Номер слушания", "Дело", "Дата проведения", "Юрист" }, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + + foreach (var record in data.Records) + { + List casesAndLawyes = record.CaseLawyers; + int recordHeight = casesAndLawyes.Count + 1; + for (int i = 0; i < recordHeight; i++) + { + List cellsData = new() { "", "", "", "" }; + if (i == 0) + { + cellsData[0] = record.Hearing; + CreateRow(new PdfRowParameters + { + Texts = cellsData, + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Left + }); + continue; + } + int k = i - 1; + if (k < casesAndLawyes.Count) + { + cellsData[1] = casesAndLawyes[k].Case; + cellsData[2] = casesAndLawyes[k].Date.ToString("yyyy-MM-dd"); + cellsData[3] = casesAndLawyes[k].Lawyer; + } + CreateRow(new PdfRowParameters + { + Texts = cellsData, + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Left + }); + } + } + + return GetFile(); + } + } +} diff --git a/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/WordBuilderProvider.cs b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/WordBuilderProvider.cs new file mode 100644 index 0000000..0343afc --- /dev/null +++ b/CaseAccounting/CaseAccountingBusinessLogics/OfficePackage/WordBuilderProvider.cs @@ -0,0 +1,170 @@ +using CaseAccountingBusinessLogic.OfficePackage.HelperModels; +using CaseAccountingContracts.ViewModels; +using DocumentFormat.OpenXml; +using DocumentFormat.OpenXml.Packaging; +using DocumentFormat.OpenXml.Wordprocessing; + +namespace CaseAccountingBusinessLogic.OfficePackage +{ + public class WordBuilderProvider + { + private readonly string tempFileName = "temp.docx"; + private WordprocessingDocument? wordDocument; + private Body? documentBody; + + public void CreateDocument() + { + wordDocument = WordprocessingDocument.Create(tempFileName, + WordprocessingDocumentType.Document); + MainDocumentPart mainPart = wordDocument.AddMainDocumentPart(); + mainPart.Document = new Document(); + documentBody = mainPart.Document.AppendChild(new Body()); + } + + public void CreateParagraph(string text) + { + if (documentBody == null) + { + return; + } + Paragraph paragraph = new(); + Run run = new(); + run.AppendChild(new Text + { + Text = text + }); + paragraph.AppendChild(run); + documentBody.AppendChild(paragraph); + } + + public void CreateTitle(string text) + { + if (documentBody == null) + { + return; + } + Paragraph paragraph = new(); + Run run = new(); + RunProperties properties = new(); + properties.AppendChild(new Bold()); + run.AppendChild(properties); + run.AppendChild(new Text + { + Text = text + }); + paragraph.AppendChild(run); + documentBody.AppendChild(paragraph); + } + + private TableCell CreateTableCell(string text, bool inHead = false, int? cellWidth = null) + { + Run run = new(); + TableCell tableCell = new(); + TableCellProperties cellProperties = new() + { + TableCellWidth = new() + { + Width = cellWidth.ToString() + }, + TableCellMargin = new() + { + LeftMargin = new() + { + Width = "100" + } + } + }; + if (inHead) + { + Shading shading = new() + { + Color = "auto", + Fill = "e0e8ff", + Val = ShadingPatternValues.Clear + }; + cellProperties.Append(shading); + RunProperties properties = new(); + properties.AppendChild(new Bold()); + run.AppendChild(properties); + } + run.AppendChild(new Text + { + Text = text + }); + Paragraph paragraph = new(run); + tableCell.AppendChild(paragraph); + tableCell.Append(cellProperties); + return tableCell; + } + + protected void CreateTable(WordTableData tableData) + { + if (documentBody == null || tableData == null) + { + return; + } + var table = new Table(); + + TableProperties tableProperties = new( + new TableBorders( + new TopBorder() { Val = new EnumValue(BorderValues.Single), Size = 3 }, + new BottomBorder() { Val = new EnumValue(BorderValues.Single), Size = 3 }, + new LeftBorder() { Val = new EnumValue(BorderValues.Single), Size = 3 }, + new RightBorder() { Val = new EnumValue(BorderValues.Single), Size = 3 }, + new InsideHorizontalBorder() { Val = new EnumValue(BorderValues.Single), Size = 3 }, + new InsideVerticalBorder() { Val = new EnumValue(BorderValues.Single), Size = 3 } + ) + ); + table.AppendChild(tableProperties); + + table.Append(new TableRow(tableData.Columns.Select(x => CreateTableCell(x.Item1, true, x.Item2)))); + table.Append(tableData.Rows.Select(x => new TableRow(x.Select(y => CreateTableCell(y))))); + + documentBody.AppendChild(table); + } + + private void Save() + { + if (documentBody == null || wordDocument == null) + { + return; + } + wordDocument.MainDocumentPart!.Document.Save(); + wordDocument.Dispose(); + } + + public byte[] GetFile() + { + Save(); + byte[] file = File.ReadAllBytes(tempFileName); + File.Delete(tempFileName); + return file; + } + + public void CreateCaseSpecializationTable(List data) + { + List> rows = new(); + foreach (ReportCaseSpecializationViewModel specializationl in data) + { + List specializationlCells = new() { specializationl.Specialization, "" }; + rows.Add(specializationlCells); + List caseCells; + foreach (string caseString in specializationl.Cases) + { + caseCells = new() { "", caseString }; + rows.Add(caseCells); + } + } + WordTableData wordTable = new() + { + Columns = new List<(string, int)>() + { + ("Специализация", 3000), + ("Дела", 3000) + }, + Rows = rows + }; + CreateTable(wordTable); + } + } +} diff --git a/CaseAccounting/CaseAccountingContracts/BindingModels/CaseSpecializationListBindingModel.cs b/CaseAccounting/CaseAccountingContracts/BindingModels/CaseSpecializationListBindingModel.cs new file mode 100644 index 0000000..23f03b3 --- /dev/null +++ b/CaseAccounting/CaseAccountingContracts/BindingModels/CaseSpecializationListBindingModel.cs @@ -0,0 +1,15 @@ +using CaseAccountingContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CaseAccountingContracts.BindingModels +{ + public class CaseSpecializationListBindingModel + { + public string FileType { get; set; } = string.Empty; + public List Cases { get; set; } = new(); + } +} diff --git a/CaseAccounting/CaseAccountingContracts/BindingModels/DealBindingModel.cs b/CaseAccounting/CaseAccountingContracts/BindingModels/DealBindingModel.cs index e321d1d..6f2c914 100644 --- a/CaseAccounting/CaseAccountingContracts/BindingModels/DealBindingModel.cs +++ b/CaseAccounting/CaseAccountingContracts/BindingModels/DealBindingModel.cs @@ -25,12 +25,17 @@ namespace CaseAccountingContracts.BindingModels public List CaseViewModels { get; set; } = new(); + public Dictionary Contracts { get; set; } = new(); + + public List ContractViewModels { get; set; } = new(); + public DealBindingModel() { } [JsonConstructor] - public DealBindingModel(Dictionary Cases) + public DealBindingModel(Dictionary Cases, Dictionary Contracts) { this.Cases = Cases.ToDictionary(x => x.Key, x => (ICaseModel)x.Value); + this.Contracts = Contracts.ToDictionary(x => x.Key, x => (IContractModel)x.Value); } } } diff --git a/CaseAccounting/CaseAccountingContracts/BindingModels/MailConfigBindingModel.cs b/CaseAccounting/CaseAccountingContracts/BindingModels/MailConfigBindingModel.cs new file mode 100644 index 0000000..b2b3fce --- /dev/null +++ b/CaseAccounting/CaseAccountingContracts/BindingModels/MailConfigBindingModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CaseAccountingContracts.BindingModels +{ + public class MailConfigBindingModel + { + public string MailLogin { get; set; } = string.Empty; + public string MailPassword { get; set; } = string.Empty; + public string SmtpClientHost { get; set; } = string.Empty; + public int SmtpClientPort { get; set; } + } +} diff --git a/CaseAccounting/CaseAccountingContracts/BindingModels/MailSendInfoBindingModel.cs b/CaseAccounting/CaseAccountingContracts/BindingModels/MailSendInfoBindingModel.cs new file mode 100644 index 0000000..5b78eea --- /dev/null +++ b/CaseAccounting/CaseAccountingContracts/BindingModels/MailSendInfoBindingModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CaseAccountingContracts.BindingModels +{ + public class MailSendInfoBindingModel + { + public string MailAddress { get; set; } = string.Empty; + public string Subject { get; set; } = string.Empty; + public string Text { get; set; } = string.Empty; + public byte[] File { get; set; } = Array.Empty(); + } +} diff --git a/CaseAccounting/CaseAccountingContracts/BindingModels/ReportBindingModel.cs b/CaseAccounting/CaseAccountingContracts/BindingModels/ReportBindingModel.cs index c857950..aeacfe6 100644 --- a/CaseAccounting/CaseAccountingContracts/BindingModels/ReportBindingModel.cs +++ b/CaseAccounting/CaseAccountingContracts/BindingModels/ReportBindingModel.cs @@ -9,12 +9,9 @@ namespace CaseAccountingContracts.BindingModels { public class ReportBindingModel { - public string FileName { get; set; } = string.Empty; - - public DateTime? DateFrom { get; set; } - - public DateTime? DateTo { get; set; } - + public string UserEmail { get; set; } = string.Empty; + public DateTime DateFrom { get; set; } + public DateTime DateTo { get; set; } public int? UserId { get; set; } } } diff --git a/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/ICaseLogic.cs b/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/ICaseLogic.cs index 61eba68..9e315a0 100644 --- a/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/ICaseLogic.cs +++ b/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/ICaseLogic.cs @@ -16,5 +16,6 @@ namespace CaseAccountingContracts.BusinessLogicContracts bool Create(CaseBindingModel model); bool Update(CaseBindingModel model); bool Delete(CaseBindingModel model); + List GetSpecializationCases(); } } diff --git a/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/IReportCustomerLogic.cs b/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/IReportCustomerLogic.cs index 5dc559d..8fe434e 100644 --- a/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/IReportCustomerLogic.cs +++ b/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/IReportCustomerLogic.cs @@ -15,11 +15,5 @@ namespace CaseAccountingContracts.BusinessLogicContracts List GetHearingSpecialization(ReportBindingModel model); byte[] SaveListFile(LawyerHearingListBindingModel model); - - void SaveLawyerHearingToWordFile(ReportBindingModel model); - - void SaveLawyerHearingToExcelFile(ReportBindingModel model); - - void SaveHearingSpecializationToPdfFile(ReportBindingModel model); } } diff --git a/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/IReportProviderLogic.cs b/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/IReportProviderLogic.cs index 678ce92..6f14f75 100644 --- a/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/IReportProviderLogic.cs +++ b/CaseAccounting/CaseAccountingContracts/BusinessLogicContracts/IReportProviderLogic.cs @@ -14,10 +14,8 @@ namespace CaseAccountingContracts.BusinessLogicContracts List GetHearingLawyer(ReportBindingModel model); - void SaveCaseSpecializationToWordFile(ReportBindingModel model); + byte[] SaveListFile(CaseSpecializationListBindingModel model); - void SaveCaseSpecializationToExcelFile(ReportBindingModel model); - - void SaveHearingLawyerToPdfFile(ReportBindingModel model); + void SendByMailStatusReport(ReportBindingModel reportModel); } } diff --git a/CaseAccounting/CaseAccountingContracts/StoragesContracts/ICaseStorage.cs b/CaseAccounting/CaseAccountingContracts/StoragesContracts/ICaseStorage.cs index 9570d06..280f367 100644 --- a/CaseAccounting/CaseAccountingContracts/StoragesContracts/ICaseStorage.cs +++ b/CaseAccounting/CaseAccountingContracts/StoragesContracts/ICaseStorage.cs @@ -18,6 +18,7 @@ namespace CaseAccountingContracts.StoragesContracts CaseViewModel? Update(CaseBindingModel model); CaseViewModel? Delete(CaseBindingModel model); - List GetCaseHearings(CaseSearchModel model); + List GetCaseMTM(int lawyerId); + List? GetSpecializationCases(); } } diff --git a/CaseAccounting/CaseAccountingContracts/StoragesContracts/ILawyerStorage.cs b/CaseAccounting/CaseAccountingContracts/StoragesContracts/ILawyerStorage.cs index a331386..60cd8d0 100644 --- a/CaseAccounting/CaseAccountingContracts/StoragesContracts/ILawyerStorage.cs +++ b/CaseAccounting/CaseAccountingContracts/StoragesContracts/ILawyerStorage.cs @@ -19,5 +19,6 @@ namespace CaseAccountingContracts.StoragesContracts LawyerViewModel? Delete(LawyerBindingModel model); List GetLawyerCases(LawyerSearchModel model); + List GetLawyerMTM(int caseId); } } diff --git a/CaseAccounting/CaseAccountingContracts/ViewModels/CaseLawyerViewModel.cs b/CaseAccounting/CaseAccountingContracts/ViewModels/CaseLawyerViewModel.cs new file mode 100644 index 0000000..49d274c --- /dev/null +++ b/CaseAccounting/CaseAccountingContracts/ViewModels/CaseLawyerViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CaseAccountingContracts.ViewModels +{ + public class CaseLawyerViewModel + { + public string Case { get; set; } = string.Empty; + public DateTime Date { get; set; } + public string Lawyer { get; set; } = string.Empty; + } +} diff --git a/CaseAccounting/CaseAccountingContracts/ViewModels/ReportCaseSpecializationViewModel.cs b/CaseAccounting/CaseAccountingContracts/ViewModels/ReportCaseSpecializationViewModel.cs index 78b6a24..7e6e4c5 100644 --- a/CaseAccounting/CaseAccountingContracts/ViewModels/ReportCaseSpecializationViewModel.cs +++ b/CaseAccounting/CaseAccountingContracts/ViewModels/ReportCaseSpecializationViewModel.cs @@ -8,10 +8,7 @@ namespace CaseAccountingContracts.ViewModels { public class ReportCaseSpecializationViewModel { - public string CaseName { get; set; } = string.Empty; - public string Applicant { get; set; } = string.Empty; - public string Defendant { get; set; } = string.Empty; - public DateTime Date { get; set; } public string Specialization { get; set; } = string.Empty; + public List Cases { get; set; } = new(); } } diff --git a/CaseAccounting/CaseAccountingContracts/ViewModels/ReportHearingLawyerViewModel.cs b/CaseAccounting/CaseAccountingContracts/ViewModels/ReportHearingLawyerViewModel.cs index 7f897e9..ced286b 100644 --- a/CaseAccounting/CaseAccountingContracts/ViewModels/ReportHearingLawyerViewModel.cs +++ b/CaseAccounting/CaseAccountingContracts/ViewModels/ReportHearingLawyerViewModel.cs @@ -8,8 +8,7 @@ namespace CaseAccountingContracts.ViewModels { public class ReportHearingLawyerViewModel { - public string Information { get; set; } = string.Empty; - public DateTime Date { get; set; } - public List<(string Surname, string Name, string Patronymic)> Lawyers { get; set; } = new(); + public string Hearing { get; set; } = string.Empty; + public List CaseLawyers { get; set; } = new(); } } diff --git a/CaseAccounting/CaseAccountingContracts/ViewModels/SpecializationCasesViewModel.cs b/CaseAccounting/CaseAccountingContracts/ViewModels/SpecializationCasesViewModel.cs new file mode 100644 index 0000000..ec5af5a --- /dev/null +++ b/CaseAccounting/CaseAccountingContracts/ViewModels/SpecializationCasesViewModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CaseAccountingContracts.ViewModels +{ + public class SpecializationCasesViewModel + { + public int Count { get; set; } + public string Name { get; set; } = string.Empty; + } +} diff --git a/CaseAccounting/CaseAccountingCustomerView/CaseAccountingCustomerView.csproj b/CaseAccounting/CaseAccountingCustomerView/CaseAccountingCustomerView.csproj index 083008b..0b83c0b 100644 --- a/CaseAccounting/CaseAccountingCustomerView/CaseAccountingCustomerView.csproj +++ b/CaseAccounting/CaseAccountingCustomerView/CaseAccountingCustomerView.csproj @@ -6,6 +6,10 @@ enable + + + + diff --git a/CaseAccounting/CaseAccountingCustomerView/Controllers/HomeController.cs b/CaseAccounting/CaseAccountingCustomerView/Controllers/HomeController.cs index d9d54e1..c26dbf7 100644 --- a/CaseAccounting/CaseAccountingCustomerView/Controllers/HomeController.cs +++ b/CaseAccounting/CaseAccountingCustomerView/Controllers/HomeController.cs @@ -102,7 +102,7 @@ namespace CaseAccountingCustomerView.Controllers } [HttpPost] - public int[]? HearingLawyerList([FromBody] LawyerHearingListBindingModel listModel) + public int[]? HearingLawyerlist([FromBody] LawyerHearingListBindingModel listModel) { if (APIUser.User == null) { diff --git a/CaseAccounting/CaseAccountingCustomerView/Controllers/Lawyers.cs b/CaseAccounting/CaseAccountingCustomerView/Controllers/Lawyers.cs index 1f0e19c..ba8c8bd 100644 --- a/CaseAccounting/CaseAccountingCustomerView/Controllers/Lawyers.cs +++ b/CaseAccounting/CaseAccountingCustomerView/Controllers/Lawyers.cs @@ -61,6 +61,13 @@ namespace CaseAccountingCustomerView.Controllers dict.Add(element.Id, _case); } lawyerModel.Cases = dict; + var dictContr = new Dictionary(); + foreach (var element in lawyerModel.ContractViewModels) + { + var contract = APIUser.GetRequest($"api/contract/get?id={element.Id}"); + dictContr.Add(element.Id, contract); + } + lawyerModel.Contracts = dictContr; APIUser.PostRequest("api/lawyer/update", lawyerModel); Response.Redirect("/Home/Lawyers"); } diff --git a/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Lawyers/lawyer-update.js b/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Lawyers/lawyer-update.js index 1c3a921..a0c0cc2 100644 --- a/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Lawyers/lawyer-update.js +++ b/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Lawyers/lawyer-update.js @@ -1,7 +1,9 @@ const createBtn = document.getElementById("create-button"); const tbody = document.getElementById("scrollable-table__tbody"); -const serviceInput = document.getElementById("service-input"); -const coastInput = document.getElementById("coast-input"); +const nameInput = document.getElementById("name-input") +const surnameInput = document.getElementById("surname-input") +const patronymicInput = document.getElementById("patronymic-input") +const experienceInput = document.getElementById("experience-input") const currentLawyerId = document.getElementById("lawyer-id").dataset.id; var contracts = []; var dataArray = []; @@ -17,7 +19,7 @@ window.addEventListener('load', async () => { }); console.log(currentLawyerId) await $.ajax({ - url: "/lawyers/get?id=${currentLawyerId}", + url: `/lawyers/get?id=${currentLawyerId}`, type: "GET", contentType: "json" }).done((result) => { @@ -36,23 +38,25 @@ window.addEventListener('load', async () => { cell.textContent = value; }); console.log(currentLawyer); - if (currentLawyer.ContractViewModels.find(x => parseInt(x.id) === parseInt(contract.id))) { + /*if (currentLawyer.сontractViewModels.find(x => parseInt(x.id) === parseInt(contract.id))) { row.classList.add("bg-success"); dataArray.push(contract); - } + }*/ row.addEventListener('click', () => addAndRemoveFromList(row)); }); }) createBtn.addEventListener('click', () => { + console.log(dataArray); var lawyerCasesUpdate = { - "Id": currentLawyer.id, - "Service": serviceInput.value, - "Coast": coastInput.value, - "Date": currentLawyer.date, - "ContractViewModels": dataArray, - "LawyerCases": currentLawyer.lawyerCases, + "Id": currentLawyerId, + "Name": nameInput.value, + "Surname": surnameInput.value, + "Patronymic": patronymicInput.value, + "Experience": parseInt(experienceInput.value), + "SpecializationId": parseInt(currentLawyer.specializationId), + "ContractViewModels": dataArray } $.ajax({ url: "/lawyers/update", diff --git a/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Report/reportlist.js b/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Report/reportlist.js index fe47bc2..1ea3643 100644 --- a/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Report/reportlist.js +++ b/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Report/reportlist.js @@ -7,15 +7,31 @@ var dataArray = []; const wordMIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; const excelMIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; -window.addEventListener('load', () => { - $.ajax({ - url: "/lawyers/getallbyuser", - type: "GET", - contentType: "json" - }).done((result) => { - lawyers = result; - lawyers.forEach((lawyer) => createRowForLawyersTable(lawyer)); - }); +window.addEventListener('load', async () => { + try { + await $.ajax({ + url: `/lawyers/getallbyuser`, + type: "GET", + contentType: "json" + }).done((result) => { + lawyers = result; + lawyers.forEach((lawyerModel) => { + const { id, name, surname, patronymic, experience, specialization } = lawyerModel; + const row = tbody.insertRow(); + row.setAttribute("data-id", id); + + const cells = [name, surname, patronymic, experience, specialization]; + cells.forEach((value) => { + const cell = row.insertCell(); + cell.textContent = value; + }); + + row.addEventListener('click', () => addAndRemoveFromList(row)); + }); + }); + } catch (error) { + console.error(error); + } }) createBtn.addEventListener('click', () => { @@ -23,7 +39,6 @@ createBtn.addEventListener('click', () => { "Lawyers": Array.from(dataArray), "FileType": fileType.value }; - console.log(listModel); $.ajax({ url: "/home/hearinglawyerlist", type: "POST", @@ -61,38 +76,16 @@ const saveFile = async function (bytes, fileType) { } } -const createRowForLawyersTable = (lawyer) => { - const { id, name, surname, patronymic, experience, specialization } = lawyer; - const row = tbody.insertRow(); - row.setAttribute("data-id", id); - - const cells = [name, surname, patronymic, experience, specialization]; - cells.forEach((value) => { - const cell = row.insertCell(); - cell.textContent = value; - }); - - row.addEventListener('click', () => addAndRemoveFromList(row)); -}; - -const formatDate = (dateString) => { - const date = new Date(dateString); - const year = date.getFullYear(); - const month = ('0' + (date.getMonth() + 1)).slice(-2); - const day = ('0' + date.getDate()).slice(-2); - return `${year}-${month}-${day}`; -}; - const addAndRemoveFromList = (row) => { var id = parseInt(row.dataset.id); console.log(lawyers.find(x => x.id === id)) var index = dataArray.indexOf(lawyers.find(x => x.id === id)); if (index === -1) { dataArray.push(lawyers.find(x => x.id === id)); - row.classList.add("bg-success"); + row.classList.add("bg-info"); } else { dataArray.splice(index, 1); - row.classList.remove("bg-success"); + row.classList.remove("bg-info"); } console.log(dataArray); -} \ No newline at end of file +} diff --git a/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Specializations/specialization-update.js b/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Specializations/specialization-update.js index 2983f1d..59d230d 100644 --- a/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Specializations/specialization-update.js +++ b/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Specializations/specialization-update.js @@ -1,5 +1,4 @@ -const updateBtn = - .getElementById("update-button"); +const updateBtn = document.getElementById("update-button"); const nameInput = document.getElementById("name-input") const specializationId = document.getElementById("spec-id").dataset.id diff --git a/CaseAccounting/CaseAccountingDataBaseImplement/Implements/CaseStorage.cs b/CaseAccounting/CaseAccountingDataBaseImplement/Implements/CaseStorage.cs index b71e5f9..37811e4 100644 --- a/CaseAccounting/CaseAccountingDataBaseImplement/Implements/CaseStorage.cs +++ b/CaseAccounting/CaseAccountingDataBaseImplement/Implements/CaseStorage.cs @@ -158,7 +158,7 @@ namespace CaseAccountingDataBaseImplement.Implements { return null; } - _case.Update(model); + _case.Update(context, model); context.SaveChanges(); _case.UpdateLawyers(context, model); transaction.Commit(); @@ -171,19 +171,36 @@ namespace CaseAccountingDataBaseImplement.Implements } } - public List GetCaseHearings(CaseSearchModel model) + public List GetCaseMTM(int lawyerId) { - if (model == null) - { - return new(); - } using var context = new CaseAccountingDatabase(); - var hearings = context.Hearings - .Where(x => x.CaseId == model.Id) + var lawyersId = context.CaseLawyers + .Where(x => x.LawyerId == lawyerId) + .Select(x => x.CaseId).ToList(); + return context.Cases + .Include(x => x.Specialization) + .Include(x => x.User) + .Where(X => lawyersId.Contains(X.Id)) .Select(x => x.GetViewModel) .ToList(); - return hearings; } + public List? GetSpecializationCases() + { + using var context = new CaseAccountingDatabase(); + var result = context.Specializations + .GroupJoin( + context.Cases, + status => status.Id, + caseModel => caseModel.SpecializationId, + (status, caseModels) => new SpecializationCasesViewModel + { + Name = status.Name, + Count = caseModels.Count() + }) + .ToList(); + + return result; + } } } diff --git a/CaseAccounting/CaseAccountingDataBaseImplement/Implements/DealStorage.cs b/CaseAccounting/CaseAccountingDataBaseImplement/Implements/DealStorage.cs index 7c44a90..718ad0d 100644 --- a/CaseAccounting/CaseAccountingDataBaseImplement/Implements/DealStorage.cs +++ b/CaseAccounting/CaseAccountingDataBaseImplement/Implements/DealStorage.cs @@ -115,9 +115,9 @@ namespace CaseAccountingDataBaseImplement.Implements { return null; } - deal.Update(model); + deal.Update(context, model); context.SaveChanges(); - deal.UpdateCases(context, model); + if(model.Cases.Count > 0) deal.UpdateCases(context, model); transaction.Commit(); return deal.GetViewModel; } diff --git a/CaseAccounting/CaseAccountingDataBaseImplement/Implements/HearingStorage.cs b/CaseAccounting/CaseAccountingDataBaseImplement/Implements/HearingStorage.cs index 1d8e806..114a79a 100644 --- a/CaseAccounting/CaseAccountingDataBaseImplement/Implements/HearingStorage.cs +++ b/CaseAccounting/CaseAccountingDataBaseImplement/Implements/HearingStorage.cs @@ -129,7 +129,7 @@ namespace CaseAccountingDataBaseImplement.Implements { return null; } - hearing.Update(model); + hearing.Update(context, model); context.SaveChanges(); return context.Hearings .Include(x => x.Case) diff --git a/CaseAccounting/CaseAccountingDataBaseImplement/Implements/LawyerStorage.cs b/CaseAccounting/CaseAccountingDataBaseImplement/Implements/LawyerStorage.cs index 16050a7..cf2b7fe 100644 --- a/CaseAccounting/CaseAccountingDataBaseImplement/Implements/LawyerStorage.cs +++ b/CaseAccounting/CaseAccountingDataBaseImplement/Implements/LawyerStorage.cs @@ -89,6 +89,20 @@ namespace CaseAccountingDataBaseImplement.Implements .Select(x => x.GetViewModel).ToList(); } + public List GetLawyerMTM(int caseId) + { + using var context = new CaseAccountingDatabase(); + var lawyersId = context.CaseLawyers + .Where(x => x.CaseId == caseId) + .Select(x => x.LawyerId).ToList(); + return context.Lawyers + .Include(x => x.Specialization) + .Include(x => x.User) + .Where(X => lawyersId.Contains(X.Id)) + .Select(x => x.GetViewModel) + .ToList(); + } + public LawyerViewModel? Insert(LawyerBindingModel model) { using var context = new CaseAccountingDatabase(); diff --git a/CaseAccounting/CaseAccountingDataBaseImplement/Models/Case.cs b/CaseAccounting/CaseAccountingDataBaseImplement/Models/Case.cs index de9098b..ceaee53 100644 --- a/CaseAccounting/CaseAccountingDataBaseImplement/Models/Case.cs +++ b/CaseAccounting/CaseAccountingDataBaseImplement/Models/Case.cs @@ -87,15 +87,19 @@ namespace CaseAccountingDataBaseImplement.Models }; } - public void Update(CaseBindingModel model) + public void Update(CaseAccountingDatabase context, CaseBindingModel model) { if (model == null) { return; } Name = model.Name; + Applicant = model.Applicant; + Defendant = model.Defendant; + SpecializationId = model.SpecializationId; + Specialization = context.Specializations.FirstOrDefault(x => x.Id == model.SpecializationId) ?? throw new Exception("Specialization не существует"); Annotation = model.Annotation; - Date = model.Date; + Date = DateTime.SpecifyKind(model.Date, DateTimeKind.Utc); } public void UpdateLawyers(CaseAccountingDatabase context, CaseBindingModel model) diff --git a/CaseAccounting/CaseAccountingDataBaseImplement/Models/Deal.cs b/CaseAccounting/CaseAccountingDataBaseImplement/Models/Deal.cs index 7bc42a9..f1e7060 100644 --- a/CaseAccounting/CaseAccountingDataBaseImplement/Models/Deal.cs +++ b/CaseAccounting/CaseAccountingDataBaseImplement/Models/Deal.cs @@ -72,7 +72,7 @@ namespace CaseAccountingDataBaseImplement.Models }; } - public void Update(DealBindingModel? model) + public void Update(CaseAccountingDatabase context, DealBindingModel? model) { if (model == null) { @@ -80,7 +80,14 @@ namespace CaseAccountingDataBaseImplement.Models } Subject = model.Subject; Responsibilities = model.Responsibilities; - Date = model.Date; + Date = DateTime.SpecifyKind(model.Date, DateTimeKind.Utc); + if (model.Contracts.Count > 0) + { + Contracts = model.Contracts.Select(x => new DealContract + { + Contract = context.Contracts.First(y => y.Id == x.Key) + }).ToList(); + } } public void UpdateCases(CaseAccountingDatabase context, DealBindingModel model) diff --git a/CaseAccounting/CaseAccountingDataBaseImplement/Models/Hearing.cs b/CaseAccounting/CaseAccountingDataBaseImplement/Models/Hearing.cs index 5fe3fef..7a2f7fe 100644 --- a/CaseAccounting/CaseAccountingDataBaseImplement/Models/Hearing.cs +++ b/CaseAccounting/CaseAccountingDataBaseImplement/Models/Hearing.cs @@ -47,14 +47,16 @@ namespace CaseAccountingDataBaseImplement.Models }; } - public void Update (HearingBindingModel? model) + public void Update (CaseAccountingDatabase context, HearingBindingModel? model) { if (model == null) { return; } Information = model.Information; - Date = model.Date; + CaseId = model.CaseId; + Case = context.Cases.FirstOrDefault(x => x.Id == model.CaseId) ?? throw new Exception("Case не существует"); + DateTime.SpecifyKind(model.Date, DateTimeKind.Utc); } public HearingViewModel GetViewModel => new() diff --git a/CaseAccounting/CaseAccountingDataBaseImplement/Models/Lawyer.cs b/CaseAccounting/CaseAccountingDataBaseImplement/Models/Lawyer.cs index fd7359f..a19305c 100644 --- a/CaseAccounting/CaseAccountingDataBaseImplement/Models/Lawyer.cs +++ b/CaseAccounting/CaseAccountingDataBaseImplement/Models/Lawyer.cs @@ -114,6 +114,13 @@ namespace CaseAccountingDataBaseImplement.Models Case = context.Cases.First(y => y.Id == x.Key) }).ToList(); } + if (model.Contracts.Count > 0) + { + LawyerContracts = model.Contracts.Select(x => new LawyerContract + { + Contract = context.Contracts.First(y => y.Id == x.Key) + }).ToList(); + } } public void UpdateContracts(CaseAccountingDatabase context, LawyerBindingModel model) diff --git a/CaseAccounting/CaseAccountingProviderView/APIUser.cs b/CaseAccounting/CaseAccountingProviderView/APIUser.cs index b162554..987c8c3 100644 --- a/CaseAccounting/CaseAccountingProviderView/APIUser.cs +++ b/CaseAccounting/CaseAccountingProviderView/APIUser.cs @@ -43,5 +43,25 @@ namespace CaseAccountingProviderView throw new Exception(result); } } - } + + public static O? PostRequestWithResult(string requestUrl, I model) + { + var json = JsonConvert.SerializeObject(model); + var data = new StringContent(json, Encoding.UTF8, "application/json"); + + var response = _user.PostAsync(requestUrl, data); + + var result = response.Result.Content.ReadAsStringAsync().Result; + + if (response.Result.IsSuccessStatusCode) + { + var temp = JsonConvert.DeserializeObject(result); + return temp; + } + else + { + return default; + } + } + } } diff --git a/CaseAccounting/CaseAccountingProviderView/Controllers/CaseController.cs b/CaseAccounting/CaseAccountingProviderView/Controllers/CaseController.cs index b8a7fbb..59afe56 100644 --- a/CaseAccounting/CaseAccountingProviderView/Controllers/CaseController.cs +++ b/CaseAccounting/CaseAccountingProviderView/Controllers/CaseController.cs @@ -129,5 +129,15 @@ namespace CaseAccountingProviderView.Controllers List? specializationModel = APIUser.GetRequest>($"api/case/getallspecializations"); return specializationModel ?? new(); } - } + + public List GetSpecializationCases() + { + if (APIUser.User == null) + { + return new(); + } + List? specializationCases = APIUser.GetRequest>($"api/case/getspecializationcases"); + return specializationCases ?? new(); + } + } } diff --git a/CaseAccounting/CaseAccountingProviderView/Controllers/DealController.cs b/CaseAccounting/CaseAccountingProviderView/Controllers/DealController.cs index f8b1c51..200646e 100644 --- a/CaseAccounting/CaseAccountingProviderView/Controllers/DealController.cs +++ b/CaseAccounting/CaseAccountingProviderView/Controllers/DealController.cs @@ -53,7 +53,14 @@ namespace CaseAccountingProviderView.Controllers throw new Exception("403"); } dealModel.UserId = APIUser.User.Id; - APIUser.PostRequest("api/deal/update", dealModel); + var contractdict = new Dictionary(); + foreach (var element in dealModel.ContractViewModels) + { + var contractModel = APIUser.GetRequest($"api/contract/get?id={element.Id}"); + contractdict.Add(element.Id, contractModel); + } + dealModel.Contracts = contractdict; + APIUser.PostRequest("api/deal/update", dealModel); Response.Redirect("/Home/Deals"); } @@ -127,5 +134,15 @@ namespace CaseAccountingProviderView.Controllers DealViewModel? dealModel = APIUser.GetRequest($"api/deal/get?id={id}"); return dealModel; } - } + + public List GetAllContracts() + { + if (APIUser.User == null) + { + return new(); + } + List? contractModel = APIUser.GetRequest>($"api/deal/getallcontracts"); + return contractModel ?? new(); + } + } } diff --git a/CaseAccounting/CaseAccountingProviderView/Controllers/HomeController.cs b/CaseAccounting/CaseAccountingProviderView/Controllers/HomeController.cs index 241b445..f94615e 100644 --- a/CaseAccounting/CaseAccountingProviderView/Controllers/HomeController.cs +++ b/CaseAccounting/CaseAccountingProviderView/Controllers/HomeController.cs @@ -35,7 +35,60 @@ namespace CaseAccountingProviderView.Controllers return View(); } - [HttpPost] + public IActionResult SpecializationCaselist() + { + return View(); + } + + public IActionResult Diagram() + { + return View(); + } + + [HttpPost] + public int[]? SpecializationCaselist([FromBody] CaseSpecializationListBindingModel listModel) + { + if (APIUser.User == null) + { + return Array.Empty(); + } + byte[]? file = APIUser.PostRequestWithResult + ("api/reportprovider/specializationcaselist", listModel); + return file!.Select(b => (int)b).ToArray(); + } + + public IActionResult GetReport() + { + return View(); + } + + [HttpPost] + public List? GetReport([FromBody] ReportBindingModel reportModel) + { + if (APIUser.User == null) + { + return new(); + } + reportModel.UserId = APIUser.User.Id; + reportModel.UserEmail = APIUser.User.Login; + List? list = APIUser.PostRequestWithResult> + ("api/reportprovider/getreportdata", reportModel); + return list; + } + + [HttpPost] + public void SendByMailStatusReport([FromBody] ReportBindingModel reportModel) + { + if (APIUser.User == null) + { + return; + } + reportModel.UserId = APIUser.User.Id; + reportModel.UserEmail = APIUser.User.Login; + APIUser.PostRequest("api/reportprovider/sendbymailstatusreport", reportModel); + } + + [HttpPost] public void Login(string login, string password) { if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)) @@ -73,15 +126,8 @@ namespace CaseAccountingProviderView.Controllers { return Redirect("~/Home/Enter"); } - /*if (page == 0) - { - page = 1; - }*/ ViewBag.Cases = APIUser.GetRequest> ($"api/case/getallbyuser?userId={APIUser.User.Id}"); - /*ViewBag.Page = page; - ViewBag.NumberOfPages = APIUser.GetRequest - ($"api/student/getnumberofpages?userId={APIUser.User.Id}");*/ return View(); } diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Case/Create.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Case/Create.cshtml index 629984a..12a0aca 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Case/Create.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Case/Create.cshtml @@ -6,7 +6,7 @@
-

+

diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Case/Update.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Case/Update.cshtml index ab2d11d..1ba778b 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Case/Update.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Case/Update.cshtml @@ -14,7 +14,7 @@
-

+

diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Deal/Bind.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Bind.cshtml new file mode 100644 index 0000000..9bb03da --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Bind.cshtml @@ -0,0 +1,37 @@ +@{ + ViewData["Title"] = "Договор"; +} + +@{ +

Привязка контракта к договору

+ +
+
+

+
+
+ +

Номер:

+ + +
+
+ + + + + + + + + + +
Услуга:Цена:Дата:
+
+
+ + +} + diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Deal/Create.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Create.cshtml index 78666c5..1131767 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Deal/Create.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Create.cshtml @@ -6,7 +6,7 @@
-

+

diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Deal/Update.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Update.cshtml index 5740afe..f8dc2a3 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Deal/Update.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Update.cshtml @@ -14,7 +14,7 @@
-

+

diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Create.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Create.cshtml index 8e914d8..d689b05 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Create.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Create.cshtml @@ -6,7 +6,7 @@
-

+

diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Update.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Update.cshtml index 87b7e2f..5dcf48a 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Update.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Update.cshtml @@ -14,7 +14,7 @@
-

+

diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/Deals.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/Deals.cshtml index 73b4f83..5279818 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Home/Deals.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/Deals.cshtml @@ -28,6 +28,9 @@ Дата составления + + Привязать запись + Изменить запись @@ -49,6 +52,9 @@ @item.Date.ToString("yyyy-MM-dd") + + Привязка + Изменить diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/Diagram.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/Diagram.cshtml new file mode 100644 index 0000000..a125855 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/Diagram.cshtml @@ -0,0 +1,15 @@ + +
+

Круговая диаграмма

+
+ +
+ +
+ +
+
+ + + + diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/GetReport.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/GetReport.cshtml new file mode 100644 index 0000000..ade05e5 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/GetReport.cshtml @@ -0,0 +1,55 @@ +@{ + ViewData["Title"] = "Отчет"; +} + +
+

Отчет по слушаниям

+
+ +
+
+

+
+
+ +
+
+

Дата начала:

+ +
+
+

Дата конца:

+ +
+ + +
+ +

+ За период с  + ... +  по  + ... +

+
+ + + + + + + + + + + +
Номер слушанияДелоДата проведенияЮрист
+
+ +
+ + \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/SpecializationCaselist.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/SpecializationCaselist.cshtml new file mode 100644 index 0000000..2df0d95 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/SpecializationCaselist.cshtml @@ -0,0 +1,42 @@ +@{ + ViewData["Title"] = "Список специализаций по делам"; +} + +

Список специализаций по делам

+ +
+
+

+
+
+ + + + + +
+
+ + + + + + + + + + + + + +
Номер дела:Истец:Ответчик:Дата составления:Примечание:Специализация:
+
+
+ + + diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Shared/_Layout.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Shared/_Layout.cshtml index 4c626ff..f759a54 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Shared/_Layout.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Shared/_Layout.cshtml @@ -12,7 +12,7 @@