Added FormatPrice utility function

This commit is contained in:
Garry Newman 2018-01-31 12:50:25 +00:00
parent c8e5c0ca5a
commit 916d9afdc9

View File

@ -59,5 +59,26 @@ public static uint FromDateTime( DateTime dt )
}
}
internal static string FormatPrice(string currency, ulong price)
{
var decimaled = (price / 100.0).ToString("0.00");
switch (currency )
{
case "GBP": return $"£{decimaled}";
case "USD": return $"${decimaled}";
case "CAD": return $"${decimaled} CAD";
case "EUR": return $"€{decimaled}";
case "RUB": return $"₽{decimaled}";
case "NZD": return $"${decimaled} NZD";
// TODO - all of them
default: return $"{decimaled}{currency}";
}
}
}
}