private void LogicalFilterHandling(SPECIAL_OP op) { this.lvEnum.Tag = op; this.lvEnum.Items.Clear(); if (this.lbAttribs.SelectedIndex == ListBox.NoMatches) { this.lbAttribs.SelectedIndex = 0; } string attributename = this.lbAttribs.SelectedItem.ToString(); Dictionary <string, long> lvdata = new Dictionary <string, long>(); Type entype = ForestBase.ADHelperDynamicDLL.GetEnumFromDynamicAssociator(attributename); if (entype != null) { lvdata = EnumToListView(entype); foreach (KeyValuePair <string, long> item in lvdata) { ListViewItem lvitem = new ListViewItem(item.Key); lvitem.Tag = item.Value; this.lvEnum.Items.Add(lvitem); } } if (this.lvEnum.Items.Count > 0) { CmdVisibility(false); this.txtVal.Text = String.Empty; } CurrentFlags = 0; }
private void UpdateFilter(ListBox source, SPECIAL_OP op) { if (source.SelectedIndex == ListBox.NoMatches) { source.SelectedIndex = 0; } string queryvalue = null; string valuename = null; if (source.Name == "lbClasses") { valuename = "objectClass"; queryvalue = source.SelectedItem.ToString(); } else { valuename = source.SelectedItem.ToString(); queryvalue = CheckValueHandling(valuename); if (queryvalue.Length == 0) { queryvalue = "*"; } } string newfilter = String.Empty; switch (op) { case SPECIAL_OP.Equals: newfilter = String.Format(" ({0}={1})", valuename, queryvalue); break; case SPECIAL_OP.Not_Equals: newfilter = String.Format(" ( ! ({0}={1}) )", valuename, queryvalue); break; case SPECIAL_OP.Less_Or_Equals: newfilter = String.Format(" ({0}<={1})", valuename, queryvalue); break; case SPECIAL_OP.Greater_Or_Equals: newfilter = String.Format(" ({0}>={1})", valuename, queryvalue); break; case SPECIAL_OP.Bitwise_And: newfilter = String.Format(" ({0}:{1}:={2})", valuename, MATCHING_RULE_BIT_AND, queryvalue); break; case SPECIAL_OP.Bitwise_Nand: newfilter = String.Format(" ( ! ({0}:{1}:={2}) )", valuename, MATCHING_RULE_BIT_AND, queryvalue); break; case SPECIAL_OP.BitWise_Or: newfilter = String.Format(" ({0}:{1}:={2})", valuename, MATCHING_RULE_BIT_OR, queryvalue); break; case SPECIAL_OP.BitWise_Nor: newfilter = String.Format(" ( ! ({0}:{1}:={2}) )", valuename, MATCHING_RULE_BIT_OR, queryvalue); break; case SPECIAL_OP.MatchInChain: newfilter = String.Format(" ({0}:{1}:={2})", valuename, MATCHING_RULE_IN_CHAIN, queryvalue); break; } if (newfilter.Length != 0) { if ((this.txtFilter.Text.Length != 0) && (GroupsCount == 0)) { NewFilterGroup("&", true); } AddedFilters.Add(new FilterBlock(newfilter, FILTER_GROUPS.NONE)); SetFilterText(); } this.cmdUnDo.Enabled = (AddedFilters.Count > 0); }