/// <summary> /// This function will ensure that values that are checked stay checked /// after the check boxes are updated and populated with new values. /// </summary> private void UpdateCheckedItems() { int index; // Material if (Filters.FitlerValues.material.Count > 0) { ChkdListBx_Material.ItemCheck -= ckdListBox_ItemCheck; foreach (string str in Filters.FitlerValues.material) { index = ChkdListBx_Material.Items.IndexOf(str); if (index >= 0) { if (!ChkdListBx_Material.GetItemChecked(index)) { ChkdListBx_Material.SetItemChecked(index, true); } } } ChkdListBx_Material.ItemCheck += ckdListBox_ItemCheck; } // Material Group if (Filters.FitlerValues.materialGroup.Count > 0) { ChkdListBx_MaterialGroup.ItemCheck -= ckdListBox_ItemCheck; foreach (string str in Filters.FitlerValues.materialGroup) { index = ChkdListBx_MaterialGroup.Items.IndexOf(str); if (index >= 0) { if (!ChkdListBx_MaterialGroup.GetItemChecked(index)) { ChkdListBx_MaterialGroup.SetItemChecked(index, true); } } } ChkdListBx_MaterialGroup.ItemCheck += ckdListBox_ItemCheck; } // Vendor if (Filters.FitlerValues.vendor.Count > 0) { ChkdListBx_Vendor.ItemCheck -= ckdListBox_ItemCheck; foreach (string str in Filters.FitlerValues.vendor) { index = ChkdListBx_Vendor.Items.IndexOf(str); if (index >= 0) { if (!ChkdListBx_Vendor.GetItemChecked(index)) { ChkdListBx_Vendor.SetItemChecked(index, true); } } } ChkdListBx_Vendor.ItemCheck += ckdListBox_ItemCheck; } // Vendor Description if (Filters.FitlerValues.vendorDesc.Count > 0) { ChkdListBx_VendorDesc.ItemCheck -= ckdListBox_ItemCheck; foreach (string str in Filters.FitlerValues.vendorDesc) { index = ChkdListBx_VendorDesc.Items.IndexOf(str); if (index >= 0) { if (!ChkdListBx_VendorDesc.GetItemChecked(index)) { ChkdListBx_VendorDesc.SetItemChecked(index, true); } } } ChkdListBx_VendorDesc.ItemCheck += ckdListBox_ItemCheck; } // Purch Group if (Filters.FitlerValues.purchGroup.Count > 0) { ChkdListBx_PurchGroup.ItemCheck -= ckdListBox_ItemCheck; foreach (string str in Filters.FitlerValues.purchGroup) { index = ChkdListBx_PurchGroup.Items.IndexOf(str); if (index >= 0) { if (!ChkdListBx_PurchGroup.GetItemChecked(index)) { ChkdListBx_PurchGroup.SetItemChecked(index, true); } } } ChkdListBx_PurchGroup.ItemCheck += ckdListBox_ItemCheck; } // IR Supp Name if (Filters.FitlerValues.irSuppName.Count > 0) { ChkdListBx_IRSuppName.ItemCheck -= ckdListBox_ItemCheck; foreach (string str in Filters.FitlerValues.irSuppName) { index = ChkdListBx_IRSuppName.Items.IndexOf(str); if (index >= 0) { if (!ChkdListBx_IRSuppName.GetItemChecked(index)) { ChkdListBx_IRSuppName.SetItemChecked(index, true); } } } ChkdListBx_IRSuppName.ItemCheck += ckdListBox_ItemCheck; } // Fxd Supp Name if (Filters.FitlerValues.fxdSuppName.Count > 0) { ChkdListBx_FxdSuppName.ItemCheck -= ckdListBox_ItemCheck; foreach (string str in Filters.FitlerValues.fxdSuppName) { index = ChkdListBx_FxdSuppName.Items.IndexOf(str); if (index >= 0) { if (!ChkdListBx_FxdSuppName.GetItemChecked(index)) { ChkdListBx_FxdSuppName.SetItemChecked(index, true); } } } ChkdListBx_FxdSuppName.ItemCheck += ckdListBox_ItemCheck; } // Dsrd Supp Name if (Filters.FitlerValues.dsrdSuppName.Count > 0) { ChkdListBx_DsrdSuppName.ItemCheck -= ckdListBox_ItemCheck; foreach (string str in Filters.FitlerValues.dsrdSuppName) { index = ChkdListBx_DsrdSuppName.Items.IndexOf(str); if (index >= 0) { if (!ChkdListBx_DsrdSuppName.GetItemChecked(index)) { ChkdListBx_DsrdSuppName.SetItemChecked(index, true); } } } ChkdListBx_DsrdSuppName.ItemCheck += ckdListBox_ItemCheck; } // Dsrd Supp Name if (Filters.FitlerValues.commCategory.Count > 0) { ChkdListBx_CommodityCat.ItemCheck -= ckdListBox_ItemCheck; foreach (string str in Filters.FitlerValues.commCategory) { index = ChkdListBx_CommodityCat.Items.IndexOf(str); if (index >= 0) { if (!ChkdListBx_CommodityCat.GetItemChecked(index)) { ChkdListBx_CommodityCat.SetItemChecked(index, true); } } } ChkdListBx_CommodityCat.ItemCheck += ckdListBox_ItemCheck; } }