Exemple #1
0
        /// <summary>
        /// Populates the filter items.
        /// </summary>
        /// <param name="colname">The colname.</param>
        /// <param name="table">The table.</param>
        /// <param name="control">The control.</param>
        /// <param name="label">The label.</param>
        internal void PopulateFilterItems(Field colname, DataTable table, VisualComboBox control, Label label)
        {
            try
            {
                if (control.Items.Count > 0)
                {
                    control.Items.Clear();
                }

                if (label.Visible == false)
                {
                    label.Visible = true;
                }

                string[] item = Fields(table, colname.ToString());
                control.Tag = colname.ToString();
                foreach (string i in item)
                {
                    control.Items.Add(i);
                }
            }
            catch (Exception ex)
            {
                new Error(ex).ShowDialog();
            }
        }
 /// <summary>
 /// The AssignChartFilterControls
 /// </summary>
 /// <param name="filter1">The filter1<see cref="VisualComboBox" /></param>
 /// <param name="filter2">The filter2<see cref="VisualComboBox" /></param>
 /// <param name="filter3">The filter3<see cref="VisualComboBox" /></param>
 /// <param name="filter4">The filter4<see cref="VisualComboBox" /></param>
 private void AssignChartFilterControls(VisualComboBox filter1, VisualComboBox filter2, VisualComboBox filter3, VisualComboBox filter4)
 {
     ChartFilterControl1 = filter1;
     ChartFilterControl2 = filter2;
     ChartFilterControl3 = filter3;
     ChartFilterControl4 = filter4;
 }
Exemple #3
0
        /// <summary>
        /// Handles the SelectedIndexChanged event of the Filter3 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void Filter3_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                VisualComboBox filter = sender as VisualComboBox;
                F3 = filter?.SelectedItem.ToString();
                if (filter != null)
                {
                    C3 = (Field)Enum.Parse(typeof(Field), filter.Tag.ToString());
                }

                DataTable tbl  = TableFilter(Table, C1, F1);
                DataTable tbl2 = TableFilter(tbl, C2, F2);
                DataTable tbl3 = TableFilter(tbl2, C3, F3);
                BindingSource.DataSource = tbl3;
                label6.Text  = DbData.GetTotal(Source, tbl3).ToString("c");
                label12.Text = tbl3.Rows.Count.ToString();
                if (Filter4.Tag != null)
                {
                    PopulateFilterItems(Filter4.Tag.ToString(), tbl3, Filter4, label4);
                }
            }
            catch (Exception ex)
            {
                new Error(ex).ShowDialog();
            }
        }
Exemple #4
0
        /// <summary>
        /// Populates the filter items.
        /// </summary>
        /// <param name="colname">The colname.</param>
        /// <param name="data">The data.</param>
        /// <param name="control">The control.</param>
        /// <param name="label">The label.</param>
        internal void PopulateFilterItems(Field colname, DataBuilder data, VisualComboBox control, Label label)
        {
            try
            {
                control.Tag = colname.ToString();
                if (control.Items.Count > 0)
                {
                    control.Items.Clear();
                }

                if (label.Visible == false)
                {
                    label.Visible = true;
                    label.Text    = control.Tag.ToString();
                }

                string[] items = ProgramElements[colname.ToString()];
                foreach (string i in items)
                {
                    control.Items.Add(i);
                }
            }
            catch (Exception ex)
            {
                new Error(ex).ShowDialog();
            }
        }
