Созданы классы-компоненты

This commit is contained in:
Данила Мочалов 2023-01-29 16:12:26 +04:00
parent 1342035a29
commit 791ab703b2
7 changed files with 209 additions and 2 deletions

View File

@ -7,9 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirm", "LawFirm\LawFirm.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmDataModels", "LawFirmDataModels\LawFirmDataModels.csproj", "{E30F4943-0DB0-4715-881F-BC23EBAAF573}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmContracts", "LawFirmContracts\LawFirmContracts.csproj", "{0BFA7B8D-BA92-4DA4-9477-144606DFFF96}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmContracts", "LawFirmContracts\LawFirmContracts.csproj", "{0BFA7B8D-BA92-4DA4-9477-144606DFFF96}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmBusinessLogic", "LawFirmBusinessLogic\LawFirmBusinessLogic.csproj", "{1A498224-4BAC-48FF-B6BC-E829BF86C5E4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmBusinessLogic", "LawFirmBusinessLogic\LawFirmBusinessLogic.csproj", "{1A498224-4BAC-48FF-B6BC-E829BF86C5E4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmListImplements", "LawFirmListImplements\LawFirmListImplements.csproj", "{43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -33,6 +35,10 @@ Global
{1A498224-4BAC-48FF-B6BC-E829BF86C5E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A498224-4BAC-48FF-B6BC-E829BF86C5E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A498224-4BAC-48FF-B6BC-E829BF86C5E4}.Release|Any CPU.Build.0 = Release|Any CPU
{43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -6,4 +6,12 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LawFirmContracts\LawFirmContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LawFirmDataModels\LawFirmDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,52 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using LawFirmDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LawFirmListImplements.Models
{
public class Blank : IBlankModel
{
public string BlankName { get; private set; } = String.Empty;
public double Cost { get; set; }
public int Id { get; private set; }
public static Blank? Create(BlankBindingModel? model)
{
if (model == null)
{
return null;
}
return new Blank()
{
Id = model.Id,
BlankName = model.BlankName,
Cost = model.Cost
};
}
public void Update(BlankBindingModel? model)
{
if (model == null)
{
return;
}
BlankName = model.BlankName;
Cost = model.Cost;
}
public BlankViewModel GetViewModel => new()
{
Id = Id,
BlankName = BlankName,
Cost = Cost
};
}
}

View File

@ -0,0 +1,55 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using LawFirmDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LawFirmListImplements.Models
{
public class Document : IDocumentModel
{
public string DocumentName { get; private set; } = string.Empty;
public double Price { get; private set; }
public Dictionary<int, (IBlankModel, int)> DocumentBlanks { get; private set; } = new Dictionary<int, (IBlankModel, int)>();
public int Id { get; private set; }
public static Document? Create(DocumentBindingModel? model)
{
if (model == null)
{
return null;
}
return new Document()
{
Id = model.Id,
DocumentName = model.DocumentName,
Price = model.Price,
DocumentBlanks = model.DocumentBlanks
};
}
public void Update(DocumentBindingModel? model)
{
if (model == null)
{
return;
}
DocumentName = model.DocumentName;
Price = model.Price;
DocumentBlanks = model.DocumentBlanks;
}
public DocumentViewModel GetViewModel => new()
{
Id = Id,
DocumentName = DocumentName,
Price = Price,
DocumentBlanks = DocumentBlanks
};
}
}

View File

@ -0,0 +1,73 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using LawFirmDataModels.Enums;
using LawFirmDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LawFirmListImplements.Models
{
public class Order : IOrderModel
{
public int DocumentId { get; private set; }
public int Count { get; private set; }
public double Sum { get; private set; }
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
public DateTime DateCreate { get; private set; } = DateTime.Now;
public DateTime? DateImplement { get; private set; }
public int Id { get; private set; }
public static Order? Create(OrderBindingModel? model)
{
if (model == null)
{
return null;
}
return new Order
{
DocumentId = model.DocumentId,
Count = model.Count,
Sum = model.Sum,
Status = model.Status,
DateCreate = model.DateCreate,
DateImplement = model.DateImplement,
Id = model.Id,
};
}
public void Update(OrderBindingModel? model)
{
if (model == null)
{
return;
}
DocumentId = model.DocumentId;
Count = model.Count;
Sum = model.Sum;
Status = model.Status;
DateCreate = model.DateCreate;
DateImplement = model.DateImplement;
Id = model.Id;
}
public OrderViewModel GetViewModel() => new()
{
DocumentId = DocumentId,
Count = Count,
Sum = Sum,
DateCreate = DateCreate,
DateImplement= DateImplement,
Id = Id,
Status= Status,
};
}
}