示例#1
0
        public void LoadRule(MDModel_QueryModel _model, MD_CheckRule _selectRule)
        {
            CurrentRule = _selectRule;
            _queryModel = _model;
            this.textEdit1.EditValue                        = CurrentRule.RuleName;
            this.textEdit1.Properties.ReadOnly              = true;
            this.sinoSZUC_MD_Model_FieldList1.QueryModel    = _queryModel;
            this.sinoSZUC_MD_Model_FieldList1.QueryViewName = _queryModel.FullQueryModelName;
            this.sinoSZUC_MD_Model_FieldList1.ShowSingleLineDefaultList();

            MDQuery_Request _request = MC_CheckRule.RuleToQueryRequest(CurrentRule, _queryModel, null);

            this.sinoSZUC_ConditionPanel1.RefreshBySaveRequest(this._queryModel, _request);
        }
        private bool FindRule(string _gzmc, ref MD_CheckRule _findRule)
        {
            _findRule = null;
            foreach (MD_CheckRule _rule in this._ruleList)
            {
                if (_rule.RuleName == _gzmc)
                {
                    _findRule = _rule;
                    return(true);
                }
            }

            return(false);
        }
 public void ModifyRule(IApplication _application)
 {
     if (RuleSelected)
     {
         int              _index      = this.gridView1.FocusedRowHandle;
         MD_CheckRule     _selectRule = this.gridView1.GetRow(_index) as MD_CheckRule;
         Dialg_ModifyRule _f          = new Dialg_ModifyRule();
         _f.LoadRule(this._queryModel, _selectRule);
         if (_f.ShowDialog() == DialogResult.OK)
         {
             //刷新规则列表
             RefreshRuleList(true);
         }
     }
 }
示例#4
0
        public static MDQuery_Request RuleToQueryRequest(MD_CheckRule _rule, MDModel_QueryModel _queryModel, MDQuery_Request filter_Request)
        {
            MDQuery_Request _ret = new MDQuery_Request();

            _ret.ChildResultTables    = new List <MDQuery_ResultTable>();
            _ret.QueryModelName       = _rule.QueryModelName;
            _ret.ConditionExpressions = StrUtils.GetMetaByName("C_BDS", _rule.MethodDefine);
            MDQuery_ResultTable _restable = new MDQuery_ResultTable();

            _restable.TableName    = _queryModel.MainTable.TableName;
            _restable.DisplayTitle = _queryModel.DisplayName;
            _restable.Columns      = new List <MDQuery_TableColumn>();
            _ret.MainResultTable   = _restable;
            if (_ret.ConditionItems == null)
            {
                _ret.ConditionItems = new List <MDQuery_ConditionItem>();
            }
            foreach (string _field in StrUtils.GetMetasByName("C_FIELD", _rule.MethodDefine))
            {
                string _index = StrUtils.GetMetaByName("MII_INDEX", _field);
                MDQuery_ConditionItem _citem = new MDQuery_ConditionItem();
                _citem.Operator = StrUtils.GetMetaByName("MII_OPER", _field).TrimStart().TrimEnd();
                MDModel_Table_Column _columnDefine = GetColumn(StrUtils.GetMetaByName("MII_FIELD", _field), _queryModel);
                _citem.Column = new MDQuery_TableColumn(_columnDefine);
                _ret.ConditionItems.Add(_citem);
                _citem.Values      = GetValues(StrUtils.GetMetaByName("MII_VALUE", _field), (_columnDefine.ColumnRefDMB != ""));
                _citem.ColumnIndex = _index;
            }
            if (filter_Request != null && filter_Request.ConditionItems.Count > 0)
            {
                int _oldcount = _ret.ConditionItems.Count;
                _ret.ConditionExpressions = string.Format("({0})", _ret.ConditionExpressions);
                foreach (MDQuery_ConditionItem _fci in filter_Request.ConditionItems)
                {
                    MDQuery_ConditionItem _citem = new MDQuery_ConditionItem();
                    _citem.Operator      = _fci.Operator;
                    _citem.Column        = _fci.Column;
                    _citem.Values        = _fci.Values;
                    _citem.CaseSensitive = _fci.CaseSensitive;
                    _citem.ColumnIndex   = (int.Parse(_fci.ColumnIndex) + _oldcount).ToString();
                    _ret.ConditionItems.Add(_citem);
                    _ret.ConditionExpressions += string.Format("*{0}", _citem.ColumnIndex);
                }
            }
            return(_ret);
        }
 public void DelRule(IApplication _application)
 {
     if (RuleSelected)
     {
         int          _index      = this.gridView1.FocusedRowHandle;
         MD_CheckRule _selectRule = this.gridView1.GetRow(_index) as MD_CheckRule;
         using (SinoSZClientBase.MetaDataQueryService.MetaDataQueryServiceClient _rsc = new SinoSZClientBase.MetaDataQueryService.MetaDataQueryServiceClient())
         {
             if (_rsc.DelDataCheckRule(_selectRule.ID))
             {
                 //刷新规则列表
                 RefreshRuleList(true);
             }
             else
             {
                 XtraMessageBox.Show("删除规则失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 return;
             }
         }
     }
 }
示例#6
0
        /// <summary>
        /// 检查规则
        /// </summary>
        /// <param name="_rule"></param>
        private void CheckRule(MD_CheckRule _rule, MDModel_QueryModel _queryModel)
        {
            DataSet         _lsdt;
            MDQuery_Request _request = MC_CheckRule.RuleToQueryRequest(_rule, _queryModel, this.CheckParam.Request);

            if (_request == null)
            {
                return;
            }
            using (SinoSZClientBase.MetaDataQueryService.MetaDataQueryServiceClient _rsc = new SinoSZClientBase.MetaDataQueryService.MetaDataQueryServiceClient())
            {
                _lsdt = _rsc.QueryData(_request);
            }
            if (_lsdt != null && _lsdt.Tables.Count > 0)
            {
                DataTable _dt = _lsdt.Tables[0];
                if (_dt.Rows.Count > 0)
                {
                    writeRuleCheckRusult(_dt, _rule.RuleName);
                }
            }
        }
        public void ImportRule(IApplication _application)
        {
            Dialog_ImportRules _frm = new Dialog_ImportRules();

            _frm.InitRuleList(this._queryModel.FullQueryModelName);
            if (_frm.ShowDialog() == DialogResult.OK)
            {
                List <DataRow> _ret = _frm.SelectedRules;
                if (_ret.Count > 0)
                {
                    using (SinoSZClientBase.MetaDataQueryService.MetaDataQueryServiceClient _rsc = new SinoSZClientBase.MetaDataQueryService.MetaDataQueryServiceClient())
                    {
                        foreach (DataRow _row in _ret)
                        {
                            MD_CheckRule _findRule = null;
                            string       _gzmc     = _row["GZMC"].ToString();
                            if (FindRule(_gzmc, ref _findRule))
                            {
                                if (XtraMessageBox.Show(string.Format("规则{0}已经存在,是否覆盖?", _gzmc), "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    _rsc.RecoverRuleDefine(_findRule.ID, _row["ID"].ToString());
                                    //刷新规则列表
                                    RefreshRuleList(true);
                                }
                            }
                            else
                            {
                                _rsc.ImportRule(_row["ID"].ToString());
                                //刷新规则列表
                                RefreshRuleList(true);
                            }
                        }
                    }
                }
            }
        }