/// <summary>
        /// 保存委托规则
        /// </summary>
        /// <returns></returns>
        public int SaveDelegateRule(string keyValue, WFDelegateRuleEntity ruleEntity, string[] shcemeInfoIdlist)
        {
            IRepository db = this.BaseRepository().BeginTrans();

            try
            {
                if (string.IsNullOrEmpty(keyValue))
                {
                    ruleEntity.Create();
                    db.Insert(ruleEntity);
                }
                else
                {
                    ruleEntity.Modify(keyValue);
                    db.Update(ruleEntity);
                }
                db.Delete <WFDelegateRuleSchemeInfoEntity>(ruleEntity.Id, "DelegateRuleId");
                foreach (string item in shcemeInfoIdlist)
                {
                    WFDelegateRuleSchemeInfoEntity entity = new WFDelegateRuleSchemeInfoEntity();
                    entity.Create();
                    entity.DelegateRuleId = ruleEntity.Id;
                    entity.SchemeInfoId   = item;
                    db.Insert(entity);
                }
                db.Commit();
                return(1);
            }
            catch
            {
                db.Rollback();
                throw;
            }
        }
        /// <summary>
        /// 使能委托规则
        /// </summary>
        /// <param name="keyValue"></param>
        /// <param name="enableMark"></param>
        /// <returns></returns>
        public int UpdateRuleEnable(string keyValue, int enableMark)
        {
            try
            {
                WFDelegateRuleEntity entity = new WFDelegateRuleEntity();
                entity.Modify(keyValue);
                entity.EnabledMark = enableMark;
                this.BaseRepository().Update(entity);

                return(1);
            }
            catch {
                throw;
            }
        }