예제 #1
0
        /// <summary>
        /// The PrimaryFilterControl_ItemSelected
        /// </summary>
        /// <param name="sender">The sender<see cref="object" /></param>
        /// <param name="e">The e<see cref="EventArgs" /></param>
        internal void PrimaryChartFilterControl_ItemSelected(object sender, EventArgs e)
        {
            try
            {
                PrimaryFilter   = sender as VisualComboBox;
                PrimaryGrouping = (Field)Enum.Parse(typeof(Field), PrimaryFilter?.SelectedItem.ToString());
                if (BocExpander1.Visible == false ||
                    BocExpander1.IsExpanded == false)
                {
                    BocExpander1.Visible    = true;
                    BocExpander1.IsExpanded = true;
                }

                AssignChartFilterControls(BocFilter1, BocFilter2, BocFilter3, BocFilter4);
                AssignChartExpanders(BocExpander1, BocExpander2);
                PopulateFilterBoxItems(BocFilter3, ProgramElements[PrimaryGrouping.ToString()]);
                string[] tabpage = GetPrimaryChartFIlterItems()
                                   .AsEnumerable()
                                   .Where(p => p != PrimaryGrouping.ToString())
                                   .Select(p => p)
                                   .ToArray();
                PopulateFilterBoxItems(BocFilter4, tabpage);
                ChartMainTitle = new[] { $"{Source.ToString()} Funding By {PrimaryGrouping}" };
                BocFilter4.Items.Remove(PrimaryGrouping.ToString());
                BocChart = new BudgetChart(BocChart, ChartMainTitle, DbData, PrimaryGrouping, Stat.Total, ChartSeriesType.Column).Activate();
            }
            catch (Exception ex)
            {
                new Error(ex).ShowDialog();
            }
        }
예제 #2
0
 /// <summary>
 /// The GetPrimarySummaryChart
 /// </summary>
 /// <param name="field">The field<see cref="Field"/></param>
 private void GetPrimarySummaryChart(Field field)
 {
     try
     {
         ChartMainTitle = new[] { $"{Source.ToString()} Resources By {field.ToString()} " };
         BocChart       = new BudgetChart(BocChart, ChartMainTitle, DbData, field, Measure, ChartType).Activate();
     }
     catch (Exception ex)
     {
         new Error(ex).ShowDialog();
     }
 }
예제 #3
0
 private ChartControl GetMainChart(ChartControl chart, string title, Dictionary <string, double> data)
 {
     try
     {
         MainChart = new BudgetChart(chart, title, data).Activate();
         return(MainChart);
     }
     catch (Exception ex)
     {
         new Error(ex).ShowDialog();
         return(null);
     }
 }
