private void Search() { var code = txtSearchKey.Text.ToLower(); //var branchCode = txtBranchCode.Text.ToLower(); Func <string, bool> contains = value => !string.IsNullOrEmpty(value) && value.IndexOf(code, StringComparison.OrdinalIgnoreCase) >= 0; var ids = GetCheckedIds(); var filteredSource = SectionsAll.FindAll(x => contains(x.Code) || contains(x.Name) || ids.Contains(x.Id)); grdSearch.DataSource = new BindingSource(filteredSource, null); SetCheckState(check: 1, filter: x => ids.Contains(x.Id)); SortGridData(); }
private void Confirm() { grdSearch.EndEdit(); SelectedIds = GetCheckedIds(); if (!SelectedIds.Any()) { SelectedIds = SectionsAll.Select(x => x.Id).ToList(); } var count = SelectedIds.Count; SelectedState = (count == SectionsAll.Count) ? "すべて" : (count == 1) ? (grdSearch.Rows.First(x => IsChecked(x)).DataBoundItem as Section).Name : "入金部門絞込有"; ParentForm.DialogResult = DialogResult.OK; }