diff --git a/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml b/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml
index 84937a09..bb281a95 100644
--- a/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml
+++ b/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml
@@ -3,6 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar"
+ xmlns:behaviors="clr-namespace:BookAStar.Behaviors;assembly=BookAStar"
+ xmlns:extensions="clr-namespace:BookAStar.Extensions;assembly=BookAStar"
x:Class="BookAStar.Pages.EditBillingLinePage"
Style="{StaticResource PageStyle}">
@@ -13,6 +15,23 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -22,7 +41,8 @@
Style="{StaticResource InputLabelStyle}">
-
+
Jours
Heures
@@ -31,12 +51,24 @@
-
+
-
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/BookAStar/BookAStar/ViewModels/BillingLineViewModel.cs b/BookAStar/BookAStar/ViewModels/BillingLineViewModel.cs
index 77f816b4..e6c59fa1 100644
--- a/BookAStar/BookAStar/ViewModels/BillingLineViewModel.cs
+++ b/BookAStar/BookAStar/ViewModels/BillingLineViewModel.cs
@@ -83,25 +83,30 @@ namespace BookAStar.ViewModels
protected decimal unitaryCost;
public static readonly string unitCostFormat = "0,.00";
+ string unitaryCostText;
public string UnitaryCostText
{
get
{
- return unitaryCost.ToString(unitCostFormat, CultureInfo.InvariantCulture);
+ return unitaryCostText;
}
set
{
- decimal newValue;
- if (decimal.TryParse(value, NumberStyles.Currency,
- CultureInfo.InvariantCulture,
- out newValue))
+ if (unitaryCostText != value)
{
- SetProperty(ref unitaryCost, newValue, "UnitaryCostText");
- SetProperty(ref invalidCost, false, "InvalidCost");
+ try
+ {
+ data.UnitaryCost = decimal.Parse(value, CultureInfo.InvariantCulture);
+ }
+ catch (Exception)
+ {
+ // TODO Error model
+ // UI should shoud entry as wearing a wrong value
+ // thanks to its `Behaviors`
+ }
}
- else
- SetProperty(ref invalidCost, true, "InvalidCost");
+ SetProperty(ref unitaryCostText, value, "UnitaryCostText");
}
}
bool invalidCost;
@@ -149,18 +154,6 @@ namespace BookAStar.ViewModels
DurationUnit = DurationUnits.Minutes;
}
}
-
- public decimal UnitaryCost
- {
- get
- {
- return decimal.Parse(this.UnitaryCostText,CultureInfo.InvariantCulture);
- }
-
- set
- {
- UnitaryCostText = value.ToString(unitCostFormat, CultureInfo.InvariantCulture);
- }
- }
+
}
}