Archived
1
0

capitalise bounty voucher type

This commit is contained in:
Florian Stinglmayr 2021-08-04 17:39:57 +02:00
parent 27d34be46d
commit dfd66c9fb6

View File

@ -1,12 +1,10 @@
using System; using System.Linq;
using System.Collections.Generic; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NonaBGS.Journal; using NonaBGS.Journal;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class Vouchers : LogEntry { public class Vouchers : LogEntry {
private string type = null;
public int TotalSum { public int TotalSum {
get { get {
@ -19,21 +17,21 @@ namespace NonaBGS.BGS {
public string Type { public string Type {
get { get {
string v = Entries if (type == null) {
.Where(x => x.GetType() == typeof(RedeemVoucherEntry)) string v = Entries
.GroupBy(x => (x as RedeemVoucherEntry).Type) .Where(x => x.GetType() == typeof(RedeemVoucherEntry))
.Select(x => x.Key) .GroupBy(x => (x as RedeemVoucherEntry).Type)
.First(); .Select(x => x.Key)
return v; .First();
type = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(v);
}
return type;
} }
} }
public override string ToString() { public override string ToString() {
StringBuilder builder = new StringBuilder(); return string.Format("{0} Vouchers: {1}", Type, Credits.FormatCredits(TotalSum));
builder.AppendFormat("{0} Vouchers: {1}", Type, Credits.FormatCredits(TotalSum));
return builder.ToString();
} }
/// <summary> /// <summary>