using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using PersonalFinance.Entity;
using System.ComponentModel.DataAnnotations.Schema;
namespace PersonalFinance
{
///
/// Payment for goods or services in family (similar to invoices in corporation)
///
public class Payment : BasePayment
{
public Payment()
{
Paid = false;
Group = PaymentGroup.Personal;
Price = 0;
Currency = PaymentCurrency.CZK;
}
///
/// Unique payment identification number (Primary key)
///
[Key]
public int PaymentId { get; set; }
///
/// Price of payment - must be positive number
///
[Range(typeof(DateTime), "1.1.1950", "31.12.2100")]
public DateTime Date { get; set; }
///
/// Payment status (nesecary for scheduling)
///
public bool Paid { get; set; }
public override string ToString()
{
string str = "Payment {0}: {1} {2} {3} for {4} {5}";
if(Note != null){
str += " has Note";
}
return string.Format(str,
PaymentId, Price, Currency, Group, Purpose, Paid ? "zaplaceno" : "nezaplaceno");
}
}
}