une signature coté serveur

This commit is contained in:
Paul Schneider 2016-12-05 05:51:24 +01:00
commit 7e7619db99
33 changed files with 698 additions and 211 deletions

View file

@ -14,16 +14,43 @@ namespace BookAStar.ViewModels
/// </summary>
public class EditingViewModel: ViewModel
{
private LocalState state;
public LocalState State {
bool existsRemotely;
public bool ExistsRemotely
{
get
{
return state;
return existsRemotely;
}
set
{
base.SetProperty<LocalState>(ref state, value);
base.SetProperty<bool>(ref existsRemotely, value);
}
}
}
bool isValid;
public bool IsValid
{
get
{
return isValid;
}
set
{
base.SetProperty<bool>(ref isValid, value);
}
}
bool isDirty;
public bool IsDirty
{
get
{
return isDirty;
}
set
{
base.SetProperty<bool>(ref isDirty, value);
}
}
}
}

View file

@ -13,13 +13,7 @@ namespace BookAStar.ViewModels.EstimateAndBilling
public BillingLineViewModel(BillingLine data)
{
this.data = data ?? new BillingLine();
// sets durationValue & durationUnit
count = data.Count;
description = data.Description;
Duration = data.Duration;
unitaryCostText = data.UnitaryCost.ToString("G", CultureInfo.InvariantCulture);
this.Data = data;
}
private int count;
@ -48,6 +42,7 @@ namespace BookAStar.ViewModels.EstimateAndBilling
{
SetProperty<string>(ref description, value);
data.Description = description;
IsValid = !string.IsNullOrWhiteSpace(description);
}
}
decimal unitaryCost;
@ -166,5 +161,26 @@ pour décrire la quantité de travail associée à ce type de service")]
}
}
public BillingLine Data
{
get
{
return data;
}
set
{
SetProperty<BillingLine>(ref data, value);
if (data != null)
{
// sets durationValue & durationUnit
count = data.Count;
description = data.Description;
Duration = data.Duration;
unitaryCostText = data.UnitaryCost.ToString("G", CultureInfo.InvariantCulture);
}
}
}
}
}

View file

@ -5,6 +5,7 @@ using BookAStar.Model;
using Xamarin.Forms;
using BookAStar.Data;
using Newtonsoft.Json;
using System.Linq;
namespace BookAStar.ViewModels.EstimateAndBilling
{
@ -17,6 +18,7 @@ namespace BookAStar.ViewModels.EstimateAndBilling
{
}
/// <summary>
/// Builds a new view model on estimate,
/// sets <c>Data</c> with given value parameter
@ -28,12 +30,18 @@ namespace BookAStar.ViewModels.EstimateAndBilling
Data = data;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Bill_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
Data.Bill = new List<BillingLine>( Bill );
Data.Bill = Bill.Select(l => l.Data).ToList();
NotifyPropertyChanged("FormattedTotal");
NotifyPropertyChanged("Bill");
}
private Estimate data;
public Estimate Data { get { return data; } set {
SetProperty<Estimate>(ref data, value);
@ -42,7 +50,9 @@ namespace BookAStar.ViewModels.EstimateAndBilling
if (data.Bill == null) data.Bill = new List<BillingLine>();
AttachedFiles = new ObservableCollection<string>(data.AttachedFiles);
AttachedGraphicList = new ObservableCollection<string>(data.AttachedGraphics);
Bill = new ObservableCollection<BillingLine>(data.Bill);
Bill = new ObservableCollection<BillingLineViewModel>(data.Bill.Select(
l => new BillingLineViewModel(l)
));
Bill.CollectionChanged += Bill_CollectionChanged;
Title = Data.Title;
Description = Data.Description;
@ -64,7 +74,7 @@ namespace BookAStar.ViewModels.EstimateAndBilling
}
[JsonIgnore]
public ObservableCollection<BillingLine> Bill
public ObservableCollection<BillingLineViewModel> Bill
{
get; protected set;
}

View file

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XLabs.Forms.Mvvm;
namespace BookAStar.ViewModels.Signing
{
class DocSigningViewModel: ViewModel
{
/// <summary>
/// The doc to sign, in Markdown format
/// </summary>
public string Document { get; set; }
}
}

View file

@ -0,0 +1,15 @@
using BookAStar.Model.Workflow;
using BookAStar.ViewModels.EstimateAndBilling;
using Xamarin.Forms;
namespace BookAStar.ViewModels.Signing
{
public class EstimateSigningViewModel: EditEstimateViewModel
{
public EstimateSigningViewModel(Estimate document)
{
Data = document;
}
public Command<bool> ValidationCommand { get; set; }
}
}