示例#1
0
 /// <summary>
 /// 保存模板信息
 /// </summary>
 /// <param name="keyValue">主键</param>
 /// <param name="formRelationEntity">表单与功能信息</param>
 public void SaveEntity(string keyValue, FormRelationEntity formRelationEntity)
 {
     try
     {
         if (string.IsNullOrEmpty(keyValue))
         {
             this.BaseRepository().Insert(formRelationEntity);
         }
         else
         {
             formRelationEntity.Modify(keyValue);
             this.BaseRepository().Update(formRelationEntity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
 /// <summary>
 /// 保存模板信息
 /// </summary>
 /// <param name="keyValue">主键</param>
 /// <param name="formRelationEntity">表单与功能信息</param>
 public void SaveEntity(string keyValue, FormRelationEntity formRelationEntity)
 {
     try
     {
         formRelationService.SaveEntity(keyValue, formRelationEntity);
         cache.Remove(cacheKey + keyValue, CacheId.formRelation);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
 /// <summary>
 /// 获取实体数据
 /// </summary>
 /// <param name="keyValue">主键</param>
 /// <returns></returns>
 public FormRelationEntity GetEntity(string keyValue)
 {
     try
     {
         FormRelationEntity entity = cache.Read <FormRelationEntity>(cacheKey + keyValue, CacheId.formRelation);
         if (entity == null)
         {
             entity = formRelationService.GetEntity(keyValue);
             cache.Write <FormRelationEntity>(cacheKey + keyValue, entity, CacheId.formRelation);
         }
         return(entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }