private void PaintTvPercent(TreeNode treeNode) { if (treeNode.Nodes.Count != 0) { Dictionary <decimal, decimal> dictionary = new Dictionary <decimal, decimal>(); //child string query = string.Format(@"select cl.term as term, fd.val as val from curve_list cl join curves c on cl.cur_id = c.cur_id join ffd ffd on ffd.fi_id = cl.fi_id join fisd_dq fd on fd.fisd_id = ffd.fisd_id where c.ident = '{0}' and ffd.fif_id = 3 and dat = to_date('{1}', 'dd.mm.yyyy')", treeNode.Text, dtpActualDate.Value.ToString("dd.MM.yyyy")); using (NpgsqlConnection connection = new NpgsqlConnection(_connection)) { connection.Open(); using (NpgsqlCommand command = new NpgsqlCommand()) { command.Connection = connection; command.CommandText = query; using (NpgsqlDataReader dataReader = command.ExecuteReader()) { while (dataReader.Read()) { decimal term = (decimal)dataReader["term"]; decimal val = (decimal)dataReader["val"]; dictionary.Add(term, val); } } } } if (dictionary.Count != 0) { var t = new PaintWindow(dictionary) { Text = treeNode.Text }; t.ShowDialog(); } } else { PortfolioPosition position = new BalancePosition(treeNode.Text, FinType.PercentCurve); TimeSeries timeSeries = _provider.GetTimeSeries(position, TimeSeriesAttribute.Close); if (timeSeries != null || timeSeries.Series.Count != 0) { var t = new PaintWindow(timeSeries.Series.ToDictionary(z => z.Key, z => z.Value)); t.ShowDialog(); } } }