BunyMuny/Statement.cs

30 lines
724 B
C#

using System;
using System.Text;
namespace BunyMuny {
public class Statement {
public DateTime Date;
private string _description;
public string Description {
get => string.IsNullOrWhiteSpace(_description) ? OriginalDescription : _description;
set => _description = value;
}
public string OriginalDescription;
public double Value;
public string Category;
public override string ToString() {
// e.g.: Debit: $5.00 --> Lynnear Software (Personal) on Apr 2 2020
return String.Format(
"{0} ${1:F2} {2} {3} ({4}) on {5:MMM d yyyy}",
Value < 0 ? "Credit:" : "Debit: ",
Math.Abs(Value),
Value < 0 ? "-->" : "<--",
Description,
Category ?? "Unknown",
Date
);
}
}
}