2023-03-06 17:15:03 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2023-05-01 20:29:36 +04:00
|
|
|
|
using System.ComponentModel;
|
2023-03-06 17:15:03 +04:00
|
|
|
|
using System.Linq;
|
2023-05-01 18:29:41 +04:00
|
|
|
|
using System.Reflection;
|
2023-03-06 17:15:03 +04:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
using SecuritySystemContracts.BindingModels;
|
|
|
|
|
using SecuritySystemContracts.ViewModels;
|
|
|
|
|
using SecuritySystemDataModels.Enums;
|
|
|
|
|
using SecuritySystemDataModels.Models;
|
|
|
|
|
|
|
|
|
|
namespace SecuritySystemListImplement.Models
|
|
|
|
|
{
|
|
|
|
|
public class Order : IOrderModel
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; private set; }
|
|
|
|
|
|
2023-03-07 12:47:29 +04:00
|
|
|
|
public int SecureId { get; private set; }
|
|
|
|
|
public string SecureName { get; private set; } = string.Empty;
|
2023-04-23 10:08:28 +04:00
|
|
|
|
public int ClientId { get; private set; }
|
2023-05-01 18:29:41 +04:00
|
|
|
|
public int? ImplementerId { get; private set; }
|
2023-03-06 17:15:03 +04:00
|
|
|
|
public int Count { get; private set; }
|
|
|
|
|
|
|
|
|
|
public double Sum { get; private set; }
|
|
|
|
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
2023-05-01 20:29:36 +04:00
|
|
|
|
public DateTime DateCreate { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
|
|
|
|
[DisplayName("Дата выполнения")]
|
2023-03-06 17:15:03 +04:00
|
|
|
|
public DateTime? DateImplement { get; set; }
|
|
|
|
|
|
|
|
|
|
public static Order? Create(OrderBindingModel? model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return new Order()
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
2023-03-07 12:47:29 +04:00
|
|
|
|
SecureId = model.SecureId,
|
|
|
|
|
SecureName = model.SecureName,
|
2023-05-01 18:29:41 +04:00
|
|
|
|
ClientId = model.ClientId,
|
|
|
|
|
ImplementerId = model.ImplementerId,
|
2023-03-06 17:15:03 +04:00
|
|
|
|
Count = model.Count,
|
|
|
|
|
Sum = model.Sum,
|
|
|
|
|
Status = model.Status,
|
|
|
|
|
DateCreate = model.DateCreate,
|
|
|
|
|
DateImplement = model.DateImplement
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Update(OrderBindingModel? model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-03-07 12:47:29 +04:00
|
|
|
|
|
2023-03-06 17:15:03 +04:00
|
|
|
|
Status = model.Status;
|
|
|
|
|
DateImplement = model.DateImplement;
|
2023-05-01 18:29:41 +04:00
|
|
|
|
ImplementerId = model.ImplementerId;
|
2023-03-06 17:15:03 +04:00
|
|
|
|
}
|
|
|
|
|
public OrderViewModel GetViewModel => new()
|
|
|
|
|
{
|
|
|
|
|
Id = Id,
|
2023-03-07 12:47:29 +04:00
|
|
|
|
SecureId = SecureId,
|
|
|
|
|
SecureName = SecureName,
|
2023-05-01 18:29:41 +04:00
|
|
|
|
ClientId = ClientId,
|
|
|
|
|
ImplementerId = ImplementerId,
|
2023-03-06 17:15:03 +04:00
|
|
|
|
Count = Count,
|
|
|
|
|
Sum = Sum,
|
|
|
|
|
Status = Status,
|
|
|
|
|
DateCreate = DateCreate,
|
|
|
|
|
DateImplement = DateImplement
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|