Example #1
0
        private void FrmQueryFilterInput_Load(object sender, EventArgs e)
        {
            if (!_IsPageSettingPanelVisiable)
            {
                mpanFilterTop.Visible = false;
            }

            //add by aifang
            if (string.IsNullOrEmpty(_DataFilterElementsName))
            {
                _DataFilterElementsName = DATA_FILTER_MAIN_CFG_NAME;
            }
            _DataElementCfgs = MB.WinBase.LayoutXmlConfigHelper.Instance.GetDataFilterCfgElements(_ClientRuleObject.ClientLayoutAttribute.UIXmlConfigFile, _DataFilterElementsName);
            if (_DataElementCfgs == null || _DataElementCfgs.Count == 0)
            {
                throw new MB.Util.APPException("该对象在对应的XML配置文件中没有配置查询项!", MB.Util.APPMessageType.DisplayToUser);
            }

            _Columns = _ClientRuleObject.UIRuleXmlConfigInfo.GetDefaultColumns();

            #region 设置过滤框的长度与宽度
            if (_DataElementCfgs.Width > 0)
            {
                this.Width = _DataElementCfgs.Width;
            }
            if (_DataElementCfgs.Height > 0)
            {
                this.Height = _DataElementCfgs.Height;
            }
            #endregion

            //增加判断,如果主窗口中的不是GridView,则不加载高级查询
            var gridControl = _ViewGridForm.GetCurrentMainGridView(true) as DevExpress.XtraGrid.GridControl;
            if (gridControl != null)
            {
                tPageAdvanceFilter.PageVisible = true;
                showAdvanceFilter();
            }
            else
            {
                tPageAdvanceFilter.PageVisible = false;
            }

            //判断大数据查询是否被激活
            IViewGridFormWithGreatData viewWithGreatData = _ViewGridForm as IViewGridFormWithGreatData;
            this.cbQueryAll.Visible = (viewWithGreatData != null && _DataElementCfgs.AllowQueryAll);
            this.cbQueryAll.Checked = false;


            bool isDynamicGroupEnabled = false;
            IViewDynamicGroupGridForm dynamicGroupView = _ViewGridForm as IViewDynamicGroupGridForm;
            if (dynamicGroupView != null)
            {
                isDynamicGroupEnabled = dynamicGroupView.IsDynamicGroupIsActive;
            }

            this.lnkDynamaicSetting.Visible = (_ClientRuleObject.ClientLayoutAttribute.LoadType == ClientDataLoadType.ReLoad && !isDynamicGroupEnabled);
            this.cbShowTotalPage.Visible    = !isDynamicGroupEnabled;
            this.cbQueryAll.Visible         = !isDynamicGroupEnabled;
        }
Example #2
0
        private void loadFilterControl()
        {
            _DataElementCfgs = MB.WinBase.LayoutXmlConfigHelper.Instance.GetDataFilterCfgElements(_ClientRule.ClientLayoutAttribute.UIXmlConfigFile, _FilterCfgName);

            if (_DataElementCfgs == null || _DataElementCfgs.Count == 0)
            {
                throw new MB.Util.APPException("该对象在对应的XML配置文件中没有配置查询项!", MB.Util.APPMessageType.DisplayToUser);
            }
            this.MinVisibleRows = _DataElementCfgs.Count;

            Dictionary <string, ColumnPropertyInfo> columns = _ClientRule.UIRuleXmlConfigInfo.GetDefaultColumns();
            int row = 0;

            foreach (DataFilterElementCfgInfo elementInfo in _DataElementCfgs.Values)
            {
                Label newLab = createLabel(elementInfo);
                panFilterPan.Controls.Add(newLab, 0, row);

                Panel pnl = new Panel();
                pnl.Size = new System.Drawing.Size(EDIT_CTL_WIDTH, Convert.ToInt32(panFilterPan.RowStyles[0].Height - MARGE_WIDTH));
                panFilterPan.Controls.Add(pnl, 1, row);

                Control newEdit = createEditCtl(elementInfo);
                //newEdit.Width = EDIT_CTL_WIDTH;
                newEdit.Dock = DockStyle.Fill;
                pnl.Controls.Add(newEdit);
                pnl.BringToFront();

                _EditColumnCtlBinding.Add(elementInfo.Name, new MB.WinBase.Binding.ColumnBindingInfo(elementInfo.Name, columns[elementInfo.Name], newEdit));
                row += 1;
            }
        }
        /// <summary>
        ///  根据xml文件名称 获取相应的对象查询配置信息。
        /// </summary>
        /// <param name="xmlFileName"></param>
        /// <param name="cfgName"></param>
        /// <returns></returns>
        public FilterElementCfgs GetDataFilterCfgElements(string xmlFileName, string cfgName)
        {
            string  xmlFileFullName = ShareLib.Instance.BuildXmlConfigFileFullName(xmlFileName);
            XmlNode rootNode        = null;
            var     lstData         = MB.Util.XmlConfig.XmlConfigHelper.Instance.CreateEntityList <DataFilterElementCfgInfo>("Name", xmlFileFullName, QUERY_ELEMENTS, cfgName, out rootNode);

            if (lstData == null || lstData.Count == 0)
            {
                throw new MB.Util.APPException(string.Format("根据查询带{0} 在 XML 文件{1} 中找不到相应的Node,请检查配置文件", cfgName, xmlFileName));
            }

            FilterElementCfgs cfgs = new FilterElementCfgs(cfgName, lstData);

            if (rootNode != null)
            {
                if (rootNode.Attributes["AllowEmptyFilter"] != null)
                {
                    cfgs.AllowEmptyFilter = MB.Util.MyConvert.Instance.ToBool(rootNode.Attributes["AllowEmptyFilter"].Value);
                }

                if (rootNode.Attributes["AllowQueryAll"] != null)
                {
                    cfgs.AllowQueryAll = MB.Util.MyConvert.Instance.ToBool(rootNode.Attributes["AllowQueryAll"].Value);
                }

                if (rootNode.Attributes["Width"] != null)
                {
                    cfgs.Width = MB.Util.MyConvert.Instance.ToInt(rootNode.Attributes["Width"].Value);
                }

                if (rootNode.Attributes["Height"] != null)
                {
                    cfgs.Height = MB.Util.MyConvert.Instance.ToInt(rootNode.Attributes["Height"].Value);
                }
            }
            return(cfgs);
        }
        public void GetSchemaTest()
        {
            XmlSchemaSet xs = new XmlSchemaSet();

            FilterElementCfgs.GetSchema(xs);
        }