/// <summary> /// 保存实体数据(新增、修改) /// <param name="keyValue">主键</param> /// <summary> /// <returns></returns> public void SaveEntity(string keyValue, LR_RPT_RelationEntity entity) { try { rptRelationService.SaveEntity(keyValue, entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }
/// <summary> /// 保存实体数据(新增、修改) /// <param name="keyValue">主键</param> /// <summary> /// <returns></returns> public void SaveEntity(string keyValue, LR_RPT_RelationEntity entity) { try { if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); this.BaseRepository().Update(entity); } else { entity.Create(); ModuleEntity moduleEntity = new ModuleEntity(); moduleEntity.F_IsMenu = 1; moduleEntity.F_EnabledMark = 1; moduleEntity.F_EnCode = entity.F_EnCode; moduleEntity.F_FullName = entity.F_FullName; moduleEntity.F_ParentId = entity.F_ParentId; moduleEntity.F_Icon = entity.F_Icon; moduleEntity.F_Description = entity.F_Description; moduleEntity.F_Target = "iframe"; moduleEntity.F_UrlAddress = "/LR_ReportModule/RptManage/Report?reportId=" + entity.F_RptUrl; List <ModuleButtonEntity> moduleButtonList = new List <ModuleButtonEntity>(); List <ModuleColumnEntity> moduleColumnList = new List <ModuleColumnEntity>(); List <ModuleFormEntity> moduleFormEntitys = new List <ModuleFormEntity>(); moduleIBLL.SaveEntity(null, moduleEntity, moduleButtonList, moduleColumnList, moduleFormEntitys); this.BaseRepository().Insert(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 删除实体数据 /// <param name="keyValue">主键</param> /// <summary> /// <returns></returns> public void DeleteEntity(string keyValue) { try { //删除报表关系同时把菜单也删除 LR_RPT_RelationEntity relation = this.BaseRepository().FindEntity <LR_RPT_RelationEntity>(keyValue); string moduleCode = relation.F_EnCode; var module = this.BaseRepository().FindList <ModuleEntity>(t => t.F_EnCode == moduleCode); this.BaseRepository().Delete(module); this.BaseRepository().Delete(relation); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }