2024-04-28 21:34:43 +04:00
|
|
|
|
using BankDataModels;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using BankDataModels.ProxyModels;
|
2024-04-28 20:20:37 +04:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace BankContracts.ViewModels
|
|
|
|
|
{
|
2024-04-28 21:34:43 +04:00
|
|
|
|
public class PurchaseViewModel : IPurchaseModel
|
2024-04-28 20:20:37 +04:00
|
|
|
|
{
|
2024-04-28 21:34:43 +04:00
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
public int ClientId { get; set; }
|
|
|
|
|
[DisplayName("Логин клиента")]
|
|
|
|
|
public string ClientPhoneNumber { get; set; } = string.Empty;
|
|
|
|
|
[DisplayName("Дата Покупки")]
|
|
|
|
|
public DateOnly DatePurchase { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
|
|
|
|
public Dictionary<int, OperationByPurchaseModel> OperationsModel { get; set; } = new();
|
|
|
|
|
|
|
|
|
|
public List<CostViewModel> CostViewModels { get; set; } = new();
|
|
|
|
|
|
|
|
|
|
public List<OperationViewModel> OperationViewModels { get; set; } = new();
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
var result = new StringBuilder(
|
|
|
|
|
$"Сделка, созданная {DatePurchase}, включает в себя операции:");
|
|
|
|
|
for (int i = 0; i < OperationViewModels.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var car = OperationViewModels[i];
|
|
|
|
|
if (car == null)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
result.Append($"\n\t{i + 1}. {car.Mark} {car.Model} стоимостью {car.Price}");
|
|
|
|
|
}
|
|
|
|
|
return result.ToString();
|
|
|
|
|
}
|
2024-04-28 20:20:37 +04:00
|
|
|
|
}
|
|
|
|
|
}
|