Фиксы кода, реализация изменений по заказам для файлов и листа

This commit is contained in:
Никита Потапов 2024-04-22 10:25:46 +04:00
parent 6a118d4622
commit fdb3444f21
3 changed files with 14 additions and 4 deletions

View File

@ -63,4 +63,3 @@ namespace SecuritySystemDatabaseImplement.Models
};
}
}
}

View File

@ -11,6 +11,7 @@ namespace SecuritySystemFileImplement.Models
public int Id { get; private set; }
public int SecureId { get; private set; }
public int ClientId { get; private set; }
public int? ImplementerId { get; private set; }
public int Count { get; private set; }
public double Sum { get; private set; }
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
@ -32,6 +33,7 @@ namespace SecuritySystemFileImplement.Models
Status = model.Status,
DateCreate = model.DateCreate,
DateImplement = model.DateImplement,
ImplementerId = model.ImplementerId
};
}
@ -49,7 +51,8 @@ namespace SecuritySystemFileImplement.Models
Count = Convert.ToInt32(element.Element("Count")!.Value),
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
DateCreate = Convert.ToDateTime(element.Element("DateCreate")!.Value),
DateImplement = string.IsNullOrEmpty(element.Element("DateImplement")!.Value) ? null : Convert.ToDateTime(element.Element("DateImplement")!.Value)
DateImplement = string.IsNullOrEmpty(element.Element("DateImplement")!.Value) ? null : Convert.ToDateTime(element.Element("DateImplement")!.Value),
ImplementerId = Convert.ToInt32(element.Element("ImplementerId")!.Value),
};
}
@ -61,6 +64,7 @@ namespace SecuritySystemFileImplement.Models
}
Status = model.Status;
DateImplement = model.DateImplement;
ImplementerId = model.ImplementerId;
}
public OrderViewModel GetViewModel => new()
@ -72,6 +76,7 @@ namespace SecuritySystemFileImplement.Models
DateCreate = DateCreate,
DateImplement = DateImplement,
Status = Status,
ImplementerId = ImplementerId,
};
public XElement GetXElement => new(
@ -82,7 +87,8 @@ namespace SecuritySystemFileImplement.Models
new XElement("Sum", Sum.ToString()),
new XElement("Status", Status.ToString()),
new XElement("DateCreate", DateCreate.ToString()),
new XElement("DateImplement", DateImplement.ToString())
new XElement("DateImplement", DateImplement.ToString()),
new XElement("ImplementerId", ImplementerId.ToString())
);
}
}

View File

@ -1,15 +1,17 @@
using SecuritySystemContracts.BindingModels;
using SecuritySystemContracts.ViewModels;
using SecuritySystemDataModels.Enums;
using SecuritySystemDataModels.Models;
namespace SecuritySystemListImplement.Models
{
public class Order
public class Order : IOrderModel
{
public int SecureId { get; private set; }
public int ClientId { get; private set; }
public int Count { get; private set; }
public double Sum { get; private set; }
public int? ImplementerId { get; private set; }
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
public DateTime DateCreate { get; private set; } = DateTime.Now;
public DateTime? DateImplement { get; private set; }
@ -29,6 +31,7 @@ namespace SecuritySystemListImplement.Models
Status = model.Status,
DateCreate = model.DateCreate,
DateImplement = model.DateImplement,
ImplementerId = model.ImplementerId,
};
}
public void Update(OrderBindingModel? model)
@ -39,6 +42,7 @@ namespace SecuritySystemListImplement.Models
}
Status = model.Status;
DateImplement = model.DateImplement;
ImplementerId = model.ImplementerId;
}
public OrderViewModel GetViewModel => new()
{
@ -49,6 +53,7 @@ namespace SecuritySystemListImplement.Models
DateImplement = DateImplement,
Id = Id,
Status = Status,
ImplementerId = ImplementerId,
};
}
}