예제 #1
0
        public void Load(
            [NotNull] StatementModel statementModel,
            [NotNull] BudgetModel budgetModel,
            [NotNull] GlobalFilterCriteria criteria,
            Engine.Ledger.LedgerBook ledgerBookModel)
        {
            if (statementModel == null)
            {
                throw new ArgumentNullException(nameof(statementModel));
            }

            if (budgetModel == null)
            {
                throw new ArgumentNullException(nameof(budgetModel));
            }

            if (criteria == null)
            {
                throw new ArgumentNullException(nameof(criteria));
            }

            this.statement  = statementModel;
            this.budget     = budgetModel;
            this.ledgerBook = ledgerBookModel;

            BurnDownCharts results = this.chartsService.BuildAllCharts(statementModel, this.budget, this.ledgerBook, criteria);

            this.beginDate       = results.BeginDate;
            DateRangeDescription = results.DateRangeDescription;
            ChartControllers     = new BindingList <BucketBurnDownController>(results.Charts.Select(BuildBucketBurnDownController).ToList());

            RaisePropertyChanged(() => ChartControllers);
        }
 private void Reset()
 {
     this.parentBook     = null;
     Date                = DateTime.MinValue;
     BankBalances        = null;
     BankAccounts        = null;
     SelectedBankAccount = null;
 }
