Compare commits
30 Commits
tempBrench
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
c3a2e129df | ||
|
33d22bbb24 | ||
|
2cca5bd9b9 | ||
|
92c6c1c503 | ||
|
db5681fc25 | ||
|
636af51602 | ||
2a69fbeb58 | |||
|
9c75a284f7 | ||
9dcb619007 | |||
|
740f8ec2ef | ||
202848320e | |||
762525822b | |||
|
3134b5f6e1 | ||
8207be80a7 | |||
|
ba1d369a2d | ||
900c5f1fb4 | |||
|
3aa0265de4 | ||
|
7483e0682d | ||
86877b84eb | |||
7fcf90e006 | |||
|
cc28f399a4 | ||
cd661669c0 | |||
0c09e52c47 | |||
1843a431ec | |||
|
39bc95794b | ||
79071f22b2 | |||
|
f03bb241c0 | ||
4bea770d99 | |||
|
f3652285b9 | ||
06f1d54d0d |
@ -76,6 +76,11 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<SpecializationCasesViewModel> GetSpecializationCases()
|
||||
{
|
||||
return _caseStorage.GetSpecializationCases() ?? new List<SpecializationCasesViewModel>();
|
||||
}
|
||||
|
||||
public bool Update(CaseBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class MailSender
|
||||
{
|
||||
private string mailLogin = string.Empty;
|
||||
private string mailPassword = string.Empty;
|
||||
private string smtpClientHost = string.Empty;
|
||||
private int smtpClientPort;
|
||||
|
||||
public MailSender(){}
|
||||
|
||||
public void MailConfig(MailConfigBindingModel config)
|
||||
{
|
||||
mailLogin = config.MailLogin;
|
||||
mailPassword = config.MailPassword;
|
||||
smtpClientHost = config.SmtpClientHost;
|
||||
smtpClientPort = config.SmtpClientPort;
|
||||
}
|
||||
|
||||
public async void SendMailAsync(MailSendInfoBindingModel info)
|
||||
{
|
||||
using var objMailMessage = new MailMessage();
|
||||
using var objSmtpClient = new SmtpClient(smtpClientHost, smtpClientPort);
|
||||
try
|
||||
{
|
||||
objMailMessage.From = new MailAddress(mailLogin);
|
||||
objMailMessage.To.Add(new MailAddress(info.MailAddress));
|
||||
objMailMessage.Subject = info.Subject;
|
||||
objMailMessage.Body = info.Text;
|
||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
||||
|
||||
MemoryStream ms = new(info.File);
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "report.pdf", "application/pdf"));
|
||||
|
||||
objSmtpClient.UseDefaultCredentials = false;
|
||||
objSmtpClient.EnableSsl = true;
|
||||
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
||||
objSmtpClient.Credentials = new NetworkCredential(mailLogin, mailPassword);
|
||||
|
||||
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
using CaseAccountingBusinessLogic.OfficePackage;
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
using CaseAccountingContracts.BusinessLogicContracts;
|
||||
using CaseAccountingContracts.SearchModels;
|
||||
using CaseAccountingContracts.StoragesContracts;
|
||||
@ -17,13 +19,18 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||
private readonly IHearingStorage _hearingStorage;
|
||||
private readonly ILawyerStorage _lawyerStorage;
|
||||
private readonly ISpecializationStorage _specializationStorage;
|
||||
private readonly WordBuilderCustomer _wordBuilder;
|
||||
private readonly ExcelBuilderCustomer _excelBuilder;
|
||||
|
||||
public ReportCustomerLogic(ICaseStorage caseStorage, IHearingStorage hearingStorage, ILawyerStorage lawyerStorage, ISpecializationStorage specializationStorage)
|
||||
public ReportCustomerLogic(ICaseStorage caseStorage, IHearingStorage hearingStorage, ILawyerStorage lawyerStorage, ISpecializationStorage specializationStorage,
|
||||
WordBuilderCustomer wordBuilder, ExcelBuilderCustomer excelBuilder)
|
||||
{
|
||||
_caseStorage = caseStorage;
|
||||
_hearingStorage = hearingStorage;
|
||||
_lawyerStorage = lawyerStorage;
|
||||
_specializationStorage = specializationStorage;
|
||||
_wordBuilder = wordBuilder;
|
||||
_excelBuilder = excelBuilder;
|
||||
}
|
||||
|
||||
public List<ReportHearingSpecializationViewModel> GetHearingSpecialization(ReportBindingModel model)
|
||||
@ -45,34 +52,23 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ReportLawyerHearingViewModel> GetLawyerHearing(List<LawyerViewModel> models)
|
||||
public List<ReportLawyerHearingViewModel> GetLawyersHearing(List<LawyerViewModel> lawyers)
|
||||
{
|
||||
var lawyers = new List<LawyerViewModel>();
|
||||
foreach (var model in models)
|
||||
var reportRecords = new List<ReportLawyerHearingViewModel>();
|
||||
foreach (var lawyer in lawyers)
|
||||
{
|
||||
lawyers.Add(_lawyerStorage.GetElement(new LawyerSearchModel { Id = model.Id}));
|
||||
}
|
||||
var list = new List<ReportLawyerHearingViewModel>();
|
||||
|
||||
foreach(var lawyer in lawyers)
|
||||
{
|
||||
var record = new ReportLawyerHearingViewModel
|
||||
var hearings = _lawyerStorage.GetLawyerCases(new() { Id = lawyer.Id })
|
||||
.SelectMany(_case => _caseStorage.GetCaseHearings(new() { Id = _case.Id }))
|
||||
.Select(hearing => hearing.Information)
|
||||
.ToList();
|
||||
ReportLawyerHearingViewModel reportRecord = new()
|
||||
{
|
||||
Name = lawyer.Name,
|
||||
Surname = lawyer.Surname,
|
||||
Patronymic = lawyer.Patronymic,
|
||||
Hearings = new List<(DateTime Date, string Information)>()
|
||||
Lawyer = lawyer.Name + " " + lawyer.Surname + ", " + lawyer.Patronymic,
|
||||
Hearings = hearings
|
||||
};
|
||||
var cases = _caseStorage.GetFullList()
|
||||
.Where(x => x.Lawyers.ContainsKey(lawyer.Id));
|
||||
foreach (var _case in cases)
|
||||
{
|
||||
record.Hearings.Add((_hearingStorage.GetElement(new HearingSearchModel { CaseId = _case.Id}).Date,
|
||||
_hearingStorage.GetElement(new HearingSearchModel { CaseId = _case.Id })?.Information ?? "Не удалось найти информацию."));
|
||||
}
|
||||
list.Add(record);
|
||||
reportRecords.Add(reportRecord);
|
||||
}
|
||||
return list;
|
||||
return reportRecords;
|
||||
}
|
||||
|
||||
public void SaveHearingSpecializationToPdfFile(ReportBindingModel model)
|
||||
@ -89,5 +85,28 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public byte[] SaveListFile(LawyerHearingListBindingModel model)
|
||||
{
|
||||
byte[] file = Array.Empty<byte>();
|
||||
|
||||
string title = "Список слушаний по выбранным юристам";
|
||||
|
||||
if (model.FileType == "docx")
|
||||
{
|
||||
_wordBuilder.CreateDocument();
|
||||
_wordBuilder.CreateTitle(title);
|
||||
_wordBuilder.CreateLawyersHearingTable(GetLawyersHearing(model.Lawyers));
|
||||
file = _wordBuilder.GetFile();
|
||||
}
|
||||
else if (model.FileType == "xlsx")
|
||||
{
|
||||
_excelBuilder.CreateDocument();
|
||||
_excelBuilder.CreateTitle(title);
|
||||
_excelBuilder.CreateLawyersHearingTable(GetLawyersHearing(model.Lawyers));
|
||||
file = _excelBuilder.GetFile();
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
using CaseAccountingBusinessLogic.BusinessLogic.OfficePackage;
|
||||
using CaseAccountingBusinessLogic.OfficePackage;
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
using CaseAccountingContracts.BusinessLogicContracts;
|
||||
using CaseAccountingContracts.SearchModels;
|
||||
using CaseAccountingContracts.StoragesContracts;
|
||||
@ -17,68 +19,135 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||
private readonly ISpecializationStorage _specializationStorage;
|
||||
private readonly IHearingStorage _hearingStorage;
|
||||
private readonly ILawyerStorage _lawyerStorage;
|
||||
private readonly WordBuilderProvider _wordBuilder;
|
||||
private readonly ExcelBuilderProvider _excelBuilder;
|
||||
private readonly PdfBuilderProvider _pdfBuilder;
|
||||
private readonly MailSender _mailSender;
|
||||
|
||||
public ReportProviderLogic(ICaseStorage caseStorage, ISpecializationStorage specializationStorage, IHearingStorage hearingStorage, ILawyerStorage lawyerStorage)
|
||||
public ReportProviderLogic(ICaseStorage caseStorage, ISpecializationStorage specializationStorage, IHearingStorage hearingStorage,
|
||||
ILawyerStorage lawyerStorage, WordBuilderProvider wordBuilder, ExcelBuilderProvider excelBuilder,
|
||||
PdfBuilderProvider pdfBuilder, MailSender mailSender)
|
||||
{
|
||||
_caseStorage = caseStorage ?? throw new ArgumentNullException(nameof(caseStorage));
|
||||
_specializationStorage = specializationStorage ?? throw new ArgumentNullException(nameof(specializationStorage));
|
||||
_hearingStorage = hearingStorage ?? throw new ArgumentNullException(nameof(hearingStorage));
|
||||
_lawyerStorage = lawyerStorage ?? throw new ArgumentNullException(nameof(lawyerStorage));
|
||||
_wordBuilder = wordBuilder ?? throw new ArgumentNullException(nameof(wordBuilder));
|
||||
_excelBuilder = excelBuilder ?? throw new ArgumentNullException(nameof(excelBuilder));
|
||||
_pdfBuilder = pdfBuilder ?? throw new ArgumentNullException(nameof(pdfBuilder));
|
||||
_mailSender = mailSender ?? throw new ArgumentNullException(nameof(mailSender));
|
||||
}
|
||||
|
||||
public List<ReportCaseSpecializationViewModel> GetCaseSpecialization(List<CaseViewModel> models)
|
||||
{
|
||||
var сases = new List<CaseViewModel>();
|
||||
List<ReportCaseSpecializationViewModel> list = new();
|
||||
foreach (var model in models)
|
||||
сases.Add(_caseStorage.GetElement(new CaseSearchModel { Id = model.Id }));
|
||||
return сases.Select(x => new ReportCaseSpecializationViewModel {
|
||||
CaseName = x.Name,
|
||||
Applicant = x.Applicant,
|
||||
Defendant = x.Defendant,
|
||||
Date = x.Date,
|
||||
Specialization = x.Specialization,
|
||||
}).ToList();
|
||||
{
|
||||
var specialization = _specializationStorage.GetElement(new SpecializationSearchModel { Id = model.SpecializationId });
|
||||
var caseModel = _caseStorage.GetElement(new CaseSearchModel { Id = model.Id });
|
||||
if (specialization == null)
|
||||
{
|
||||
throw new Exception("Некоректные данные по специализации");
|
||||
}
|
||||
if (caseModel == null)
|
||||
{
|
||||
throw new Exception("Некоректные данные по делу");
|
||||
}
|
||||
|
||||
bool hasSpec = false;
|
||||
if (list.Count > 0)
|
||||
{
|
||||
foreach (var report in list)
|
||||
{
|
||||
if (hasSpec = report.Specialization.Equals(specialization.Name))
|
||||
{
|
||||
report.Cases.Add("Дело #" + caseModel.Id.ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasSpec)
|
||||
{
|
||||
var newElement = new ReportCaseSpecializationViewModel
|
||||
{
|
||||
Specialization = specialization.Name,
|
||||
Cases = new()
|
||||
};
|
||||
newElement.Cases.Add("Дело #" + caseModel.Id.ToString());
|
||||
list.Add(newElement);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model)
|
||||
{
|
||||
var hearings = _hearingStorage
|
||||
.GetFilteredList(new HearingSearchModel { UserId = model.UserId})
|
||||
.GetFilteredList(new HearingSearchModel { UserId = model.UserId })
|
||||
.Where(x => model.DateFrom <= x.Date && model.DateTo >= x.Date);
|
||||
var list = new List<ReportHearingLawyerViewModel>();
|
||||
foreach (var hearing in hearings)
|
||||
{
|
||||
var record = new ReportHearingLawyerViewModel
|
||||
{
|
||||
Information = hearing.Information,
|
||||
Date = hearing.Date,
|
||||
Lawyers = new List<(string Surname, string Name, string Patronymic)>()
|
||||
Hearing = "Номер слушания #" + hearing.Id.ToString(),
|
||||
CaseLawyers = new()
|
||||
};
|
||||
foreach (var lawyer in _caseStorage.GetElement(new CaseSearchModel { Id = hearing.CaseId }).Lawyers.Values)
|
||||
var caseId = _caseStorage.GetElement(new CaseSearchModel { Id = hearing.CaseId }).Id;
|
||||
foreach (var lawyer in _lawyerStorage.GetLawyerMTM(caseId))
|
||||
{
|
||||
record.Lawyers.Add((lawyer.Surname, lawyer.Name, lawyer.Patronymic));
|
||||
record.CaseLawyers.Add(new CaseLawyerViewModel
|
||||
{
|
||||
Case = "Дело #" + caseId.ToString(),
|
||||
Date = hearing.Date,
|
||||
Lawyer = lawyer.Surname + " " + lawyer.Name + " " + lawyer.Patronymic
|
||||
});
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void SaveCaseSpecializationToExcelFile(ReportBindingModel model)
|
||||
public byte[] SaveListFile(CaseSpecializationListBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
//TODO
|
||||
byte[] file = Array.Empty<byte>();
|
||||
|
||||
string title = "Список специализаций по выбраным делам";
|
||||
|
||||
if (model.FileType == "docx")
|
||||
{
|
||||
_wordBuilder.CreateDocument();
|
||||
_wordBuilder.CreateTitle(title);
|
||||
_wordBuilder.CreateCaseSpecializationTable(GetCaseSpecialization(model.Cases));
|
||||
file = _wordBuilder.GetFile();
|
||||
}
|
||||
else if (model.FileType == "xlsx")
|
||||
{
|
||||
_excelBuilder.CreateDocument();
|
||||
_excelBuilder.CreateTitle(title);
|
||||
_excelBuilder.CreateCaseSpecializationTable(GetCaseSpecialization(model.Cases));
|
||||
file = _excelBuilder.GetFile();
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
public void SaveCaseSpecializationToWordFile(ReportBindingModel model)
|
||||
public void SendByMailStatusReport(ReportBindingModel reportModel)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
//TODO
|
||||
}
|
||||
|
||||
public void SaveHearingLawyerToPdfFile(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
//TODO
|
||||
byte[] file = _pdfBuilder.GetHearingLawyerReportFile(new()
|
||||
{
|
||||
Title = "Отчет по слушаниям",
|
||||
DateFrom = reportModel.DateFrom,
|
||||
DateTo = reportModel.DateTo,
|
||||
Records = GetHearingLawyer(reportModel)
|
||||
});
|
||||
_mailSender.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = reportModel.UserEmail,
|
||||
Subject = "Отчет по слушаниям",
|
||||
Text = $"За период с {reportModel.DateFrom.ToShortDateString()} " +
|
||||
$"по {reportModel.DateTo.ToShortDateString()}.",
|
||||
File = file
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,18 +7,28 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="OfficePackage\Implements\**" />
|
||||
<EmbeddedResource Remove="OfficePackage\Implements\**" />
|
||||
<None Remove="OfficePackage\Implements\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CaseAccountingContracts\CaseAccountingContracts.csproj" />
|
||||
<ProjectReference Include="..\CaseAccountingDataBaseImplement\CaseAccountingDataBaseImplement.csproj" />
|
||||
<ProjectReference Include="..\CaseAccountingDataModels\CaseAccountingDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="OfficePackage\HelperEnums\" />
|
||||
<Folder Include="OfficePackage\HelperModels\" />
|
||||
<Folder Include="OfficePackage\Implements\" />
|
||||
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage
|
||||
{
|
||||
public class AbstractSaveToExcelCustomer
|
||||
{
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage
|
||||
{
|
||||
public class AbstractSaveToExcelProvider
|
||||
{
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage
|
||||
{
|
||||
public class AbstractSaveToPdfCustomer
|
||||
{
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage
|
||||
{
|
||||
public class AbstractSaveToPdfProvider
|
||||
{
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage
|
||||
{
|
||||
public class AbstractSaveToWordCustomer
|
||||
{
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage
|
||||
{
|
||||
public class AbstractSaveToWordProvider
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,361 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage
|
||||
{
|
||||
public class ExcelBuilderCustomer
|
||||
{
|
||||
private readonly string tempFileName = "temp.xlsx";
|
||||
private SpreadsheetDocument? spreadsheetDocument;
|
||||
private SharedStringTablePart? shareStringPart;
|
||||
private Worksheet? worksheet;
|
||||
|
||||
private 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 });
|
||||
fonts.Append(fontUsual);
|
||||
|
||||
var fontTitle = new Font();
|
||||
fontTitle.Append(new Bold());
|
||||
fontTitle.Append(new FontSize() { Val = 12D });
|
||||
fonts.Append(fontTitle);
|
||||
|
||||
var fills = new Fills() { Count = 3U };
|
||||
|
||||
var fill1 = new Fill();
|
||||
fill1.Append(new PatternFill()
|
||||
{
|
||||
PatternType = PatternValues.None
|
||||
});
|
||||
|
||||
var fill2 = new Fill();
|
||||
fill2.Append(new PatternFill()
|
||||
{
|
||||
PatternType = PatternValues.Gray125
|
||||
});
|
||||
|
||||
var fill3 = new Fill();
|
||||
fill3.Append(new PatternFill()
|
||||
{
|
||||
PatternType = PatternValues.Solid,
|
||||
ForegroundColor = new()
|
||||
{
|
||||
Rgb = "e0e8ff"
|
||||
}
|
||||
});
|
||||
|
||||
var fill4 = new Fill();
|
||||
fill1.Append(new PatternFill()
|
||||
{
|
||||
PatternType = PatternValues.None
|
||||
});
|
||||
|
||||
fills.Append(fill1);
|
||||
fills.Append(fill2);
|
||||
fills.Append(fill3);
|
||||
fills.Append(fill4);
|
||||
|
||||
var borders = new Borders() { Count = 2U };
|
||||
|
||||
var borderNoBorder = new Border();
|
||||
borderNoBorder.Append(new LeftBorder());
|
||||
borderNoBorder.Append(new RightBorder());
|
||||
borderNoBorder.Append(new TopBorder());
|
||||
borderNoBorder.Append(new BottomBorder());
|
||||
borderNoBorder.Append(new DiagonalBorder());
|
||||
|
||||
var borderThin = new Border();
|
||||
|
||||
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
||||
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
var rightBorder = new RightBorder() { Style = BorderStyleValues.Thin };
|
||||
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
||||
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
var bottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin };
|
||||
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
borderThin.Append(leftBorder);
|
||||
borderThin.Append(rightBorder);
|
||||
borderThin.Append(topBorder);
|
||||
borderThin.Append(bottomBorder);
|
||||
borderThin.Append(new DiagonalBorder());
|
||||
|
||||
borders.Append(borderNoBorder);
|
||||
borders.Append(borderThin);
|
||||
|
||||
CellFormats cellFormats = new() { Count = 4U };
|
||||
CellFormat cellFormatEmpty = new()
|
||||
{
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 1U,
|
||||
ApplyFont = true
|
||||
};
|
||||
CellFormat cellFormatDefault = new()
|
||||
{
|
||||
FontId = 0U,
|
||||
FillId = 3U,
|
||||
BorderId = 1U,
|
||||
ApplyFont = true
|
||||
};
|
||||
CellFormat cellFormatTitle = new()
|
||||
{
|
||||
FontId = 1U,
|
||||
FillId = 2U,
|
||||
BorderId = 1U,
|
||||
ApplyFont = true,
|
||||
ApplyBorder = true,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
Horizontal = HorizontalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
};
|
||||
|
||||
cellFormats.Append(cellFormatEmpty);
|
||||
cellFormats.Append(cellFormatDefault);
|
||||
cellFormats.Append(cellFormatTitle);
|
||||
|
||||
sp.Stylesheet.Append(fonts);
|
||||
sp.Stylesheet.Append(fills);
|
||||
sp.Stylesheet.Append(borders);
|
||||
sp.Stylesheet.Append(cellFormats);
|
||||
}
|
||||
|
||||
public void CreateDocument()
|
||||
{
|
||||
spreadsheetDocument = SpreadsheetDocument.Create(tempFileName,
|
||||
SpreadsheetDocumentType.Workbook);
|
||||
WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart();
|
||||
workbookpart.Workbook = new Workbook();
|
||||
|
||||
CreateStyles(workbookpart);
|
||||
|
||||
shareStringPart = spreadsheetDocument.WorkbookPart!
|
||||
.GetPartsOfType<SharedStringTablePart>()
|
||||
.Any()
|
||||
? spreadsheetDocument.WorkbookPart
|
||||
.GetPartsOfType<SharedStringTablePart>()
|
||||
.First()
|
||||
: spreadsheetDocument.WorkbookPart
|
||||
.AddNewPart<SharedStringTablePart>();
|
||||
|
||||
if (shareStringPart.SharedStringTable == null)
|
||||
{
|
||||
shareStringPart.SharedStringTable = new SharedStringTable();
|
||||
}
|
||||
|
||||
WorksheetPart worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||
|
||||
Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||
Sheet sheet = new()
|
||||
{
|
||||
Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
|
||||
worksheet = worksheetPart.Worksheet;
|
||||
}
|
||||
|
||||
public void InsertCellInWorksheet(ExcelCellData cellData)
|
||||
{
|
||||
if (worksheet == null || shareStringPart == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var sheetData = worksheet.GetFirstChild<SheetData>();
|
||||
if (sheetData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Row? row = sheetData.Elements<Row>()
|
||||
.Where(r => r.RowIndex! == cellData.RowIndex)
|
||||
.FirstOrDefault();
|
||||
if (row == null)
|
||||
{
|
||||
row = new Row() { RowIndex = cellData.RowIndex };
|
||||
sheetData.Append(row);
|
||||
}
|
||||
|
||||
Cell? cell = row.Elements<Cell>()
|
||||
.Where(c => c.CellReference!.Value == cellData.CellReference)
|
||||
.FirstOrDefault();
|
||||
if (cell == null)
|
||||
{
|
||||
Cell? refCell = null;
|
||||
foreach (Cell rowCell in row.Elements<Cell>())
|
||||
{
|
||||
if (string.Compare(rowCell.CellReference!.Value, cellData.CellReference, true) > 0)
|
||||
{
|
||||
refCell = rowCell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var newCell = new Cell()
|
||||
{
|
||||
CellReference = cellData.CellReference
|
||||
};
|
||||
row.InsertBefore(newCell, refCell);
|
||||
cell = newCell;
|
||||
}
|
||||
|
||||
shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(cellData.Text)));
|
||||
shareStringPart.SharedStringTable.Save();
|
||||
cell.CellValue = new CellValue((shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
|
||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||
cell.StyleIndex = cellData.StyleIndex;
|
||||
}
|
||||
|
||||
private 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);
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if (spreadsheetDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||
spreadsheetDocument.Dispose();
|
||||
}
|
||||
|
||||
public byte[] GetFile()
|
||||
{
|
||||
Save();
|
||||
byte[] file = File.ReadAllBytes(tempFileName);
|
||||
File.Delete(tempFileName);
|
||||
return file;
|
||||
}
|
||||
|
||||
public void CreateTitle(string text)
|
||||
{
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "B1"
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = text,
|
||||
StyleIndex = 0
|
||||
});
|
||||
}
|
||||
|
||||
public void CreateLawyersHearingTable(List<ReportLawyerHearingViewModel> data)
|
||||
{
|
||||
if (worksheet == null || shareStringPart == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Columns columns = new();
|
||||
Column columnA = new() { Min = 1, Max = 1, Width = 30, CustomWidth = true };
|
||||
columns.Append(columnA);
|
||||
Column columnB = new() { Min = 2, Max = 2, Width = 30, CustomWidth = true };
|
||||
columns.Append(columnB);
|
||||
worksheet.InsertAt(columns, 0);
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 2,
|
||||
Text = "Юрист",
|
||||
StyleIndex = 2
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = 2,
|
||||
Text = "Слушание",
|
||||
StyleIndex = 2
|
||||
});
|
||||
|
||||
uint currentRow = 3;
|
||||
foreach (ReportLawyerHearingViewModel lawyer in data)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = currentRow,
|
||||
Text = lawyer.Lawyer,
|
||||
StyleIndex = 1
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = currentRow,
|
||||
Text = "",
|
||||
StyleIndex = 1
|
||||
});
|
||||
currentRow++;
|
||||
foreach (string hearing in lawyer.Hearings)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = currentRow,
|
||||
Text = "",
|
||||
StyleIndex = 1
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = currentRow,
|
||||
Text = hearing,
|
||||
StyleIndex = 1
|
||||
});
|
||||
currentRow++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,357 @@
|
||||
using CaseAccountingBusinessLogic.OfficePackage;
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage
|
||||
{
|
||||
public class ExcelBuilderProvider
|
||||
{
|
||||
private readonly string tempFileName = "temp.xlsx";
|
||||
private SpreadsheetDocument? spreadsheetDocument;
|
||||
private SharedStringTablePart? shareStringPart;
|
||||
private Worksheet? worksheet;
|
||||
|
||||
private void CreateStyles(WorkbookPart workbookpart)
|
||||
{
|
||||
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
||||
sp.Stylesheet = new Stylesheet();
|
||||
|
||||
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
||||
|
||||
var fontUsual = new Font();
|
||||
fontUsual.Append(new FontSize() { Val = 12D });
|
||||
fonts.Append(fontUsual);
|
||||
|
||||
var fontTitle = new Font();
|
||||
fontTitle.Append(new Bold());
|
||||
fontTitle.Append(new FontSize() { Val = 12D });
|
||||
fonts.Append(fontTitle);
|
||||
|
||||
var fills = new Fills() { Count = 3U };
|
||||
|
||||
var fill1 = new Fill();
|
||||
fill1.Append(new PatternFill()
|
||||
{
|
||||
PatternType = PatternValues.None
|
||||
});
|
||||
|
||||
var fill2 = new Fill();
|
||||
fill2.Append(new PatternFill()
|
||||
{
|
||||
PatternType = PatternValues.Gray125
|
||||
});
|
||||
|
||||
var fill3 = new Fill();
|
||||
fill3.Append(new PatternFill()
|
||||
{
|
||||
PatternType = PatternValues.Solid,
|
||||
ForegroundColor = new()
|
||||
{
|
||||
Rgb = "e0e8ff"
|
||||
}
|
||||
});
|
||||
|
||||
var fill4 = new Fill();
|
||||
fill1.Append(new PatternFill()
|
||||
{
|
||||
PatternType = PatternValues.None
|
||||
});
|
||||
|
||||
fills.Append(fill1);
|
||||
fills.Append(fill2);
|
||||
fills.Append(fill3);
|
||||
fills.Append(fill4);
|
||||
|
||||
var borders = new Borders() { Count = 2U };
|
||||
|
||||
var borderNoBorder = new Border();
|
||||
borderNoBorder.Append(new LeftBorder());
|
||||
borderNoBorder.Append(new RightBorder());
|
||||
borderNoBorder.Append(new TopBorder());
|
||||
borderNoBorder.Append(new BottomBorder());
|
||||
borderNoBorder.Append(new DiagonalBorder());
|
||||
|
||||
var borderThin = new Border();
|
||||
|
||||
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
||||
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
var rightBorder = new RightBorder() { Style = BorderStyleValues.Thin };
|
||||
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
||||
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
var bottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin };
|
||||
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
borderThin.Append(leftBorder);
|
||||
borderThin.Append(rightBorder);
|
||||
borderThin.Append(topBorder);
|
||||
borderThin.Append(bottomBorder);
|
||||
borderThin.Append(new DiagonalBorder());
|
||||
|
||||
borders.Append(borderNoBorder);
|
||||
borders.Append(borderThin);
|
||||
|
||||
CellFormats cellFormats = new() { Count = 4U };
|
||||
CellFormat cellFormatEmpty = new()
|
||||
{
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 1U,
|
||||
ApplyFont = true
|
||||
};
|
||||
CellFormat cellFormatDefault = new()
|
||||
{
|
||||
FontId = 0U,
|
||||
FillId = 3U,
|
||||
BorderId = 1U,
|
||||
ApplyFont = true
|
||||
};
|
||||
CellFormat cellFormatTitle = new()
|
||||
{
|
||||
FontId = 1U,
|
||||
FillId = 2U,
|
||||
BorderId = 1U,
|
||||
ApplyFont = true,
|
||||
ApplyBorder = true,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
Horizontal = HorizontalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
};
|
||||
|
||||
cellFormats.Append(cellFormatEmpty);
|
||||
cellFormats.Append(cellFormatDefault);
|
||||
cellFormats.Append(cellFormatTitle);
|
||||
|
||||
sp.Stylesheet.Append(fonts);
|
||||
sp.Stylesheet.Append(fills);
|
||||
sp.Stylesheet.Append(borders);
|
||||
sp.Stylesheet.Append(cellFormats);
|
||||
}
|
||||
|
||||
public void CreateDocument()
|
||||
{
|
||||
spreadsheetDocument = SpreadsheetDocument.Create(tempFileName,
|
||||
SpreadsheetDocumentType.Workbook);
|
||||
WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart();
|
||||
workbookpart.Workbook = new Workbook();
|
||||
|
||||
CreateStyles(workbookpart);
|
||||
|
||||
shareStringPart = spreadsheetDocument.WorkbookPart!
|
||||
.GetPartsOfType<SharedStringTablePart>()
|
||||
.Any()
|
||||
? spreadsheetDocument.WorkbookPart
|
||||
.GetPartsOfType<SharedStringTablePart>()
|
||||
.First()
|
||||
: spreadsheetDocument.WorkbookPart
|
||||
.AddNewPart<SharedStringTablePart>();
|
||||
|
||||
if (shareStringPart.SharedStringTable == null)
|
||||
{
|
||||
shareStringPart.SharedStringTable = new SharedStringTable();
|
||||
}
|
||||
|
||||
WorksheetPart worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||
|
||||
Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||
Sheet sheet = new()
|
||||
{
|
||||
Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
|
||||
worksheet = worksheetPart.Worksheet;
|
||||
}
|
||||
|
||||
public void InsertCellInWorksheet(ExcelCellData cellData)
|
||||
{
|
||||
if (worksheet == null || shareStringPart == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var sheetData = worksheet.GetFirstChild<SheetData>();
|
||||
if (sheetData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Row? row = sheetData.Elements<Row>()
|
||||
.Where(r => r.RowIndex! == cellData.RowIndex)
|
||||
.FirstOrDefault();
|
||||
if (row == null)
|
||||
{
|
||||
row = new Row() { RowIndex = cellData.RowIndex };
|
||||
sheetData.Append(row);
|
||||
}
|
||||
|
||||
Cell? cell = row.Elements<Cell>()
|
||||
.Where(c => c.CellReference!.Value == cellData.CellReference)
|
||||
.FirstOrDefault();
|
||||
if (cell == null)
|
||||
{
|
||||
Cell? refCell = null;
|
||||
foreach (Cell rowCell in row.Elements<Cell>())
|
||||
{
|
||||
if (string.Compare(rowCell.CellReference!.Value, cellData.CellReference, true) > 0)
|
||||
{
|
||||
refCell = rowCell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var newCell = new Cell()
|
||||
{
|
||||
CellReference = cellData.CellReference
|
||||
};
|
||||
row.InsertBefore(newCell, refCell);
|
||||
cell = newCell;
|
||||
}
|
||||
|
||||
shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(cellData.Text)));
|
||||
shareStringPart.SharedStringTable.Save();
|
||||
cell.CellValue = new CellValue((shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
|
||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||
cell.StyleIndex = cellData.StyleIndex;
|
||||
}
|
||||
|
||||
private 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);
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if (spreadsheetDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||
spreadsheetDocument.Dispose();
|
||||
}
|
||||
|
||||
public byte[] GetFile()
|
||||
{
|
||||
Save();
|
||||
byte[] file = File.ReadAllBytes(tempFileName);
|
||||
File.Delete(tempFileName);
|
||||
return file;
|
||||
}
|
||||
|
||||
public void CreateTitle(string text)
|
||||
{
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "B1"
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = text,
|
||||
StyleIndex = 0
|
||||
});
|
||||
}
|
||||
|
||||
public void CreateCaseSpecializationTable(List<ReportCaseSpecializationViewModel> data)
|
||||
{
|
||||
if (worksheet == null || shareStringPart == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Columns columns = new();
|
||||
Column columnA = new() { Min = 1, Max = 1, Width = 30, CustomWidth = true };
|
||||
columns.Append(columnA);
|
||||
Column columnB = new() { Min = 2, Max = 2, Width = 30, CustomWidth = true };
|
||||
columns.Append(columnB);
|
||||
worksheet.InsertAt(columns, 0);
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 2,
|
||||
Text = "Специализация:",
|
||||
StyleIndex = 2
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = 2,
|
||||
Text = "Дела:",
|
||||
StyleIndex = 2
|
||||
});
|
||||
|
||||
uint currentRow = 3;
|
||||
foreach (ReportCaseSpecializationViewModel specialization in data)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = currentRow,
|
||||
Text = specialization.Specialization,
|
||||
StyleIndex = 1
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = currentRow,
|
||||
Text = "",
|
||||
StyleIndex = 1
|
||||
});
|
||||
currentRow++;
|
||||
foreach (string caseName in specialization.Cases)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = currentRow,
|
||||
Text = "",
|
||||
StyleIndex = 1
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellData
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = currentRow,
|
||||
Text = caseName,
|
||||
StyleIndex = 1
|
||||
});
|
||||
currentRow++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperEnums
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum ExcelStyleInfoType
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperEnums
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum PdfParagraphAlignmentType
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperEnums
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum WordJustificationType
|
||||
{
|
||||
|
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelCellData
|
||||
{
|
||||
public string ColumnName { get; set; } = string.Empty;
|
||||
|
||||
public uint RowIndex { get; set; }
|
||||
|
||||
public string Text { get; set; } = string.Empty;
|
||||
|
||||
public string CellReference => $"{ColumnName}{RowIndex}";
|
||||
|
||||
public uint StyleIndex { get; set; } = 0;
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
using ComputersShopBusinessLogic.OfficePackage.HelperEnums;
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelCellParameters
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelMergeParameters
|
||||
{
|
||||
|
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfData<T>
|
||||
{
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public DateTime DateFrom { get; set; }
|
||||
|
||||
public DateTime DateTo { get; set; }
|
||||
|
||||
public List<T> Records { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
using ComputersShopBusinessLogic.OfficePackage.HelperEnums;
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfParagraph
|
||||
{
|
||||
|
@ -1,11 +1,11 @@
|
||||
using ComputersShopBusinessLogic.OfficePackage.HelperEnums;
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfRowParameters
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordParagraph
|
||||
{
|
||||
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTableData
|
||||
{
|
||||
public List<(string, int)> Columns { get; set; } = new();
|
||||
public List<List<string>> Rows { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
using ComputersShopBusinessLogic.OfficePackage.HelperEnums;
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTextProperties
|
||||
{
|
||||
|
@ -0,0 +1,183 @@
|
||||
using CaseAccountingBusinessLogic.OfficePackage;
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
using MigraDoc.Rendering;
|
||||
using PdfSharp.Pdf;
|
||||
using System.Text;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.BusinessLogic.OfficePackage
|
||||
{
|
||||
public class PdfBuilderProvider
|
||||
{
|
||||
private readonly string tempFileName = "temp.pdf";
|
||||
private Document? document;
|
||||
private Section? section;
|
||||
private Table? table;
|
||||
|
||||
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
||||
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
||||
_ => ParagraphAlignment.Justify,
|
||||
};
|
||||
}
|
||||
|
||||
private void DefineStyles(Document document)
|
||||
{
|
||||
var style = document.Styles["Normal"];
|
||||
style.Font.Name = "Times New Roman";
|
||||
style.Font.Size = 14;
|
||||
|
||||
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
||||
style.Font.Bold = true;
|
||||
}
|
||||
|
||||
public void CreateDocument()
|
||||
{
|
||||
document = new Document();
|
||||
DefineStyles(document);
|
||||
section = document.AddSection();
|
||||
}
|
||||
|
||||
public void CreateParagraph(PdfParagraph pdfParagraph)
|
||||
{
|
||||
if (section == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var paragraph = section.AddParagraph(pdfParagraph.Text);
|
||||
paragraph.Format.SpaceAfter = "1cm";
|
||||
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
||||
paragraph.Style = pdfParagraph.Style;
|
||||
}
|
||||
|
||||
public void CreateTable(List<string> columns)
|
||||
{
|
||||
if (document == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
table = document.LastSection.AddTable();
|
||||
foreach (var elem in columns)
|
||||
{
|
||||
table.AddColumn(elem);
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateRow(PdfRowParameters rowParameters)
|
||||
{
|
||||
if (table == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var row = table.AddRow();
|
||||
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
||||
{
|
||||
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
||||
if (!string.IsNullOrEmpty(rowParameters.Style))
|
||||
{
|
||||
row.Cells[i].Style = rowParameters.Style;
|
||||
}
|
||||
Unit borderWidth = 0.5;
|
||||
row.Cells[i].Borders.Left.Width = borderWidth;
|
||||
row.Cells[i].Borders.Right.Width = borderWidth;
|
||||
row.Cells[i].Borders.Top.Width = borderWidth;
|
||||
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
||||
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
||||
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
||||
}
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
|
||||
// Регистрация провайдера кодировки для кодировки 1252, без этого ошибОчка была
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = document
|
||||
};
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(tempFileName);
|
||||
}
|
||||
|
||||
public byte[] GetFile()
|
||||
{
|
||||
Save();
|
||||
byte[] file = File.ReadAllBytes(tempFileName);
|
||||
File.Delete(tempFileName);
|
||||
return file;
|
||||
}
|
||||
|
||||
public byte[] GetHearingLawyerReportFile(PdfData<ReportHearingLawyerViewModel> data)
|
||||
{
|
||||
CreateDocument();
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = data.Title,
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"за период с {data.DateFrom.ToShortDateString()} " +
|
||||
$"по {data.DateTo.ToShortDateString()}",
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
CreateTable(new List<string> { "4cm","5cm", "3cm", "3cm" });
|
||||
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Номер слушания", "Дело", "Дата проведения", "Юрист" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
foreach (var record in data.Records)
|
||||
{
|
||||
List<CaseLawyerViewModel> casesAndLawyes = record.CaseLawyers;
|
||||
int recordHeight = casesAndLawyes.Count + 1;
|
||||
for (int i = 0; i < recordHeight; i++)
|
||||
{
|
||||
List<string> cellsData = new() { "", "", "", "" };
|
||||
if (i == 0)
|
||||
{
|
||||
cellsData[0] = record.Hearing;
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = cellsData,
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
continue;
|
||||
}
|
||||
int k = i - 1;
|
||||
if (k < casesAndLawyes.Count)
|
||||
{
|
||||
cellsData[1] = casesAndLawyes[k].Case;
|
||||
cellsData[2] = casesAndLawyes[k].Date.ToString("yyyy-MM-dd");
|
||||
cellsData[3] = casesAndLawyes[k].Lawyer;
|
||||
}
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = cellsData,
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return GetFile();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using DocumentFormat.OpenXml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordBuilderCustomer
|
||||
{
|
||||
private readonly string tempFileName = "temp.docx";
|
||||
private WordprocessingDocument? wordDocument;
|
||||
private Body? documentBody;
|
||||
|
||||
public void CreateDocument()
|
||||
{
|
||||
wordDocument = WordprocessingDocument.Create(tempFileName,
|
||||
WordprocessingDocumentType.Document);
|
||||
MainDocumentPart mainPart = wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = new Document();
|
||||
documentBody = mainPart.Document.AppendChild(new Body());
|
||||
}
|
||||
|
||||
public void CreateParagraph(string text)
|
||||
{
|
||||
if (documentBody == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Paragraph paragraph = new();
|
||||
Run run = new();
|
||||
run.AppendChild(new Text
|
||||
{
|
||||
Text = text
|
||||
});
|
||||
paragraph.AppendChild(run);
|
||||
documentBody.AppendChild(paragraph);
|
||||
}
|
||||
|
||||
public void CreateTitle(string text)
|
||||
{
|
||||
if (documentBody == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Paragraph paragraph = new();
|
||||
Run run = new();
|
||||
RunProperties properties = new();
|
||||
properties.AppendChild(new Bold());
|
||||
run.AppendChild(properties);
|
||||
run.AppendChild(new Text
|
||||
{
|
||||
Text = text
|
||||
});
|
||||
paragraph.AppendChild(run);
|
||||
documentBody.AppendChild(paragraph);
|
||||
}
|
||||
|
||||
private TableCell CreateTableCell(string text, bool inHead = false, int? cellWidth = null)
|
||||
{
|
||||
Run run = new();
|
||||
TableCell tableCell = new();
|
||||
TableCellProperties cellProperties = new()
|
||||
{
|
||||
TableCellWidth = new()
|
||||
{
|
||||
Width = cellWidth.ToString()
|
||||
},
|
||||
TableCellMargin = new()
|
||||
{
|
||||
LeftMargin = new()
|
||||
{
|
||||
Width = "100"
|
||||
}
|
||||
}
|
||||
};
|
||||
if (inHead)
|
||||
{
|
||||
Shading shading = new()
|
||||
{
|
||||
Color = "auto",
|
||||
Fill = "e0e8ff",
|
||||
Val = ShadingPatternValues.Clear
|
||||
};
|
||||
cellProperties.Append(shading);
|
||||
RunProperties properties = new();
|
||||
properties.AppendChild(new Bold());
|
||||
run.AppendChild(properties);
|
||||
}
|
||||
run.AppendChild(new Text
|
||||
{
|
||||
Text = text
|
||||
});
|
||||
Paragraph paragraph = new(run);
|
||||
tableCell.AppendChild(paragraph);
|
||||
tableCell.Append(cellProperties);
|
||||
return tableCell;
|
||||
}
|
||||
|
||||
protected void CreateTable(WordTableData tableData)
|
||||
{
|
||||
if (documentBody == null || tableData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var table = new Table();
|
||||
|
||||
TableProperties tableProperties = new(
|
||||
new TableBorders(
|
||||
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 }
|
||||
)
|
||||
);
|
||||
table.AppendChild(tableProperties);
|
||||
|
||||
table.Append(new TableRow(tableData.Columns.Select(x => CreateTableCell(x.Item1, true, x.Item2))));
|
||||
table.Append(tableData.Rows.Select(x => new TableRow(x.Select(y => CreateTableCell(y)))));
|
||||
|
||||
documentBody.AppendChild(table);
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if (documentBody == null || wordDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
wordDocument.MainDocumentPart!.Document.Save();
|
||||
wordDocument.Dispose();
|
||||
}
|
||||
|
||||
public byte[] GetFile()
|
||||
{
|
||||
Save();
|
||||
byte[] file = File.ReadAllBytes(tempFileName);
|
||||
File.Delete(tempFileName);
|
||||
return file;
|
||||
}
|
||||
|
||||
public void CreateLawyersHearingTable(List<ReportLawyerHearingViewModel> data)
|
||||
{
|
||||
List<List<string>> rows = new();
|
||||
foreach (ReportLawyerHearingViewModel lawyer in data)
|
||||
{
|
||||
List<string> lawyerCells = new() { lawyer.Lawyer, "" };
|
||||
rows.Add(lawyerCells);
|
||||
List<string> hearingCells;
|
||||
foreach (string hearing in lawyer.Hearings)
|
||||
{
|
||||
hearingCells = new() { "", hearing };
|
||||
rows.Add(hearingCells);
|
||||
}
|
||||
}
|
||||
WordTableData wordTable = new()
|
||||
{
|
||||
Columns = new List<(string, int)>()
|
||||
{
|
||||
("Юрист", 3000),
|
||||
("Слушание", 3000)
|
||||
},
|
||||
Rows = rows
|
||||
};
|
||||
CreateTable(wordTable);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
|
||||
namespace CaseAccountingBusinessLogic.OfficePackage
|
||||
{
|
||||
public class WordBuilderProvider
|
||||
{
|
||||
private readonly string tempFileName = "temp.docx";
|
||||
private WordprocessingDocument? wordDocument;
|
||||
private Body? documentBody;
|
||||
|
||||
public void CreateDocument()
|
||||
{
|
||||
wordDocument = WordprocessingDocument.Create(tempFileName,
|
||||
WordprocessingDocumentType.Document);
|
||||
MainDocumentPart mainPart = wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = new Document();
|
||||
documentBody = mainPart.Document.AppendChild(new Body());
|
||||
}
|
||||
|
||||
public void CreateParagraph(string text)
|
||||
{
|
||||
if (documentBody == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Paragraph paragraph = new();
|
||||
Run run = new();
|
||||
run.AppendChild(new Text
|
||||
{
|
||||
Text = text
|
||||
});
|
||||
paragraph.AppendChild(run);
|
||||
documentBody.AppendChild(paragraph);
|
||||
}
|
||||
|
||||
public void CreateTitle(string text)
|
||||
{
|
||||
if (documentBody == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Paragraph paragraph = new();
|
||||
Run run = new();
|
||||
RunProperties properties = new();
|
||||
properties.AppendChild(new Bold());
|
||||
run.AppendChild(properties);
|
||||
run.AppendChild(new Text
|
||||
{
|
||||
Text = text
|
||||
});
|
||||
paragraph.AppendChild(run);
|
||||
documentBody.AppendChild(paragraph);
|
||||
}
|
||||
|
||||
private TableCell CreateTableCell(string text, bool inHead = false, int? cellWidth = null)
|
||||
{
|
||||
Run run = new();
|
||||
TableCell tableCell = new();
|
||||
TableCellProperties cellProperties = new()
|
||||
{
|
||||
TableCellWidth = new()
|
||||
{
|
||||
Width = cellWidth.ToString()
|
||||
},
|
||||
TableCellMargin = new()
|
||||
{
|
||||
LeftMargin = new()
|
||||
{
|
||||
Width = "100"
|
||||
}
|
||||
}
|
||||
};
|
||||
if (inHead)
|
||||
{
|
||||
Shading shading = new()
|
||||
{
|
||||
Color = "auto",
|
||||
Fill = "e0e8ff",
|
||||
Val = ShadingPatternValues.Clear
|
||||
};
|
||||
cellProperties.Append(shading);
|
||||
RunProperties properties = new();
|
||||
properties.AppendChild(new Bold());
|
||||
run.AppendChild(properties);
|
||||
}
|
||||
run.AppendChild(new Text
|
||||
{
|
||||
Text = text
|
||||
});
|
||||
Paragraph paragraph = new(run);
|
||||
tableCell.AppendChild(paragraph);
|
||||
tableCell.Append(cellProperties);
|
||||
return tableCell;
|
||||
}
|
||||
|
||||
protected void CreateTable(WordTableData tableData)
|
||||
{
|
||||
if (documentBody == null || tableData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var table = new Table();
|
||||
|
||||
TableProperties tableProperties = new(
|
||||
new TableBorders(
|
||||
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 },
|
||||
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 3 }
|
||||
)
|
||||
);
|
||||
table.AppendChild(tableProperties);
|
||||
|
||||
table.Append(new TableRow(tableData.Columns.Select(x => CreateTableCell(x.Item1, true, x.Item2))));
|
||||
table.Append(tableData.Rows.Select(x => new TableRow(x.Select(y => CreateTableCell(y)))));
|
||||
|
||||
documentBody.AppendChild(table);
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if (documentBody == null || wordDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
wordDocument.MainDocumentPart!.Document.Save();
|
||||
wordDocument.Dispose();
|
||||
}
|
||||
|
||||
public byte[] GetFile()
|
||||
{
|
||||
Save();
|
||||
byte[] file = File.ReadAllBytes(tempFileName);
|
||||
File.Delete(tempFileName);
|
||||
return file;
|
||||
}
|
||||
|
||||
public void CreateCaseSpecializationTable(List<ReportCaseSpecializationViewModel> data)
|
||||
{
|
||||
List<List<string>> rows = new();
|
||||
foreach (ReportCaseSpecializationViewModel specializationl in data)
|
||||
{
|
||||
List<string> specializationlCells = new() { specializationl.Specialization, "" };
|
||||
rows.Add(specializationlCells);
|
||||
List<string> caseCells;
|
||||
foreach (string caseString in specializationl.Cases)
|
||||
{
|
||||
caseCells = new() { "", caseString };
|
||||
rows.Add(caseCells);
|
||||
}
|
||||
}
|
||||
WordTableData wordTable = new()
|
||||
{
|
||||
Columns = new List<(string, int)>()
|
||||
{
|
||||
("Специализация", 3000),
|
||||
("Дела", 3000)
|
||||
},
|
||||
Rows = rows
|
||||
};
|
||||
CreateTable(wordTable);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingContracts.BindingModels
|
||||
{
|
||||
public class CaseSpecializationListBindingModel
|
||||
{
|
||||
public string FileType { get; set; } = string.Empty;
|
||||
public List<CaseViewModel> Cases { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using CaseAccountingDataModels.Models;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using CaseAccountingDataModels.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -20,5 +22,20 @@ namespace CaseAccountingContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
|
||||
public Dictionary<int, ICaseModel> Cases { get; set; } = new();
|
||||
|
||||
public List<CaseViewModel> CaseViewModels { get; set; } = new();
|
||||
|
||||
public Dictionary<int, IContractModel> Contracts { get; set; } = new();
|
||||
|
||||
public List<ContractViewModel> ContractViewModels { get; set; } = new();
|
||||
|
||||
public DealBindingModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
public DealBindingModel(Dictionary<int, CaseViewModel> Cases, Dictionary<int, ContractViewModel> Contracts)
|
||||
{
|
||||
this.Cases = Cases.ToDictionary(x => x.Key, x => (ICaseModel)x.Value);
|
||||
this.Contracts = Contracts.ToDictionary(x => x.Key, x => (IContractModel)x.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
using CaseAccountingDataModels.Models;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using CaseAccountingDataModels.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -17,12 +20,28 @@ namespace CaseAccountingContracts.BindingModels
|
||||
|
||||
public int Experience { get; set; }
|
||||
|
||||
public int SpecializationId { get; set; }
|
||||
public int? SpecializationId { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public Dictionary<int, ICaseModel> Cases { get; set; } = new();
|
||||
|
||||
public List<CaseViewModel> CaseViewModels { get; set; } = new();
|
||||
|
||||
public Dictionary<int, IContractModel> Contracts { get; set; } = new();
|
||||
|
||||
public List<ContractViewModel> ContractViewModels { get; set; } = new();
|
||||
|
||||
public LawyerBindingModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
public LawyerBindingModel(Dictionary<int, ContractViewModel> Contracts, Dictionary<int, CaseViewModel> Cases)
|
||||
{
|
||||
this.Contracts = Contracts.ToDictionary(x => x.Key, x => (IContractModel)x.Value);
|
||||
this.Cases = Cases.ToDictionary(x => x.Key, x => (ICaseModel)x.Value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingContracts.BindingModels
|
||||
{
|
||||
public class LawyerHearingListBindingModel
|
||||
{
|
||||
public string FileType { get; set; } = string.Empty;
|
||||
public List<LawyerViewModel> Lawyers { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingContracts.BindingModels
|
||||
{
|
||||
public class MailConfigBindingModel
|
||||
{
|
||||
public string MailLogin { get; set; } = string.Empty;
|
||||
public string MailPassword { get; set; } = string.Empty;
|
||||
public string SmtpClientHost { get; set; } = string.Empty;
|
||||
public int SmtpClientPort { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingContracts.BindingModels
|
||||
{
|
||||
public class MailSendInfoBindingModel
|
||||
{
|
||||
public string MailAddress { get; set; } = string.Empty;
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
public string Text { get; set; } = string.Empty;
|
||||
public byte[] File { get; set; } = Array.Empty<byte>();
|
||||
}
|
||||
}
|
@ -9,12 +9,9 @@ namespace CaseAccountingContracts.BindingModels
|
||||
{
|
||||
public class ReportBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? DateFrom { get; set; }
|
||||
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
public string UserEmail { get; set; } = string.Empty;
|
||||
public DateTime DateFrom { get; set; }
|
||||
public DateTime DateTo { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ namespace CaseAccountingContracts.BusinessLogicContracts
|
||||
bool Create(CaseBindingModel model);
|
||||
bool Update(CaseBindingModel model);
|
||||
bool Delete(CaseBindingModel model);
|
||||
List<SpecializationCasesViewModel> GetSpecializationCases();
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,12 @@ namespace CaseAccountingContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IReportCustomerLogic
|
||||
{
|
||||
List<ReportLawyerHearingViewModel> GetLawyerHearing(List<LawyerViewModel> models);
|
||||
List<ReportLawyerHearingViewModel> GetLawyersHearing(List<LawyerViewModel> models);
|
||||
|
||||
List<ReportHearingSpecializationViewModel> GetHearingSpecialization(ReportBindingModel model);
|
||||
|
||||
byte[] SaveListFile(LawyerHearingListBindingModel model);
|
||||
|
||||
void SaveLawyerHearingToWordFile(ReportBindingModel model);
|
||||
|
||||
void SaveLawyerHearingToExcelFile(ReportBindingModel model);
|
||||
|
@ -14,10 +14,8 @@ namespace CaseAccountingContracts.BusinessLogicContracts
|
||||
|
||||
List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model);
|
||||
|
||||
void SaveCaseSpecializationToWordFile(ReportBindingModel model);
|
||||
byte[] SaveListFile(CaseSpecializationListBindingModel model);
|
||||
|
||||
void SaveCaseSpecializationToExcelFile(ReportBindingModel model);
|
||||
|
||||
void SaveHearingLawyerToPdfFile(ReportBindingModel model);
|
||||
void SendByMailStatusReport(ReportBindingModel reportModel);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,10 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CaseAccountingDataModels\CaseAccountingDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -17,5 +17,8 @@ namespace CaseAccountingContracts.StoragesContracts
|
||||
CaseViewModel? Insert(CaseBindingModel model);
|
||||
CaseViewModel? Update(CaseBindingModel model);
|
||||
CaseViewModel? Delete(CaseBindingModel model);
|
||||
|
||||
List<HearingViewModel> GetCaseHearings(CaseSearchModel model);
|
||||
List<SpecializationCasesViewModel>? GetSpecializationCases();
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,8 @@ namespace CaseAccountingContracts.StoragesContracts
|
||||
LawyerViewModel? Insert(LawyerBindingModel model);
|
||||
LawyerViewModel? Update(LawyerBindingModel model);
|
||||
LawyerViewModel? Delete(LawyerBindingModel model);
|
||||
|
||||
List<CaseViewModel> GetLawyerCases(LawyerSearchModel model);
|
||||
List<LawyerViewModel> GetLawyerMTM(int caseId);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingContracts.ViewModels
|
||||
{
|
||||
public class CaseLawyerViewModel
|
||||
{
|
||||
public string Case { get; set; } = string.Empty;
|
||||
public DateTime Date { get; set; }
|
||||
public string Lawyer { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -18,11 +18,13 @@ namespace CaseAccountingContracts.ViewModels
|
||||
public string Patronymic { get; set; } = string.Empty;
|
||||
[DisplayName("Опыт работы")]
|
||||
public int Experience { get; set; }
|
||||
public int SpecializationId { get; set; }
|
||||
public int? SpecializationId { get; set; }
|
||||
[DisplayName("Специализация")]
|
||||
public string Specialization { get; set; } = string.Empty;
|
||||
public int UserId { get; set; }
|
||||
public int Id { get; set; }
|
||||
public Dictionary<int, IContractModel> Contracts { get; set; } = new();
|
||||
|
||||
public Dictionary<int, ICaseModel> Cases { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,7 @@ namespace CaseAccountingContracts.ViewModels
|
||||
{
|
||||
public class ReportCaseSpecializationViewModel
|
||||
{
|
||||
public string CaseName { get; set; } = string.Empty;
|
||||
public string Applicant { get; set; } = string.Empty;
|
||||
public string Defendant { get; set; } = string.Empty;
|
||||
public DateTime Date { get; set; }
|
||||
public string Specialization { get; set; } = string.Empty;
|
||||
public List<string> Cases { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,7 @@ namespace CaseAccountingContracts.ViewModels
|
||||
{
|
||||
public class ReportHearingLawyerViewModel
|
||||
{
|
||||
public string Information { get; set; } = string.Empty;
|
||||
public DateTime Date { get; set; }
|
||||
public List<(string Surname, string Name, string Patronymic)> Lawyers { get; set; } = new();
|
||||
public string Hearing { get; set; } = string.Empty;
|
||||
public List<CaseLawyerViewModel> CaseLawyers { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,7 @@ namespace CaseAccountingContracts.ViewModels
|
||||
{
|
||||
public class ReportLawyerHearingViewModel
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public string Surname { get; set; } = string.Empty;
|
||||
|
||||
public string Patronymic { get; set; } = string.Empty;
|
||||
|
||||
public List<(DateTime Date, string Information)> Hearings { get; set; } = new();
|
||||
public string Lawyer { get; set; } = string.Empty;
|
||||
public List<string> Hearings { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingContracts.ViewModels
|
||||
{
|
||||
public class SpecializationCasesViewModel
|
||||
{
|
||||
public int Count { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -39,5 +39,25 @@ namespace CaseAccountingCustomerView
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
|
||||
public static O? PostRequestWithResult<I, O>(string requestUrl, I model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = _client.PostAsync(requestUrl, data);
|
||||
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
|
||||
if (response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
var temp = JsonConvert.DeserializeObject<O>(result);
|
||||
return temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIUser.User = APIUser.GetRequest<UserViewModel>($"api/user/login?login={login}&password={password}&role={Role.Provider}");
|
||||
APIUser.User = APIUser.GetRequest<UserViewModel>($"api/user/login?login={login}&password={password}&role={Role.Customer}");
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
@ -56,8 +56,8 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
{
|
||||
Login = login,
|
||||
Password = password,
|
||||
Role = Role.Provider
|
||||
});
|
||||
Role = Role.Customer
|
||||
});
|
||||
Response.Redirect("Login");
|
||||
return;
|
||||
}
|
||||
@ -69,7 +69,7 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Lawyers = APIUser.GetRequest<List<LawyerViewModel>>
|
||||
($"api/lawyer/getmany?userId={APIUser.User.Id}");
|
||||
($"api/lawyer/getallbyuser?userId={APIUser.User.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Specializations = APIUser.GetRequest<List<SpecializationViewModel>>
|
||||
($"api/specialization/getmany?userId={APIUser.User.Id}");
|
||||
($"api/specialization/getallbyuser?userId={APIUser.User.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Contracts = APIUser.GetRequest<List<ContractViewModel>>
|
||||
($"api/contract/getmany?userId={APIUser.User.Id}");
|
||||
($"api/contract/getallbyuser?userId={APIUser.User.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -100,5 +100,22 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public int[]? HearingLawyerList([FromBody] LawyerHearingListBindingModel listModel)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return Array.Empty<int>();
|
||||
}
|
||||
byte[]? file = APIUser.PostRequestWithResult<LawyerHearingListBindingModel, byte[]>
|
||||
("api/reportcustomer/lawyerhearinglist", listModel);
|
||||
return file!.Select(b => (int)b).ToArray();
|
||||
}
|
||||
|
||||
public IActionResult HearingLawyerList()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using CaseAccountingDataModels.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace CaseAccountingCustomerView.Controllers
|
||||
@ -23,6 +24,14 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
throw new Exception("403");
|
||||
}
|
||||
lawyerModel.UserId = APIUser.User.Id;
|
||||
lawyerModel.SpecializationId = null;
|
||||
var dict = new Dictionary<int, IContractModel>();
|
||||
foreach (var element in lawyerModel.ContractViewModels)
|
||||
{
|
||||
var contract = APIUser.GetRequest<ContractViewModel>($"api/contract/get?id={element.Id}");
|
||||
dict.Add(element.Id, contract);
|
||||
}
|
||||
lawyerModel.Contracts = dict;
|
||||
APIUser.PostRequest("api/lawyer/create", lawyerModel);
|
||||
Response.Redirect("/Home/Lawyers");
|
||||
}
|
||||
@ -45,6 +54,20 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
throw new Exception("403");
|
||||
}
|
||||
lawyerModel.UserId = APIUser.User.Id;
|
||||
var dict = new Dictionary<int, ICaseModel>();
|
||||
foreach (var element in lawyerModel.CaseViewModels)
|
||||
{
|
||||
var _case = APIUser.GetRequest<CaseViewModel>($"api/case/get?id={element.Id}");
|
||||
dict.Add(element.Id, _case);
|
||||
}
|
||||
lawyerModel.Cases = dict;
|
||||
var dictContr = new Dictionary<int, IContractModel>();
|
||||
foreach (var element in lawyerModel.ContractViewModels)
|
||||
{
|
||||
var contract = APIUser.GetRequest<ContractViewModel>($"api/contract/get?id={element.Id}");
|
||||
dictContr.Add(element.Id, contract);
|
||||
}
|
||||
lawyerModel.Contracts = dictContr;
|
||||
APIUser.PostRequest("api/lawyer/update", lawyerModel);
|
||||
Response.Redirect("/Home/Lawyers");
|
||||
}
|
||||
@ -70,16 +93,6 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
return lawyers ?? new();
|
||||
}
|
||||
|
||||
/*public List<EducationGroupViewModel> GetAllCases()
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
List<EducationGroupViewModel>? group = APIUser.GetRequest<List<EducationGroupViewModel>>("api/lawyer/GetAllCases");
|
||||
return group ?? new();
|
||||
}*/
|
||||
|
||||
public LawyerViewModel? Get(int id)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
@ -100,6 +113,16 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Bind([FromBody] LawyerBindingModel lawyerModel)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIUser.PostRequest("api/lawyer/update", lawyerModel);
|
||||
}
|
||||
|
||||
public List<LawyerViewModel> GetAllByUserAndSpecialization(int specialization)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
@ -109,6 +132,17 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
List<LawyerViewModel>? lawyers = APIUser.GetRequest<List<LawyerViewModel>>($"api/lawyer/getallbyuserandspecialization?userId={APIUser.User.Id}&specialization={specialization}");
|
||||
return lawyers ?? new();
|
||||
}
|
||||
|
||||
public List<CaseViewModel> GetAllCases()
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
List<CaseViewModel>? _case = APIUser.GetRequest<List<CaseViewModel>>("api/lawyer/GetAllCases");
|
||||
return _case ?? new();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,5 +79,24 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
SpecializationViewModel? specialization = APIUser.GetRequest<SpecializationViewModel>($"api/specialization/get?id={id}");
|
||||
return specialization;
|
||||
}
|
||||
public IActionResult AddLawyer(int id)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.SpecializationId = id;
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AddLawyer([FromBody] LawyerBindingModel lawyerModel)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIUser.PostRequest("api/lawyer/update", lawyerModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,4 +21,4 @@
|
||||
Создать
|
||||
</button>
|
||||
|
||||
<script src="~/js/contract/contract-create.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Contracts/contract-create.js" asp-append-version="true"></script>
|
@ -6,7 +6,7 @@
|
||||
|
||||
@{
|
||||
|
||||
<h4 class="fw-bold" id="vb-id" data-id="@ViewBag.Contract.Id">Изменение данных контракта</h4>
|
||||
<h4 class="fw-bold" id="contr-id" data-id="@ViewBag.Contract.Id">Изменение данных контракта</h4>
|
||||
|
||||
if (ViewBag.Contract == null)
|
||||
{
|
||||
@ -31,4 +31,4 @@
|
||||
</button>
|
||||
}
|
||||
|
||||
<script src="~/js/contract/contract-update.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Contracts/contract-update.js" asp-append-version="true"></script>
|
@ -0,0 +1,72 @@
|
||||
@using CaseAccountingContracts.ViewModels
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Контракты";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Контракты</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (ViewBag.Contracts == null)
|
||||
{
|
||||
<h3 class="display-4">Войдите в аккаунт</h3>
|
||||
return;
|
||||
}
|
||||
<div>
|
||||
<a class="btn btn-secondary" asp-controller="Contracts" asp-action="Create">Добавить контракт</a>
|
||||
</div>
|
||||
<div class="d-flex mb-2 gap-1">
|
||||
<a href="/Home/Contracts" id="go-button" class="button-primary text-button">
|
||||
Перейти
|
||||
</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Услуга
|
||||
</th>
|
||||
<th>
|
||||
Цена
|
||||
</th>
|
||||
<th>
|
||||
Дата
|
||||
</th>
|
||||
<th>
|
||||
Изменить запись
|
||||
</th>
|
||||
<th>
|
||||
Удалить запись
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ViewBag.Contracts)
|
||||
{
|
||||
<tr class="d-table-row">
|
||||
<td>
|
||||
@item.Service
|
||||
</td>
|
||||
<td>
|
||||
@item.Coast
|
||||
</td>
|
||||
<td>
|
||||
@item.Date
|
||||
</td>
|
||||
<td>
|
||||
<a id="update-button-@item.Id" class="btn btn-secondary" asp-controller="Contracts" asp-action="Update" asp-route-id="@item.Id">Изменить</a>
|
||||
</td>
|
||||
<td>
|
||||
<a id="remove-button-@item.Id" class="btn btn-secondary remove-btn" data-id="@item.Id">Удалить</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
||||
<script src="~/js/Contracts/contracts.js" asp-append-version="true"></script>
|
@ -0,0 +1,44 @@
|
||||
@{
|
||||
ViewData["Title"] = "Список слушаний по юристам";
|
||||
}
|
||||
|
||||
<h4 class="fw-bold">Список слушаний по юристам</h4>
|
||||
|
||||
<div id="error-div-shell" class="error-div-shell mb-2">
|
||||
<div>
|
||||
<p id="error-p" class="error-p"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<select id="file-type">
|
||||
<option>docx</option>
|
||||
<option>xlsx</option>
|
||||
</select>
|
||||
|
||||
<button id="create-button" type="button" class="button-primary text-button">
|
||||
Показать итоговый вариант
|
||||
</button>
|
||||
|
||||
<button id="save-button" type="button" class="button-primary text-button">
|
||||
Сохранить результат
|
||||
</button>
|
||||
|
||||
<div>
|
||||
<div class="scrollable-table">
|
||||
<table class="table table-bordered">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Имя</th>
|
||||
<th>Фамилия</th>
|
||||
<th>Отчество</th>
|
||||
<th>Опыт работы</th>
|
||||
<th>Специализация</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="scrollable-table__tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="~/js/Report/reportlist.js" asp-append-version="true"></script>
|
@ -16,16 +16,7 @@
|
||||
return;
|
||||
}
|
||||
<div>
|
||||
<a class="btn btn-secondary" asp-controller="Lawyer" asp-action="Create">Добавить юриста</a>
|
||||
</div>
|
||||
<div class="d-flex mb-2 gap-1">
|
||||
<div class="input-group" style="width: auto;">
|
||||
<input id="page-input" type="number" min="1" value="@ViewBag.Page" max="@ViewBag.NumberOfPages" class="form-control" style="max-width: 5em">
|
||||
<span class="input-group-text">/ @ViewBag.NumberOfPages</span>
|
||||
</div>
|
||||
<a href="/Home/Lawyers?page=@ViewBag.Page" id="go-button" class="button-primary text-button">
|
||||
Перейти
|
||||
</a>
|
||||
<a class="btn btn-secondary" asp-controller="Lawyers" asp-action="Create">Добавить юриста</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
@ -55,13 +46,16 @@
|
||||
@item.Name @item.Surname @item.Patronymic
|
||||
</td>
|
||||
<td>
|
||||
@item.StudentCard
|
||||
@item.Experience
|
||||
</td>
|
||||
<td>
|
||||
@item.EducationStatusName
|
||||
@item.Specialization
|
||||
</td>
|
||||
<td>
|
||||
<a id="update-button-@item.Id" class="btn btn-secondary" asp-controller="Lawyer" asp-action="Update" asp-route-id="@item.Id">Изменить</a>
|
||||
<a id="update-button-@item.Id" class="btn btn-secondary" asp-controller="Lawyers" asp-action="Bind" asp-route-id="@item.Id">Привязка</a>
|
||||
</td>
|
||||
<td>
|
||||
<a id="update-button-@item.Id" class="btn btn-secondary" asp-controller="Lawyers" asp-action="Update" asp-route-id="@item.Id">Изменить</a>
|
||||
</td>
|
||||
<td>
|
||||
<a id="remove-button-@item.Id" class="btn btn-secondary remove-btn" data-id="@item.Id">Удалить</a>
|
||||
@ -73,4 +67,4 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<script src="~/js/lawyer/lawyers.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Lawyers/lawyers.js" asp-append-version="true"></script>
|
@ -0,0 +1,63 @@
|
||||
@using CaseAccountingContracts.ViewModels
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Специализации";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Специализации</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (ViewBag.Specializations == null)
|
||||
{
|
||||
<h3 class="display-4">Войдите в аккаунт</h3>
|
||||
return;
|
||||
}
|
||||
<div>
|
||||
<a class="btn btn-secondary" asp-controller="Specializations" asp-action="Create">Добавить специализацию</a>
|
||||
</div>
|
||||
<div class="d-flex mb-2 gap-1">
|
||||
<a href="/Home/Specializations" id="go-button" class="button-primary text-button">
|
||||
Перейти
|
||||
</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Название
|
||||
</th>
|
||||
<th>
|
||||
Изменить запись
|
||||
</th>
|
||||
<th>
|
||||
Удалить запись
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ViewBag.Specializations)
|
||||
{
|
||||
<tr class="d-table-row">
|
||||
<td>
|
||||
@item.Name
|
||||
</td>
|
||||
<td>
|
||||
<a id="add-lawyer-button-@item.Id" class="btn btn-secondary" asp-controller="Specializations" asp-action="AddLawyer" asp-route-id="@item.Id">Назначить специализацию для юриста</a>
|
||||
</td>
|
||||
<td>
|
||||
<a id="update-button-@item.Id" class="btn btn-secondary" asp-controller="Specializations" asp-action="Update" asp-route-id="@item.Id">Изменить</a>
|
||||
</td>
|
||||
<td>
|
||||
<a id="remove-button-@item.Id" class="btn btn-secondary remove-btn" data-id="@item.Id">Удалить</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
||||
<script src="~/js/Specializations/specializations.js" asp-append-version="true"></script>
|
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
|
||||
<p class="mb-0">Название:</p>
|
||||
<input type="text" readonly value="@ViewBag.Document.Name" id="name-input" name="name" class="form-control mb-3" />
|
||||
<input type="text" readonly value="@ViewBag.Lawyer.Name" id="name-input" name="name" class="form-control mb-3" />
|
||||
|
||||
<button id="create-button" type="button" class="button-primary text-button">
|
||||
Сохранить привязку
|
||||
@ -23,7 +23,7 @@
|
||||
<table class="table table-bordered">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Название группы:</th>
|
||||
<th>Название дела:</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="scrollable-table__tbody">
|
||||
@ -32,4 +32,4 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<script src="~/js/document/document-bind.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Lawyers/lawyer-bind.js" asp-append-version="true"></script>
|
@ -19,8 +19,24 @@
|
||||
<p class="mb-0">Опыт работы:</p>
|
||||
<input type="number" id="experience-input" name="experience" class="form-control mb-3" />
|
||||
|
||||
<div>
|
||||
<div class="scrollable-table">
|
||||
<table class="table table-bordered">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Услуга</th>
|
||||
<th>Цена</th>
|
||||
<th>Дата</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="scrollable-table__tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="create-button" type="button" class="button-primary text-button">
|
||||
Создать
|
||||
</button>
|
||||
|
||||
<script src="~/js/lawyer/lawyer-create.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Lawyers/lawyer-create.js" asp-append-version="true"></script>
|
@ -6,7 +6,7 @@
|
||||
|
||||
@{
|
||||
|
||||
<h4 class="fw-bold" id="vb-id" data-id="@ViewBag.Lawyer.Id">Изменение данных юриста</h4>
|
||||
<h4 class="fw-bold" id="lawyer-id" data-id="@ViewBag.Lawyer.Id">Изменение данных юриста</h4>
|
||||
|
||||
if (ViewBag.Lawyer == null)
|
||||
{
|
||||
@ -28,9 +28,25 @@
|
||||
<p class="mb-0">Опыт работы:</p>
|
||||
<input value="@ViewBag.Lawyer.Experience" type="number" id="experience-input" name="experience" class="form-control mb-3" />
|
||||
|
||||
<button id="update-button" type="button" class="button-primary text-button">
|
||||
<button id="create-button" type="button" class="btn btn-primary text-button">
|
||||
Сохранить изменения
|
||||
</button>
|
||||
|
||||
<div class="mt-4">
|
||||
<div class="scrollable-table">
|
||||
<table class="table table-bordered">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Услуга</th>
|
||||
<th>Цена</th>
|
||||
<th>Дата</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="scrollable-table__tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<script src="~/js/lawyer/lawyer-update.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Lawyers/lawyer-update.js" asp-append-version="true"></script>
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - CaseAccountingCustomerView</title>
|
||||
<title>@ViewData["Title"] - Юридическая фирма «Вас обманут» "Заказчик"</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/CaseAccountingCustomerView.styles.css" asp-append-version="true" />
|
||||
@ -12,7 +12,7 @@
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">CaseAccountingCustomerView</a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Юридическая фирма «Вас обманут» "Заказчик"</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
@ -20,10 +20,19 @@
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Contracts">Контракты</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Lawyers">Юристы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Specializations">Специализации</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="HearingLawyerList">Получить список</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="GetReport">Получить отчёт</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -38,7 +47,7 @@
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2023 - CaseAccountingCustomerView - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
© Юридическая фирма «Вас обманут» "Заказчик" - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
|
@ -54,4 +54,4 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<script src="~/js/specialization/specialization-add-student.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Specializations/specializations-add-lawyer.js" asp-append-version="true"></script>
|
@ -17,4 +17,4 @@
|
||||
Создать
|
||||
</button>
|
||||
|
||||
<script src="~/js/specialization/specialization-create.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Specializations/specialization-create.js" asp-append-version="true"></script>
|
@ -6,9 +6,9 @@
|
||||
|
||||
@{
|
||||
|
||||
<h4 class="fw-bold" id="vb-id" data-id="@ViewBag.Specialization.Id">Изменение данных специализации</h4>
|
||||
<h4 class="fw-bold" id="spec-id" data-id="@ViewBag.Specialization.Id">Изменение данных специализации</h4>
|
||||
|
||||
if (ViewBag.EducationStatus == null)
|
||||
if (ViewBag.Specialization == null)
|
||||
{
|
||||
<h3 class="display-4">Войдите в аккаунт</h3>
|
||||
return;
|
||||
@ -27,4 +27,4 @@
|
||||
</button>
|
||||
}
|
||||
|
||||
<script src="~/js/specialization/specialization-update.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Specializations/specialization-update.js" asp-append-version="true"></script>
|
@ -7,5 +7,5 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
|
||||
"IPAddress": "http://localhost:5146/"
|
||||
"IPAddress": "http://localhost:5146"
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ createBtn.addEventListener("click", () => {
|
||||
};
|
||||
console.log(contract)
|
||||
$.ajax({
|
||||
url: "/contract/create",
|
||||
url: "/contracts/create",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(contract)
|
||||
|
@ -4,26 +4,26 @@ const coastInput = document.getElementById("coast-input")
|
||||
const dateInput = document.getElementById("date-input")
|
||||
const contractId = document.getElementById("contr-id").dataset.id
|
||||
|
||||
contracts = []
|
||||
|
||||
window.addEventListener("load", () => {
|
||||
const contractsResponse = $.ajax({
|
||||
url: `/contracts/getallbyuser`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
});
|
||||
contracts = contractsResponse;
|
||||
})
|
||||
|
||||
const correctData = () => {
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
updateBtn.addEventListener("click", () => {
|
||||
if (!correctData()) {
|
||||
return;
|
||||
}
|
||||
if (!validate()) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
const correctData = function () {
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const validate = function () {
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
updateBtn.addEventListener("click", () => {
|
||||
let contract = {
|
||||
"Id": parseInt(contractId),
|
||||
"Service": serviceInput.value,
|
||||
@ -32,7 +32,7 @@ updateBtn.addEventListener("click", () => {
|
||||
};
|
||||
console.log(contract)
|
||||
$.ajax({
|
||||
url: "/lawyer/update",
|
||||
url: "/contracts/update",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(contract)
|
||||
|
@ -8,7 +8,7 @@ removeButtons.forEach(function (button) {
|
||||
var result = confirm("Вы уверены, что хотите удалить эту запись?");
|
||||
if (result) {
|
||||
$.ajax({
|
||||
url: "/contract/delete",
|
||||
url: "/contracts/delete",
|
||||
type: "POST",
|
||||
data: { Id: id }
|
||||
}).done(() => {
|
||||
|
@ -4,48 +4,54 @@ const nameInput = document.getElementById("name-input");
|
||||
const currentLawyerId = document.getElementById("lawyer-data").dataset.id;
|
||||
var cases = [];
|
||||
var dataArray = [];
|
||||
var currentlawyer = null;
|
||||
var currentLawyer = null;
|
||||
|
||||
window.addEventListener('load', async () => {
|
||||
await $.ajax({
|
||||
url: "/lawyer/getallgroups",
|
||||
url: "/lawyers/getallcases",
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
groups = result;
|
||||
console.log(groups)
|
||||
cases = result;
|
||||
console.log(cases)
|
||||
});
|
||||
await $.ajax({
|
||||
url: `/document/get?id=${currentDocumentId}`,
|
||||
url: `/lawyers/get?id=${currentLawyerId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
currentDocument = result;
|
||||
console.log(currentDocument)
|
||||
currentLawyer = result;
|
||||
});
|
||||
groups.forEach((group) => createRowForGroupsTable(group));
|
||||
cases.forEach((_case) => createRowForCasesTable(_case));
|
||||
})
|
||||
|
||||
createBtn.addEventListener('click', () => {
|
||||
var documentGroupsUpdate = {
|
||||
"Id": currentDocument.id,
|
||||
"Name": currentDocument.name,
|
||||
"Date": currentDocument.date,
|
||||
"DocumentStudents": currentDocument.documentStudents,
|
||||
"DocumentGroups": dataArray,
|
||||
console.log("My data:")
|
||||
console.log(currentLawyer);
|
||||
console.log(dataArray);
|
||||
var lawyerCasesUpdate = {
|
||||
"Id": currentLawyer.id,
|
||||
"Name": currentLawyer.name,
|
||||
"Surname": currentLawyer.surname,
|
||||
"Patronymic": currentLawyer.patronymic,
|
||||
"SpecializationId": currentLawyer.specializationId,
|
||||
"Experience": currentLawyer.experience,
|
||||
"ContractViewModels": currentLawyer.contractViewModels,
|
||||
"CaseViewModels": dataArray,
|
||||
}
|
||||
console.log(lawyerCasesUpdate);
|
||||
$.ajax({
|
||||
url: "/document/update",
|
||||
url: "/lawyers/update",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(documentGroupsUpdate)
|
||||
data: JSON.stringify(lawyerCasesUpdate)
|
||||
}).done(() => {
|
||||
window.location.href = "/Home/Documents";
|
||||
window.location.href = "/Home/Lawyers";
|
||||
});
|
||||
})
|
||||
|
||||
const createRowForGroupsTable = (group) => {
|
||||
const { id, name } = group;
|
||||
const createRowForCasesTable = (_case) => {
|
||||
const { id, name, applicant, defendant, annotation, date, specializationId } = _case;
|
||||
const row = tbody.insertRow();
|
||||
row.setAttribute("data-id", id);
|
||||
|
||||
@ -54,10 +60,10 @@ const createRowForGroupsTable = (group) => {
|
||||
const cell = row.insertCell();
|
||||
cell.textContent = value;
|
||||
});
|
||||
console.log(currentDocument)
|
||||
if (currentDocument.documentEdGroups?.find(x => parseInt(x.id) === parseInt(group.id))) {
|
||||
console.log(currentLawyer)
|
||||
if (currentLawyer.lawyerCases?.find(x => parseInt(x.id) === parseInt(_case.id))) {
|
||||
row.classList.add("bg-success");
|
||||
dataArray.push(group);
|
||||
dataArray.push(_case);
|
||||
}
|
||||
|
||||
row.addEventListener('click', () => addAndRemoveFromList(row));
|
||||
@ -73,9 +79,9 @@ const formatDate = (dateString) => {
|
||||
|
||||
const addAndRemoveFromList = (row) => {
|
||||
var id = parseInt(row.dataset.id);
|
||||
var index = dataArray.indexOf(groups.find(x => x.id === id));
|
||||
var index = dataArray.indexOf(cases.find(x => x.id === id));
|
||||
if (index === -1) {
|
||||
dataArray.push(groups.find(x => x.id === id));
|
||||
dataArray.push(cases.find(x => x.id === id));
|
||||
row.classList.add("bg-success");
|
||||
} else {
|
||||
dataArray.splice(index, 1);
|
||||
|
@ -10,12 +10,12 @@ var dataArray = [];
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
$.ajax({
|
||||
url: "/contract/getallbyuser",
|
||||
url: "/contracts/getallbyuser",
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
contracts = result;
|
||||
contracts.forEach((contract) => createRowForStudentsTable(contract));
|
||||
contracts.forEach((contract) => createRowForContractsTable(contract));
|
||||
});
|
||||
})
|
||||
|
||||
@ -25,10 +25,11 @@ createBtn.addEventListener('click', () => {
|
||||
"Surname": surnameInput.value,
|
||||
"Patronymic": patronymicInput.value,
|
||||
"Experience": parseInt(experienceInput.value),
|
||||
"LawyerContracts": dataArray,
|
||||
"ContractViewModels": dataArray,
|
||||
}
|
||||
console.log(lawyer);
|
||||
$.ajax({
|
||||
url: "/lawyer/create",
|
||||
url: "/lawyers/create",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(lawyer)
|
||||
|
@ -1,67 +1,72 @@
|
||||
const createBtn = document.getElementById("create-button");
|
||||
const tbody = document.getElementById("scrollable-table__tbody");
|
||||
const serviceInput = document.getElementById("service-input");
|
||||
const coastInput = document.getElementById("coast-input");
|
||||
const currentLawyerId = document.getElementById("lawyer-data").dataset.id;
|
||||
const nameInput = document.getElementById("name-input")
|
||||
const surnameInput = document.getElementById("surname-input")
|
||||
const patronymicInput = document.getElementById("patronymic-input")
|
||||
const experienceInput = document.getElementById("experience-input")
|
||||
const currentLawyerId = document.getElementById("lawyer-id").dataset.id;
|
||||
var contracts = [];
|
||||
var dataArray = [];
|
||||
var currentLawyer = null;
|
||||
|
||||
window.addEventListener('load', async () => {
|
||||
await $.ajax({
|
||||
url: "/contract/getallbyuser",
|
||||
url: "/contracts/getallbyuser",
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
contracts = result;
|
||||
});
|
||||
console.log(currentLawyerId)
|
||||
await $.ajax({
|
||||
url: `/lawyer/get?id=${currentLawyerId}`,
|
||||
url: `/lawyers/get?id=${currentLawyerId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
currentLawyer = result;
|
||||
});
|
||||
contracts.forEach((contract) => createRowForContractsTable(contract));
|
||||
console.log(currentLawyerId);
|
||||
console.log(currentLawyer);
|
||||
contracts.forEach((contract) => {
|
||||
const { id, service, coast, date } = contract;
|
||||
const row = tbody.insertRow();
|
||||
row.setAttribute("data-id", id);
|
||||
|
||||
const cells = [service, coast, formatDate(date)];
|
||||
cells.forEach((value) => {
|
||||
const cell = row.insertCell();
|
||||
cell.textContent = value;
|
||||
});
|
||||
console.log(currentLawyer);
|
||||
/*if (currentLawyer.сontractViewModels.find(x => parseInt(x.id) === parseInt(contract.id))) {
|
||||
row.classList.add("bg-success");
|
||||
dataArray.push(contract);
|
||||
}*/
|
||||
|
||||
row.addEventListener('click', () => addAndRemoveFromList(row));
|
||||
});
|
||||
})
|
||||
|
||||
/*createBtn.addEventListener('click', () => {
|
||||
createBtn.addEventListener('click', () => {
|
||||
console.log(dataArray);
|
||||
var lawyerCasesUpdate = {
|
||||
"Id": currentLawyer.id,
|
||||
"Service": serviceInput.value,
|
||||
"Coast": coastInput.value,
|
||||
"Date": currentLawyer.date,
|
||||
"LawyerContracts": dataArray,
|
||||
"LawyerCases": currentLawyer.lawyerCases,
|
||||
"Id": currentLawyerId,
|
||||
"Name": nameInput.value,
|
||||
"Surname": surnameInput.value,
|
||||
"Patronymic": patronymicInput.value,
|
||||
"Experience": parseInt(experienceInput.value),
|
||||
"SpecializationId": parseInt(currentLawyer.specializationId),
|
||||
"ContractViewModels": dataArray
|
||||
}
|
||||
$.ajax({
|
||||
url: "/lawyer/update",
|
||||
url: "/lawyers/update",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(lawyerCasesUpdate)
|
||||
}).done(() => {
|
||||
window.location.href = "/Home/Lawyers";
|
||||
});
|
||||
})*/
|
||||
|
||||
const createRowForContractsTable = (contract) => {
|
||||
const { id, service, coast, date} = contract;
|
||||
const row = tbody.insertRow();
|
||||
row.setAttribute("data-id", id);
|
||||
|
||||
const cells = [service, coast, formatDate(date)];
|
||||
cells.forEach((value) => {
|
||||
const cell = row.insertCell();
|
||||
cell.textContent = value;
|
||||
});
|
||||
|
||||
if (currentLawyer.lawyerContracts.find(x => parseInt(x.id) === parseInt(contract.id))) {
|
||||
row.classList.add("bg-success");
|
||||
dataArray.push(contract);
|
||||
}
|
||||
|
||||
row.addEventListener('click', () => addAndRemoveFromList(row));
|
||||
};
|
||||
})
|
||||
|
||||
const formatDate = (dateString) => {
|
||||
const date = new Date(dateString);
|
||||
|
@ -10,7 +10,7 @@ removeButtons.forEach(function (button) {
|
||||
var result = confirm("Вы уверены, что хотите удалить эту запись?");
|
||||
if (result) {
|
||||
$.ajax({
|
||||
url: "/lawyer/delete",
|
||||
url: "/lawyers/delete",
|
||||
type: "POST",
|
||||
data: { Id: id }
|
||||
}).done(() => {
|
||||
|
@ -0,0 +1,98 @@
|
||||
const createBtn = document.getElementById("create-button")
|
||||
const tbody = document.getElementById("scrollable-table__tbody")
|
||||
const nameInput = document.getElementById("name-input")
|
||||
var fileType = document.getElementById("file-type")
|
||||
var lawyers = []
|
||||
var dataArray = [];
|
||||
const wordMIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
const excelMIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
$.ajax({
|
||||
url: "/lawyers/getallbyuser",
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
lawyers = result;
|
||||
lawyers.forEach((lawyer) => createRowForLawyersTable(lawyer));
|
||||
});
|
||||
})
|
||||
|
||||
createBtn.addEventListener('click', () => {
|
||||
let listModel = {
|
||||
"Lawyers": Array.from(dataArray),
|
||||
"FileType": fileType.value
|
||||
};
|
||||
console.log(listModel);
|
||||
$.ajax({
|
||||
url: "/home/hearinglawyerlist",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(listModel)
|
||||
}).done((file) => {
|
||||
let byteArray = new Uint8Array(file);
|
||||
saveFile(byteArray, fileType);
|
||||
});
|
||||
})
|
||||
|
||||
const saveFile = async function (bytes, fileType) {
|
||||
if (window.showSaveFilePicker) {
|
||||
let type;
|
||||
if (fileType.value == "docx") {
|
||||
type = {
|
||||
description: "Microsoft Word (OpenXML)",
|
||||
accept: { [wordMIME]: [".docx"] }
|
||||
};
|
||||
} else if (fileType.value == "xlsx") {
|
||||
type = {
|
||||
description: "Microsoft Excel (OpenXML)",
|
||||
accept: { [excelMIME]: [".xlsx"] }
|
||||
};
|
||||
}
|
||||
|
||||
const opts = {
|
||||
suggestedName: `lawyer-hearing-list.${fileType.value}`,
|
||||
types: [type],
|
||||
};
|
||||
const handle = await showSaveFilePicker(opts);
|
||||
const writable = await handle.createWritable();
|
||||
await writable.write(bytes);
|
||||
writable.close();
|
||||
}
|
||||
}
|
||||
|
||||
const createRowForLawyersTable = (lawyer) => {
|
||||
const { id, name, surname, patronymic, experience, specialization } = lawyer;
|
||||
const row = tbody.insertRow();
|
||||
row.setAttribute("data-id", id);
|
||||
|
||||
const cells = [name, surname, patronymic, experience, specialization ];
|
||||
cells.forEach((value) => {
|
||||
const cell = row.insertCell();
|
||||
cell.textContent = value;
|
||||
});
|
||||
|
||||
row.addEventListener('click', () => addAndRemoveFromList(row));
|
||||
};
|
||||
|
||||
const formatDate = (dateString) => {
|
||||
const date = new Date(dateString);
|
||||
const year = date.getFullYear();
|
||||
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||
const day = ('0' + date.getDate()).slice(-2);
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
|
||||
const addAndRemoveFromList = (row) => {
|
||||
var id = parseInt(row.dataset.id);
|
||||
console.log(lawyers.find(x => x.id === id))
|
||||
var index = dataArray.indexOf(lawyers.find(x => x.id === id));
|
||||
if (index === -1) {
|
||||
dataArray.push(lawyers.find(x => x.id === id));
|
||||
row.classList.add("bg-success");
|
||||
} else {
|
||||
dataArray.splice(index, 1);
|
||||
row.classList.remove("bg-success");
|
||||
}
|
||||
console.log(dataArray);
|
||||
}
|
@ -21,15 +21,15 @@ const validate = function () {
|
||||
};
|
||||
|
||||
createBtn.addEventListener("click", () => {
|
||||
let specialization = {
|
||||
let specializationModel = {
|
||||
"Name": nameInput.value,
|
||||
};
|
||||
console.log(specialization)
|
||||
console.log(specializationModel)
|
||||
$.ajax({
|
||||
url: "/specialization/create",
|
||||
url: "/specializations/create",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(specialization)
|
||||
data: JSON.stringify(specializationModel)
|
||||
}).done(() => {
|
||||
window.location.href = "/Home/Specializations";
|
||||
});
|
||||
|
@ -28,7 +28,7 @@ updateBtn.addEventListener("click", () => {
|
||||
};
|
||||
console.log(specialization)
|
||||
$.ajax({
|
||||
url: "/specialization/update",
|
||||
url: "/specializations/update",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(specialization)
|
||||
|
@ -10,18 +10,19 @@ var specialization = null;
|
||||
window.addEventListener("load", async () => {
|
||||
try {
|
||||
const lawyersResponse = await $.ajax({
|
||||
url: `/lawyer/getallbyuserandspecialization?specialization=${specializationId}`,
|
||||
url: `/lawyers/getallbyuserandspecialization?specialization=${specializationId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
});
|
||||
lawyers = lawyersResponse;
|
||||
|
||||
console.log(lawyers);
|
||||
lawyers.forEach((lawyer) => {
|
||||
createLawyerOption(lawyer);
|
||||
});
|
||||
|
||||
const specializationResponse = await $.ajax({
|
||||
url: `/specialization/get?id=${specializationId}`,
|
||||
url: `/specializations/get?id=${specializationId}`,
|
||||
type: 'GET',
|
||||
contentType: 'json'
|
||||
});
|
||||
@ -42,7 +43,7 @@ updateBtn.addEventListener("click", () => {
|
||||
lawyer.specializationId = specialization.id;
|
||||
|
||||
$.ajax({
|
||||
url: "/lawyer/update",
|
||||
url: "/lawyers/update",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(lawyer)
|
||||
|
@ -8,7 +8,7 @@ removeButtons.forEach(function (button) {
|
||||
var result = confirm("Вы уверены, что хотите удалить эту запись?");
|
||||
if (result) {
|
||||
$.ajax({
|
||||
url: "/specialization/delete",
|
||||
url: "/specializations/delete",
|
||||
type: "POST",
|
||||
data: { Id: id }
|
||||
}).done(() => {
|
||||
|
@ -18,8 +18,8 @@ namespace CaseAccountingDataBaseImplement
|
||||
Host=localhost;
|
||||
Port=5432;
|
||||
Database=CaseAccountingDatabase;
|
||||
Username=postgres;
|
||||
Password=postgres");
|
||||
Username=courseuser;
|
||||
Password=courseuser");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_case.Update(model);
|
||||
_case.Update(context, model);
|
||||
context.SaveChanges();
|
||||
_case.UpdateLawyers(context, model);
|
||||
transaction.Commit();
|
||||
@ -170,5 +170,37 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public List<HearingViewModel> GetCaseHearings(CaseSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new CaseAccountingDatabase();
|
||||
var hearings = context.Hearings
|
||||
.Where(x => x.CaseId == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
return hearings;
|
||||
}
|
||||
|
||||
public List<SpecializationCasesViewModel>? GetSpecializationCases()
|
||||
{
|
||||
using var context = new CaseAccountingDatabase();
|
||||
var result = context.Specializations
|
||||
.GroupJoin(
|
||||
context.Cases,
|
||||
status => status.Id,
|
||||
caseModel => caseModel.SpecializationId,
|
||||
(status, caseModels) => new SpecializationCasesViewModel
|
||||
{
|
||||
Name = status.Name,
|
||||
Count = caseModels.Count()
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,14 +86,13 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
|
||||
public ContractViewModel? Insert(ContractBindingModel model)
|
||||
{
|
||||
var newContract = Contract.Create(model);
|
||||
using var context = new CaseAccountingDatabase();
|
||||
var newContract = Contract.Create(context, model);
|
||||
if (newContract == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new CaseAccountingDatabase();
|
||||
|
||||
context.Contracts.Add(newContract);
|
||||
context.SaveChanges();
|
||||
return context.Contracts
|
||||
|
@ -115,9 +115,9 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
deal.Update(model);
|
||||
deal.Update(context, model);
|
||||
context.SaveChanges();
|
||||
deal.UpdateCases(context, model);
|
||||
if(model.Cases.Count > 0) deal.UpdateCases(context, model);
|
||||
transaction.Commit();
|
||||
return deal.GetViewModel;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
hearing.Update(model);
|
||||
hearing.Update(context, model);
|
||||
context.SaveChanges();
|
||||
return context.Hearings
|
||||
.Include(x => x.Case)
|
||||
|
@ -89,15 +89,29 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<LawyerViewModel> GetLawyerMTM(int caseId)
|
||||
{
|
||||
using var context = new CaseAccountingDatabase();
|
||||
var lawyersId = context.CaseLawyers
|
||||
.Where(x => x.CaseId == caseId)
|
||||
.Select(x => x.LawyerId).ToList();
|
||||
return context.Lawyers
|
||||
.Include(x => x.Specialization)
|
||||
.Include(x => x.User)
|
||||
.Where(X => lawyersId.Contains(X.Id))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public LawyerViewModel? Insert(LawyerBindingModel model)
|
||||
{
|
||||
var newLawyer = Lawyer.Create(model);
|
||||
using var context = new CaseAccountingDatabase();
|
||||
var newLawyer = Lawyer.Create(context, model);
|
||||
if (newLawyer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new CaseAccountingDatabase();
|
||||
|
||||
context.Lawyers.Add(newLawyer);
|
||||
context.SaveChanges();
|
||||
@ -123,9 +137,12 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
lawyer.Update(model);
|
||||
lawyer.Update(context, model);
|
||||
context.SaveChanges();
|
||||
lawyer.UpdateContracts(context, model);
|
||||
if (model.Cases.Count > 0)
|
||||
{
|
||||
lawyer.UpdateContracts(context, model);
|
||||
}
|
||||
transaction.Commit();
|
||||
return lawyer.GetViewModel;
|
||||
}
|
||||
@ -135,5 +152,19 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CaseViewModel> GetLawyerCases(LawyerSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new CaseAccountingDatabase();
|
||||
var cases = context.CaseLawyers
|
||||
.Where(x => x.LawyerId == model.Id)
|
||||
.Select(x => x.Case.GetViewModel)
|
||||
.ToList();
|
||||
return cases;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,14 +85,14 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
|
||||
public SpecializationViewModel? Insert(SpecializationBindingModel model)
|
||||
{
|
||||
var newSpecialization = Specialization.Create(model);
|
||||
using var context = new CaseAccountingDatabase();
|
||||
|
||||
var newSpecialization = Specialization.Create(context, model);
|
||||
if (newSpecialization == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new CaseAccountingDatabase();
|
||||
|
||||
context.Specializations.Add(newSpecialization);
|
||||
context.SaveChanges();
|
||||
return context.Specializations
|
||||
|
553
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230518222251_MergMig.Designer.cs
generated
Normal file
553
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230518222251_MergMig.Designer.cs
generated
Normal file
@ -0,0 +1,553 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CaseAccountingDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CaseAccountingDatabase))]
|
||||
[Migration("20230518222251_MergMig")]
|
||||
partial class MergMig
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Applicant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Defendant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("CaseDeals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("CaseLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Coast")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Service")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("DealContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Information")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Experience")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("CaseDeals")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("DealContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Specializations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Navigation("DealContracts");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("CaseDeals");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Specializations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class MergMig : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,554 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CaseAccountingDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CaseAccountingDatabase))]
|
||||
[Migration("20230519143905_migrSpecializationNull")]
|
||||
partial class migrSpecializationNull
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Applicant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Defendant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("CaseDeals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("CaseLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Coast")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Service")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("DealContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Information")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Experience")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("SpecializationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("CaseDeals")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("DealContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Specializations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Navigation("DealContracts");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("CaseDeals");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Specializations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class migrSpecializationNull : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,551 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CaseAccountingDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CaseAccountingDatabase))]
|
||||
[Migration("20230519145356_migrSpecializationNullAttempt2")]
|
||||
partial class migrSpecializationNullAttempt2
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Applicant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Defendant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("CaseDeals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("CaseLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Coast")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Service")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("DealContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Information")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Experience")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("CaseDeals")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("DealContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId");
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Specializations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Navigation("DealContracts");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("CaseDeals");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Specializations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class migrSpecializationNullAttempt2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Lawyers_Specializations_SpecializationId",
|
||||
table: "Lawyers");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SpecializationId",
|
||||
table: "Lawyers",
|
||||
type: "integer",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Lawyers_Specializations_SpecializationId",
|
||||
table: "Lawyers",
|
||||
column: "SpecializationId",
|
||||
principalTable: "Specializations",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Lawyers_Specializations_SpecializationId",
|
||||
table: "Lawyers");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SpecializationId",
|
||||
table: "Lawyers",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Lawyers_Specializations_SpecializationId",
|
||||
table: "Lawyers",
|
||||
column: "SpecializationId",
|
||||
principalTable: "Specializations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519162440_migrBindTry1.Designer.cs
generated
Normal file
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519162440_migrBindTry1.Designer.cs
generated
Normal file
@ -0,0 +1,551 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CaseAccountingDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CaseAccountingDatabase))]
|
||||
[Migration("20230519162440_migrBindTry1")]
|
||||
partial class migrBindTry1
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Applicant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Defendant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("CaseDeals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("CaseLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Coast")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Service")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("DealContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Information")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Experience")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("CaseDeals")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("DealContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId");
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Specializations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Navigation("DealContracts");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("CaseDeals");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Specializations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class migrBindTry1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519172138_migrBindTry2.Designer.cs
generated
Normal file
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519172138_migrBindTry2.Designer.cs
generated
Normal file
@ -0,0 +1,551 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CaseAccountingDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CaseAccountingDatabase))]
|
||||
[Migration("20230519172138_migrBindTry2")]
|
||||
partial class migrBindTry2
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Applicant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Defendant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("CaseDeals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("CaseLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Coast")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Service")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("DealContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Information")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Experience")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("CaseDeals")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("DealContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId");
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Specializations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Navigation("DealContracts");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("CaseDeals");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Specializations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class migrBindTry2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519222316_migrTilt.Designer.cs
generated
Normal file
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519222316_migrTilt.Designer.cs
generated
Normal file
@ -0,0 +1,551 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CaseAccountingDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CaseAccountingDatabase))]
|
||||
[Migration("20230519222316_migrTilt")]
|
||||
partial class migrTilt
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Applicant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Defendant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("CaseDeals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("CaseLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Coast")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Service")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("DealContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Information")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Experience")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("CaseDeals")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("DealContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId");
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Specializations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Navigation("DealContracts");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("CaseDeals");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Specializations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class migrTilt : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -239,7 +239,7 @@ namespace CaseAccountingDataBaseImplement.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
b.Property<int?>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
@ -448,9 +448,7 @@ namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("SpecializationId");
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
|
@ -87,15 +87,19 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(CaseBindingModel model)
|
||||
public void Update(CaseAccountingDatabase context, CaseBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
Applicant = model.Applicant;
|
||||
Defendant = model.Defendant;
|
||||
SpecializationId = model.SpecializationId;
|
||||
Specialization = context.Specializations.FirstOrDefault(x => x.Id == model.SpecializationId) ?? throw new Exception("Specialization не существует");
|
||||
Annotation = model.Annotation;
|
||||
Date = model.Date;
|
||||
Date = DateTime.SpecifyKind(model.Date, DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
public void UpdateLawyers(CaseAccountingDatabase context, CaseBindingModel model)
|
||||
@ -139,6 +143,7 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
Annotation = Annotation,
|
||||
Date = Date,
|
||||
SpecializationId = SpecializationId,
|
||||
Specialization = Specialization.Name,
|
||||
UserId = UserId
|
||||
};
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
}
|
||||
}
|
||||
|
||||
public static Contract? Create(ContractBindingModel? model)
|
||||
public static Contract? Create(CaseAccountingDatabase context, ContractBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -65,7 +65,8 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
Service = model.Service,
|
||||
Coast = model.Coast,
|
||||
Date = model.Date,
|
||||
UserId = model.UserId
|
||||
UserId = model.UserId,
|
||||
User = context.Users.FirstOrDefault(x => x.Id == model.UserId) ?? throw new Exception("Not found user")
|
||||
};
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user