/// <summary> /// 保存实体 /// </summary> /// <param name="keyValue">主键</param> /// <param name="wfDelegateRuleEntity">实体数据</param> /// <param name="schemeInfoList">关联模板主键</param> public void SaveEntity(string keyValue, WfDelegateRuleEntity wfDelegateRuleEntity, string[] schemeInfoList) { try { wfDelegateRuleService.SaveEntity(keyValue, wfDelegateRuleEntity, schemeInfoList); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }
/// <summary> /// 保存实体 /// </summary> /// <param name="keyValue">主键</param> /// <param name="wfDelegateRuleEntity">实体数据</param> /// <param name="schemeInfoList">关联模板主键</param> public void SaveEntity(string keyValue, WfDelegateRuleEntity wfDelegateRuleEntity, string[] schemeInfoList) { var db = this.BaseRepository().BeginTrans(); try { if (string.IsNullOrEmpty(keyValue)) { wfDelegateRuleEntity.Create(); db.Insert(wfDelegateRuleEntity); } else { wfDelegateRuleEntity.Modify(keyValue); db.Update(wfDelegateRuleEntity); db.Delete <WfDelegateRuleRelationEntity>(t => t.F_DelegateRuleId == keyValue); } foreach (string schemeInfoId in schemeInfoList) { WfDelegateRuleRelationEntity wfDelegateRuleRelationEntity = new WfDelegateRuleRelationEntity(); wfDelegateRuleRelationEntity.Create(); wfDelegateRuleRelationEntity.F_DelegateRuleId = wfDelegateRuleEntity.F_Id; wfDelegateRuleRelationEntity.F_SchemeInfoId = schemeInfoId; db.Insert(wfDelegateRuleRelationEntity); } db.Commit(); } catch (Exception ex) { db.Rollback(); if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 更新委托规则状态信息 /// </summary> /// <param name="keyValue">主键</param> /// <param name="state"></param> public void UpdateState(string keyValue, int state) { try { WfDelegateRuleEntity wfDelegateRuleEntity = new WfDelegateRuleEntity { F_Id = keyValue, F_EnabledMark = state }; this.BaseRepository().Update(wfDelegateRuleEntity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }