Пример #1
0
        public void Execute(object parameter)
        {
            string fundSymbol = (string)parameter;

            _allFundsWindowVM.CurrentFund = _fundService.GetFund(fundSymbol);
            // this will return the most recent nav or the funds launch
            if (_allFundsWindowVM.CurrentFund.NavPrices.Count == 0)
            {
                _allFundsWindowVM.asOfDate = _allFundsWindowVM.CurrentFund.LaunchDate;
            }
            else
            {
                // This currently means that once users perform edits/additions it will revert to most recent nav... this can be improved.
                _allFundsWindowVM.asOfDate = _allFundsWindowVM.CurrentFund.NavPrices.OrderBy(f => f.FinalisedDate).Last().FinalisedDate;
            }
            _allFundsWindowVM.priceTable = _staticReferences.GetPriceTable(_allFundsWindowVM.asOfDate);
        }
Пример #2
0
        public AllFundsViewModel(IFundService fundService,
                                 ITransactionService transactionService, IPortfolioService portfolioService,
                                 IStaticReferences staticReferences, IWindowFactory windowFactory)
        {
            _fundService        = fundService;
            _portfolioService   = portfolioService;
            _transactionService = transactionService;
            _staticReferences   = staticReferences;
            _windowFactory      = windowFactory;

            _lbFunds            = _fundService.GetAllFundSymbols();
            _currentFund        = (lbFunds.Count != 0) ? _fundService.GetFund(_lbFunds[0]) : null;
            _asOfDate           = (_currentFund != null) ? _staticReferences.GetMostRecentLockedDate(_currentFund.FundId) : DateTime.Today;
            _priceTable         = _staticReferences.GetPriceTable(_asOfDate);
            SelectFundCommand   = new SelectFundCommand(this, fundService, staticReferences);
            ShowNewTradeCommand = new ActionCommand(OpenNewTradeWindow);

            ShowEditTradeCommand = new ActionCommand(OpenEditTradeWindow);

            ShowDeleteTradeCommand = new ActionCommand(DeleteTradeDialog);

            ShowRestoreTradeCommand = new ActionCommand(RestoreTradeDialog);

            ShowNewFXTradeCommand         = new ActionCommand(OpenNewFxTradeWindow);
            ShowNewCashTradeCommand       = new ActionCommand(OpenNewCashTradeWindow);
            ShowEditCashTradeCommand      = new ActionCommand(OpenEditCashTradeWindow);
            ShowNewInvestorActionCommand  = new ActionCommand(OpenInvestorActionWindow);
            ShowFundInitialisationCommand = new ActionCommand(OpenFundInitialisationWindow);
            ShowFundPropertiesCommand     = new ActionCommand(OpenFundPropertiesWindow);

            ShowFundMetricsCommand = new ActionCommand(OpenMetricsWindow);

            ShowPositionDetailsCommand = new ActionCommand(OpenPositionDetailWindow);

            ShowNavSummaryCommand       = new ActionCommand(OpenNavSummaryWindow);
            DateSelectionChangedCommand = new ActionCommand(ChangeDateCommand);
            RefreshFundCommand          = new ActionCommand(RefreshCurrentFund);
        }
Пример #3
0
 private void RefreshCurrentFund()
 {
     CurrentFund = _fundService.GetFund(CurrentFund.Symbol);
     priceTable  = _staticReferences.GetPriceTable(asOfDate);
 }