Почти готово.

This commit is contained in:
Programmist73 2023-04-30 12:39:36 +04:00
parent c984bc9462
commit ea70ee1e69
10 changed files with 94 additions and 36 deletions

View File

@ -10,5 +10,4 @@ namespace BlacksmithWorkshopContracts.BindingModels
{
public string FolderName { get; set; } = string.Empty;
}
}

View File

@ -8,6 +8,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Unity" Version="5.11.10" />
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
</ItemGroup>
<ItemGroup>

View File

@ -13,5 +13,4 @@ namespace BlacksmithWorkshopContracts.BusinessLogicsContracts
//путь и имя файла для архивации
void CreateBackUp(BackUpSaveBinidngModel model);
}
}

View File

@ -20,7 +20,7 @@ namespace BlacksmithWorkshopContracts.DI
private DependencyManager()
{
_dependencyManager = new ServiceDependencyContainer();
_dependencyManager = new UnityDependencyContainer();
}
public static DependencyManager Instance

View File

@ -0,0 +1,43 @@
using Microsoft.Extensions.Logging;
using Unity.Microsoft.Logging;
using Unity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BlacksmithWorkshopContracts.DI
{
public class UnityDependencyContainer : IDependencyContainer
{
private readonly IUnityContainer _container;
public UnityDependencyContainer()
{
_container = new UnityContainer();
}
public void AddLogging(Action<ILoggingBuilder> configure)
{
var factory = LoggerFactory.Create(configure);
_container.AddExtension(new LoggingExtension(factory));
}
public void RegisterType<T>(bool isSingle) where T : class
{
_container.RegisterType<T>(isSingle ? TypeLifetime.Singleton : TypeLifetime.Transient);
}
public T Resolve<T>()
{
return _container.Resolve<T>();
}
void IDependencyContainer.RegisterType<T, U>(bool isSingle)
{
_container.RegisterType<T, U>(isSingle ? TypeLifetime.Singleton : TypeLifetime.Transient);
}
}
}

View File

@ -1,4 +1,5 @@
using BlacksmithWorkshopDataModels.Models;
using BlacksmithWorkshopContracts.Attributes;
using BlacksmithWorkshopDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -10,18 +11,19 @@ namespace BlacksmithWorkshopContracts.ViewModels
{
public class ImplementerViewModel : IImplementerModel
{
public int Id { get; set; }
[Column(visible: false)]
public int Id { get; set; }
[DisplayName("ФИО исполнителя")]
[Column(title: "ФИО исполнителя", width: 150)]
public string ImplementerFIO { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
[Column(title: "Пароль", width: 150)]
public string Password { get; set; } = string.Empty;
[DisplayName("Стаж")]
public int WorkExperience { get; set; }
[Column(title: "Стаж", width: 150)]
public int WorkExperience { get; set; }
[DisplayName("Квалификация")]
public int Qualification { get; set; }
[Column(title: "Квалификация", width: 150)]
public int Qualification { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using BlacksmithWorkshopDataModels.Models;
using BlacksmithWorkshopContracts.Attributes;
using BlacksmithWorkshopDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -11,14 +12,16 @@ namespace BlacksmithWorkshopContracts.ViewModels
//класс для отображения пользователю информаци о продуктах (изделиях)
public class ManufactureViewModel : IManufactureModel
{
[Column(visible: false)]
public int Id { get; set; }
[DisplayName("Навание изделия")]
[Column(title: "Навание изделия", width: 150)]
public string ManufactureName { get; set; } = string.Empty;
[DisplayName("Цена")]
[Column(title: "Цена", width: 150)]
public double Price { get; set; }
[Column(visible: false)]
public Dictionary<int, (IWorkPieceModel, int)> ManufactureWorkPieces { get; set; } = new();
}
}

View File

@ -1,4 +1,5 @@
using BlacksmithWorkshopDataModels.Models;
using BlacksmithWorkshopContracts.Attributes;
using BlacksmithWorkshopDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -10,22 +11,25 @@ namespace BlacksmithWorkshopContracts.ViewModels
{
public class MessageInfoViewModel : IMessageInfoModel
{
[Column(visible: false)]
public int Id { get; set; }
[Column(visible: false)]
public string MessageId { get; set; } = string.Empty;
[Column(visible: false)]
public int? ClientId { get; set; }
[DisplayName("Отправитель")]
[Column(title: "Отправитель", width: 150)]
public string SenderName { get; set; } = string.Empty;
[DisplayName("Дата отправки")]
[Column(title: "Дата отправки", width: 150)]
public DateTime DateDelivery { get; set; } = DateTime.Now;
[DisplayName("Заголовок")]
[Column(title: "Заголовок", width: 150)]
public string Subject { get; set; } = string.Empty;
[DisplayName("Текст")]
public string Body { get; set; } = string.Empty;
[Column(title: "Текст", width: 150)]
public string Body { get; set; } = string.Empty;
}
}

View File

@ -1,4 +1,5 @@
using BlacksmithWorkshopDataModels.Enums;
using BlacksmithWorkshopContracts.Attributes;
using BlacksmithWorkshopDataModels.Enums;
using BlacksmithWorkshopDataModels.Models;
using System;
using System.Collections.Generic;
@ -12,37 +13,40 @@ namespace BlacksmithWorkshopContracts.ViewModels
//класс для отображения пользователю информации о заказах
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
[Column(visible: false)]
public int Id { get; set; }
public int ClientId { get; set; }
[Column(visible: false)]
public int ClientId { get; set; }
public int? ImplementerId { get; set; }
[Column(visible: false)]
public int? ImplementerId { get; set; }
public int ManufactureId { get; set; }
[Column(visible: false)]
public int ManufactureId { get; set; }
[DisplayName("ФИО клиента")]
[Column(title: "ФИО клиента", width: 150)]
public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Изделие")]
[Column(title: "Изделие", width: 150)]
public string ManufactureName { get; set; } = string.Empty;
[DisplayName("ФИО исполнителя")]
[Column(title: "ФИО исполнителя", width: 150)]
public string ImplementerFIO { get; set; } = string.Empty;
[DisplayName("Количество")]
[Column(title: "Количество", width: 150)]
public int Count { get; set; }
[DisplayName("Сумма")]
[Column(title: "Сумма", width: 150)]
public double Sum { get; set; }
[DisplayName("Статус")]
[Column(title: "Статус", width: 150)]
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
[DisplayName("Дата создания")]
[Column(title: "Дата создания", width: 150)]
public DateTime DateCreate { get; set; } = DateTime.Now;
[DisplayName("Дата выполнения")]
[Column(title: "Дата выполнения", width: 150)]
public DateTime? DateImplement { get; set; }
}
}

View File

@ -5,18 +5,20 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BlacksmithWorkshopContracts.Attributes;
namespace BlacksmithWorkshopContracts.ViewModels
{
//класс для отображения пользователю данных о заготовких (заготовках)
public class WorkPieceViewModel : IWorkPieceModel
{
[Column(visible: false)]
public int Id { get; set; }
[DisplayName("Название заготовки")]
[Column(title: "Название заготовки", width: 150)]
public string WorkPieceName { get; set; } = string.Empty;
[DisplayName("Цена")]
[Column(title: "Цена", width: 150)]
public double Cost { get; set; }
}
}