Exemple #5
0
        /// <summary>
        /// Populates the filter items.
        /// </summary>
        /// <param name="colname">The colname.</param>
        /// <param name="data">The data.</param>
        /// <param name="control">The control.</param>
        /// <param name="label">The label.</param>
        internal void PopulateFilterItems(string colname, DataBuilder data, VisualComboBox control, Label label)
        {
            try
            {
                if (control.Items.Count > 0)
                {
                    control.Items.Clear();
                }

                if (label.Visible == false)
                {
                    label.Visible = true;
                }

                string[] filters = data.ProgramElements[colname];
                control.Tag = colname;
                foreach (string i in filters)
                {
                    control.Items.Add(i);
                }
            }
            catch (Exception ex)
            {
                new Error(ex).ShowDialog();
            }
        }
        private void Filter4_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                VisualComboBox filter = sender as VisualComboBox;
                if (filter.SelectedItem != null)
                {
                    F4 = filter.SelectedItem.ToString();
                    C4 = (Field)Enum.Parse(typeof(Field), filter.Tag.ToString());
                }

                DataTable table = Table.AsEnumerable().Where(p => p.Field <string>(C1.ToString()).Equals(F1)).Where(p => p.Field <string>(C2.ToString()).Equals(F2)).Where(p => p.Field <string>(C3.ToString()).Equals(F3)).Where(p => p.Field <string>(C4.ToString()).Equals(F4)).Select(p => p).CopyToDataTable();
                BindingSource.DataSource = table;
                if (table.Columns.Contains("Amount"))
                {
                    label6.Text = DbData.GetTotal(Source, table).ToString("c");
                }

                label12.Text = table.Rows.Count.ToString();
            }
            catch (Exception ex)
            {
                new Error(ex).ShowDialog();
            }
        }
        private void Filter3_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                VisualComboBox filter = sender as VisualComboBox;
                if (filter?.SelectedItem != null)
                {
                    F3 = filter.SelectedItem.ToString();
                    C3 = (Field)Enum.Parse(typeof(Field), filter.Tag.ToString());
                }

                DataTable table = Table.AsEnumerable().Where(p => p.Field <string>(C1.ToString()).Equals(F1)).Where(p => p.Field <string>(C2.ToString()).Equals(F2)).Where(p => p.Field <string>(C3.ToString()).Equals(F3)).Select(p => p).CopyToDataTable();
                BindingSource.DataSource = table;
                label6.Text  = DbData.GetTotal(Source, table).ToString("c") ?? "0";
                label12.Text = table.Rows.Count.ToString() ?? "0";
                if (Filter4.Tag != null)
                {
                    PopulateFilterItems(Filter4.Tag.ToString(), table, Filter4, label4);
                }
            }
            catch (Exception ex)
            {
                new Error(ex).ShowDialog();
            }
        }
        internal void PopulateFilterItems(Field colname, DataTable table, VisualComboBox control, Label label)
        {
            try
            {
                if (control.Items.Count > 0)
                {
                    control.Items.Clear();
                }

                if (label.Visible == false)
                {
                    label.Visible = true;
                }

                string[] item = table.AsEnumerable().Select(p => p.Field <string>(colname.ToString())).Distinct().ToArray();
                control.Tag = colname.ToString();
                foreach (string i in item)
                {
                    control.Items.Add(i);
                }
            }
            catch (Exception ex)
            {
                new Error(ex).ShowDialog();
            }
        }
 /// <summary>
 /// The PopulateFilterBoxItems
 /// </summary>
 /// <param name="cmbox">The cmbox<see cref="VisualComboBox" /></param>
 /// <param name="names">The names<see cref="string[]"/></param>
 internal void PopulateFilterBoxItems(VisualComboBox cmbox, string[] names)
 {
     try
     {
         cmbox.Items.Clear();
         foreach (string t in names)
         {
             cmbox.Items.Add(t);
         }
     }
     catch (Exception ex)
     {
         new Error(ex).ShowDialog();
     }
 }
Exemple #10
0
 /// <summary>
 /// Populates the filter buttons.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="list">The list.</param>
 internal void PopulateFilterButtons(VisualComboBox control, string[] list)
 {
     try
     {
         control.Items.Clear();
         foreach (string f in list)
         {
             control.Items.Add(f);
         }
     }
     catch (Exception ex)
     {
         new Error(ex).ShowDialog();
     }
 }
Exemple #11
0
 /// <summary>
 /// Handles the SelectedIndexChanged event of the Filter1 control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 private void Filter1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         VisualComboBox filter = sender as VisualComboBox;
         F1 = filter?.SelectedItem.ToString();
         C1 = (Field)Enum.Parse(typeof(Field), filter?.Tag.ToString());
         DataTable tbl = TableFilter(Table, C1, F1);
         BindingSource.DataSource = tbl;
         label6.Text  = DbData.GetTotal(Source, tbl).ToString("c");
         label12.Text = tbl.Rows.Count.ToString();
         PopulateFilterItems(Filter2.Tag.ToString(), tbl, Filter2, label2);
         Filter3.Visible = false;
         label3.Visible  = false;
         Filter4.Visible = false;
         label4.Visible  = false;
     }
     catch (Exception ex)
     {
         new Error(ex).ShowDialog();
     }
 }
 public VisualComboBoxActionList(IComponent component) : base(component)
 {
     buttonControl   = (VisualComboBox)component;
     designerService = (DesignerActionUIService)GetService(typeof(DesignerActionUIService));
 }