|
|
|
@ -13,48 +13,57 @@ namespace BookAStar.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BillingLine data;
|
|
|
|
BillingLine data;
|
|
|
|
|
|
|
|
|
|
|
|
public BillingLineViewModel( BillingLine data)
|
|
|
|
public BillingLineViewModel(BillingLine data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.data = data ?? new BillingLine();
|
|
|
|
this.data = data ?? new BillingLine();
|
|
|
|
// sets durationValue & durationUnit
|
|
|
|
// sets durationValue & durationUnit
|
|
|
|
|
|
|
|
count = data.Count;
|
|
|
|
|
|
|
|
description = data.Description;
|
|
|
|
|
|
|
|
|
|
|
|
Duration = data.Duration;
|
|
|
|
Duration = data.Duration;
|
|
|
|
unitaryCostText = data.UnitaryCost.ToString("G",CultureInfo.InvariantCulture);
|
|
|
|
unitaryCostText = data.UnitaryCost.ToString("G", CultureInfo.InvariantCulture);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int count;
|
|
|
|
public int Count
|
|
|
|
public int Count
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get
|
|
|
|
get
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return data.Count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
data.Count = value;
|
|
|
|
SetProperty<int>(ref count, value);
|
|
|
|
|
|
|
|
data.Count = count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private string description;
|
|
|
|
public string Description
|
|
|
|
public string Description
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get
|
|
|
|
get
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return data.Description;
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
data.Description = value;
|
|
|
|
SetProperty<string>(ref description, value);
|
|
|
|
|
|
|
|
data.Description = description;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
decimal unitaryCost;
|
|
|
|
public decimal UnitaryCost
|
|
|
|
public decimal UnitaryCost
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get
|
|
|
|
get
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return data.UnitaryCost;
|
|
|
|
return unitaryCost;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
data.UnitaryCost = value;
|
|
|
|
SetProperty<decimal>(ref unitaryCost, value);
|
|
|
|
|
|
|
|
data.UnitaryCost = unitaryCost;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -73,11 +82,11 @@ namespace BookAStar.ViewModels
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public enum DurationUnits:int
|
|
|
|
public enum DurationUnits : int
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Jours=0,
|
|
|
|
Jours = 0,
|
|
|
|
Heures=1,
|
|
|
|
Heures = 1,
|
|
|
|
Minutes=2
|
|
|
|
Minutes = 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private DurationUnits durationUnit;
|
|
|
|
private DurationUnits durationUnit;
|
|
|
|
|
|
|
|
|
|
|
|
@ -85,17 +94,17 @@ namespace BookAStar.ViewModels
|
|
|
|
pour décrire la quantité de travail associée à ce type de service")]
|
|
|
|
pour décrire la quantité de travail associée à ce type de service")]
|
|
|
|
public DurationUnits DurationUnit
|
|
|
|
public DurationUnits DurationUnit
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get {
|
|
|
|
get
|
|
|
|
|
|
|
|
{
|
|
|
|
return durationUnit;
|
|
|
|
return durationUnit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set
|
|
|
|
set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetProperty<DurationUnits>(ref durationUnit, value, "DurationUnit");
|
|
|
|
SetProperty<DurationUnits>(ref durationUnit, value, "DurationUnit");
|
|
|
|
data.Duration = this.Duration;
|
|
|
|
data.Duration = this.Duration;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected decimal unitaryCost;
|
|
|
|
|
|
|
|
public static readonly string unitCostFormat = "0,.00";
|
|
|
|
public static readonly string unitCostFormat = "0,.00";
|
|
|
|
string unitaryCostText;
|
|
|
|
string unitaryCostText;
|
|
|
|
public string UnitaryCostText
|
|
|
|
public string UnitaryCostText
|
|
|
|
@ -129,7 +138,7 @@ pour décrire la quantité de travail associée à ce type de service")]
|
|
|
|
case DurationUnits.Heures:
|
|
|
|
case DurationUnits.Heures:
|
|
|
|
return new TimeSpan(DurationValue, 0, 0);
|
|
|
|
return new TimeSpan(DurationValue, 0, 0);
|
|
|
|
case DurationUnits.Jours:
|
|
|
|
case DurationUnits.Jours:
|
|
|
|
return new TimeSpan(DurationValue*24, 0, 0);
|
|
|
|
return new TimeSpan(DurationValue * 24, 0, 0);
|
|
|
|
case DurationUnits.Minutes:
|
|
|
|
case DurationUnits.Minutes:
|
|
|
|
return new TimeSpan(0, DurationValue, 0);
|
|
|
|
return new TimeSpan(0, DurationValue, 0);
|
|
|
|
// Assert(false); since all units are treated bellow
|
|
|
|
// Assert(false); since all units are treated bellow
|
|
|
|
@ -143,18 +152,18 @@ pour décrire la quantité de travail associée à ce type de service")]
|
|
|
|
double days = value.TotalDays;
|
|
|
|
double days = value.TotalDays;
|
|
|
|
if (days >= 1.0)
|
|
|
|
if (days >= 1.0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DurationValue = (int) days;
|
|
|
|
DurationValue = (int)days;
|
|
|
|
DurationUnit = DurationUnits.Jours;
|
|
|
|
DurationUnit = DurationUnits.Jours;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
double hours = value.TotalHours;
|
|
|
|
double hours = value.TotalHours;
|
|
|
|
if (hours >= 1.0)
|
|
|
|
if (hours >= 1.0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DurationValue = (int) hours;
|
|
|
|
DurationValue = (int)hours;
|
|
|
|
DurationUnit = DurationUnits.Jours;
|
|
|
|
DurationUnit = DurationUnits.Jours;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DurationValue = (int) value.TotalMinutes;
|
|
|
|
DurationValue = (int)value.TotalMinutes;
|
|
|
|
DurationUnit = DurationUnits.Minutes;
|
|
|
|
DurationUnit = DurationUnits.Minutes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|