using Learun.Cache.Base; using Learun.Cache.Factory; using Learun.Util; using System; using System.Collections.Generic; namespace Learun.Application.Form { /// /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架 /// Copyright (c) 2013-2018 Hexagon PPM /// 创建人:研发部 /// 日 期:2017.04.01 /// 描 述:表单关联功能 /// public class FormRelationBLL : FormRelationIBLL { private FormRelationService formRelationService = new FormRelationService(); private FormSchemeIBLL formSchemeIBLL = new FormSchemeBLL(); #region 缓存定义 private ICache cache = CacheFactory.CaChe(); private string cacheKey = "learun_adms_formrelation_";// +模板主键 #endregion #region 获取数据 /// /// 获取分页列表 /// /// 分页参数 /// 关键字 /// public IEnumerable GetPageList(Pagination pagination, string keyword) { try { return formRelationService.GetPageList(pagination, keyword); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 获取实体数据 /// /// 主键 /// public FormRelationEntity GetEntity(string keyValue) { try { FormRelationEntity entity = cache.Read(cacheKey + keyValue, CacheId.formRelation); if (entity == null) { entity = formRelationService.GetEntity(keyValue); cache.Write(cacheKey + keyValue, entity, CacheId.formRelation); } return entity; } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 获取树形数据列表 /// /// public List GetTree() { try { var list = formRelationService.GetList(); List treeList = new List(); foreach (var item in list) { TreeModel node = new TreeModel(); node.id = item.F_Id; node.text = item.F_ModuleId; node.value = item.F_FormId; node.showcheck = false; node.checkstate = 0; node.isexpand = true; node.parentId = "0"; treeList.Add(node); } return treeList.ToTree(); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } #endregion #region 提交数据 /// /// 虚拟删除模板信息 /// /// 主键 public void DeleteEntity(string keyValue) { try { formRelationService.DeleteEntity(keyValue); cache.Remove(cacheKey + keyValue, CacheId.formRelation); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 保存模板信息 /// /// 主键 /// 表单与功能信息 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); } } } #endregion } }