예제 #1
0
        private void LoadAccountBalance()
        {
            accountChart.Series.Clear();

            using (var core = new StandardBusinessLayer(DataCache)) {
                core.Connect();

                DataTable accountDataTable = core.GetAccountBalances(CurrentApplication.DateTimeNow);

                int serieNo = 0;

                foreach (DataRow accountDataRow in accountDataTable.Rows)
                {
                    string  name    = (string)accountDataRow[Account.fName];
                    decimal balance = (decimal)accountDataRow["Balance"];

                    if ((int)accountTypeToolStripComboBox.ComboBox.SelectedValue == 1)   // Visa konton
                    {
                        if (balance >= 0)
                        {
                            accountChart.Series.Add(name).Points.Add((double)balance);
                        }
                    }
                    else if ((int)accountTypeToolStripComboBox.ComboBox.SelectedValue == 2)   // Visa skulder
                    {
                        if (balance <= 0)
                        {
                            accountChart.Series.Add(name).Points.Add((double)-balance);
                        }
                    }
                    else   // Visa konton och skulder
                    {
                        accountChart.Series.Add(name).Points.Add((double)balance);
                    }

                    serieNo++;
                }
            }
        }