public CashFlowViewModel() { _contoData = new ContoData(); AddWithdrawCommand = new RelayCommand(AddWithdrawCommand_Executed); AddCostCommand = new RelayCommand(AddCostCommand_Executed); WithdrawDate = DateTime.Now; CostDate = DateTime.Now; SelfInvoices = new CollectionView(_contoData.CashFlowSelfInvoices()); Balance = _contoData.CashFlowBalance(); }
public void AddWithdrawCommand_Executed(object sender) { if (Withdraw > 0) { _contoData.CashFlowAdd(new CashFlowDataObject { Cash = Withdraw, Description = "Prelievo per cassa", FlowDate = WithdrawDate, }); Balance = _contoData.CashFlowBalance(); Withdraw = 0; WithdrawDate = DateTime.Now; } else { MessageBox.Show("Immettere un valore di prelievo"); } }