public void ShowElement(IAccountingElement iElmt, TreeViewMappingElement tvme = null, Dictionary <string, double?> lastTotal = null)
        {
            if (tvme == null)
            {
                tvme = _Memory;
            }
            else
            {
                _Memory = tvme;
            }

            SetLastTotalMemoryAmount(lastTotal);

            Rows.Clear();
            foreach (IAccountingElement item in iElmt.GetItemList(tvme))
            {
                AddRow(item, iElmt.CcyRef, lastTotal: GetLastTotalMemoryAmount(item.GetName()));
            }
            AddRow(iElmt.GetTotalAccount(FXMarketUsed, AssetMarketUsed, iElmt.CcyRef,
                                         overrideName: "Total",
                                         lastTotal: GetLastTotalMemoryAmount()),
                   isTotalRow: iElmt.GetNodeType() != NodeType.Account);
            ElementShowed             = iElmt;
            TotalShowed               = null;
            Rows[0].Cells[0].Selected = false;
        }
        public static TreeViewMappingElement CreateElement(IAccountingElement iNewElmt)
        {
            var res = new TreeViewMappingElement(iNewElmt.GetName());

            foreach (IAccountingElement item in iNewElmt.GetItemList())
            {
                res.AddElement(CreateElement(item));
            }
            return(res);
        }
        internal void ShowTotal(IAccountingData iad, Dictionary <string, double?> lastTotal = null)
        {
            Rows.Clear();

            SetLastTotalMemoryAmount(lastTotal);

            foreach (ICategory icat in iad.Categories)
            {
                AddRow(icat, iad.Ccy, GetLastTotalMemoryAmount(icat.CategoryName));
            }

            AddRow(iad.Total(GetLastTotalMemoryAmount()), isTotalRow: true, isTotalView: true);
            ElementShowed             = null;
            TotalShowed               = iad;
            Rows[0].Cells[0].Selected = false;
        }
Exemple #4
0
        public void ShowElement(NodeAddress na)
        {
            labelTable.Text = na.GetLabelText();
            DateTime?                    dt        = GetPreviousDate();
            IAccountingElement           element   = Data.GetElement(na);
            Dictionary <string, double?> lastTotal = new Dictionary <string, double?> {
            };

            if (dt.HasValue)
            {
                AccountingData lastData = _DataHistory.GetData(dt.Value);
                lastTotal[dataGridViewAccounting._LastTotalMemoryMainKey] = lastData.GetQuote(lastData.Ccy, _DataHistory.TotalCcy) * lastData.GetValue(na);
                foreach (var subitem in lastData.GetElement(na).GetItemList())
                {
                    lastTotal[subitem.GetName()] = subitem.GetTotalAmount(_DataHistory.TotalCcy, lastData.FXMarket);
                }
            }
            dataGridViewAccounting.ShowElement(Data.GetElement(na), Data.Map.GetElement(na), lastTotal);;
            _AddressofElementShowed = na;
        }
        private void AddRow(IAccountingElement item, ICcyAsset convCcy, bool isTotal = false, double?lastTotal = null)
        {
            IAccount sum = item.GetTotalAccount(FXMarketUsed, AssetMarketUsed, convCcy, item.GetName(), lastTotal: lastTotal);

            AddRow(sum, isTotal);
        }
 internal void AddItem(NodeAddress nodeAddress, IAccountingElement iNewAcc)
 {
     TreeViewMappingElement elmt    = GetElement(nodeAddress.GetParent());
     TreeViewMappingElement newElmt = elmt.AddElement(nodeAddress.Address.Last(), TreeViewMappingElement.CreateElement(iNewAcc));
 }