43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using ProjectFamilyBudget.Entities.Enums;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ProjectFamilyBudget.Entities;
|
|
|
|
public class PeopleIncome
|
|
{
|
|
public int Id { get; private set; }
|
|
[Browsable(false)]
|
|
public int PeopleId { get; private set; }
|
|
[DisplayName("Человек")]
|
|
public string PeopleName { get; private set; } = string.Empty;
|
|
[DisplayName("Дата")]
|
|
public DateTime DataReciept { get; private set; }
|
|
[DisplayName("Доходы")]
|
|
public string Income => IncomePeopleIncomes != null ?
|
|
string.Join(", ", IncomePeopleIncomes.Select(x => $"{x.IncomeName} {x.Sum}")) : string.Empty;
|
|
[Browsable(false)]
|
|
public IEnumerable<IncomePeopleIncome> IncomePeopleIncomes { get; private set; } = [];
|
|
public static PeopleIncome CreateOperation(int id, int peopleId,DateTime dataReciept,IEnumerable<IncomePeopleIncome> incomePeopleIncomes)
|
|
{
|
|
return new PeopleIncome
|
|
{
|
|
Id = id,
|
|
PeopleId = peopleId,
|
|
DataReciept = dataReciept,
|
|
IncomePeopleIncomes = incomePeopleIncomes
|
|
};
|
|
}
|
|
public void SetIncomePeopleIncomes(IEnumerable<IncomePeopleIncome> incomePeopleIncomes)
|
|
{
|
|
if (incomePeopleIncomes != null && incomePeopleIncomes.Any())
|
|
{
|
|
IncomePeopleIncomes = incomePeopleIncomes;
|
|
}
|
|
}
|
|
}
|