78 lines
2 KiB
C#
78 lines
2 KiB
C#
|
|
using System;
|
|
using System.Diagnostics;
|
|
using XLabs.Forms.Mvvm;
|
|
|
|
namespace BookAStar.ViewModels.EstimateAndBilling
|
|
{
|
|
using Data;
|
|
using Interfaces;
|
|
using Model;
|
|
using Model.Social;
|
|
using Model.Workflow;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
|
|
class BookQueryViewModel : ViewModel, IBookQueryData
|
|
{
|
|
public BookQueryViewModel()
|
|
{
|
|
|
|
}
|
|
public BookQueryViewModel(BookQueryData data)
|
|
{
|
|
Debug.Assert(data != null);
|
|
Client=data.Client;
|
|
Location = data.Location;
|
|
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;
|
|
public BookQueryData Data {
|
|
get
|
|
{
|
|
return data;
|
|
}
|
|
}
|
|
public ClientProviderInfo Client { get; set; }
|
|
public Location Location { get; set; }
|
|
public long Id { get; set; }
|
|
public DateTime EventDate { get; set; }
|
|
public decimal? Previsionnal { get; set; }
|
|
public EditEstimateViewModel DraftEstimate
|
|
{
|
|
get
|
|
{
|
|
return DataManager.Current.EstimationCache.LocalGet(this.Id);
|
|
}
|
|
}
|
|
private ObservableCollection<Estimate> estimates;
|
|
public ObservableCollection<Estimate> Estimates {
|
|
get {
|
|
return estimates;
|
|
} }
|
|
|
|
public bool EstimationDone
|
|
{
|
|
get
|
|
{
|
|
return Estimates != null && Estimates.Count>0;
|
|
}
|
|
}
|
|
|
|
public string EditEstimateButtonText
|
|
{
|
|
get
|
|
{
|
|
return DraftEstimate != null ?
|
|
Strings.EditEstimate : Strings.DoEstimate;
|
|
}
|
|
}
|
|
}
|
|
}
|