public void IniCreateFilterElements() { if (_ClientRuleObject != null) { SimpleDataFilterControlAttribute ctlAtt = MB.WinBase.Atts.AttributeConfigHelper.Instance.GetSimpleDataFilterControl(_ClientRuleObject.GetType()); if (ctlAtt != null) { _SimpleFilterControl = ctlAtt.FormControlType.Assembly.CreateInstance(ctlAtt.FormControlType.FullName, true) as Control; } if (_SimpleFilterControl == null) { _SimpleFilterEdit = new ucFilterCondition(_ViewGridForm, _ClientRuleObject, _DataFilterElementsName); _SimpleFilterControl = _SimpleFilterEdit; } _FilterConditionCtl = _SimpleFilterControl as IFilterConditionCtl; if (_FilterConditionCtl == null) { throw new MB.Util.APPException(string.Format("条件过滤窗口 {0} 未继承接口 IFilterConditionCtl ,请检查!", ctlAtt.FormControlType.FullName), APPMessageType.DisplayToUser); } panQuickFilter.Controls.Add(_SimpleFilterControl); _SimpleFilterControl.Dock = DockStyle.Fill; //panFilterTop.Height = 2; //panFilterTop.BorderStyle = BorderStyle.FixedSingle; // panBottom.BackColor = _SimpleFilterEdit.AllowEmptyFilter ? System.Drawing.Color.FromArgb(212, 228, 248) : Color.White; if (_FilterConditionCtl.AllowEmptyFilter) { _ToolTip.SetToolTip(panBottom, "查询绿色通道,允许查询所有数据"); } } }
public void IniCreateFilterElements() { if (_ClientRule != null) { _SimpleFilterEdit = new ucFilterCondition(_ClientRule, _FilterCfgName); panQuickFilter.Controls.Add(_SimpleFilterEdit); _SimpleFilterEdit.Dock = DockStyle.Fill; } }
private void queryFilterData() { try { ucFilterCondition filterCtl = _StepShowControlPane[PaneViewType.FilterPane] as ucFilterCondition; MB.Util.Model.QueryParameterInfo[] filters = filterCtl.GetQueryParameters(); List <QueryParameterInfo> tempFilters = new List <QueryParameterInfo>(filters); //判断如果是自定义的条件,在查询的时候,需要再加上这个条件 if (_FilterParametersIfNoFiterPanel != null && _FilterParametersIfNoFiterPanel.Count > 0) { tempFilters.AddRange(_FilterParametersIfNoFiterPanel); filters = tempFilters.ToArray(); } if (filters == null || filters.Length == 0) { if (!filterCtl.AllowEmptyFilter) { MB.WinBase.MessageBoxEx.Show("请至少输入一个数据过滤的条件!"); return; } else { MB.Util.Model.QueryParameterInfo allFilter = new MB.Util.Model.QueryParameterInfo("0", "0", MB.Util.DataFilterConditions.Special); filters = new MB.Util.Model.QueryParameterInfo[] { allFilter }; } } //modify by aifang 2012-04-17 支持树型控件数据助手选择 //ucDataCheckListView listView = _StepShowControlPane[PaneViewType.DataSelect] as ucDataCheckListView; IDataAssistantListControl listView = _StepShowControlPane[PaneViewType.DataSelect] as IDataAssistantListControl; //modify by aifang 2012-04-17 支持树型控件数据助手选择 listView.MultiSelect = _MultiSelect; listView.ColumnEditCfgInfo = _ClumnEditCfgInfo; lnkChecked.Visible = _MultiSelect; using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) { int mainType = 0; if (_ClientRule.MainDataTypeInDoc != null) { mainType = (int)_ClientRule.MainDataTypeInDoc; } //获得动态列的MessageKey string messageHeaderKey = string.Empty; if (_ClientRule.ClientLayoutAttribute.LoadType == ClientDataLoadType.ReLoad) { messageHeaderKey = _ClientRule.ClientLayoutAttribute.MessageHeaderKey; } //添加动态列消息头 MB.XWinLib.XtraGrid.XtraGridDynamicHelper.Instance.AppendQueryBehaviorColumns(_ClientRule); using (QueryBehaviorScope scope = new QueryBehaviorScope(_ClientRule.CurrentQueryBehavior, messageHeaderKey)) { var lstDatas = this.GetFilterObjects(mainType, new List <MB.Util.Model.QueryParameterInfo>(filters)); if (lstDatas != null && lstDatas.Count > 0) { listView.SetDataSource(_ClientRule, lstDatas); _StepShowControlPane[PaneViewType.DataSelect].BringToFront(); validateButton(PaneViewType.DataSelect); validatedPageControl((lstDatas as IList).Count); } else { MB.WinBase.MessageBoxEx.Show("根据该条件查找不到数据,请重试!"); } } } } catch (Exception ex) { MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex); } }
void FrmGetObjectDataAssistant_Load(object sender, EventArgs e) { if (MB.Util.General.IsInDesignMode()) { return; } if (_ClientRule == null) { string[] tps = this.InvokeDataSourceDesc.Type.Split(','); if (string.IsNullOrEmpty(this.InvokeDataSourceDesc.TypeConstructParams)) { _ClientRule = MB.Util.DllFactory.Instance.LoadObject(tps[0], tps[1]) as MB.WinBase.IFace.IClientRuleQueryBase; } else { var conPars = this.InvokeDataSourceDesc.TypeConstructParams.Split(','); _ClientRule = MB.Util.DllFactory.Instance.LoadObject(tps[0], conPars, tps[1]) as MB.WinBase.IFace.IClientRuleQueryBase; } } if (_ClientRule == null) { throw new MB.Util.APPException("没有得到客户端业务控制类!", MB.Util.APPMessageType.SysErrInfo); } //增加分页 add by aifang 2012-07-26 begin MB.WinBase.AppMessenger.DefaultMessenger.Subscribe <string>(QUERY_REFRESH_MSG_ID, o => { labTitleMsg.Text = o; }); if (_QueryObject == null && pnlQry.Visible) { lnkNextPage.Click += new EventHandler(lnkNextPage_Click); lnkPreviousPage.Click += new EventHandler(lnkPreviousPage_Click); lnkPreviousPage.Enabled = false; lnkNextPage.Enabled = false; } //增加分页 add by aifang 2012-07-26 end if (_StepShowControlPane == null) { _StepShowControlPane = new Dictionary <PaneViewType, Control>(); _StepShowControlPane.Add(PaneViewType.FilterPane, CreateFilterControl(_ClientRule, ClumnEditCfgInfo.FilterCfgName)); ITreeListViewHoster treeViewRule = _ClientRule as ITreeListViewHoster; if (treeViewRule == null) { _ListView = new ucDataCheckListView(); } else { _ListView = new ucDataTreeListView(); } _ListView.AfterSelectData += new GetObjectDataAssistantEventHandle(listView_AfterSelectData); _StepShowControlPane.Add(PaneViewType.DataSelect, _ListView as Control); foreach (Control ctl in _StepShowControlPane.Values) { ctl.Dock = DockStyle.Fill; panMain.Controls.Add(ctl); } } if (_HideFilterPane) { _StepShowControlPane[PaneViewType.DataSelect].BringToFront(); _ListView.MultiSelect = _MultiSelect; _ListView.ColumnEditCfgInfo = _ClumnEditCfgInfo; lnkChecked.Visible = _MultiSelect; try { //获得动态列的MessageKey string messageHeaderKey = string.Empty; if (_ClientRule.ClientLayoutAttribute.LoadType == ClientDataLoadType.ReLoad) { messageHeaderKey = _ClientRule.ClientLayoutAttribute.MessageHeaderKey; } //添加动态列消息头 MB.XWinLib.XtraGrid.XtraGridDynamicHelper.Instance.AppendQueryBehaviorColumns(_ClientRule); //增加分页信息 if (_MAX_SHOW_ROWS <= 0) { _MAX_SHOW_ROWS = MB.Util.MyConvert.Instance.ToInt(nubMaxShotCount.Value); } _ClientRule.CurrentQueryBehavior.PageSize = _MAX_SHOW_ROWS; _ClientRule.CurrentQueryBehavior.PageIndex = 0; using (QueryBehaviorScope scope = new QueryBehaviorScope(_ClientRule.CurrentQueryBehavior, messageHeaderKey)) { List <MB.Util.Model.QueryParameterInfo> filterParas; if (_FilterParametersIfNoFiterPanel != null) { filterParas = _FilterParametersIfNoFiterPanel; } else { filterParas = new List <MB.Util.Model.QueryParameterInfo>(); } var lstDatas = this.GetFilterObjects(0, filterParas); _ListView.SetDataSource(_ClientRule, lstDatas); validateButton(PaneViewType.DataSelect); butNext.Enabled = false; butPreviouss.Enabled = false; validatedPageControl((lstDatas as IList).Count); } } catch (Exception ex) { MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex); } } else { _StepShowControlPane[PaneViewType.FilterPane].BringToFront(); validateButton(PaneViewType.FilterPane); } ucFilterCondition filterCtl = _StepShowControlPane[PaneViewType.FilterPane] as ucFilterCondition; if (filterCtl != null) { //panBottom.BackColor = filterCtl.AllowEmptyFilter ? System.Drawing.Color.FromArgb(212, 228, 248) : Color.White; if (filterCtl.AllowEmptyFilter) { _ToolTip.SetToolTip(panBottom, "查询绿色通道,允许查询所有数据"); } } }