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++)
|
|
|
|
|
{
|
2024-04-28 21:30:55 +04:00
|
|
|
|
var operation = OperationViewModels[i];
|
|
|
|
|
if (operation == null)
|
2024-04-28 21:34:43 +04:00
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-28 21:30:55 +04:00
|
|
|
|
result.Append($"\n\t{i + 1}. {operation.Mark} {operation.Model} стоимостью {operation.Price}");
|
2024-04-28 21:34:43 +04:00
|
|
|
|
}
|
|
|
|
|
return result.ToString();
|
|
|
|
|
}
|
2024-04-28 20:20:37 +04:00
|
|
|
|
}
|
|
|
|
|
}
|