2021-05-13 20:03:07 +02:00
|
|
|
|
using System;
|
|
|
|
|
using TINK.Model.Bikes.Bike;
|
|
|
|
|
using TINK.MultilingualResources;
|
|
|
|
|
|
|
|
|
|
namespace TINK.ViewModel.Bikes.Bike
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// View model for displaying tariff info.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class TariffDescriptionViewModel
|
|
|
|
|
{
|
|
|
|
|
private TariffDescription Tariff { get; }
|
|
|
|
|
|
|
|
|
|
public TariffDescriptionViewModel(TariffDescription tariff)
|
|
|
|
|
{
|
|
|
|
|
Tariff = tariff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Header
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(FeeEuroPerHour)
|
|
|
|
|
&& string.IsNullOrEmpty(AboEuroPerMonth)
|
|
|
|
|
&& string.IsNullOrEmpty(FreeTimePerSession)
|
|
|
|
|
&& string.IsNullOrEmpty(MaxFeeEuroPerDay))
|
|
|
|
|
// No tariff description details available.
|
|
|
|
|
return string.Empty;
|
|
|
|
|
|
2021-06-26 20:57:55 +02:00
|
|
|
|
#if USCSHARP9
|
2021-05-13 20:03:07 +02:00
|
|
|
|
return string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-", Tariff?.Number != null ? Tariff.Number : "-");
|
2021-06-26 20:57:55 +02:00
|
|
|
|
#else
|
|
|
|
|
return string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-", Tariff?.Number != null ? Tariff.Number.ToString() : "-");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2021-05-13 20:03:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Costs per hour in euro.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string FeeEuroPerHour
|
|
|
|
|
=> !double.IsNaN(Tariff.FeeEuroPerHour)
|
|
|
|
|
? string.Format("{0} {1}", Tariff.FeeEuroPerHour.ToString("0.00"), AppResources.MessageBikesManagementTariffDescriptionEuroPerHour)
|
|
|
|
|
: string.Empty;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Costs of the abo per month.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string AboEuroPerMonth
|
|
|
|
|
=> !double.IsNaN(Tariff.AboEuroPerMonth)
|
|
|
|
|
? string.Format("{0} {1}", Tariff.AboEuroPerMonth.ToString("0.00"), AppResources.MessageBikesManagementTariffDescriptionEuroPerHour)
|
|
|
|
|
: string.Empty;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Free use time.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string FreeTimePerSession
|
|
|
|
|
=> Tariff.FreeTimePerSession != TimeSpan.Zero
|
|
|
|
|
? string.Format("{0} {1}", Tariff.FreeTimePerSession.TotalHours, AppResources.MessageBikesManagementTariffDescriptionHour)
|
|
|
|
|
: string.Empty;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Max costs per day in euro.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string MaxFeeEuroPerDay
|
|
|
|
|
=> !double.IsNaN(Tariff.FeeEuroPerHour)
|
|
|
|
|
? string.Format("{0} {1}", Tariff.MaxFeeEuroPerDay.ToString("0.00"), AppResources.MessageBikesManagementMaxFeeEuroPerDay)
|
|
|
|
|
: string.Empty;
|
2021-11-07 21:28:13 +01:00
|
|
|
|
|
|
|
|
|
/// <summary> Info about operator agb as HTML (i.g. text and hyperlink). </summary>
|
|
|
|
|
public string OperatorAgb => !string.IsNullOrEmpty(Tariff?.OperatorAgb)
|
|
|
|
|
? Tariff.OperatorAgb
|
|
|
|
|
: string.Empty;
|
2021-05-13 20:03:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|