private void btnSearch_Click(object sender, EventArgs e) { //If grid contains rows, build normal filter string if (dgvFilters.Rows.Count >= 1) { whereClause = BuildFilter(); } //Otherwise, just use the values in the combo boxes and text box to build the filter else if (!txtSearch1.Text.Equals(string.Empty) || !txtSearch1.Text.Equals("Search Text Here...")) { whereClause = BuildFilterNoRows(); } if (optionalClause.Equals("")) { query = $"SELECT * FROM {tableName} WHERE {whereClause};"; } else { query = $"SELECT * FROM {tableName} WHERE {optionalClause} AND {whereClause};"; } FilterDoneEventArgs args = new FilterDoneEventArgs(Database.ExecuteFilter(query), query); if (args.Results == null || args.Results.Rows.Count <= 0) { CMessageBox.Show("No records found with that filter.\nTry to refine it.", "No Records", MessageBoxButtons.OK, Resources.warning_64x64); } else { FilterDone?.Invoke(this, args); Close(); } }
private void ProcessSearch(object sender, EventArgs e) { if (e is FilterDoneEventArgs args) { lastFilterResults = args.Results; currentFilterArgs = args; LoadData(); } }
public ViewObjectsCtl(EntityTypes typeToDisplay, FilterDoneEventArgs args = null) { InitializeComponent(); typeOfData = typeToDisplay; if (args != null) { lastFilterResults = args.Results; currentFilterArgs = args; } }
public ViewPage(EntityTypes entity, string titleText, FilterDoneEventArgs args = null) { Text = titleText; TextTitle = Text; ImageSmall = Resources.view_16x16; ImageLarge = Resources.view; ViewObjectsCtl ctl = new ViewObjectsCtl(entity, args) { Dock = System.Windows.Forms.DockStyle.Fill }; ctl.StatusUpdate += UpdateMainFormStatus; Controls.Add(ctl); }