예제 #4
0
 // CONSTRUCTORS
 public MainForm()
 {
     InitializeComponent();
     NinjaData = new FormData();
     R6        = new DataBuilder(Source.RegionalAccounts);
     D6        = new DataBuilder(Source.DivisionAccounts);
     Metric    = new PrcMetric(R6);
     Timer     = new Timer();
     Values    = new[] { Metric.GetChartTotals(R6.Table, Field.FundCode), Metric.GetChartTotals(R6.Table, Field.BOC), Metric.GetChartTotals(D6.Table, Field.FundCode), Metric.GetChartTotals(R6.Table, Field.NPM), Metric.GetChartTotals(D6.Table, Field.NPM), Metric.GetChartTotals(R6.Table, Field.GoalName), Metric.GetChartTotals(D6.Table, Field.GoalName) };
     Title     = GetChartTitles(Values);
     Chart     = GetMainChart;
     MainChart = new BudgetChart(MainChart, Title[1], Values[1]).Activate();
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SummaryForm"/> class.
 /// </summary>
 /// <param name="source">The source<see cref="Source" /></param>
 /// <param name="provider">The provider<see cref="Provider" /></param>
 public SummaryForm(Source source, Provider provider)
 {
     InitializeComponent();
     Source          = source;
     Provider        = provider;
     DbData          = new DataBuilder(Source, Provider);
     Table           = DbData.Table;
     ProgramElements = DbData.ProgramElements;
     Metric          = new PrcMetric(DbData);
     GetBindingSource();
     Grid.DataSource = BindingSource;
     ChartMainTitle  = new[] { $"{Source.ToString()} Resources" };
     BocChart        = new BudgetChart(BocChart, ChartMainTitle, DbData, Field.FundName, Stat.Total, ChartSeriesType.Column).Activate();
 }
예제 #6
0
        /// <summary>
        /// The SummaryTabPage_TabSelected
        /// </summary>
        /// <param name="sender">The sender<see cref="object" /></param>
        /// <param name="e">The e<see cref="EventArgs" /></param>
        internal void SummaryTabPage_TabSelected(object sender, EventArgs e)
        {
            try
            {
                SummaryTabControl = sender as TabControlAdv;
                if (SummaryTabControl != null)
                {
                    CurrentIndex = SummaryTabControl.SelectedIndex;
                }

                switch (CurrentIndex)
                {
                case 0:
                    AssignChartFilterControls(BocFilter1, BocFilter2, BocFilter3, BocFilter4);
                    AssignChartExpanders(BocExpander1, BocExpander2);
                    PopulateFilterBoxItems(BocFilter3, DbData.ProgramElements["BocName"]);
                    PopulateFilterBoxItems(BocFilter4, GetPrimaryChartFIlterItems());
                    BocFilter4.Items.Remove("BocName");
                    if (DbData.Source == Source.RegionalAccounts)
                    {
                        BocFilter4.Items.Remove("RC");
                    }

                    if (Division != null)
                    {
                        ChartMainTitle = new[] { $"{Division} Funding By Object Class" };
                    }
                    else
                    {
                        ChartMainTitle = new[] { $"{Source.ToString()} Funding By Object Class" };
                    }

                    BocChart = new BudgetChart(BocChart, ChartMainTitle, DbData, Field.BocName, Stat.Total, ChartSeriesType.Column).Activate();
                    break;

                case 1:
                    DataTable table = DbData.Table.AsEnumerable().Select(p => p).CopyToDataTable();
                    lblCount.Text     = table.Rows.Count.ToString();
                    lblAve.Text       = table.AsEnumerable().Select(p => p.Field <decimal>("Amount")).Average().ToString("N");
                    lblTotal.Text     = table.AsEnumerable().Select(p => p.Field <decimal>("Amount")).Sum().ToString("N");
                    GridGroupBox.Text = $"{Source.ToString()}";
                    break;
                }
            }
            catch (Exception ex)
            {
                new Error(ex).ShowDialog();
            }
        }
예제 #7
0
 /// <summary>
 /// The GetSecondaryGroupSummaryChart
 /// </summary>
 /// <param name="field">The field<see cref="Field"/></param>
 private void GetSecondaryGroupSummaryChart(Field field)
 {
     try
     {
         Dictionary <string, object> fp = new Dictionary <string, object> {
             [PrimaryFilter.SelectedItem.ToString()] = BocFilter3.SelectedItem.ToString()
         };
         ChartMainTitle = new[] { $"{Source.ToString()} {ChartFilter} Resources By {field.ToString()} " };
         DataBuilder fd = new DataBuilder(Source, Provider, fp);
         BocChart = new BudgetChart(BocChart, ChartMainTitle, fd, field, Measure, ChartType).Activate();
     }
     catch (Exception ex)
     {
         new Error(ex).ShowDialog();
     }
 }
예제 #8
0
 /// <summary>
 /// The TransitionChart
 /// </summary>
 /// <param name="table">The table<see cref="DataTable"/></param>
 internal void TransitionChart(DataTable table)
 {
     try
     {
         DataRow row   = table?.Rows[0];
         decimal total = table.AsEnumerable().Where(p => p.Field <string>("BFY").Equals(row?["BFY"].ToString())).Where(p => p.Field <string>("Code").Contains(row?["Code"].ToString())).Select(p => p.Field <decimal>("Amount")).Sum();
         decimal ratio = decimal.Parse(row?["Amount"].ToString()) / total;
         Dictionary <string, double> d = new Dictionary <string, double> {
             ["Total"] = (double)total, ["Allocation"] = (double)decimal.Parse(row?["Amount"].ToString())
         };
         ChartMainTitle = new[] { $"{ratio.ToString("P")} {Source.ToString()} PRC {row?["Code"]} Funding" };
         AccountChart   = new BudgetChart(AccountChart, ChartMainTitle, d, Field.ProgramProjectCode, Stat.Total, ChartSeriesType.Column).Activate();
     }
     catch (Exception ex)
     {
         new Error(ex).ShowDialog();
     }
 }
예제 #9
0
 /// <summary>
 /// The UpdateAccountChart
 /// </summary>
 /// <param name="sender">The sender<see cref="object"/></param>
 /// <param name="e">The e<see cref="EventArgs"/></param>
 internal void UpdateAccountChart(object sender, EventArgs e)
 {
     try
     {
         Grid = sender as DataGridView;
         DataGridViewRow drv   = Grid?.CurrentRow;
         decimal         total = Table.AsEnumerable().Where(p => p.Field <string>("BFY").Equals(drv?.Cells["BFY"].Value.ToString())).Where(p => p.Field <string>("Code").Contains(drv?.Cells["Code"].Value.ToString())).Select(p => p.Field <decimal>("Amount")).Sum();
         if (drv != null)
         {
             decimal ratio = (decimal)drv.Cells["Amount"].Value / total;
             Dictionary <string, double> d = new Dictionary <string, double> {
                 ["Total"] = (double)total, ["Allocation"] = (double)(decimal)drv.Cells["Amount"].Value
             };
             ChartMainTitle = new[] { $"{ratio.ToString("P")} {Source.ToString()} PRC {drv.Cells["Code"].Value} Funding" };
             AccountChart   = new BudgetChart(AccountChart, ChartMainTitle, d, Field.ProgramProjectCode, Stat.Total, ChartSeriesType.Column).Activate();
         }
     }
     catch (Exception ex)
     {
         new Error(ex).ShowDialog();
     }
 }