private void applyFilters() { string holdFilter = UIHelpers.getRadioButtonStatus(new Button[] { btnAll, btnHeld, btnReleased }); string andFilter = ""; if (holdFilter == "btnHeld") { andFilter = " and (CedentHoldPayment=1)"; } if (holdFilter == "btnReleased") { andFilter = " and (CedentHoldPayment=0)"; } if (rectInactive.Opacity < 0.3d) { andFilter += " and (CedentActive=1)"; } DataRow[] dtIdeasFiltered = dtCedentHold.Select("(CedentCompany like '%" + txtFilter.Text + "%')" + andFilter); DataView dv = new DataView(); if (dtIdeasFiltered.Count() == 0) { dgCedents.ItemsSource = null; return; } dv = dtIdeasFiltered.CopyToDataTable().DefaultView; dv.Sort = "CedentCompany"; dgCedents.ItemsSource = dv; //dgCedents.ItemsSource = dtCedentHold.DefaultView; }
private void filterData() { DataTable dtNavFiltered = dtNavData.Clone(); foreach (DataRow dr in dtNavData.Rows) { if (dr["ClaimNumber"].ToString() != "") { string action = dr["Action"].ToString(); string actionFilter = UIHelpers.getRadioButtonStatus(new Button[] { btnAll, btnCleared, btnIssued, btnVoided }); string textFilter = txtFilter.Text.ToUpper(); if ((actionFilter == "btnCleared") && (action != "Cleared")) { continue; } if ((actionFilter == "btnIssued") && (action != "Issued")) { continue; } if ((actionFilter == "btnVoided") && (action != "Voided")) { continue; } if (textFilter != "") { string claim = dr["ClaimNumber"].ToString().ToUpper(); string vendor = dr["VendorName"].ToString().ToUpper(); string ceding = dr["CedingCompany"].ToString().ToUpper(); string insured = dr["Insured"].ToString().ToUpper(); string refno = dr["Reference Number"].ToString().ToUpper(); if ((claim.IndexOf(textFilter) < 0) && (vendor.IndexOf(textFilter) < 0) && (ceding.IndexOf(textFilter) < 0) && (insured.IndexOf(textFilter) < 0) && (refno.IndexOf(textFilter) < 0)) { continue; } } dtNavFiltered.ImportRow(dr); } } dgPayments.ItemsSource = dtNavFiltered.DefaultView; }