예제 #3
0
        private void OnLedgerBookReadyMessageReceived([NotNull] LedgerBookReadyMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            this.currentLedgerBook = message.LedgerBook;
        }
        /// <summary>
        ///     This is drawn programatically because the dimensions of the ledger book grid are two-dimensional and dynamic.
        ///     Unknown number
        ///     of columns and many rows. ListView and DataGrid dont work well.
        /// </summary>
        public void BuildGrid([CanBeNull] Engine.Ledger.LedgerBook currentLedgerBook, [NotNull] ResourceDictionary viewResources, [NotNull] ContentPresenter contentPanel)
        {
            if (viewResources == null)
            {
                throw new ArgumentNullException("viewResources");
            }

            if (contentPanel == null)
            {
                throw new ArgumentNullException("contentPanel");
            }

            this.ledgerBook = currentLedgerBook;
            this.localResources = viewResources;
            this.contentPresenter = contentPanel;
            DynamicallyCreateLedgerBookGrid();
        }
        /// <summary>
        ///     Used to start a new Ledger Book reconciliation.  This will ultimately add a new <see cref="LedgerEntryLine" /> to
        ///     the <see cref="LedgerBook" />.
        /// </summary>
        public void ShowCreateDialog([NotNull] Engine.Ledger.LedgerBook ledgerBook)
        {
            if (ledgerBook == null)
            {
                throw new ArgumentNullException(nameof(ledgerBook));
            }

            this.parentBook      = ledgerBook;
            BankBalances         = new ObservableCollection <BankBalanceViewModel>();
            CreateMode           = true;
            AddBalanceVisibility = true;
            Editable             = true;

            var requestFilterMessage = new RequestFilterMessage(this);

            MessengerInstance.Send(requestFilterMessage);
            Date = requestFilterMessage.Criteria.EndDate?.AddDays(1) ?? DateTime.Today;

            ShowDialogCommon("New Monthly Reconciliation");
        }
        /// <summary>
        ///     This is drawn programatically because the dimensions of the ledger book grid are two-dimensional and dynamic.
        ///     Unknown number
        ///     of columns and many rows. ListView and DataGrid dont work well.
        /// </summary>
        public void BuildGrid(
            Engine.Ledger.LedgerBook currentLedgerBook,
            ResourceDictionary viewResources,
            ContentPresenter contentPanel,
            int numberOfMonthsToShow)
        {
            if (viewResources == null)
            {
                throw new ArgumentNullException(nameof(viewResources));
            }

            if (contentPanel == null)
            {
                throw new ArgumentNullException(nameof(contentPanel));
            }

            this.ledgerBook = currentLedgerBook;
            this.localResources = viewResources;
            this.contentPresenter = contentPanel;
            DynamicallyCreateLedgerBookGrid(numberOfMonthsToShow);
        }
        /// <summary>
        ///     This is drawn programatically because the dimensions of the ledger book grid are two-dimensional and dynamic.
        ///     Unknown number
        ///     of columns and many rows. ListView and DataGrid dont work well.
        /// </summary>
        public void BuildGrid(
            Engine.Ledger.LedgerBook currentLedgerBook,
            ResourceDictionary viewResources,
            ContentPresenter contentPanel,
            int numberOfMonthsToShow)
        {
            if (viewResources == null)
            {
                throw new ArgumentNullException(nameof(viewResources));
            }

            if (contentPanel == null)
            {
                throw new ArgumentNullException(nameof(contentPanel));
            }

            this.ledgerBook       = currentLedgerBook;
            this.localResources   = viewResources;
            this.contentPresenter = contentPanel;
            DynamicallyCreateLedgerBookGrid(numberOfMonthsToShow);
        }
        /// <summary>
        ///     Used to show the bank balances involved in this <see cref="LedgerEntryLine" />.
        ///     Only shows balances at this stage, no editing allowed.
        /// </summary>
        public void ShowViewDialog([NotNull] Engine.Ledger.LedgerBook ledgerBook, [NotNull] LedgerEntryLine line)
        {
            if (ledgerBook == null)
            {
                throw new ArgumentNullException(nameof(ledgerBook));
            }

            if (line == null)
            {
                throw new ArgumentNullException(nameof(line));
            }

            this.parentBook      = ledgerBook;
            Date                 = line.Date;
            BankBalances         = new ObservableCollection <BankBalanceViewModel>(line.BankBalances.Select(b => new BankBalanceViewModel(line, b)));
            CreateMode           = false;
            AddBalanceVisibility = false;
            Editable             = false; // Bank balances are not editable after creating a new Ledger Line at this stage.

            ShowDialogCommon(Editable ? "Edit Bank Balances" : "Bank Balances");
        }
        public void ShowDialog([NotNull] Engine.Ledger.LedgerBook parentLedgerBook, [NotNull] LedgerBucket ledgerBucket, [NotNull] BudgetModel budgetModel)
        {
            if (parentLedgerBook == null)
            {
                throw new ArgumentNullException(nameof(parentLedgerBook));
            }

            if (ledgerBucket == null)
            {
                throw new ArgumentNullException(nameof(ledgerBucket));
            }

            if (budgetModel == null)
            {
                throw new ArgumentNullException(nameof(budgetModel));
            }

            if (LedgerBucketHistoryAnalysis == null)
            {
                LedgerBucketHistoryAnalysis = CreateBucketHistoryAnalyser();
            }
            LedgerBucketHistoryAnalysis.Analyse(ledgerBucket, parentLedgerBook);
            this.ledger         = ledgerBucket;
            BankAccounts        = new ObservableCollection <Account>(this.accountRepo.ListCurrentlyUsedAccountTypes());
            BucketBeingTracked  = ledgerBucket.BudgetBucket;
            StoredInAccount     = ledgerBucket.StoredInAccount;
            MonthlyBudgetAmount = budgetModel.Expenses.Single(e => e.Bucket == BucketBeingTracked).Amount;
            this.correlationId  = Guid.NewGuid();

            var dialogRequest = new ShellDialogRequestMessage(BudgetAnalyserFeature.LedgerBook, this, ShellDialogType.OkCancel)
            {
                CorrelationId = this.correlationId,
                Title         = "Ledger - " + BucketBeingTracked,
                HelpAvailable = true
            };

            MessengerInstance.Send(dialogRequest);
        }
        public void Load(
            [NotNull] StatementModel statementModel,
            [NotNull] BudgetModel budgetModel,
            [NotNull] GlobalFilterCriteria criteria,
            Engine.Ledger.LedgerBook ledgerBookModel)
        {
            if (statementModel == null)
            {
                throw new ArgumentNullException("statementModel");
            }

            if (budgetModel == null)
            {
                throw new ArgumentNullException("budgetModel");
            }

            if (criteria == null)
            {
                throw new ArgumentNullException("criteria");
            }

            this.statement = statementModel;
            this.budget = budgetModel;
            this.ledgerBook = ledgerBookModel;

            this.chartBuilder.Build(criteria, statementModel, budgetModel, ledgerBookModel);
            this.beginDate = this.chartBuilder.Results.BeginDate;
            DateRangeDescription = this.chartBuilder.Results.DateRangeDescription;
            ChartControllers = new BindingList<BucketBurnDownController>(this.chartBuilder.Results.Charts.ToList());

            RaisePropertyChanged(() => ChartControllers);
        }
 private void Reset()
 {
     this.parentBook = null;
     Date = DateTime.MinValue;
     BankBalances = null;
     BankAccounts = null;
     SelectedBankAccount = null;
 }
        /// <summary>
        ///     Used to show the bank balances involved in this <see cref="LedgerEntryLine" />.
        ///     Only shows balances at this stage, no editing allowed.
        /// </summary>
        public void ShowViewDialog([NotNull] Engine.Ledger.LedgerBook ledgerBook, [NotNull] LedgerEntryLine line)
        {
            if (ledgerBook == null)
            {
                throw new ArgumentNullException(nameof(ledgerBook));
            }

            if (line == null)
            {
                throw new ArgumentNullException(nameof(line));
            }

            this.parentBook = ledgerBook;
            Date = line.Date;
            BankBalances = new ObservableCollection<BankBalanceViewModel>(line.BankBalances.Select(b => new BankBalanceViewModel(line, b)));
            CreateMode = false;
            AddBalanceVisibility = false;
            Editable = false; // Bank balances are not editable after creating a new Ledger Line at this stage.

            ShowDialogCommon(Editable ? "Edit Bank Balances" : "Bank Balances");
        }
        /// <summary>
        ///     Used to start a new Ledger Book reconciliation.  This will ultimately add a new <see cref="LedgerEntryLine" /> to
        ///     the <see cref="LedgerBook" />.
        /// </summary>
        public void ShowCreateDialog([NotNull] Engine.Ledger.LedgerBook ledgerBook)
        {
            if (ledgerBook == null)
            {
                throw new ArgumentNullException(nameof(ledgerBook));
            }

            this.parentBook = ledgerBook;
            BankBalances = new ObservableCollection<BankBalanceViewModel>();
            CreateMode = true;
            AddBalanceVisibility = true;
            Editable = true;

            var requestFilterMessage = new RequestFilterMessage(this);
            MessengerInstance.Send(requestFilterMessage);
            Date = requestFilterMessage.Criteria.EndDate?.AddDays(1) ?? DateTime.Today;

            ShowDialogCommon("New Monthly Reconciliation");
        }
 public LedgerBookReadyMessage(Engine.Ledger.LedgerBook ledgerBook)
 {
     LedgerBook = ledgerBook;
 }
        private void OnLedgerBookReadyMessageReceived([NotNull] LedgerBookReadyMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            this.currentLedgerBook = message.LedgerBook;
        }
        public void Load(
            [NotNull] StatementModel statementModel,
            [NotNull] BudgetModel budgetModel,
            [NotNull] GlobalFilterCriteria criteria,
            Engine.Ledger.LedgerBook ledgerBookModel)
        {
            if (statementModel == null)
            {
                throw new ArgumentNullException(nameof(statementModel));
            }

            if (budgetModel == null)
            {
                throw new ArgumentNullException(nameof(budgetModel));
            }

            if (criteria == null)
            {
                throw new ArgumentNullException(nameof(criteria));
            }

            this.statement = statementModel;
            this.budget = budgetModel;
            this.ledgerBook = ledgerBookModel;

            BurnDownCharts results = this.chartsService.BuildAllCharts(statementModel, this.budget, this.ledgerBook, criteria);
            this.beginDate = results.BeginDate;
            DateRangeDescription = results.DateRangeDescription;
            ChartControllers = new BindingList<BucketBurnDownController>(results.Charts.Select(BuildBucketBurnDownController).ToList());

            RaisePropertyChanged(() => ChartControllers);
        }