/// <summary> /// 保存实体 /// </summary> /// <param name="keyValue">主键</param> /// <param name="wfDelegateRuleEntity">实体数据</param> /// <param name="schemeInfoList">关联模板主键</param> public void SaveEntity(string keyValue, NWFDelegateRuleEntity wfDelegateRuleEntity, string[] schemeInfoList) { try { nWFDelegateService.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, NWFDelegateRuleEntity 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 <NWFDelegateRelationEntity>(t => t.F_DelegateRuleId == keyValue); } foreach (string schemeInfoId in schemeInfoList) { NWFDelegateRelationEntity wfDelegateRuleRelationEntity = new NWFDelegateRelationEntity(); 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 { NWFDelegateRuleEntity wfDelegateRuleEntity = new NWFDelegateRuleEntity { F_Id = keyValue, F_EnabledMark = state }; this.BaseRepository().Update(wfDelegateRuleEntity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }