private void FilterTree_MouseDown(object sender, MouseEventArgs e) { TreeNode tn = FilterTree.GetNodeAt(e.X, e.Y); if (tn == null) { empty_selection_in_FilterBox(); } if (e.Button == MouseButtons.Left) { FilterTree.SelectedNode = tn; } else { if (tn != null) { FilterTreeMenu.Items["upToolStripMenuItem"].Enabled = true; FilterTreeMenu.Items["downToolStripMenuItem"].Enabled = true; FilterTreeMenu.Items["insertToolStripMenuItem"].Enabled = true; FilterTreeMenu.Items["deleteToolStripMenuItem"].Enabled = true; FilterTreeMenu.Items["deleteBranchToolStripMenuItem"].Enabled = true; FilterTree.SelectedNode = tn; } else { FilterTreeMenu.Items["upToolStripMenuItem"].Enabled = false; FilterTreeMenu.Items["downToolStripMenuItem"].Enabled = false; FilterTreeMenu.Items["insertToolStripMenuItem"].Enabled = false; FilterTreeMenu.Items["deleteToolStripMenuItem"].Enabled = false; FilterTreeMenu.Items["deleteBranchToolStripMenuItem"].Enabled = false; } } }
//生产单位 private Control CreateProducUnitPart() { proudceUnitFilterTree = new FilterTree(); proudceUnitFilterTree.HorizontalRepeatColumns = 10; this.Load += delegate { if (!IsPostBack) { var rootNode = proudceUnitFilterTree.DataSource; var packModeInfo = GetProduceUnitInfo(); foreach (var item in packModeInfo) { proudceUnitFilterTree.DataSource.Childs.Add(new FilterTreeNode(item.Item2, item.Item1.ToString())); } } }; mTreeContainer.Add("produceUnit", proudceUnitFilterTree); proudceUnitFilterTree.FilterAction = (query, node) => { if (!string.IsNullOrEmpty(node.Value)) { var packMode = long.Parse(node.Value); query.Where.Conditions.Add(DQCondition.EQ(main, "ProductionUnit_ID", packMode)); } }; return(proudceUnitFilterTree); }
//班组 private Control CreateShiftPart() { shiftFilterTree = new FilterTree(); shiftFilterTree.HorizontalRepeatColumns = 10; this.Load += delegate { if (!IsPostBack) { var rootNode = shiftFilterTree.DataSource; var shiftInfo = GetShiftInfo(); foreach (var item in shiftInfo) { shiftFilterTree.DataSource.Childs.Add(new FilterTreeNode(item.Item2, item.Item1.ToString())); } } }; mTreeContainer.Add("shift", shiftFilterTree); shiftFilterTree.FilterAction = (query, node) => { if (!string.IsNullOrEmpty(node.Value)) { var shiftID = long.Parse(node.Value); query.Where.Conditions.Add(DQCondition.EQ("Goods_ProductShift_ID", shiftID)); } }; return(shiftFilterTree); }
private void PropertyBoxUpdated(object sender, DataTransferEventArgs e) { DropDownBox src = e.Source as DropDownBox; if (src == null) { return; } FilterTree tree = src.DataContext as FilterTree; if (tree == null) { return; } string oldProperty = src.SelectedValue as string; if (oldProperty == null) { return; } string newProperty = tree.GetChild(0).GetChild(0).Text; if (oldProperty != newProperty && newProperty != null) { UpdateExpression(tree, oldProperty, newProperty); } }
public void AddString(string str, int idx = 0) { char c = '|'; if (idx >= str.Length) { if (!Childs.ContainsKey(c)) { Childs.Add(c, null); } return; } c = str[idx]; FilterTree child = null; if (!Childs.ContainsKey(c)) { child = new FilterTree(); Childs.Add(c, child); } else { child = Childs[c]; } child.AddString(str, ++idx); }
//班组 private Control CreateAccPart() { accFilterTree = new FilterTree(); accFilterTree.HorizontalRepeatColumns = 10; this.Load += delegate { if (!IsPostBack) { var rootNode = accFilterTree.DataSource; var shiftInfo = GetAccInfo(); foreach (var item in shiftInfo) { accFilterTree.DataSource.Childs.Add(new FilterTreeNode(item.Item2, item.Item1.ToString())); } } }; mTreeContainer.Add(mAccName, accFilterTree); accFilterTree.FilterAction = (query, node) => { if (!string.IsNullOrEmpty(node.Value)) { var shiftID = long.Parse(node.Value); query.Where.Conditions.Add(DQCondition.EQ(main, "AccountingUnit_ID", shiftID)); } }; return(accFilterTree); }
/// <inheritdoc /> public override IFilterTree BuildFilterTree() { var attributeName = FilterHelper.GetAttributeName(_Attribute); var operatorTokenType = FilterHelper.GetOperatorTokenType(_Operation); var valueTree = FilterTree.MakeValue(_Value); return(FilterHelper.MakeComparison(operatorTokenType, attributeName, valueTree)); }
private void TxtSearchQuery_TextChanged(object sender, EventArgs e) { if (txtSearchQuery.Text == SharedConstants.SearchText) { return; } FilterTree?.Invoke(this, new FilterTreeEventArgs(txtSearchQuery.Text)); treeBookmarks.Invalidate(); }
protected void DeleteNode(SQLTree tree) { FilterTree parent = tree.Parent as FilterTree; if (parent != null) { parent.DeleteChild(tree.ChildIndex); parent.MarkAsDirty(); } }
public override IFilterTree BuildFilterTree() { var attributeName = FilterHelper.GetAttributeName(_Attribute); var operatorTokenType = TokenType.Like; var valueTree = _Value == null ? FilterTree.MakeNull() : FilterTree.MakeValue(_Value); return(FilterHelper.MakeComparison(operatorTokenType, attributeName, valueTree)); }
/// <exception cref="ArgumentNullException"><paramref name="attrName"/> is <see langword="null" />.</exception> internal static IFilterTree MakeComparison(TokenType operationToken, [NotNull] string attrName, IFilterTree valueTree) { if (attrName == null) { throw new ArgumentNullException(nameof(attrName)); } var attrItem = FilterTree.MakeAttr(attrName); return(new FilterTree(new Token(operationToken), new[] { attrItem, valueTree })); }
// HACK ALERT: We exploit the point when value in datacontext have been changed but UI did not update yet private void StringOperatorUpdated(object sender, DataTransferEventArgs e) { DropDownBox src = e.Source as DropDownBox; if (src == null) { return; } FilterTree tree = src.DataContext as FilterTree; if (tree == null) { return; } int newType = tree.Children[0].Type; int oldType = StringExprTypePicker.ConvertBack(src.SelectedIndex); if (newType != StringPatternLexer.COMPLEX && oldType == StringPatternLexer.COMPLEX) { StringTree constTree = tree.Children[0].GetChild(1) as StringTree; if (constTree != null) { constTree.Text = Filter.Escape(constTree.Text); MarkNodeAsUpdated(constTree); } } else if (newType == StringPatternLexer.COMPLEX && oldType != StringPatternLexer.COMPLEX) { StringTree constTree = tree.Children[0].GetChild(1) as StringTree; if (constTree != null) { switch (oldType) { case StringPatternLexer.IS: constTree.Text = "%" + constTree.Text + "%"; break; case StringPatternLexer.BEGINS: constTree.Text = constTree.Text + "%"; break; case StringPatternLexer.ENDS: constTree.Text = "%" + constTree.Text; break; } } MarkNodeAsUpdated(constTree); } MarkNodeAsUpdated((FilterTree)tree.Children[0]); }
public override IFilterTree BuildFilterTree() { string valueString = null; if (_Value.HasValue) { valueString = XmlConvert.ToString(_Value.Value, XmlDateTimeSerializationMode.RoundtripKind); } var attributeName = FilterHelper.GetAttributeName(_Attribute); var operatorTokenType = FilterHelper.GetOperatorTokenType(_Operation); var valueTree = FilterTree.MakeValue(valueString); return(FilterHelper.MakeComparison(operatorTokenType, attributeName, valueTree)); }
private void ValueUpdated(object sender, DataTransferEventArgs e) { FrameworkElement src = e.Source as FrameworkElement; if (src == null) { return; } FilterTree tree = src.DataContext as FilterTree; if (tree == null) { return; } MarkNodeAsUpdated((FilterTree)tree.Children[0].GetChild(1)); }
private void NodeUpdated(object sender, DataTransferEventArgs e) { FrameworkElement src = e.Source as FrameworkElement; if (src == null) { return; } FilterTree tree = src.DataContext as FilterTree; if (tree == null) { return; } MarkNodeAsUpdated(tree); }
public bool Init(DataTable table) { if (mFilterTree == null) { mFilterTree = new FilterTree(); } IDictionaryEnumerator itr = table.GetEnumerator(); while (itr.MoveNext()) { StrFilterTableItem item = itr.Value as StrFilterTableItem; mFilterTree.AddString(item.str); } // foreach( DictionaryEntry v in table ) // { // StrFilterTableItem item = v.Value as StrFilterTableItem; // mFilterTree.AddString(item.str); // } return(true); }
/// <inheritdoc /> public override IFilterTree BuildFilterTree() { var valuesStrings = new List <string>(); foreach (var dateTime in _Values) { string valueString = null; if (dateTime.HasValue) { valueString = XmlConvert.ToString(dateTime.Value, XmlDateTimeSerializationMode.RoundtripKind); } valuesStrings.Add(valueString); } var attributeName = FilterHelper.GetAttributeName(_Attribute); var operatorTokenType = FilterHelper.GetOperatorTokenType(_Operation); var valueTree = FilterTree.MakeValueList(valuesStrings.ToArray()); return(FilterHelper.MakeComparison(operatorTokenType, attributeName, valueTree)); }
protected void UpdateExpression(FilterTree expressionTree, string oldProp, string newProp) { int newPropertyType = PropertiesMap[newProp].Item1; if (newPropertyType != SQLFilterLexer.ENUM_EXPR && newPropertyType == expressionTree.Type) { return; } switch (newPropertyType) { case SQLFilterLexer.NUM_EXPR: Filter.ToNumExpr(expressionTree); return; case SQLFilterLexer.STRING_EXPR: Filter.ToStringExpr(expressionTree); return; case SQLFilterLexer.ENUM_EXPR: Type ofT = typeof(T); var newPropType = ofT.GetProperty(newProp, BindingFlags.Public | BindingFlags.Instance).PropertyType; if (newPropType != ofT.GetProperty(oldProp, BindingFlags.Public | BindingFlags.Instance).PropertyType) { Filter.ToEnumExpr(expressionTree, newPropType); } return; case SQLFilterLexer.IP_EXPR: Filter.ToIPExpr(expressionTree); return; case SQLFilterLexer.BOOL_EXPR: Filter.ToBoolExpr(expressionTree); return; } return; }
private void DeleteCanExecute(object sender, CanExecuteRoutedEventArgs e) { FilterTree tree = e.Parameter as FilterTree; e.CanExecute = (tree != null && tree.Parent != null); }
//包装模式 private Control CreatePackModePart() { packModeFilterTree = new FilterTree(); packModeFilterTree.HorizontalRepeatColumns = 10; this.Load += delegate { if (!IsPostBack) { var rootNode = packModeFilterTree.DataSource; var packModeInfo = GetPackModeInfo(); foreach (var item in packModeInfo) { packModeFilterTree.DataSource.Childs.Add(new FilterTreeNode(item.Value, item.Key.ToString())); } } }; mTreeContainer.Add("packMode", packModeFilterTree); packModeFilterTree.FilterAction = (query, node) => { if (!string.IsNullOrEmpty(node.Value)) { var packMode = long.Parse(node.Value); query.Where.Conditions.Add(DQCondition.EQ("Goods_PackageModel", packMode)); } }; mTreeContainer.Select += delegate { var shift = ""; var packModel = ""; var beginDate = ""; var endDate = ""; if (shiftFilterTree != null) { var shiftNode = shiftFilterTree.GetSelecteItem(); shift = shiftNode.Value; } if (packModeFilterTree != null) { var packNode = packModeFilterTree.GetSelecteItem(); packModel = packNode.Value; } if (dateInput.Value != null) { beginDate = dateInput.Value.ToString(); } if (enddateInput.Value != null) { endDate = enddateInput.Value.ToString(); } var printUrl = string.Format("PackingMaterialReportPrint.aspx?Shift={0}&PackMode={1}&BeginDate={2}&EndDate={3}", shift, packModel, beginDate, endDate); Page.ClientScript.RegisterStartupScript(this.GetType(), "__printUrl", string.Format("window.__printUrl='{0}';", printUrl), true); var query = GetQueryDom(); mTreeContainer.AddConditions(query); var args = new LoadArguments(query); foreach (var item in detailSumIndex) { args.SumColumns.Add(item); } foreach (var item in detailGroupSumIndex) { args.GroupSumColumns.Add(item); } detailGrid.LoadArguments = args; detailGrid.DataBind(); }; return(packModeFilterTree); }
/// <inheritdoc /> public override IFilterTree BuildFilterTree() { var subTree = _ChildCondition.BuildFilterTree(); return(FilterTree.MakeNot(subTree)); }
void ShowMatchingRecordValues(List <LogRow> Records) { if (ConfigurePanel.InvokeRequired) { ShowMatchingRecordValues_d CALL_d = new ShowMatchingRecordValues_d(ShowMatchingRecordValues); ConfigurePanel.Invoke(CALL_d, new object[] { Records }); } else { FilterTree.Nodes.Clear(); FilterTree.Nodes.Add("Methods").Checked = true; FilterTree.Nodes.Add("File Extensions").Checked = true; FilterTree.Nodes.Add("Urls").Checked = true; CandidatesGrid.Rows.Clear(); foreach (LogRow LR in Records) { if (!FilterTree.Nodes[0].Nodes.ContainsKey(LR.Method)) { FilterTree.Nodes[0].Nodes.Add(LR.Method, LR.Method).Checked = true; } string File = LR.File; if (File.Trim().Length == 0) { File = " - NO EXTENSION - "; } if (!FilterTree.Nodes[1].Nodes.ContainsKey(File)) { FilterTree.Nodes[1].Nodes.Add(File, File).Checked = true; } if (!FilterTree.Nodes[2].Nodes.ContainsKey(LR.Host)) { FilterTree.Nodes[2].Nodes.Add(LR.Host, LR.Host).Checked = true; } TreeNode HostNode = FilterTree.Nodes[2].Nodes[LR.Host]; if (!HostNode.Nodes.ContainsKey("/")) { HostNode.Nodes.Add("/", "/").Checked = true; } Request Req = new Request(string.Format("http://{0}{1}", LR.Host, LR.Url)); for (int i = 0; i < Req.UrlPathParts.Count; i++) { string Path = Req.UrlPathParts[i]; string FullPath = ""; if (Req.UrlPathParts.Count > 0) { StringBuilder SB = new StringBuilder(); for (int j = 0; j <= i; j++) { SB.Append("/"); SB.Append(Req.UrlPathParts[j]); } FullPath = SB.ToString(); } else { FullPath = "/"; } if (!HostNode.Nodes.ContainsKey(FullPath)) { HostNode.Nodes.Add(FullPath, Path).Checked = true; if (!HostNode.Checked) { HostNode.Checked = true; } } HostNode = HostNode.Nodes[FullPath]; } } //Adding the rows after the tree population since every check on the tree node would trigger a filter application on the grids foreach (LogRow LR in Records) { object[] Fields = LR.ToLogAnalyzerGridRowObjectArray(); Fields[0] = true; CandidatesGrid.Rows.Add(Fields); } FilterTree.ExpandAll(); CandidatesStepProgressBar.Visible = false; CandidatesBaseSplit.Visible = true; TestCandidatesBtn.Visible = true; } }
protected void MarkNodeAsUpdated(FilterTree tree) { tree.MarkAsDirty(); }
public override IFilterTree BuildFilterTree() { var subTrees = _ChildConditions.Select(condition => condition.BuildFilterTree()); return(FilterTree.MakeAnd(subTrees.ToArray())); }
//存货类别 private Control CreatGoodsCategoryPart() { goodsCategoryFilterTree = new FilterTree(); goodsCategoryFilterTree.HorizontalRepeatColumns = 10; this.Load += delegate { if (!IsPostBack) { var rootNode = goodsCategoryFilterTree.DataSource; var packModeInfo = GetGoodsCategoryInfo(); foreach (var item in packModeInfo) { goodsCategoryFilterTree.DataSource.Childs.Add(new FilterTreeNode(item.Item2, item.Item1.ToString())); } } }; mTreeContainer.Add("goodsCategory", goodsCategoryFilterTree); goodsCategoryFilterTree.FilterAction = (query, node) => { if (!string.IsNullOrEmpty(node.Value)) { var packMode = long.Parse(node.Value); query.Where.Conditions.Add(DQCondition.EQ(main, "GoodsCategory_ID", packMode)); } }; mTreeContainer.Select += delegate { //当选中的是 会计单位的时候 if (mTreeContainer.SelectName == mAccName) { var rootNode = proudceUnitFilterTree.DataSource; var packModeInfo = GetProduceUnitInfo(); proudceUnitFilterTree.DataSource.Childs.Clear(); foreach (var item in packModeInfo) { proudceUnitFilterTree.DataSource.Childs.Add(new FilterTreeNode(item.Item2, item.Item1.ToString())); } proudceUnitFilterTree.DataBind(); } var query = GetQueryDom(); mTreeContainer.AddConditions(query); var args = new LoadArguments(query); foreach (var item in detailSumIndex) { args.SumColumns.Add(item); } foreach (var item in detailGroupSumIndex) { args.GroupSumColumns.Add(item); } detailGrid.LoadArguments = args; detailGrid.DataBind(); }; return(goodsCategoryFilterTree); }