Compare commits
6 Commits
f5abf30989
...
e08f9b6870
Author | SHA1 | Date | |
---|---|---|---|
e08f9b6870 | |||
8c84e64cb2 | |||
1724d0f4cf | |||
67f4dc1593 | |||
de7b62944f | |||
6b1ad9142c |
@ -14,7 +14,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ExecutorLogic : IExecutorLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IExecutorStorage _executorStorage;
|
||||
|
||||
public ExecutorLogic(ILogger<ExecutorLogic> logger, IExecutorStorage executorStorage)
|
||||
|
@ -6,6 +6,7 @@ using LawCompanyContracts.SearchModels;
|
||||
using LawCompanyContracts.StoragesContracts;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDatabaseImplement.Models;
|
||||
using LawCompanyDatabaseImplement.Implements;
|
||||
|
||||
namespace HotelBusinessLogic.BusinessLogics
|
||||
{
|
||||
@ -16,24 +17,158 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
private readonly IVisitStorage _visitStorage;
|
||||
private readonly IConsultationStorage _consultationStorage;
|
||||
private readonly ICaseStorage _caseStorage;
|
||||
private readonly IClientStorage _clientStorage;
|
||||
private readonly AbstractSaveToExcelExecutor _saveToExcel;
|
||||
private readonly AbstractSaveToWordExecutor _saveToWord;
|
||||
private readonly AbstractSaveToPdfExecutor _saveToPdf;
|
||||
|
||||
public ReportLogicGuarantor(IHearingStorage hearingStorage, ILawyerStorage lawyerStorage,
|
||||
IVisitStorage visitStorage, IConsultationStorage consultationStorage, ICaseStorage caseStorage,
|
||||
AbstractSaveToExcelExecutor saveToExcel, AbstractSaveToWordExecutor saveToWord, AbstractSaveToPdfExecutor saveToPdf)
|
||||
public ReportLogicExecutor(IHearingStorage hearingStorage, ILawyerStorage lawyerStorage,
|
||||
IVisitStorage visitStorage, IConsultationStorage consultationStorage, ICaseStorage caseStorage, IClientStorage clientStorage,
|
||||
AbstractSaveToExcelExecutor saveToExcel, AbstractSaveToWordExecutor saveToWord, AbstractSaveToPdfExecutor saveToPdf)
|
||||
{
|
||||
_hearingStorage = hearingStorage;
|
||||
_lawyerStorage = lawyerStorage;
|
||||
_visitStorage = visitStorage;
|
||||
_consultationStorage = consultationStorage;
|
||||
_caseStorage = caseStorage;
|
||||
_clientStorage = clientStorage;
|
||||
_caseStorage = caseStorage;
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
_saveToPdf = saveToPdf;
|
||||
}
|
||||
|
||||
|
||||
public List<ReportClientHearingViewModel> GetClientHearing(List<int> Ids)
|
||||
{
|
||||
if (Ids == null || !Ids.Any())
|
||||
{
|
||||
return new List<ReportClientHearingViewModel>();
|
||||
}
|
||||
|
||||
var clients = _clientStorage.GetFullList();
|
||||
var hearings = _hearingStorage.GetFullList();
|
||||
var visits = _visitStorage.GetFullList();
|
||||
|
||||
var filteredClients = clients.Where(c => Ids.Contains(c.Id)).ToList();
|
||||
var result = new List<ReportClientHearingViewModel>();
|
||||
|
||||
foreach (var client in filteredClients)
|
||||
{
|
||||
var record = new ReportClientHearingViewModel
|
||||
{
|
||||
FIO = client.FIO,
|
||||
Hearing = new List<Tuple<string, DateTime>>()
|
||||
};
|
||||
|
||||
var clientVisits = visits.Where(v => v.VisitClients.ContainsKey(client.Id)).ToList();
|
||||
foreach (var visit in clientVisits)
|
||||
{
|
||||
if (visit.HearingId.HasValue)
|
||||
{
|
||||
var hearing = hearings.FirstOrDefault(h => h.Id == visit.HearingId.Value);
|
||||
if (hearing != null)
|
||||
{
|
||||
record.Hearing.Add(new Tuple<string, DateTime>(hearing.Judge, hearing.HearingDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.Add(record);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ReportClientsViewModel> GetClients(ReportExecutorBindingModel model)
|
||||
{
|
||||
var listAll = new List<ReportClientsViewModel>();
|
||||
|
||||
// Получаем список всех дел для указанного исполнителя и за указанный период
|
||||
var cases = _caseStorage.GetFilteredList(new CaseSearchModel
|
||||
{
|
||||
ExecutorId = model.ExecutorId,
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
});
|
||||
|
||||
// Добавляем информацию о клиентах из дел
|
||||
foreach (var _case in cases)
|
||||
{
|
||||
foreach (var cc in _case.CaseClients.Values)
|
||||
{
|
||||
listAll.Add(new ReportClientsViewModel
|
||||
{
|
||||
FIO = cc.FIO,
|
||||
Name = _case.Name,
|
||||
Status = _case.Status
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Получаем список всех консультаций для указанного исполнителя и за указанный период
|
||||
var consultations = _consultationStorage.GetFilteredList(new ConsultationSearchModel
|
||||
{
|
||||
GuarantorId = model.ExecutorId,
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
});
|
||||
|
||||
// Добавляем информацию о клиентах из консультаций
|
||||
foreach (var consultation in consultations)
|
||||
{
|
||||
foreach (var cc in consultation.Case.CaseClients.Values)
|
||||
{
|
||||
listAll.Add(new ReportClientsViewModel
|
||||
{
|
||||
FIO = cc.FIO,
|
||||
ConsultationDate = consultation.ConsultationDate,
|
||||
Cost = consultation.Cost
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return listAll;
|
||||
}
|
||||
|
||||
public void SaveClientHearingToExcelFile(ReportExecutorBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfoExecutor
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список слушаний",
|
||||
ClientHearings = GetClientHearing(model.Ids)
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveClientHearingToWordFile(ReportExecutorBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfoExecutor
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список слушаний",
|
||||
ClientHearings = GetClientHearing(model.Ids)
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveClientsToPdfFile(ReportExecutorBindingModel model)
|
||||
{
|
||||
if (model.DateFrom == null)
|
||||
{
|
||||
throw new ArgumentException("Дата начала не задана");
|
||||
}
|
||||
|
||||
if (model.DateTo == null)
|
||||
{
|
||||
throw new ArgumentException("Дата окончания не задана");
|
||||
}
|
||||
_saveToPdf.CreateDoc(new PdfInfoExecutor
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список клиентов",
|
||||
DateFrom = model.DateFrom!.Value,
|
||||
DateTo = model.DateTo!.Value,
|
||||
Clients = GetClients(model)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ using LawCompanyDatabaseImplement.Models;
|
||||
|
||||
namespace LawCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ReportLogicGuarantor : IReportGuarantorLogic
|
||||
{
|
||||
private readonly IVisitStorage _visitStorage;
|
||||
public class ReportLogicGuarantor : IReportGuarantorLogic
|
||||
{
|
||||
/*private readonly IVisitStorage _visitStorage;
|
||||
private readonly IClientStorage _clientStorage;
|
||||
private readonly ICaseStorage _caseStorage;
|
||||
private readonly IConsultationStorage _consultationStorage;
|
||||
@ -32,8 +32,30 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
_saveToPdf = saveToPdf;
|
||||
}
|
||||
}*/
|
||||
public List<ReportLawyerHearingViewModel> GetLawyerHearing(List<int> Ids)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<ReportLawyersViewModel> GetLawyers(ReportGuarantorBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
public void SaveLawyerHearingToExcelFile(ReportGuarantorBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveLawyerHearingToWordFile(ReportGuarantorBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveLawyersToPdfFile(ReportGuarantorBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,7 +8,73 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage
|
||||
{
|
||||
internal class AbstractSaveToExcelExecutor
|
||||
public abstract class AbstractSaveToExcelExecutor
|
||||
{
|
||||
public void CreateReport(ExcelInfoExecutor info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
|
||||
uint rowIndex = 2;
|
||||
|
||||
foreach (var mc in info.ClientHearings)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = mc.FIO,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
foreach (var conference in mc.Hearing)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = conference.Item1,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = conference.Item2.ToString("d"),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
protected abstract void CreateExcel(ExcelInfoExecutor info);
|
||||
|
||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||
|
||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||
|
||||
protected abstract void SaveExcel(ExcelInfoExecutor info);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,7 +8,78 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage
|
||||
{
|
||||
internal class AbstractSaveToPdfExecutor
|
||||
public abstract class AbstractSaveToPdfExecutor
|
||||
{
|
||||
public void CreateDoc(PdfInfoExecutor info)
|
||||
{
|
||||
CreatePdf(info);
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = info.Title,
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
CreateTable(new List<string> { "4cm", "5cm", "3cm", "4cm", "2cm" });
|
||||
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "ФИО клиента", "Дата консультации", "Стоимость консультации", "Название дела", "Статус дела" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
foreach (var member in info.Clients)
|
||||
{
|
||||
bool IsDate = true;
|
||||
if (member.ConsultationDate.ToShortDateString() == "01.01.0001")
|
||||
{
|
||||
IsDate = false;
|
||||
}
|
||||
|
||||
bool IsCost = true;
|
||||
if (member.Cost.ToString() == "0")
|
||||
{
|
||||
IsCost = false;
|
||||
}
|
||||
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string>
|
||||
{
|
||||
member.FIO,
|
||||
IsDate is true ? member.ConsultationDate.ToShortDateString() : string.Empty,
|
||||
IsCost is true ? member.Cost.ToString() : string.Empty,
|
||||
member.Name,
|
||||
member.Status.ToString(),
|
||||
},
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
}
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"Итого: {info.Clients.Sum(x => x.Cost)}\t",
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
|
||||
});
|
||||
|
||||
SavePdf(info);
|
||||
}
|
||||
|
||||
protected abstract void CreatePdf(PdfInfoExecutor info);
|
||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||
protected abstract void CreateTable(List<string> columns);
|
||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||
protected abstract void SavePdf(PdfInfoExecutor info);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,7 +8,55 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage
|
||||
{
|
||||
internal class AbstractSaveToWordExecutor
|
||||
public abstract class AbstractSaveToWordExecutor
|
||||
{
|
||||
public void CreateDoc(WordInfoExecutor info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var mc in info.ClientHearings)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)>
|
||||
{ ( mc.FIO, new WordTextProperties { Size = "20", Bold=true})},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var conference in mc.Hearing)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)>
|
||||
{ (conference.Item1 + " - ", new WordTextProperties { Size = "16", Bold=false}),
|
||||
(conference.Item2.ToShortDateString(), new WordTextProperties { Size = "16", Bold=false})},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
protected abstract void CreateWord(WordInfoExecutor info);
|
||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||
protected abstract void SaveWord(WordInfoExecutor info);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,7 +8,73 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage
|
||||
{
|
||||
internal class AbstractSaveToWordGuarantor
|
||||
public class AbstractSaveToWordGuarantor
|
||||
{
|
||||
/*public void CreateReport(ExcelInfoGuarantor info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
z
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
|
||||
uint rowIndex = 2;
|
||||
|
||||
foreach (var mc in info.MemberConferences)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = $"{mc.MemberSurname} {mc.MemberName} {mc.MemberPatronymic}",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
foreach (var conference in mc.ConferenceBookings)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = conference.Item1,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = conference.Item2.ToString("d"),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
protected abstract void CreateExcel(ExcelInfoOrganiser info);
|
||||
|
||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||
|
||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||
|
||||
protected abstract void SaveExcel(ExcelInfoOrganiser info);*/
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -8,6 +9,8 @@ namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelInfoExecutor
|
||||
{
|
||||
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ReportClientHearingViewModel> ClientHearings { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,7 +7,12 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
internal class PdfInfoExecutor
|
||||
public class PdfInfoExecutor
|
||||
{
|
||||
public string FileName { get; set; } = "C:\\Reports\\pdffile.pdf";
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public DateTime DateFrom { get; set; }
|
||||
public DateTime DateTo { get; set; }
|
||||
public List<ReportClientsViewModel> Clients { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,7 +7,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
internal class WordInfoExecutor
|
||||
public class WordInfoExecutor
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ReportClientHearingViewModel> ClientHearings { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,11 @@
|
||||
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DocumentFormat.OpenXml.Office2013.Excel;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -7,7 +14,321 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
internal class SaveToExcelExecutor
|
||||
public class SaveToExcelExecutor : AbstractSaveToExcelExecutor
|
||||
{
|
||||
private SpreadsheetDocument? _spreadsheetDocument;
|
||||
private SharedStringTablePart? _shareStringPart;
|
||||
private Worksheet? _worksheet;
|
||||
|
||||
private static void CreateStyles(WorkbookPart workbookpart)
|
||||
{
|
||||
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
||||
sp.Stylesheet = new Stylesheet();
|
||||
|
||||
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
||||
|
||||
var fontUsual = new Font();
|
||||
fontUsual.Append(new FontSize() { Val = 12D });
|
||||
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U });
|
||||
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
||||
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
||||
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
|
||||
var fontTitle = new Font();
|
||||
fontTitle.Append(new Bold());
|
||||
fontTitle.Append(new FontSize() { Val = 14D });
|
||||
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U });
|
||||
fontTitle.Append(new FontName() { Val = "Times New Roman" });
|
||||
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
||||
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
|
||||
fonts.Append(fontUsual);
|
||||
fonts.Append(fontTitle);
|
||||
|
||||
var fills = new Fills() { Count = 2U };
|
||||
|
||||
var fill1 = new Fill();
|
||||
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
||||
|
||||
var fill2 = new Fill();
|
||||
fill2.Append(new PatternFill() { PatternType = PatternValues.Gray125 });
|
||||
|
||||
fills.Append(fill1);
|
||||
fills.Append(fill2);
|
||||
|
||||
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);
|
||||
|
||||
var cellStyleFormats = new CellStyleFormats()
|
||||
{
|
||||
Count = 1U
|
||||
};
|
||||
var cellFormatStyle = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U
|
||||
};
|
||||
|
||||
cellStyleFormats.Append(cellFormatStyle);
|
||||
|
||||
var cellFormats = new CellFormats()
|
||||
{
|
||||
Count = 3U
|
||||
};
|
||||
var cellFormatFont = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U,
|
||||
FormatId = 0U,
|
||||
ApplyFont = true
|
||||
};
|
||||
var cellFormatFontAndBorder = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 1U,
|
||||
FormatId = 0U,
|
||||
ApplyFont = true,
|
||||
ApplyBorder = true
|
||||
};
|
||||
var cellFormatTitle = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 1U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U,
|
||||
FormatId = 0U,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true,
|
||||
Horizontal = HorizontalAlignmentValues.Center
|
||||
},
|
||||
ApplyFont = true
|
||||
};
|
||||
cellFormats.Append(cellFormatFont);
|
||||
cellFormats.Append(cellFormatFontAndBorder);
|
||||
cellFormats.Append(cellFormatTitle);
|
||||
var cellStyles = new CellStyles() { Count = 1U };
|
||||
cellStyles.Append(new CellStyle()
|
||||
{
|
||||
Name = "Normal",
|
||||
FormatId = 0U,
|
||||
BuiltinId = 0U
|
||||
});
|
||||
var differentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
|
||||
{
|
||||
Count = 0U
|
||||
};
|
||||
|
||||
var tableStyles = new TableStyles()
|
||||
{
|
||||
Count = 0U,
|
||||
DefaultTableStyle = "TableStyleMedium2",
|
||||
DefaultPivotStyle = "PivotStyleLight16"
|
||||
};
|
||||
var stylesheetExtensionList = new StylesheetExtensionList();
|
||||
var stylesheetExtension1 = new StylesheetExtension()
|
||||
{
|
||||
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
|
||||
};
|
||||
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
stylesheetExtension1.Append(new SlicerStyles()
|
||||
{
|
||||
DefaultSlicerStyle = "SlicerStyleLight1"
|
||||
});
|
||||
var stylesheetExtension2 = new StylesheetExtension()
|
||||
{
|
||||
Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
|
||||
};
|
||||
stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
||||
stylesheetExtension2.Append(new TimelineStyles()
|
||||
{
|
||||
DefaultTimelineStyle = "TimeSlicerStyleLight1"
|
||||
});
|
||||
|
||||
stylesheetExtensionList.Append(stylesheetExtension1);
|
||||
stylesheetExtensionList.Append(stylesheetExtension2);
|
||||
|
||||
sp.Stylesheet.Append(fonts);
|
||||
sp.Stylesheet.Append(fills);
|
||||
sp.Stylesheet.Append(borders);
|
||||
sp.Stylesheet.Append(cellStyleFormats);
|
||||
sp.Stylesheet.Append(cellFormats);
|
||||
sp.Stylesheet.Append(cellStyles);
|
||||
sp.Stylesheet.Append(differentialFormats);
|
||||
sp.Stylesheet.Append(tableStyles);
|
||||
sp.Stylesheet.Append(stylesheetExtensionList);
|
||||
}
|
||||
|
||||
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
|
||||
{
|
||||
return styleInfo switch
|
||||
{
|
||||
ExcelStyleInfoType.Title => 2U,
|
||||
ExcelStyleInfoType.TextWithBroder => 1U,
|
||||
ExcelStyleInfoType.Text => 0U,
|
||||
_ => 0U,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void CreateExcel(ExcelInfoExecutor info)
|
||||
{
|
||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
|
||||
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
||||
workbookpart.Workbook = new Workbook();
|
||||
CreateStyles(workbookpart);
|
||||
_shareStringPart = _spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any() ? _spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First() : _spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
|
||||
|
||||
if (_shareStringPart.SharedStringTable == null)
|
||||
{
|
||||
_shareStringPart.SharedStringTable = new SharedStringTable();
|
||||
}
|
||||
|
||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||
|
||||
var sheets = _spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||
var sheet = new Sheet()
|
||||
{
|
||||
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
_worksheet = worksheetPart.Worksheet;
|
||||
}
|
||||
|
||||
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
|
||||
{
|
||||
if (_worksheet == null || _shareStringPart == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sheetData = _worksheet.GetFirstChild<SheetData>();
|
||||
|
||||
if (sheetData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Row row;
|
||||
|
||||
if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any())
|
||||
{
|
||||
row = sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
row = new Row() { RowIndex = excelParams.RowIndex };
|
||||
sheetData.Append(row);
|
||||
}
|
||||
|
||||
Cell cell;
|
||||
|
||||
if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any())
|
||||
{
|
||||
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
Cell? refCell = null;
|
||||
foreach (Cell rowCell in row.Elements<Cell>())
|
||||
{
|
||||
if (string.Compare(rowCell.CellReference!.Value, excelParams.CellReference, true) > 0)
|
||||
{
|
||||
refCell = rowCell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var newCell = new Cell()
|
||||
{
|
||||
CellReference = excelParams.CellReference
|
||||
};
|
||||
row.InsertBefore(newCell, refCell);
|
||||
cell = newCell;
|
||||
}
|
||||
|
||||
_shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text)));
|
||||
_shareStringPart.SharedStringTable.Save();
|
||||
cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
|
||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
||||
}
|
||||
|
||||
protected override void MergeCells(ExcelMergeParameters excelParams)
|
||||
{
|
||||
if (_worksheet == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MergeCells mergeCells;
|
||||
if (_worksheet.Elements<MergeCells>().Any())
|
||||
{
|
||||
mergeCells = _worksheet.Elements<MergeCells>().First();
|
||||
}
|
||||
else
|
||||
{
|
||||
mergeCells = new MergeCells();
|
||||
if (_worksheet.Elements<CustomSheetView>().Any())
|
||||
{
|
||||
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<CustomSheetView>().First());
|
||||
}
|
||||
else
|
||||
{
|
||||
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<SheetData>().First());
|
||||
}
|
||||
}
|
||||
var mergeCell = new MergeCell()
|
||||
{
|
||||
Reference = new StringValue(excelParams.Merge)
|
||||
};
|
||||
mergeCells.Append(mergeCell);
|
||||
}
|
||||
|
||||
protected override void SaveExcel(ExcelInfoExecutor info)
|
||||
{
|
||||
if (_spreadsheetDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||
_spreadsheetDocument.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ using DocumentFormat.OpenXml;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToExcelGuarantor : AbstractSaveToExcelGuarantor
|
||||
/*public class SaveToExcelGuarantor : AbstractSaveToExcelGuarantor
|
||||
{
|
||||
private SpreadsheetDocument? _spreadsheetDocument;
|
||||
private SharedStringTablePart? _shareStringPart;
|
||||
@ -324,5 +324,5 @@ namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||
_spreadsheetDocument.Close();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
@ -1,12 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.Rendering;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
internal class SaveToPdfExecutor
|
||||
public class SaveToPdfExecutor : AbstractSaveToPdfExecutor
|
||||
{
|
||||
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,
|
||||
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
|
||||
_ => ParagraphAlignment.Justify,
|
||||
};
|
||||
}
|
||||
|
||||
private static 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;
|
||||
}
|
||||
|
||||
protected override 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;
|
||||
}
|
||||
|
||||
protected override void CreatePdf(PdfInfoExecutor info)
|
||||
{
|
||||
_document = new Document();
|
||||
DefineStyles(_document);
|
||||
_section = _document.AddSection();
|
||||
}
|
||||
|
||||
protected override 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;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void CreateTable(List<string> columns)
|
||||
{
|
||||
if (_document == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_table = _document.LastSection.AddTable();
|
||||
foreach (var elem in columns)
|
||||
{
|
||||
_table.AddColumn(elem);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SavePdf(PdfInfoExecutor info)
|
||||
{
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = _document
|
||||
};
|
||||
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(info.FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,125 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||
|
||||
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
internal class SaveToWordExecutor
|
||||
public class SaveToWordExecutor : AbstractSaveToWordExecutor
|
||||
{
|
||||
private WordprocessingDocument? _wordDocument;
|
||||
private Body? _docBody;
|
||||
|
||||
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
WordJustificationType.Both => JustificationValues.Both,
|
||||
WordJustificationType.Center => JustificationValues.Center,
|
||||
_ => JustificationValues.Left,
|
||||
};
|
||||
}
|
||||
|
||||
private static SectionProperties CreateSectionProperties()
|
||||
{
|
||||
var properties = new SectionProperties();
|
||||
var pageSize = new PageSize
|
||||
{
|
||||
Orient = PageOrientationValues.Portrait
|
||||
};
|
||||
properties.AppendChild(pageSize);
|
||||
return properties;
|
||||
}
|
||||
|
||||
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||
{
|
||||
if (paragraphProperties == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var properties = new ParagraphProperties();
|
||||
|
||||
properties.AppendChild(new Justification()
|
||||
{
|
||||
Val = GetJustificationValues(paragraphProperties.JustificationType)
|
||||
});
|
||||
|
||||
properties.AppendChild(new SpacingBetweenLines
|
||||
{
|
||||
LineRule = LineSpacingRuleValues.Auto
|
||||
});
|
||||
|
||||
properties.AppendChild(new Indentation());
|
||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||
|
||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||
{
|
||||
paragraphMarkRunProperties.AppendChild(new FontSize
|
||||
{
|
||||
Val = paragraphProperties.Size
|
||||
});
|
||||
}
|
||||
|
||||
properties.AppendChild(paragraphMarkRunProperties);
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
protected override void CreateParagraph(WordParagraph paragraph)
|
||||
{
|
||||
if (_docBody == null || paragraph == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var docParagraph = new Paragraph();
|
||||
|
||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||
|
||||
foreach (var run in paragraph.Texts)
|
||||
{
|
||||
var docRun = new Run();
|
||||
var properties = new RunProperties();
|
||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||
|
||||
if (run.Item2.Bold)
|
||||
{
|
||||
properties.AppendChild(new Bold());
|
||||
}
|
||||
|
||||
docRun.AppendChild(properties);
|
||||
|
||||
docRun.AppendChild(new Text
|
||||
{
|
||||
Text = run.Item1,
|
||||
Space = SpaceProcessingModeValues.Preserve
|
||||
});
|
||||
|
||||
docParagraph.AppendChild(docRun);
|
||||
}
|
||||
_docBody.AppendChild(docParagraph);
|
||||
}
|
||||
|
||||
protected override void CreateWord(WordInfoExecutor info)
|
||||
{
|
||||
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = new Document();
|
||||
_docBody = mainPart.Document.AppendChild(new Body());
|
||||
}
|
||||
|
||||
protected override void SaveWord(WordInfoExecutor info)
|
||||
{
|
||||
if (_docBody == null || _wordDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_docBody.AppendChild(CreateSectionProperties());
|
||||
_wordDocument.MainDocumentPart!.Document.Save();
|
||||
_wordDocument.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ namespace LawCompanyContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public CaseStatus Status { get; set; } = CaseStatus.Неизвестен;
|
||||
public string CaseType { get; set; } = string.Empty;
|
||||
public DateTime DateCreate { get; set; }
|
||||
public DateTime? DateImplement { get; set; }
|
||||
public Dictionary<int, IClientModel> CaseClients { get; set; } = new();
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyContracts.BindingModels
|
||||
{
|
||||
internal class MailConfigBindingModel
|
||||
public class MailConfigBindingModel
|
||||
{
|
||||
public string MailLogin { get; set; } = string.Empty;
|
||||
public string MailPassword { get; set; } = string.Empty;
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyContracts.BindingModels
|
||||
{
|
||||
internal class MailSendInfoBindingModel
|
||||
public class MailSendInfoBindingModel
|
||||
{
|
||||
public string MailAddress { get; set; } = string.Empty;
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyContracts.BindingModels
|
||||
{
|
||||
internal class ReportExecutorBindingModel
|
||||
public class ReportExecutorBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public DateTime? DateFrom { get; set; }
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyContracts.BindingModels
|
||||
{
|
||||
internal class ReportGuarantorBindingModel
|
||||
public class ReportGuarantorBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string HearingName { get; set; } = string.Empty;
|
||||
|
@ -6,7 +6,7 @@ namespace LawCompanyContracts.BindingModels
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public DateTime VisitDate { get; set; }
|
||||
public int HearingId { get; set; }
|
||||
public int? HearingId { get; set; }
|
||||
public Dictionary<int, IClientModel> VisitClients { get; set; } = new();
|
||||
public int ExecutorId { get; set; }
|
||||
}
|
||||
|
@ -10,11 +10,7 @@ namespace LawCompanyContracts.BusinessLogicContracts
|
||||
List<CaseViewModel>? ReadList(CaseSearchModel? model);
|
||||
CaseViewModel? ReadElement(CaseSearchModel model);
|
||||
bool CreateCase(CaseBindingModel model);
|
||||
bool CaseAnalysis(CaseBindingModel model);
|
||||
bool CaseHearing(CaseBindingModel model);
|
||||
bool CloseCase(CaseBindingModel model);
|
||||
bool DeleteCase(CaseBindingModel model);
|
||||
bool AddClientToCase(CaseSearchModel model, IClientModel client);
|
||||
bool Update(CaseBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,12 @@ using LawCompanyContracts.ViewModels;
|
||||
|
||||
namespace LawCompanyContracts.BusinessLogicContracts
|
||||
{
|
||||
internal class IReportExecutorLogic
|
||||
public interface IReportExecutorLogic
|
||||
{
|
||||
List<ReportClientCaseViewModel> GetClientCaseBooking(List<int> Ids);
|
||||
List<ReportClientsViewModel> GetClients(ReportOrganiserBindingModel model);
|
||||
void SaveClientCaseToWordFile(ReportOrganiserBindingModel model);
|
||||
void SaveClientCaseToExcelFile(ReportOrganiserBindingModel model);
|
||||
void SaveClientsToPdfFile(ReportOrganiserBindingModel model);
|
||||
List<ReportClientHearingViewModel> GetClientHearing(List<int> Ids);
|
||||
List<ReportClientsViewModel> GetClients(ReportExecutorBindingModel model);
|
||||
void SaveClientHearingToWordFile(ReportExecutorBindingModel model);
|
||||
void SaveClientHearingToExcelFile(ReportExecutorBindingModel model);
|
||||
void SaveClientsToPdfFile(ReportExecutorBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ using LawCompanyContracts.ViewModels;
|
||||
|
||||
namespace LawCompanyContracts.BusinessLogicContracts
|
||||
{
|
||||
internal class IReportGuarantorLogic
|
||||
public interface IReportGuarantorLogic
|
||||
{
|
||||
List<ReportLawyerHearingViewModel> GetLawyerHearing(List<int> Ids);
|
||||
List<ReportLawyersViewModel> GetLawyers(ReportGuarantorBindingModel model);
|
||||
|
@ -4,7 +4,6 @@
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? CaseType { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public int? ExecutorId { get; set; }
|
||||
|
@ -11,8 +11,6 @@ namespace LawCompanyContracts.ViewModels
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Статус")]
|
||||
public CaseStatus Status { get; set; } = CaseStatus.Неизвестен;
|
||||
[DisplayName("Вид производства")]
|
||||
public string CaseType { get; set; } = string.Empty;
|
||||
[DisplayName("Дата создания")]
|
||||
public DateTime DateCreate { get; set; }
|
||||
[DisplayName("Дата выполнения")]
|
||||
|
@ -16,5 +16,6 @@ namespace LawCompanyContracts.ViewModels
|
||||
public int CaseId { get; set; }
|
||||
public int GuarantorId { get; set; }
|
||||
public Dictionary<int, ILawyerModel> ConsultationLawyers { get; set; } = new();
|
||||
}
|
||||
public CaseViewModel Case { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyContracts.ViewModels
|
||||
{
|
||||
public class ReportClientHearingViewModel
|
||||
{
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
public List<Tuple<string, DateTime>> Hearing { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using LawCompanyDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,7 +7,15 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyContracts.ViewModels
|
||||
{
|
||||
internal class ReportClientsViewModel
|
||||
public class ReportClientsViewModel
|
||||
{
|
||||
// клиент
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
// дело
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public CaseStatus Status { get; set; } = CaseStatus.Неизвестен;
|
||||
// консультация
|
||||
public DateTime ConsultationDate { get; set; }
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyContracts.ViewModels
|
||||
{
|
||||
internal class ReportLawyerHearingViewModel
|
||||
public class ReportLawyerHearingViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyContracts.ViewModels
|
||||
{
|
||||
internal class ReportLawyersViewModel
|
||||
public class ReportLawyersViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace LawCompanyContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Дата визита")]
|
||||
public DateTime VisitDate { get; set; }
|
||||
public int HearingId { get; set; }
|
||||
public int? HearingId { get; set; }
|
||||
public Dictionary<int, IClientModel> VisitClients { get; set; } = new();
|
||||
public int ExecutorId { get; set; }
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ namespace LawCompanyDataModels.Models
|
||||
Dictionary<int, IClientModel> CaseClients { get; }
|
||||
string Name { get; }
|
||||
CaseStatus Status { get; }
|
||||
string CaseType { get; }
|
||||
DateTime DateCreate { get; }
|
||||
DateTime? DateImplement { get; }
|
||||
public int ExecutorId { get; }
|
||||
|
@ -4,7 +4,7 @@
|
||||
{
|
||||
Dictionary<int, IClientModel> VisitClients { get; }
|
||||
DateTime VisitDate { get; }
|
||||
int HearingId { get; }
|
||||
int? HearingId { get; }
|
||||
public int ExecutorId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -93,8 +93,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var _case = context.Cases.FirstOrDefault(rec =>
|
||||
rec.Id == model.Id);
|
||||
var _case = context.Cases.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (_case == null)
|
||||
{
|
||||
return null;
|
||||
@ -102,21 +101,19 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
_case.Update(model);
|
||||
context.SaveChanges();
|
||||
_case.UpdateClients(context, model);
|
||||
|
||||
transaction.Commit();
|
||||
return _case.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public CaseViewModel? Delete(CaseBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var element = context.Cases
|
||||
.Include(x => x.Clients)
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
var element = context.Cases.Include(x => x.Clients).FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Cases.Remove(element);
|
||||
|
@ -3,6 +3,7 @@ using LawCompanyContracts.SearchModels;
|
||||
using LawCompanyContracts.StoragesContracts;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Implements
|
||||
{
|
||||
@ -11,9 +12,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
public List<ExecutorViewModel> GetFullList()
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Executors
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
return context.Executors.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<ExecutorViewModel> GetFilteredList(ExecutorSearchModel model)
|
||||
@ -23,38 +22,53 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Executors
|
||||
.Where(x => x.Email.Equals(model.Email))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Executors
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
using var context = new LawCompanyDatabase();
|
||||
|
||||
return context.Executors
|
||||
.Include(x => x.Cases)
|
||||
.Include(x => x.Clients)
|
||||
.Include(x => x.Visits)
|
||||
.Where(x => x.Email.Contains(model.Email) && x.Password == model.Password)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public ExecutorViewModel? GetElement(ExecutorSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
||||
&& string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LawCompanyDatabase();
|
||||
using var context = new LawCompanyDatabase();
|
||||
|
||||
return context.Executors
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email)
|
||||
&& x.Email == model.Email) || (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.Executors
|
||||
.Include(x => x.Cases)
|
||||
.Include(x => x.Clients)
|
||||
.Include(x => x.Visits)
|
||||
.FirstOrDefault(x => x.Id == model.Id)?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.Email) && !string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return context.Executors
|
||||
.Include(x => x.Cases)
|
||||
.Include(x => x.Clients)
|
||||
.Include(x => x.Visits)
|
||||
.FirstOrDefault(x => x.Email.Equals(model.Email) && x.Password.Equals(model.Password))?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
return context.Executors
|
||||
.Include(x => x.Cases)
|
||||
.Include(x => x.Clients)
|
||||
.Include(x => x.Visits)
|
||||
.FirstOrDefault(x => x.Email.Equals(model.Email))?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ExecutorViewModel? Insert(ExecutorBindingModel model)
|
||||
{
|
||||
|
@ -3,96 +3,111 @@ using LawCompanyContracts.SearchModels;
|
||||
using LawCompanyContracts.StoragesContracts;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Implements
|
||||
{
|
||||
public class GuarantorStorage : IGuarantorStorage
|
||||
{
|
||||
public List<GuarantorViewModel> GetFullList()
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Guarantors
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public class GuarantorStorage : IGuarantorStorage
|
||||
{
|
||||
public List<GuarantorViewModel> GetFullList()
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Guarantors.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<GuarantorViewModel> GetFilteredList(GuarantorSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
||||
&& string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Guarantors
|
||||
.Where(x => x.Email.Equals(model.Email))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Guarantors
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
public List<GuarantorViewModel> GetFilteredList(GuarantorSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && string.IsNullOrEmpty(model.FIO)
|
||||
&& string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
public GuarantorViewModel? GetElement(GuarantorSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
||||
&& string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LawCompanyDatabase();
|
||||
using var context = new LawCompanyDatabase();
|
||||
|
||||
return context.Guarantors
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email)
|
||||
&& x.Email == model.Email) || (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
return context.Guarantors
|
||||
.Include(x => x.Consultations)
|
||||
.Include(x => x.Lawyers)
|
||||
.Include(x => x.Hearings)
|
||||
.Where(x => x.Email.Contains(model.Email) && x.Password == model.Password)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public GuarantorViewModel? Insert(GuarantorBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var newGuarantor = Guarantor.Create(context, model);
|
||||
if (newGuarantor == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Guarantors.Add(newGuarantor);
|
||||
context.SaveChanges();
|
||||
return newGuarantor.GetViewModel;
|
||||
}
|
||||
public GuarantorViewModel? GetElement(GuarantorSearchModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
|
||||
public GuarantorViewModel? Update(GuarantorBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var executor = context.Guarantors.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (executor == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
executor.Update(model);
|
||||
context.SaveChanges();
|
||||
return executor.GetViewModel;
|
||||
}
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.Guarantors
|
||||
.Include(x => x.Consultations)
|
||||
.Include(x => x.Lawyers)
|
||||
.Include(x => x.Hearings)
|
||||
.FirstOrDefault(x => x.Id == model.Id)?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
public GuarantorViewModel? Delete(GuarantorBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var element = context.Guarantors.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Guarantors.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.Email) && !string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return context.Guarantors
|
||||
.Include(x => x.Consultations)
|
||||
.Include(x => x.Lawyers)
|
||||
.Include(x => x.Hearings)
|
||||
.FirstOrDefault(x => x.Email.Equals(model.Email) && x.Password.Equals(model.Password))?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
return context.Guarantors
|
||||
.Include(x => x.Consultations)
|
||||
.Include(x => x.Lawyers)
|
||||
.Include(x => x.Hearings)
|
||||
.FirstOrDefault(x => x.Email.Equals(model.Email))?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public GuarantorViewModel? Insert(GuarantorBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var newGuarantor = Guarantor.Create(context, model);
|
||||
if (newGuarantor == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Guarantors.Add(newGuarantor);
|
||||
context.SaveChanges();
|
||||
return newGuarantor.GetViewModel;
|
||||
}
|
||||
|
||||
public GuarantorViewModel? Update(GuarantorBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var executor = context.Guarantors.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (executor == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
executor.Update(model);
|
||||
context.SaveChanges();
|
||||
return executor.GetViewModel;
|
||||
}
|
||||
|
||||
public GuarantorViewModel? Delete(GuarantorBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var element = context.Guarantors.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Guarantors.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Visits
|
||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||
.Where(x => x.ExecutorId == model.ExecutorId && x.VisitDate >= model.DateFrom && x.VisitDate <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -121,8 +121,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var visit = context.Visits.FirstOrDefault(rec =>
|
||||
rec.Id == model.Id);
|
||||
var visit = context.Visits.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (visit == null)
|
||||
{
|
||||
return null;
|
||||
@ -142,9 +141,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
public VisitViewModel? Delete(VisitBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var element = context.Visits
|
||||
.Include(x => x.Clients)
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
var element = context.Visits.Include(x => x.Clients).FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Visits.Remove(element);
|
||||
|
@ -16,7 +16,7 @@ namespace LawCompanyDatabaseImplement
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
//optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-6GNIALH9\SQLEXPRESS;Initial Catalog=LawCompanyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-H8060U3\SQLEXPRESS;Initial Catalog=LawCompanyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-7DB3VEN\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
543
LawCompany/LawCompanyDatabaseImplement/Migrations/20240526073959_test.Designer.cs
generated
Normal file
543
LawCompany/LawCompanyDatabaseImplement/Migrations/20240526073959_test.Designer.cs
generated
Normal file
@ -0,0 +1,543 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using LawCompanyDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(LawCompanyDatabase))]
|
||||
[Migration("20240526073959_test")]
|
||||
partial class test
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CaseType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.CaseClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("CaseClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("ConsultationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Consultations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ConsultationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ConsultationId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("ConsultationLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Executor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Executors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Guarantor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Guarantors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("HearingDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Judge")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.HearingLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("VisitDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.ToTable("Visits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.VisitClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("VisitId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("VisitId");
|
||||
|
||||
b.ToTable("VisitClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.CaseClient", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("CaseClients")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
||||
.WithMany()
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Consultations")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Consultation", "Consultation")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("ConsultationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("ConsultationLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Consultation");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.HearingLawyer", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("HearingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("HearingLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Hearing");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("GuarantorId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
||||
.WithMany("Visits")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
||||
.WithMany()
|
||||
.HasForeignKey("HearingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Hearing");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.VisitClient", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("ClientVisits")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Visit", "Visit")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("VisitId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Visit");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("CaseClients");
|
||||
|
||||
b.Navigation("ClientVisits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Executor", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Clients");
|
||||
|
||||
b.Navigation("Visits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Guarantor", b =>
|
||||
{
|
||||
b.Navigation("Consultations");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("ConsultationLawyers");
|
||||
|
||||
b.Navigation("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,412 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class test : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Executors",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Executors", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Guarantors",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Guarantors", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Cases",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CaseType = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Cases", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Cases_Executors_ExecutorId",
|
||||
column: x => x.ExecutorId,
|
||||
principalTable: "Executors",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Clients",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Clients_Executors_ExecutorId",
|
||||
column: x => x.ExecutorId,
|
||||
principalTable: "Executors",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Hearings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
HearingDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
Judge = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
GuarantorId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Hearings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Hearings_Guarantors_GuarantorId",
|
||||
column: x => x.GuarantorId,
|
||||
principalTable: "Guarantors",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Lawyers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
GuarantorId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Lawyers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
||||
column: x => x.GuarantorId,
|
||||
principalTable: "Guarantors",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Consultations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Cost = table.Column<double>(type: "float", nullable: false),
|
||||
ConsultationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CaseId = table.Column<int>(type: "int", nullable: false),
|
||||
GuarantorId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Consultations", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Consultations_Cases_CaseId",
|
||||
column: x => x.CaseId,
|
||||
principalTable: "Cases",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Consultations_Guarantors_GuarantorId",
|
||||
column: x => x.GuarantorId,
|
||||
principalTable: "Guarantors",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CaseClients",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CaseId = table.Column<int>(type: "int", nullable: false),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CaseClients", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CaseClients_Cases_CaseId",
|
||||
column: x => x.CaseId,
|
||||
principalTable: "Cases",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CaseClients_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Visits",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
VisitDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
HearingId = table.Column<int>(type: "int", nullable: false),
|
||||
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Visits", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Visits_Executors_ExecutorId",
|
||||
column: x => x.ExecutorId,
|
||||
principalTable: "Executors",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Visits_Hearings_HearingId",
|
||||
column: x => x.HearingId,
|
||||
principalTable: "Hearings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HearingLawyers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
HearingId = table.Column<int>(type: "int", nullable: false),
|
||||
LawyerId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HearingLawyers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_HearingLawyers_Hearings_HearingId",
|
||||
column: x => x.HearingId,
|
||||
principalTable: "Hearings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_HearingLawyers_Lawyers_LawyerId",
|
||||
column: x => x.LawyerId,
|
||||
principalTable: "Lawyers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ConsultationLawyers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ConsultationId = table.Column<int>(type: "int", nullable: false),
|
||||
LawyerId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ConsultationLawyers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ConsultationLawyers_Consultations_ConsultationId",
|
||||
column: x => x.ConsultationId,
|
||||
principalTable: "Consultations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ConsultationLawyers_Lawyers_LawyerId",
|
||||
column: x => x.LawyerId,
|
||||
principalTable: "Lawyers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "VisitClients",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
VisitId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_VisitClients", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_VisitClients_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_VisitClients_Visits_VisitId",
|
||||
column: x => x.VisitId,
|
||||
principalTable: "Visits",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CaseClients_CaseId",
|
||||
table: "CaseClients",
|
||||
column: "CaseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CaseClients_ClientId",
|
||||
table: "CaseClients",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cases_ExecutorId",
|
||||
table: "Cases",
|
||||
column: "ExecutorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Clients_ExecutorId",
|
||||
table: "Clients",
|
||||
column: "ExecutorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ConsultationLawyers_ConsultationId",
|
||||
table: "ConsultationLawyers",
|
||||
column: "ConsultationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ConsultationLawyers_LawyerId",
|
||||
table: "ConsultationLawyers",
|
||||
column: "LawyerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Consultations_CaseId",
|
||||
table: "Consultations",
|
||||
column: "CaseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Consultations_GuarantorId",
|
||||
table: "Consultations",
|
||||
column: "GuarantorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HearingLawyers_HearingId",
|
||||
table: "HearingLawyers",
|
||||
column: "HearingId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HearingLawyers_LawyerId",
|
||||
table: "HearingLawyers",
|
||||
column: "LawyerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Hearings_GuarantorId",
|
||||
table: "Hearings",
|
||||
column: "GuarantorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lawyers_GuarantorId",
|
||||
table: "Lawyers",
|
||||
column: "GuarantorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_VisitClients_ClientId",
|
||||
table: "VisitClients",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_VisitClients_VisitId",
|
||||
table: "VisitClients",
|
||||
column: "VisitId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Visits_ExecutorId",
|
||||
table: "Visits",
|
||||
column: "ExecutorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Visits_HearingId",
|
||||
table: "Visits",
|
||||
column: "HearingId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CaseClients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ConsultationLawyers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HearingLawyers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "VisitClients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Consultations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Lawyers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Visits");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cases");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Hearings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Executors");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Guarantors");
|
||||
}
|
||||
}
|
||||
}
|
541
LawCompany/LawCompanyDatabaseImplement/Migrations/20240526100556_test1.Designer.cs
generated
Normal file
541
LawCompany/LawCompanyDatabaseImplement/Migrations/20240526100556_test1.Designer.cs
generated
Normal file
@ -0,0 +1,541 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using LawCompanyDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(LawCompanyDatabase))]
|
||||
[Migration("20240526100556_test1")]
|
||||
partial class test1
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CaseType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.CaseClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("CaseClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("ConsultationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Consultations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ConsultationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ConsultationId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("ConsultationLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Executor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Executors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Guarantor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Guarantors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("HearingDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Judge")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.HearingLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("VisitDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.ToTable("Visits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.VisitClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("VisitId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("VisitId");
|
||||
|
||||
b.ToTable("VisitClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.CaseClient", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("CaseClients")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
||||
.WithMany()
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Consultations")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Consultation", "Consultation")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("ConsultationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("ConsultationLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Consultation");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.HearingLawyer", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("HearingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("HearingLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Hearing");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("GuarantorId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
||||
.WithMany("Visits")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
||||
.WithMany()
|
||||
.HasForeignKey("HearingId");
|
||||
|
||||
b.Navigation("Hearing");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.VisitClient", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("ClientVisits")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Visit", "Visit")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("VisitId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Visit");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("CaseClients");
|
||||
|
||||
b.Navigation("ClientVisits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Executor", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Clients");
|
||||
|
||||
b.Navigation("Visits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Guarantor", b =>
|
||||
{
|
||||
b.Navigation("Consultations");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("ConsultationLawyers");
|
||||
|
||||
b.Navigation("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class test1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Visits_Hearings_HearingId",
|
||||
table: "Visits");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "HearingId",
|
||||
table: "Visits",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Visits_Hearings_HearingId",
|
||||
table: "Visits",
|
||||
column: "HearingId",
|
||||
principalTable: "Hearings",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Visits_Hearings_HearingId",
|
||||
table: "Visits");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "HearingId",
|
||||
table: "Visits",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Visits_Hearings_HearingId",
|
||||
table: "Visits",
|
||||
column: "HearingId",
|
||||
principalTable: "Hearings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
537
LawCompany/LawCompanyDatabaseImplement/Migrations/20240526114610_test3.Designer.cs
generated
Normal file
537
LawCompany/LawCompanyDatabaseImplement/Migrations/20240526114610_test3.Designer.cs
generated
Normal file
@ -0,0 +1,537 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using LawCompanyDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(LawCompanyDatabase))]
|
||||
[Migration("20240526114610_test3")]
|
||||
partial class test3
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.CaseClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("CaseClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("ConsultationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Consultations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ConsultationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ConsultationId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("ConsultationLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Executor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Executors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Guarantor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Guarantors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("HearingDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Judge")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.HearingLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("VisitDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.ToTable("Visits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.VisitClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("VisitId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("VisitId");
|
||||
|
||||
b.ToTable("VisitClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.CaseClient", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("CaseClients")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
||||
.WithMany()
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Consultations")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Consultation", "Consultation")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("ConsultationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("ConsultationLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Consultation");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.HearingLawyer", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("HearingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("HearingLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Hearing");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("GuarantorId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
||||
.WithMany("Visits")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
||||
.WithMany()
|
||||
.HasForeignKey("HearingId");
|
||||
|
||||
b.Navigation("Hearing");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.VisitClient", b =>
|
||||
{
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("ClientVisits")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Visit", "Visit")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("VisitId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Visit");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("CaseClients");
|
||||
|
||||
b.Navigation("ClientVisits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Executor", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Clients");
|
||||
|
||||
b.Navigation("Visits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Guarantor", b =>
|
||||
{
|
||||
b.Navigation("Consultations");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("ConsultationLawyers");
|
||||
|
||||
b.Navigation("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class test3 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CaseType",
|
||||
table: "Cases");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CaseType",
|
||||
table: "Cases",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
}
|
||||
}
|
@ -30,10 +30,6 @@ namespace LawCompanyDatabaseImplement.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CaseType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@ -301,7 +297,7 @@ namespace LawCompanyDatabaseImplement.Migrations
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HearingId")
|
||||
b.Property<int?>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("VisitDate")
|
||||
@ -457,9 +453,7 @@ namespace LawCompanyDatabaseImplement.Migrations
|
||||
|
||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
||||
.WithMany()
|
||||
.HasForeignKey("HearingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("HearingId");
|
||||
|
||||
b.Navigation("Hearing");
|
||||
});
|
||||
|
@ -13,8 +13,6 @@ namespace LawCompanyDatabaseImplement.Models
|
||||
[Required]
|
||||
public string Name { get; private set; } = String.Empty;
|
||||
[Required]
|
||||
public string CaseType { get; private set; } = String.Empty;
|
||||
[Required]
|
||||
public DateTime DateCreate { get; private set; }
|
||||
public DateTime? DateImplement { get; private set; }
|
||||
[Required]
|
||||
@ -29,9 +27,7 @@ namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
if (_caseClients == null)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
_caseClients = Clients
|
||||
.ToDictionary(x => x.ClientId, x => (context.Clients.FirstOrDefault(y => y.Id == x.ClientId) as IClientModel));
|
||||
_caseClients = Clients.ToDictionary(x => x.ClientId, x => (x.Client as IClientModel));
|
||||
}
|
||||
|
||||
return _caseClients;
|
||||
@ -41,10 +37,6 @@ namespace LawCompanyDatabaseImplement.Models
|
||||
public virtual List<CaseClient> Clients { get; set; } = new();
|
||||
public static Case Create(LawCompanyDatabase context, CaseBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Case()
|
||||
{
|
||||
Id = model.Id,
|
||||
@ -59,54 +51,57 @@ namespace LawCompanyDatabaseImplement.Models
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
public void Update(CaseBindingModel? model)
|
||||
public void Update(CaseBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
if (model == null)
|
||||
if (model.Status == CaseStatus.ЗакрытиеДела)
|
||||
{
|
||||
return;
|
||||
DateImplement = DateTime.Now;
|
||||
}
|
||||
if (model.Status == CaseStatus.ЗакрытиеДела) DateImplement = DateTime.Now;
|
||||
Name = model.Name;
|
||||
Status = model.Status;
|
||||
|
||||
|
||||
if (model.DateImplement.HasValue) DateImplement = model.DateImplement;
|
||||
if (model.DateImplement.HasValue)
|
||||
{
|
||||
DateImplement = model.DateImplement;
|
||||
}
|
||||
}
|
||||
|
||||
public CaseViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
CaseType = CaseType,
|
||||
DateCreate = DateCreate,
|
||||
DateImplement = DateImplement,
|
||||
ExecutorId = ExecutorId,
|
||||
Status = Status,
|
||||
CaseClients = CaseClients,
|
||||
};
|
||||
|
||||
|
||||
public void UpdateClients(LawCompanyDatabase context, CaseBindingModel model)
|
||||
{
|
||||
var caseClients = context.CaseClients.Where(rec =>
|
||||
rec.CaseId == model.Id).ToList();
|
||||
var caseClients = context.CaseClients.Where(rec => rec.CaseId == model.Id).ToList();
|
||||
|
||||
if (caseClients != null && caseClients.Count > 0)
|
||||
{ // удалили те, которых нет в модели
|
||||
context.CaseClients.RemoveRange(caseClients.Where(rec
|
||||
=> !model.CaseClients.ContainsKey(rec.ClientId)));
|
||||
context.CaseClients.RemoveRange(caseClients.Where(rec => !model.CaseClients.ContainsKey(rec.ClientId)));
|
||||
context.SaveChanges();
|
||||
|
||||
foreach (var updateLunch in caseClients)
|
||||
{
|
||||
model.CaseClients.Remove(updateLunch.ClientId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
var _case = context.Cases.First(x => x.Id == Id);
|
||||
|
||||
foreach (var pc in model.CaseClients)
|
||||
{
|
||||
if (!CaseClients.ContainsKey(pc.Key))
|
||||
context.CaseClients.Add(new CaseClient
|
||||
{
|
||||
context.CaseClients.Add(new CaseClient
|
||||
{
|
||||
Case = _case,
|
||||
Client = context.Clients.First(x => x.Id == pc.Key),
|
||||
});
|
||||
}
|
||||
Case = _case,
|
||||
Client = context.Clients.First(x => x.Id == pc.Key),
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_caseClients = null;
|
||||
|
@ -20,6 +20,7 @@ namespace LawCompanyDatabaseImplement.Models
|
||||
[ForeignKey("ClientId")]
|
||||
public virtual List<VisitClient> ClientVisits { get; set; } = new();
|
||||
public int ExecutorId { get; set; }
|
||||
public virtual Executor Executor { get; set; }
|
||||
|
||||
public static Client? Create(ClientBindingModel? model)
|
||||
{
|
||||
|
@ -13,12 +13,13 @@ namespace LawCompanyDatabaseImplement.Models
|
||||
public DateTime VisitDate { get; private set; }
|
||||
|
||||
//связь один-к-одному
|
||||
public int HearingId { get; private set; }
|
||||
public int? HearingId { get; private set; }
|
||||
public Hearing Hearing { get; set; } = null!;
|
||||
//---
|
||||
public int ExecutorId { get; set; }
|
||||
|
||||
private Dictionary<int, IClientModel>? _visitClients = null;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, IClientModel> VisitClients
|
||||
{
|
||||
@ -27,82 +28,69 @@ namespace LawCompanyDatabaseImplement.Models
|
||||
|
||||
if (_visitClients == null)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
_visitClients = Clients
|
||||
.ToDictionary(x => x.ClientId, x => (context.Clients
|
||||
.FirstOrDefault(y => y.Id == x.ClientId) as IClientModel));
|
||||
_visitClients = Clients.ToDictionary(x => x.ClientId, x => (x.Client as IClientModel));
|
||||
}
|
||||
return _visitClients;
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("VisitId")]
|
||||
public virtual List<VisitClient> Clients { get; set; } = new();
|
||||
public static Visit? Create(LawCompanyDatabase context, VisitBindingModel? model)
|
||||
|
||||
public static Visit Create(LawCompanyDatabase context, VisitBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var visits = context.Visits.Where(x => x.HearingId == model.HearingId).ToList();
|
||||
if (visits.Count > 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Visit()
|
||||
{
|
||||
Id = model.Id,
|
||||
VisitDate = model.VisitDate,
|
||||
HearingId = model.HearingId,
|
||||
ExecutorId = model.ExecutorId,
|
||||
Hearing = context.Hearings.First(x => x.Id == model.HearingId),
|
||||
Clients = model.VisitClients.Select(x => new VisitClient
|
||||
{
|
||||
Client = context.Clients.First(y => y.Id == x.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
public void Update(VisitBindingModel? model)
|
||||
|
||||
public void Update(VisitBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VisitDate = model.VisitDate;
|
||||
HearingId = model.HearingId;
|
||||
}
|
||||
|
||||
public VisitViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
VisitDate = VisitDate,
|
||||
HearingId = HearingId,
|
||||
VisitClients = VisitClients,
|
||||
ExecutorId = ExecutorId,
|
||||
};
|
||||
public void UpdateClients(LawCompanyDatabase context,
|
||||
VisitBindingModel model)
|
||||
|
||||
public void UpdateClients(LawCompanyDatabase context, VisitBindingModel model)
|
||||
{
|
||||
var visitClients = context.VisitClients.Where(rec =>
|
||||
rec.VisitId == model.Id).ToList();
|
||||
var visitClients = context.VisitClients.Where(rec => rec.VisitId == model.Id).ToList();
|
||||
|
||||
if (visitClients != null && visitClients.Count > 0)
|
||||
{ // удалили те, которых нет в модели
|
||||
context.VisitClients.RemoveRange(visitClients.Where(rec
|
||||
=> !model.VisitClients.ContainsKey(rec.ClientId)));
|
||||
context.VisitClients.RemoveRange(visitClients.Where(rec => !model.VisitClients.ContainsKey(rec.ClientId)));
|
||||
context.SaveChanges();
|
||||
|
||||
foreach (var updateLunch in visitClients)
|
||||
{
|
||||
model.VisitClients.Remove(updateLunch.ClientId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
var _visit = context.Visits.First(x => x.Id == Id);
|
||||
|
||||
foreach (var pc in model.VisitClients)
|
||||
{
|
||||
if (!VisitClients.ContainsKey(pc.Key))
|
||||
context.VisitClients.Add(new VisitClient
|
||||
{
|
||||
context.VisitClients.Add(new VisitClient
|
||||
{
|
||||
Visit = _visit,
|
||||
Client = context.Clients.First(x => x.Id == pc.Key),
|
||||
});
|
||||
}
|
||||
Visit = _visit,
|
||||
Client = context.Clients.First(x => x.Id == pc.Key),
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_visitClients = null;
|
||||
|
@ -1,12 +1,115 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.SearchModels;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDataModels.Enums;
|
||||
using LawCompanyDataModels.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawCompanyExecutorApp.Controllers
|
||||
{
|
||||
public class CaseController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
public class CaseController : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
public IActionResult CreateCase()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/GetClientList?executorId={APIClient.Executor.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateCase(string name, List<int> clientselect)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
Dictionary<int, IClientModel> client = new Dictionary<int, IClientModel>();
|
||||
foreach (int members in clientselect)
|
||||
{
|
||||
client.Add(members, new ClientSearchModel { Id = members } as IClientModel);
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/case/createcase", new CaseBindingModel
|
||||
{
|
||||
Name = name,
|
||||
DateCreate = DateTime.Now,
|
||||
CaseClients = client,
|
||||
ExecutorId = APIClient.Executor.Id,
|
||||
});
|
||||
Response.Redirect("/Home/Cases");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteCase(int id)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/case/deletecase", new CaseBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
Response.Redirect("/Home/Cases");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult UpdateCase(int id)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
var caseViewModel = APIClient.GetRequest<CaseViewModel>($"api/case/GetCase/{id}");
|
||||
if (caseViewModel == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/GetClientList?executorId={APIClient.Executor.Id}");
|
||||
return View(caseViewModel);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateCase(int id, string name, int statusId, List<int> clientselect)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
Dictionary<int, IClientModel> client = new Dictionary<int, IClientModel>();
|
||||
foreach (int members in clientselect)
|
||||
{
|
||||
client.Add(members, new ClientSearchModel { Id = members } as IClientModel);
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/case/updatecase", new CaseBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
Status = (CaseStatus)statusId,
|
||||
CaseClients = client
|
||||
});
|
||||
Response.Redirect("/Home/Cases");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult CaseClients(int id)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<ClientViewModel>>($"api/case/getclientlisttocase?caseId={id}"));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,86 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.SearchModels;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDatabaseImplement.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawCompanyExecutorApp.Controllers
|
||||
{
|
||||
public class ClientController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult CreateClient()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateClient(string fio, string phone, string email)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/client/createclient", new ClientBindingModel
|
||||
{
|
||||
FIO = fio,
|
||||
Phone = phone,
|
||||
Email = email,
|
||||
ExecutorId = APIClient.Executor.Id,
|
||||
});
|
||||
Response.Redirect("/Home/Clients");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteClient(int id)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/client/deleteclient", new ClientBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
Response.Redirect("/Home/Clients");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult UpdateClient(int id)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var client = APIClient.GetRequest<ClientViewModel>($"api/client/getclientbyid/{id}");
|
||||
return View(client);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateClient(int id, string fio, string email, string phone)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/client/updateclient", new ClientBindingModel
|
||||
{
|
||||
Id = id,
|
||||
FIO = fio,
|
||||
Email = email,
|
||||
Phone = phone
|
||||
});
|
||||
Response.Redirect("/Home/Clients");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
using LawCompanyExecutorApp.Models;
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.BusinessLogicContracts;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyExecutorApp.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
|
||||
@ -7,20 +10,325 @@ namespace LawCompanyExecutorApp.Controllers
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly IReportExecutorLogic _report;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
public HomeController(ILogger<HomeController> logger, IReportExecutorLogic report)
|
||||
{
|
||||
_logger = logger;
|
||||
_report = report;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Register(string fio, string email, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(fio) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите фио, почту и пароль");
|
||||
}
|
||||
APIClient.PostRequest("api/executor/register", new ExecutorBindingModel
|
||||
{
|
||||
FIO = fio,
|
||||
Email = email,
|
||||
Password = password,
|
||||
});
|
||||
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIClient.Executor = APIClient.GetRequest<ExecutorViewModel>($"api/executor/login?login={login}&password={password}");
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.Executor);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Privacy(string fio, string email, string password)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(fio) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите фио, почту и пароль");
|
||||
}
|
||||
APIClient.PostRequest("api/executor/updatedata", new ExecutorBindingModel
|
||||
{
|
||||
Id = APIClient.Executor.Id,
|
||||
FIO = fio,
|
||||
Password = password,
|
||||
Email = email,
|
||||
});
|
||||
|
||||
APIClient.Executor.FIO = fio;
|
||||
APIClient.Executor.Email = email;
|
||||
APIClient.Executor.Password = password;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
public IActionResult Clients()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?executorId={APIClient.Executor.Id}"));
|
||||
}
|
||||
|
||||
public IActionResult Cases()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<CaseViewModel>>($"api/case/GetCaseList?executorId={APIClient.Executor.Id}"));
|
||||
}
|
||||
|
||||
public IActionResult Visits()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<VisitViewModel>>($"api/visit/getvisitlist?executorId={APIClient.Executor.Id}"));
|
||||
}
|
||||
|
||||
public IActionResult VisitHearing()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Visits = APIClient.GetRequest<List<VisitViewModel>>($"api/visit/GetVisitList?executorId={APIClient.Executor.Id}");
|
||||
ViewBag.Hearings = APIClient.GetRequest<List<HearingViewModel>>($"api/hearing/GetHearingList");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void VisitHearing(int visit, int hearing)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
var roomElem = APIClient.GetRequest<VisitViewModel>($"api/visit/GetVisit?id={visit}");
|
||||
APIClient.PostRequest("api/visit/updatevisit", new VisitBindingModel
|
||||
{
|
||||
Id = visit,
|
||||
ExecutorId = APIClient.Executor.Id,
|
||||
VisitDate = roomElem.VisitDate,
|
||||
HearingId = hearing
|
||||
});
|
||||
Response.Redirect("Visits");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult ClientHearingToFile()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<ClientViewModel>>($"api/client/GetClientList?executorId={APIClient.Executor.Id}"));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void ClientHearingToFile(int[] Ids, string type)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
if (Ids.Length <= 0)
|
||||
{
|
||||
throw new Exception("Количество должно быть больше 0");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(type))
|
||||
{
|
||||
throw new Exception("Неверный тип отчета");
|
||||
}
|
||||
|
||||
List<int> res = new List<int>();
|
||||
|
||||
foreach (var item in Ids)
|
||||
{
|
||||
res.Add(item);
|
||||
}
|
||||
|
||||
if (type == "docx")
|
||||
{
|
||||
APIClient.PostRequest("api/report/CreateExecutorReportToWordFile", new ReportExecutorBindingModel
|
||||
{
|
||||
Ids = res,
|
||||
FileName = "C:\\Reports\\wordfile.docx"
|
||||
});
|
||||
Response.Redirect("GetWordFile");
|
||||
}
|
||||
else
|
||||
{
|
||||
APIClient.PostRequest("api/report/CreateOrganiserReportToExcelFile", new ReportExecutorBindingModel
|
||||
{
|
||||
Ids = res,
|
||||
FileName = "C:\\Reports\\excelfile.xlsx"
|
||||
});
|
||||
Response.Redirect("GetExcelFile");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetWordFile()
|
||||
{
|
||||
return new PhysicalFileResult("C:\\Reports\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetExcelFile()
|
||||
{
|
||||
return new PhysicalFileResult("C:\\Reports\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
}
|
||||
|
||||
public IActionResult GetPdfFile()
|
||||
{
|
||||
return new PhysicalFileResult("C:\\ReportsCourseWork\\pdffile.pdf", "application/pdf");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult ClientsToPdfFile()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View("ClientsToPdfFile");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void ClientsToPdfFile(DateTime dateFrom, DateTime dateTo, string email)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Email пуст");
|
||||
}
|
||||
APIClient.PostRequest("api/report/CreateExecutorReportToPdfFile", new ReportExecutorBindingModel
|
||||
{
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo,
|
||||
ExecutorId = APIClient.Executor.Id
|
||||
});
|
||||
APIClient.PostRequest("api/report/SendPdfToMail", new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = email,
|
||||
Subject = "Отчет по клиентам (pdf)",
|
||||
Text = "Отчет по клиентам с " + dateFrom.ToShortDateString() + " до " + dateTo.ToShortDateString()
|
||||
});
|
||||
Response.Redirect("ClientsToPdfFile");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string GetClientsReport(DateTime dateFrom, DateTime dateTo)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
List<ReportClientsViewModel> result;
|
||||
try
|
||||
{
|
||||
result = _report.GetClients(new ReportExecutorBindingModel
|
||||
{
|
||||
ExecutorId = APIClient.Executor.Id,
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
double sum = 0;
|
||||
string table = "";
|
||||
table += "<h2 class=\"text-custom-color-1\">Предварительный отчет</h2>";
|
||||
table += "<div class=\"table-responsive\">";
|
||||
table += "<table class=\"table table-striped table-bordered table-hover\">";
|
||||
table += "<thead class=\"table-dark\">";
|
||||
table += "<tr>";
|
||||
table += "<th scope=\"col\">Клиент</th>";
|
||||
table += "<th scope=\"col\">Наименование дела</th>";
|
||||
table += "<th scope=\"col\">Статус дела</th>";
|
||||
table += "<th scope=\"col\">Дата консультации</th>";
|
||||
table += "<th scope=\"col\">Цена консультации</th>";
|
||||
table += "</tr>";
|
||||
table += "</thead>";
|
||||
foreach (var report in result)
|
||||
{
|
||||
bool IsCost = true;
|
||||
if (report.Cost == 0)
|
||||
{
|
||||
IsCost = false;
|
||||
}
|
||||
table += "<tbody>";
|
||||
table += "<tr>";
|
||||
table += $"<td>{report.FIO}</td>";
|
||||
table += $"<td>{report.Name}</td>";
|
||||
table += $"<td>{report.Status}</td>";
|
||||
table += $"<td>{report.ConsultationDate.ToShortDateString()}</td>";
|
||||
table += $"<td>{(IsCost ? report.Cost.ToString() : string.Empty)}</td>";
|
||||
table += "</tr>";
|
||||
table += "</tbody>";
|
||||
sum += report.Cost;
|
||||
}
|
||||
table += "<tfoot class=\"table-secondary\">";
|
||||
table += $"<tr><th colspan=\"2\">Итого:</th><th>{sum}</th><th colspan=\"2\"></th></tr>";
|
||||
table += "</tfoot>";
|
||||
table += "</table>";
|
||||
table += "</div>";
|
||||
return table;
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
|
114
LawCompany/LawCompanyExecutorApp/Controllers/VisitController.cs
Normal file
114
LawCompany/LawCompanyExecutorApp/Controllers/VisitController.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.SearchModels;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDataModels.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawCompanyExecutorApp.Controllers
|
||||
{
|
||||
public class VisitController : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
public IActionResult CreateVisit()
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/GetClientList?executorId={APIClient.Executor.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateVisit(DateTime visitDate, List<int> clientselect)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(visitDate.ToString()))
|
||||
{
|
||||
throw new Exception("Введите дату");
|
||||
}
|
||||
|
||||
Dictionary<int, IClientModel> client = new Dictionary<int, IClientModel>();
|
||||
foreach (int members in clientselect)
|
||||
{
|
||||
client.Add(members, new ClientSearchModel { Id = members } as IClientModel);
|
||||
}
|
||||
APIClient.PostRequest("api/visit/createvisit", new VisitBindingModel
|
||||
{
|
||||
VisitDate = visitDate,
|
||||
ExecutorId = APIClient.Executor.Id,
|
||||
VisitClients = client
|
||||
});
|
||||
|
||||
Response.Redirect("/Home/Visits");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteVisit(int id)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/visit/deletevisit", new VisitBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
Response.Redirect("/Home/Visits");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult UpdateVisit(int id)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/GetClientList?executorId={APIClient.Executor.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateVisit(int id, DateTime visitDate, List<int> clientselect)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(visitDate.ToString()))
|
||||
{
|
||||
throw new Exception("Введите дату");
|
||||
}
|
||||
|
||||
Dictionary<int, IClientModel> client = new Dictionary<int, IClientModel>();
|
||||
foreach (int members in clientselect)
|
||||
{
|
||||
client.Add(members, new ClientSearchModel { Id = members } as IClientModel);
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/visit/updatevisit", new VisitBindingModel
|
||||
{
|
||||
Id = id,
|
||||
VisitDate = visitDate,
|
||||
VisitClients = client
|
||||
});
|
||||
Response.Redirect("/Home/Visits");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult VisitClients(int id)
|
||||
{
|
||||
if (APIClient.Executor == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<ClientViewModel>>($"api/visit/getclientlisttovisit?visitId={id}"));
|
||||
}
|
||||
}
|
||||
}
|
@ -6,13 +6,19 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Controllers\VizitController.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LawCompanyBusinessLogic\LawCompanyBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\LawCompanyContracts\LawCompanyContracts.csproj" />
|
||||
<ProjectReference Include="..\LawCompanyDatabaseImplement\LawCompanyDatabaseImplement.csproj" />
|
||||
<ProjectReference Include="..\LawCompanyDataModels\LawCompanyDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -4,12 +4,25 @@ using LawCompanyContracts.StoragesContracts;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDatabaseImplement.Implements;
|
||||
using LawCompanyDataModels.Models;
|
||||
using LawCompanyBusinessLogic.OfficePackage;
|
||||
using LawCompanyBusinessLogic.OfficePackage.Implements;
|
||||
using LawCompanyContracts.BusinessLogicContracts;
|
||||
using HotelBusinessLogic.BusinessLogics;
|
||||
using LawCompanyBusinessLogic.BusinessLogics;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddTransient<IReportExecutorLogic, ReportLogicExecutor>();
|
||||
builder.Services.AddTransient<IReportGuarantorLogic, ReportLogicGuarantor>();
|
||||
builder.Services.AddTransient<ICaseStorage, CaseStorage>();
|
||||
builder.Services.AddTransient<IVisitStorage, VisitStorage>();
|
||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||
builder.Services.AddTransient<IHearingStorage, HearingStorage>();
|
||||
builder.Services.AddTransient<ILawyerStorage, LawyerStorage>();
|
||||
builder.Services.AddTransient<IConsultationStorage, ConsultationStorage>();
|
||||
|
||||
builder.Services.AddTransient<AbstractSaveToWordExecutor, SaveToWordExecutor>();
|
||||
builder.Services.AddTransient<AbstractSaveToExcelExecutor, SaveToExcelExecutor>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdfExecutor, SaveToPdfExecutor>();
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
@ -17,12 +30,10 @@ var app = builder.Build();
|
||||
APIClient.Connect(builder.Configuration);
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
@ -3,7 +3,6 @@
|
||||
@model List<ClientViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Клиенты";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Мои клиенты</h1>
|
||||
|
@ -1,6 +1,8 @@
|
||||
@{
|
||||
@using LawCompanyContracts.ViewModels;
|
||||
@using LawCompanyDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "CreateCase";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
@ -13,10 +15,17 @@
|
||||
<input type="text" name="name" id="name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-8">
|
||||
<select name="clientselect" class="form-control" multiple size="6" id="clientselect">
|
||||
@foreach (var member in ViewBag.Clients)
|
||||
{
|
||||
<option value="@member.Id">@member.FIO</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создать" class="btn btn-primary" />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
@ -1,16 +1,29 @@
|
||||
@{
|
||||
@using LawCompanyContracts.ViewModels;
|
||||
@using LawCompanyDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Обновить дело";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Обновление дела</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<form asp-action="UpdateCase" method="post">
|
||||
<input type="hidden" name="id" value="@Model.Id" />
|
||||
<div class="row">
|
||||
<div class="col-4">Имя</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="name" id="name" />
|
||||
<input type="text" name="name" id="name" value="@Model.Name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-8">
|
||||
<select name="clientselect" class="form-control" multiple size="6" id="clientselect">
|
||||
@foreach (var member in ViewBag.Clients)
|
||||
{
|
||||
<option value="@member.Id">@member.FIO</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -18,10 +31,13 @@
|
||||
<div class="col-8">
|
||||
<select id="statusId" name="statusId" class="form-control">
|
||||
<option value="0">Принято</option>
|
||||
<option value="1">АнализДелаИПодготовкаДокументов</option>
|
||||
<option value="1">Анализ дела и подготовка документов</option>
|
||||
<option value="2">СлушанияДела</option>
|
||||
<option value="3">ЗакрытиеДела</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создать" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
@ -16,7 +16,7 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Номер телефона</div>
|
||||
<div class="col-8">
|
||||
<input type="number" id="phone" name="phone" />
|
||||
<input type="text" id="phone" name="phone" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -1,34 +1,37 @@
|
||||
@{
|
||||
ViewData["Title"] = "Обновить клиента";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
@using LawCompanyContracts.ViewModels
|
||||
@model ClientViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Обновить клиента";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание клиента</h2>
|
||||
<h2 class="display-4">Изменение клиента</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">ФИО</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="fio" id="fio" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Номер телефона</div>
|
||||
<div class="col-8">
|
||||
<input type="number" id="phone" name="phone" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">E-mail</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="email" id="email" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Обновить" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form asp-action="UpdateClient" method="post">
|
||||
<input type="hidden" name="id" value="@Model.Id" />
|
||||
<div class="row">
|
||||
<div class="col-4">ФИО</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="fio" id="fio" value="@Model.FIO" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Номер телефона</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="phone" name="phone" value="@Model.Phone" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">E-mail</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="email" id="email" value="@Model.Email" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Обновить" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -10,14 +10,8 @@
|
||||
</div>
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<a asp-controller="Case" asp-action="CreateCase">Добавить дела</a>
|
||||
<a asp-controller="Case" asp-action="AddClient">Добавить клиентов к делам</a>
|
||||
</p>
|
||||
<br />
|
||||
<table class="table">
|
||||
@ -72,7 +66,7 @@
|
||||
<td>
|
||||
<form action="/Case/UpdateCase">
|
||||
<input type="hidden" name="id" value="@item.Id" />
|
||||
<button type="submit" class="btn btn-danger">Изменить имя</button>
|
||||
<button type="submit" class="btn btn-danger">Изменить</button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
|
@ -0,0 +1,73 @@
|
||||
@using LawCompanyContracts.ViewModels
|
||||
|
||||
@model List<ClientViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "ClientHearingToFile";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<div class="title">
|
||||
<h2>Создание отчёта по клиентам</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<form method="post">
|
||||
<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="table">
|
||||
<table class="table table-hover">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th scope="col"></th>
|
||||
<th scope="col">ФИО</th>
|
||||
<th scope="col">Почта</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="Ids[]" value="@item.Id" id="@item.Id">
|
||||
</div>
|
||||
</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.FIO)</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.Email)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button type="submit" class="btn btn-block btn-outline-dark w-100">Создать</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.title {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.file-format {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.table {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
@ -3,18 +3,12 @@
|
||||
@model List<ClientViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Clients";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Мои клиенты</h1>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<a asp-controller="Client" asp-action="CreateClient">Добавить клиента</a>
|
||||
</p>
|
||||
|
@ -0,0 +1,72 @@
|
||||
@using LawCompanyContracts.ViewModels
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "ClientsToPdfFile";
|
||||
}
|
||||
|
||||
<div class="container">
|
||||
<div class="text-center mb-4">
|
||||
<h2 class="text-custom-color-1">Отчет по клиентам за период</h2>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="dateFrom" class="form-label text-custom-color-1">Начало периода:</label>
|
||||
<input type="datetime-local" id="dateFrom" name="dateFrom" class="form-control" placeholder="Выберите дату начала периода">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="dateTo" class="form-label text-custom-color-1">Окончание периода:</label>
|
||||
<input type="datetime-local" id="dateTo" name="dateTo" class="form-control" placeholder="Выберите дату окончания периода">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-4">
|
||||
<label for="email" class="form-label text-custom-color-1">Почта:</label>
|
||||
<input type="email" id="email" name="email" class="form-control" placeholder="Введите вашу почту">
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-8"></div>
|
||||
<div class="col-md-4">
|
||||
<button type="submit" class="btn btn-outline-dark w-100 text-center d-flex justify-content-md-center">Отправить на почту</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-8"></div>
|
||||
<div class="col-md-4">
|
||||
<button type="button" id="demonstrate" class="btn btn-outline-dark w-100 text-center d-flex justify-content-md-center">Продемонстрировать</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="report"></div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
function check() {
|
||||
var dateFrom = $('#dateFrom').val();
|
||||
var dateTo = $('#dateTo').val();
|
||||
if (dateFrom && dateTo) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetClientsReport",
|
||||
data: { dateFrom: dateFrom, dateTo: dateTo },
|
||||
success: function (result) {
|
||||
if (result != null) {
|
||||
$('#report').html(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#demonstrate').on('click', (e) => check());
|
||||
</script>
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
@{
|
||||
ViewData["Title"] = "Enter";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Вход в приложение</h2>
|
||||
|
@ -1,62 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - LawCompanyExecutorApp</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">Юридическая фирма "Вас обманут"</a>
|
||||
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex flex-smrow-reverse">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Cases">Мои дела</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Clients">Клиенты</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Visits">Визиты</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Отчёты по слшуаниям</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Отчёты по клиентам</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2024 - Юридическая фирма - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1 class="card-title">LawCompany</h1>
|
||||
<h4>Курсовая работа</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2,7 +2,6 @@
|
||||
@model ExecutorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Личные данные</h2>
|
||||
|
@ -1,6 +1,5 @@
|
||||
@{
|
||||
ViewData["Title"] = "Register";
|
||||
Layout = "/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Регистрация исполнителя</h2>
|
||||
@ -12,7 +11,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Логин:</div>
|
||||
<div class="col-8"><input type="text" name="login" /></div>
|
||||
<div class="col-8"><input type="text" name="email" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
|
@ -0,0 +1,22 @@
|
||||
@using LawCompanyContracts.ViewModels;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "VisitHearing";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Связывание визита и слушания</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label for="visit">Визит</label>
|
||||
<select id="visit" name="visit" class="form-control" asp-items="@(new SelectList(@ViewBag.Visits, "Id", "VisitDate"))"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="hearing">Слушание</label>
|
||||
<select id="hearing" name="hearing" class="form-control" asp-items="@(new SelectList(@ViewBag.Hearings, "Id", "HearingDate"))"></select>
|
||||
</div>
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
<input type="submit" value="Сохранить" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
@ -19,11 +19,6 @@
|
||||
<a asp-controller="Visit" asp-action="CreateVisit">Добавить визиты</a>
|
||||
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
|
||||
<a asp-controller="Visit" asp-action="AddClient">Назначить клиентов</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -48,9 +43,19 @@
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.VisitDate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.HearingId)
|
||||
</td>
|
||||
@if (item.HearingId == null)
|
||||
{
|
||||
<td>
|
||||
Вакантно
|
||||
</td>
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.HearingId)
|
||||
</td>
|
||||
}
|
||||
|
||||
<td>
|
||||
|
||||
|
@ -28,14 +28,17 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Visits">Визиты</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="VisitHearing">Связывание</a>
|
||||
</li>
|
||||
<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="Enter">Отчёт по клиентам</a>
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ClientHearingToFile">Отчёт по слушаниям</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Отчёт по слушаниям</a>
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ClientsToPdfFile">Отчёт по слушаниям</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
|
@ -1,6 +1,8 @@
|
||||
@{
|
||||
@using LawCompanyContracts.ViewModels;
|
||||
@using LawCompanyDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "CreateTaskAssigments";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
<style>
|
||||
</style>
|
||||
@ -8,19 +10,22 @@
|
||||
<h2 class="display-4">Создать визит</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">Слушание</div>
|
||||
<div class="col-8">
|
||||
<select id="hearingId" name="hearingId" class="form-control" asp-items="@(new SelectList(@ViewBag.Hearings,"Id", "Id"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Дата и время</div>
|
||||
<div class="col-8">
|
||||
<input type="datetime-local" placeholder="Введите дату" name="visitDate" id="visitDate">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-8">
|
||||
<select name="clientselect" class="form-control" multiple size="6" id="clientselect">
|
||||
@foreach (var member in ViewBag.Clients)
|
||||
{
|
||||
<option value="@member.Id">@member.FIO</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
|
@ -1,22 +1,28 @@
|
||||
@{
|
||||
@using LawCompanyContracts.ViewModels;
|
||||
@using LawCompanyDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Обновить визит";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
<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="hearingId" name="hearingId" class="form-control" asp-items="@(new SelectList(@ViewBag.Hearings,"Id", "Id"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Дата</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="date" id="date" />
|
||||
<input type="datetime-local" placeholder="Введите дату" name="visitDate" id="visitDate">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-8">
|
||||
<select name="clientselect" class="form-control" multiple size="6" id="clientselect">
|
||||
@foreach (var member in ViewBag.Clients)
|
||||
{
|
||||
<option value="@member.Id">@member.FIO</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -1,9 +1,8 @@
|
||||
@using LawCompanyContracts.ViewModels;
|
||||
@using LawCompanyContracts.ViewModels
|
||||
|
||||
@model List<ClientViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Клиенты";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Мои клиенты</h1>
|
||||
@ -38,16 +37,20 @@
|
||||
{
|
||||
<tr>
|
||||
<td id="id">
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.FIO)
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.FIO)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Email)
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.Email)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Phone)
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.Phone)
|
||||
</td>
|
||||
|
||||
|
||||
|
12
LawCompany/LawCompanyGuarantorApp/Views/Home/Index.cshtml
Normal file
12
LawCompany/LawCompanyGuarantorApp/Views/Home/Index.cshtml
Normal file
@ -0,0 +1,12 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1 class="card-title">LawCompany</h1>
|
||||
<h4>Курсовая работа</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -38,6 +38,20 @@ namespace LawCompanyRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public CaseViewModel? GetCase(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new CaseSearchModel { Id = id, });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка продуктов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateCase(CaseBindingModel model)
|
||||
{
|
||||
@ -69,51 +83,6 @@ namespace LawCompanyRestApi.Controllers
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AnalysisCase(CaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
//возможно переделаю метод
|
||||
_logic.CaseAnalysis(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания заказа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void HearingCase(CaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
//возможно переделаю метод
|
||||
_logic.CaseHearing(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания заказа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CloseCase(CaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
_logic.CloseCase(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания заказа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteCase(CaseBindingModel model)
|
||||
{
|
||||
@ -129,21 +98,6 @@ namespace LawCompanyRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AddClientToCase(Tuple<CaseSearchModel, int> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var modelClient = _clientlogic.ReadElement(new ClientSearchModel { Id = model.Item2 });
|
||||
if (modelClient != null) _logic.AddClientToCase(model.Item1, modelClient);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания заказа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<ClientViewModel>? GetClientListToCase(int caseId)
|
||||
{
|
||||
|
@ -35,6 +35,21 @@ namespace LawCompanyRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public ClientViewModel? GetClientById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new ClientSearchModel { Id = id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения данных клиента");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public void CreateClient(ClientBindingModel model)
|
||||
{
|
||||
|
@ -23,14 +23,13 @@ namespace LawCompanyRestApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ExecutorViewModel? Login(string fio, string email, string password)
|
||||
public ExecutorViewModel? Login(string login, string password)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new ExecutorSearchModel
|
||||
{
|
||||
FIO = fio,
|
||||
Email = email,
|
||||
Email = login,
|
||||
Password = password,
|
||||
});
|
||||
}
|
||||
|
@ -20,13 +20,12 @@ namespace LawCompanyRestApi.Controllers
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public GuarantorViewModel? Login(string fio, string login, string password)
|
||||
public GuarantorViewModel? Login(string login, string password)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new GuarantorSearchModel
|
||||
{
|
||||
FIO = fio,
|
||||
Email = login,
|
||||
Password = password
|
||||
});
|
||||
|
135
LawCompany/LawCompanyRestApi/Controllers/ReportController.cs
Normal file
135
LawCompany/LawCompanyRestApi/Controllers/ReportController.cs
Normal file
@ -0,0 +1,135 @@
|
||||
using LawCompanyBusinessLogic.MailWorker;
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.BusinessLogicContracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace HotelRestApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ReportController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IReportExecutorLogic _reportExecutorLogic;
|
||||
private readonly IReportGuarantorLogic _reportGuarantorLogic;
|
||||
private readonly AbstractMailWorker _mailWorker;
|
||||
|
||||
public ReportController(ILogger<ReportController> logger, IReportExecutorLogic reportExecutorLogic, IReportGuarantorLogic reportGuarantorLogic, AbstractMailWorker mailWorker)
|
||||
{
|
||||
_logger = logger;
|
||||
_reportExecutorLogic = reportExecutorLogic;
|
||||
_reportGuarantorLogic = reportGuarantorLogic;
|
||||
_mailWorker = mailWorker;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateExecutorReportToPdfFile(ReportExecutorBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportExecutorLogic.SaveClientsToPdfFile(new ReportExecutorBindingModel
|
||||
{
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo,
|
||||
ExecutorId = model.ExecutorId,
|
||||
FileName = "C:\\Reports\\pdffile.pdf",
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void SendPdfToMail(MailSendInfoBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_mailWorker.MailSendAsync(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отправки письма");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateExecutorReportToWordFile(ReportExecutorBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportExecutorLogic.SaveClientHearingToWordFile(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateOrganiserReportToExcelFile(ReportExecutorBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportExecutorLogic.SaveClientHearingToExcelFile(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/*[HttpPost]
|
||||
public void CreateHeadwaiterReportToWordFile(ReportHeadwaiterBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportHeadwaiterLogic.SaveLunchRoomToWordFile(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateHeadwaiterReportToExcelFile(ReportHeadwaiterBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportHeadwaiterLogic.SaveLunchRoomToExcelFile(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateHeadwaiterReportToPdfFile(ReportHeadwaiterBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportHeadwaiterLogic.SaveLunchesToPdfFile(new ReportHeadwaiterBindingModel
|
||||
{
|
||||
FileName = "C:\\Reports\\pdffile.pdf",
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo,
|
||||
HeadwaiterId = model.HeadwaiterId,
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
@ -25,9 +25,6 @@ namespace LawCompanyRestApi.Controllers
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public List<VisitViewModel>? GetVisitList(int executorId)
|
||||
{
|
||||
@ -43,7 +40,7 @@ namespace LawCompanyRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpGet("{id}")]
|
||||
public VisitViewModel? GetVisit(int id)
|
||||
{
|
||||
try
|
||||
@ -60,7 +57,6 @@ namespace LawCompanyRestApi.Controllers
|
||||
[HttpPost]
|
||||
public void CreateVisit(VisitBindingModel model)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
_logic.Create(model);
|
||||
|
@ -1,8 +1,13 @@
|
||||
using HotelBusinessLogic.BusinessLogics;
|
||||
using LawCompanyBusinessLogic.BusinessLogics;
|
||||
using LawCompanyBusinessLogic.OfficePackage.Implements;
|
||||
using LawCompanyBusinessLogic.OfficePackage;
|
||||
using LawCompanyContracts.BusinessLogicContracts;
|
||||
using LawCompanyContracts.StoragesContracts;
|
||||
using LawCompanyDatabaseImplement.Implements;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using LawCompanyBusinessLogic.MailWorker;
|
||||
using LawCompanyContracts.BindingModels;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@ -34,6 +39,14 @@ builder.Services.AddTransient<ILawyerLogic, LawyerLogic>();
|
||||
builder.Services.AddTransient<IExecutorLogic, ExecutorLogic>();
|
||||
builder.Services.AddTransient<IGuarantorLogic, GuarantorLogic>();
|
||||
|
||||
builder.Services.AddTransient<IReportExecutorLogic, ReportLogicExecutor>();
|
||||
builder.Services.AddTransient<IReportGuarantorLogic, ReportLogicGuarantor>();
|
||||
|
||||
builder.Services.AddTransient<AbstractSaveToWordExecutor, SaveToWordExecutor>();
|
||||
builder.Services.AddTransient<AbstractSaveToExcelExecutor, SaveToExcelExecutor>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdfExecutor, SaveToPdfExecutor>();
|
||||
|
||||
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
@ -46,6 +59,18 @@ builder.Services.AddSwaggerGen(c => c.SwaggerDoc("v1", new OpenApiInfo
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
var mailSender = app.Services.GetService<AbstractMailWorker>();
|
||||
|
||||
mailSender?.MailConfig(new MailConfigBindingModel
|
||||
{
|
||||
MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty,
|
||||
MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
|
||||
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
|
||||
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
|
||||
PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
|
||||
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
|
||||
});
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
|
@ -11,6 +11,6 @@
|
||||
"SmtpClientPort": "587",
|
||||
"PopHost": "pop.gmail.com",
|
||||
"PopPort": "995",
|
||||
"MailLogin": "lab7yakobchuk@gmail.com",
|
||||
"MailPassword": "scht ahjt fxmx tdpc"
|
||||
"MailLogin": "laba46466@gmail.com",
|
||||
"MailPassword": "iyin rgai wjdh ocmi"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user