/// <summary> /// This timer will begin when the data has been imported or loaded. This event will check certain conditions /// and call functions that will load the unique data. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FiltersTimer_Tick(object sender, EventArgs e) { if (!FilterUtils.FilterLoadProcessStarted) { FilterUtils.FilterLoadProcessStarted = true; Thread filtersThread = new Thread(() => { FilterUtils.LoadFilters(filters); }); filtersThread.Start(); } if (FilterUtils.FiltersLoaded) { pnl_loadingScreen.Visible = false; FilterUtils.FiltersLoaded = false; FiltersTimer.Stop(); tblpnl_DashbaordPage.BringToFront(); NavigationLocked = false; } }
/// <summary> /// When a check box is check this event will fire. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ckdListBox_ItemCheck(object sender, ItemCheckEventArgs e) { CheckedListBox clb = (CheckedListBox)sender; int tag = int.Parse(clb.Tag.ToString()); switch (tag) { case 0: break; case 1: break; case 2: // Material if (e.NewValue == CheckState.Checked) { Filters.FitlerValues.material.Add(clb.Items[e.Index].ToString()); AddFilterSnapShot(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.Material); } else { Filters.FitlerValues.material.Remove(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.Material); RevertFilterData(clb.Items[e.Index].ToString()); } UpdateCheckedItems(); break; case 3: // Material Group if (e.NewValue == CheckState.Checked) { Filters.FitlerValues.materialGroup.Add(clb.Items[e.Index].ToString()); AddFilterSnapShot(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.MaterialGroup); } else { Filters.FitlerValues.materialGroup.Remove(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.MaterialGroup); RevertFilterData(clb.Items[e.Index].ToString()); } UpdateCheckedItems(); break; case 4: // Vendor if (e.NewValue == CheckState.Checked) { Filters.FitlerValues.vendor.Add(clb.Items[e.Index].ToString()); AddFilterSnapShot(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.Vendor); } else { Filters.FitlerValues.vendor.Remove(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.Vendor); RevertFilterData(clb.Items[e.Index].ToString()); } UpdateCheckedItems(); break; case 5: // Vendor Desc if (e.NewValue == CheckState.Checked) { Filters.FitlerValues.vendorDesc.Add(clb.Items[e.Index].ToString()); AddFilterSnapShot(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.VendorDescription); } else { Filters.FitlerValues.vendorDesc.Remove(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.VendorDescription); RevertFilterData(clb.Items[e.Index].ToString()); } UpdateCheckedItems(); break; case 6: // Purch Group if (e.NewValue == CheckState.Checked) { Filters.FitlerValues.purchGroup.Add(clb.Items[e.Index].ToString()); AddFilterSnapShot(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.PurchGroup); } else { Filters.FitlerValues.purchGroup.Remove(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.PurchGroup); RevertFilterData(clb.Items[e.Index].ToString()); } UpdateCheckedItems(); break; case 7: // IR Supp Name if (e.NewValue == CheckState.Checked) { Filters.FitlerValues.irSuppName.Add(clb.Items[e.Index].ToString()); AddFilterSnapShot(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.IRSuppName); } else { Filters.FitlerValues.irSuppName.Remove(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.IRSuppName); RevertFilterData(clb.Items[e.Index].ToString()); } UpdateCheckedItems(); break; case 8: // Fxd Supp Name if (e.NewValue == CheckState.Checked) { Filters.FitlerValues.fxdSuppName.Add(clb.Items[e.Index].ToString()); AddFilterSnapShot(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.FxdSuppName); } else { Filters.FitlerValues.fxdSuppName.Remove(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.FxdSuppName); RevertFilterData(clb.Items[e.Index].ToString()); } UpdateCheckedItems(); break; case 9: // Dsrd Supp Name if (e.NewValue == CheckState.Checked) { Filters.FitlerValues.dsrdSuppName.Add(clb.Items[e.Index].ToString()); AddFilterSnapShot(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.DsrdSuppName); } else { Filters.FitlerValues.dsrdSuppName.Remove(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.DsrdSuppName); RevertFilterData(clb.Items[e.Index].ToString()); } UpdateCheckedItems(); break; case 10: // Commodity Category if (e.NewValue == CheckState.Checked) { Filters.FitlerValues.commCategory.Add(clb.Items[e.Index].ToString()); AddFilterSnapShot(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.CommCat); } else { Filters.FitlerValues.commCategory.Remove(clb.Items[e.Index].ToString()); BuildQueryFilters(); FilterUtils.LoadFilters(filters, FilterUtils.Filters.CommCat); RevertFilterData(clb.Items[e.Index].ToString()); } UpdateCheckedItems(); break; } }
/// <summary> /// Any filters that are checked will be unchecked and the filters check lists /// will be set back to the normal state. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_clearSelected_Click(object sender, EventArgs e) { foreach (int i in ChkdListBx_Material.CheckedIndices) { ChkdListBx_Material.ItemCheck -= ckdListBox_ItemCheck; ChkdListBx_Material.SetItemCheckState(i, CheckState.Unchecked); ChkdListBx_Material.ItemCheck += ckdListBox_ItemCheck; } foreach (int i in ChkdListBx_MaterialGroup.CheckedIndices) { ChkdListBx_MaterialGroup.ItemCheck -= ckdListBox_ItemCheck; ChkdListBx_MaterialGroup.SetItemCheckState(i, CheckState.Unchecked); ChkdListBx_MaterialGroup.ItemCheck += ckdListBox_ItemCheck; } foreach (int i in ChkdListBx_Vendor.CheckedIndices) { ChkdListBx_Vendor.ItemCheck -= ckdListBox_ItemCheck; ChkdListBx_Vendor.SetItemCheckState(i, CheckState.Unchecked); ChkdListBx_Vendor.ItemCheck += ckdListBox_ItemCheck; } foreach (int i in ChkdListBx_VendorDesc.CheckedIndices) { ChkdListBx_VendorDesc.ItemCheck -= ckdListBox_ItemCheck; ChkdListBx_VendorDesc.SetItemCheckState(i, CheckState.Unchecked); ChkdListBx_VendorDesc.ItemCheck += ckdListBox_ItemCheck; } foreach (int i in ChkdListBx_PurchGroup.CheckedIndices) { ChkdListBx_PurchGroup.ItemCheck -= ckdListBox_ItemCheck; ChkdListBx_PurchGroup.SetItemCheckState(i, CheckState.Unchecked); ChkdListBx_PurchGroup.ItemCheck += ckdListBox_ItemCheck; } foreach (int i in ChkdListBx_IRSuppName.CheckedIndices) { ChkdListBx_IRSuppName.ItemCheck -= ckdListBox_ItemCheck; ChkdListBx_IRSuppName.SetItemCheckState(i, CheckState.Unchecked); ChkdListBx_IRSuppName.ItemCheck += ckdListBox_ItemCheck; } foreach (int i in ChkdListBx_FxdSuppName.CheckedIndices) { ChkdListBx_FxdSuppName.ItemCheck -= ckdListBox_ItemCheck; ChkdListBx_FxdSuppName.SetItemCheckState(i, CheckState.Unchecked); ChkdListBx_FxdSuppName.ItemCheck += ckdListBox_ItemCheck; } foreach (int i in ChkdListBx_DsrdSuppName.CheckedIndices) { ChkdListBx_DsrdSuppName.ItemCheck -= ckdListBox_ItemCheck; ChkdListBx_DsrdSuppName.SetItemCheckState(i, CheckState.Unchecked); ChkdListBx_DsrdSuppName.ItemCheck += ckdListBox_ItemCheck; } foreach (int i in ChkdListBx_CommodityCat.CheckedIndices) { ChkdListBx_CommodityCat.ItemCheck -= ckdListBox_ItemCheck; ChkdListBx_CommodityCat.SetItemCheckState(i, CheckState.Unchecked); ChkdListBx_CommodityCat.ItemCheck += ckdListBox_ItemCheck; } Filters.FitlerValues.Clear(); Filters.ClbDictionaryValues.Clear(); filters = string.Empty; FilterUtils.LoadFilters(filters); }