Example #1
0
        static bool checkValue(string ruleValue, int index, ProcessRule processRule)
        {
            string pattern = null;
            if (index == 0)
            {
                pattern = processRule.Value1;
            }
            else if (index == 1)
            {
                pattern = processRule.Value2;
            }
            else if (index == 2)
            {
                pattern = processRule.Value3;
            }
            else if (index == 3)
            {
                pattern = processRule.Value4;
            }
            else if (index == 4)
            {
                pattern = processRule.Value5;
            }
            else if (index == 5)
            {
                pattern = processRule.Value6;
            } 

            if (string.IsNullOrEmpty(pattern))
            {
                return false;
            }

            return Regex.IsMatch(ruleValue, pattern, RegexOptions.Compiled);
        }
Example #2
0
        static bool matchRule(ProcessRule item, ProcessRuleSet ruleSet)
        {
            IList<string> ruleValueList = ruleSet.ConditiionValueList;
            int count = ruleValueList.Count;
            bool bAllmatched = (count==0? false:true);
            
            for (int i=0; i<count;++i)
            {
                string ruleValue = ruleValueList[i];
                if (string.IsNullOrEmpty(ruleValue))
                {
                    bAllmatched = false;
                    break;
                }
                if (!checkValue(ruleValue, i, item))
                {
                    bAllmatched = false;
                    break;
                }               
            }

            return bAllmatched;
        }
Example #3
0
        public string AddRule(ProcessRule rule)
        {
            //若所有非Disable的Column Value输入框中的内容全都与Rule List表格中某个数据行中的对应栏位数据相同,则警示用户,放弃后续操作   
            if (processRepository.IFRuleIsExists(rule))
            {
                List<string> erpara = new List<string>();
                FisException ex = new FisException("DMT032", erpara);
                throw ex;
            }
            UnitOfWork uow = new UnitOfWork();
            processRepository.DeleteModelProcessByProcessDefered(uow, rule.Process);
            ////若当前被选Rule Set是Model,则删除Model_Process数据表中对应用户所输Model条件的记录。否则,删除Model_Process数据表中的所有记录。
            //if (processRepository.IFConditionIsModel(rule.Rule_set_id))
            //{
            //    processRepository.DeleteModelProcessByModelDefered(uow, rule.Value1);
            //}
            //else
            //{
            //    processRepository.DeleteAllModelProcessDefered(uow);
            //}
            processRepository.AddProcessRuleDefered(uow,rule);
            uow.Commit();

            return rule.Id.ToString();
        }
Example #4
0
 public void EditRule(ProcessRule rule)
 {
     //若所有非Disable的Column Value输入框中的内容全都与Rule List表格中某个数据行中的对应栏位数据相同,则警示用户,放弃后续操作  
     if (processRepository.IFRuleIsExists(rule))
     {
         List<string> erpara = new List<string>();
         FisException ex = new FisException("DMT032", erpara);
         throw ex;
     }
     UnitOfWork uow = new UnitOfWork();
     processRepository.DeleteModelProcessByProcessDefered(uow, rule.Process);
     ////若当前被选Rule Set是Model,则删除Model_Process数据表中对应修改前后两个Model的记录。否则,删除Model_Process数据表中的所有记录。
     //if (processRepository.IFConditionIsModel(rule.Rule_set_id))
     //{
     //    ProcessRule item = processRepository.GetProcessRuleById(rule.Id);
     //    if (item != null)
     //    {
     //        processRepository.DeleteModelProcessByModelDefered(uow, item.Value1);
     //    }
     //    processRepository.DeleteModelProcessByModelDefered(uow, rule.Value1);
     //}
     //else
     //{
     //    processRepository.DeleteAllModelProcessDefered(uow);
     //}           
     processRepository.UpdateProcessRuleDefered(uow,rule);
     uow.Commit();
 }
    protected void btnSaveRule_ServerClick(Object sender, EventArgs e)
    {
        string process = this.hidProcess.Value;
        string txt1 = this.hidtxt1.Value;
        string txt2 = this.hidtxt2.Value;
        string txt3 = this.hidtxt3.Value;
        string txt4 = this.hidtxt4.Value;
        string txt5 = this.hidtxt5.Value;
        string txt6 = this.hidtxt6.Value;
        ProcessRule rule = new ProcessRule();
        string ruleSetID = this.hidConditionID.Value;
        string condition = this.hidFld1.Value;
        IList<ProcessRule> lstProcessRule = null;
        string ruleID = this.hidRuleID.Value;

        try
        {
            rule.Process = process;
            rule.Editor = UserId;
            rule.Value1 = txt1;
            rule.Value2 = txt2;
            rule.Value3 = txt3;
            rule.Value4 = txt4;
            rule.Value5 = txt5;
            rule.Value6 = txt6;
            rule.Rule_set_id = int.Parse(ruleSetID);
            rule.Id = int.Parse(ruleID);

            iModelProcess.EditRule(rule);
            gCurrentRuleID = rule.Id;
            iModelProcess.CheckAdd_SaveModelProcess(int.Parse(ruleID));
            lstProcessRule = iModelProcess.GetRuleListByConditionAndProcess(int.Parse(ruleSetID), process);

            bindTable(lstProcessRule, DEFAULT_ROW_NUM, condition);
            this.updatePanel3.Update();
            ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "dealWait", "DealHideWait();", true);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            //bindTable(null, DEFAULT_ROW_NUM, null);
            //this.hidRecordCount.Value = "0";
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            //bindTable(null, DEFAULT_ROW_NUM, null);
            //this.hidRecordCount.Value = "0";
        }
     
    }