/// <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(); } }
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(); } }
/// <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(); } }
/// <summary> /// Handles the SelectedIndexChanged event of the Filter2 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 Filter2_SelectedIndexChanged(object sender, EventArgs e) { try { if (sender is VisualComboBox filter) { F2 = filter.SelectedItem.ToString(); C2 = (Field)Enum.Parse(typeof(Field), filter.Tag.ToString()); } DataTable tbl = TableFilter(Table, C1, F1); DataTable tbl2 = TableFilter(tbl, C2, F2); BindingSource.DataSource = tbl2; label6.Text = DbData.GetTotal(Source, tbl2).ToString("c"); label12.Text = tbl2.Rows.ToString(); PopulateFilterItems(Filter3.Tag.ToString(), tbl2, Filter3, label3); Filter4.Visible = false; label4.Visible = false; } catch (Exception ex) { new Error(ex).ShowDialog(); } }