/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnFilterEdit_Click(object sender, EventArgs e) { if (listFilters.SelectedObjects.Count == 0) { return; } Filter filter = (Filter)listFilters.SelectedObjects[0]; using (FormFilter formFilter = new FormFilter(_sql, _filters)) { formFilter.Filter = filter; if (formFilter.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel) { return; } filter.Definition = formFilter.Filter.Definition; filter.Condition = formFilter.Filter.Condition; filter.Value = formFilter.Filter.Value; LoadFilters(); LoadSearch(1); SetFilterButtonStatus(true); } }
/// <summary> /// 工具栏-过滤器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btiFilter_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeNode curNode = trvDatabase.SelectedNode; List <IDataTable> lstSource = curNode.Tag as List <IDataTable>; FormFilter frmFilter = FormFilter.GetInstance(curNode); DialogResult result = frmFilter.ShowDialog(); if (result == DialogResult.OK) { List <IDataTable> lstTables = frmFilter.GetFilterResult(lstSource); LoadTableOrViewNodes(curNode, lstTables); } else if (result == DialogResult.Ignore) //--代表清除过滤条件 { LoadTableOrViewNodes(curNode, lstSource); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnFilterAdd_Click(object sender, EventArgs e) { using (FormFilter formFilter = new FormFilter(_sql, _filters)) { using (new HourGlass(this)) using (NPoco.Database db = new NPoco.Database(Db.GetOpenMySqlConnection())) { formFilter.LoadClassifications(db); } if (formFilter.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel) { return; } _filters.Add(formFilter.Filter); LoadFilters(); LoadSearch(1); SetFilterButtonStatus(true); } }