WIP estimate

This commit is contained in:
Paul Schneider 2016-11-25 17:57:49 +01:00
commit 805e5fcb4f
8 changed files with 42 additions and 17 deletions

View file

@ -10,6 +10,7 @@ namespace BookAStar.ViewModels.EstimateAndBilling
using Model;
using Model.Social;
using Model.Workflow;
using System.Collections.ObjectModel;
using System.Linq;
class BookQueryViewModel : ViewModel, IBookQueryData
@ -26,6 +27,10 @@ namespace BookAStar.ViewModels.EstimateAndBilling
EventDate = data.EventDate;
Previsionnal = data.Previsionnal;
Id = data.Id;
estimates = new ObservableCollection<Estimate>(
DataManager.Current.Estimates.Where(
e => e.Query.Id == Id
));
this.data = data;
}
private BookQueryData data;
@ -47,19 +52,17 @@ namespace BookAStar.ViewModels.EstimateAndBilling
return DataManager.Current.EstimationCache.LocalGet(this.Id);
}
}
public Estimate Estimate { get
{
return DataManager.Current.Estimates.FirstOrDefault(
e=>e.Query.Id == Id
);
private ObservableCollection<Estimate> estimates;
public ObservableCollection<Estimate> Estimates {
get {
return estimates;
} }
public bool EstimationDone
{
get
{
return Estimate != null;
return Estimates != null && Estimates.Count>0;
}
}

View file

@ -32,10 +32,11 @@ namespace BookAStar.ViewModels.EstimateAndBilling
{
Data.Bill = new List<BillingLine>( Bill );
NotifyPropertyChanged("FormattedTotal");
NotifyPropertyChanged("Bill");
}
private Estimate data;
public Estimate Data { get { return data; } set {
data = value;
SetProperty<Estimate>(ref data, value);
if (data.AttachedFiles == null) data.AttachedFiles = new List<string>();
if (data.AttachedGraphics == null) data.AttachedGraphics = new List<string>();
if (data.Bill == null) data.Bill = new List<BillingLine>();
@ -43,6 +44,11 @@ namespace BookAStar.ViewModels.EstimateAndBilling
AttachedGraphicList = new ObservableCollection<string>(data.AttachedGraphics);
Bill = new ObservableCollection<BillingLine>(data.Bill);
Bill.CollectionChanged += Bill_CollectionChanged;
Title = Data.Title;
Description = Data.Description;
NotifyPropertyChanged("FormattedTotal");
NotifyPropertyChanged("Query");
NotifyPropertyChanged("CLient");
} }
[JsonIgnore]