/// <summary> /// 保存明细数据实体 /// </summary> /// <param name="keyValue">主键</param> /// <param name="entity">实体</param> public void SaveDetailEntity(string keyValue, DataItemDetailEntity entity) { try { if (string.IsNullOrEmpty(keyValue)) { entity.Create(); this.BaseRepository().Insert(entity); } else { entity.Modify(keyValue); this.BaseRepository().Update(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 保存明细数据实体 /// </summary> /// <param name="keyValue">主键</param> /// <param name="entity">实体</param> public void SaveDetailEntity(string keyValue, DataItemDetailEntity entity) { try { List <DataItemEntity> list = GetClassifyList(); string itemId = entity.F_ItemId; DataItemEntity classifyEntity = list.Find(t => t.F_ItemId.Equals(itemId)); if (classifyEntity.F_IsTree != 1 || string.IsNullOrEmpty(entity.F_ParentId)) { entity.F_ParentId = "0"; } dataItemService.SaveDetailEntity(keyValue, entity); cache.Remove(cacheKeyDetail + "dic", CacheId.dataItem); cache.Remove(cacheKeyDetail + classifyEntity.F_ItemCode, CacheId.dataItem); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }
/// <summary> /// 虚拟删除明细数据 /// </summary> /// <param name="keyValue">主键</param> public void VirtualDeleteDetail(string keyValue) { try { DataItemDetailEntity entity = new DataItemDetailEntity() { F_ItemDetailId = keyValue, F_DeleteMark = 1 }; this.BaseRepository().Update(entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 虚拟删除明细数据 /// </summary> /// <param name="keyValue">主键</param> public void VirtualDeleteDetail(string keyValue) { try { dataItemService.VirtualDeleteDetail(keyValue); DataItemDetailEntity entity = dataItemService.GetDetailEntity(keyValue); List <DataItemEntity> list = GetClassifyList(); string itemId = entity.F_ItemId; DataItemEntity classifyEntity = list.Find(t => t.F_ItemId.Equals(itemId)); cache.Remove(cacheKeyDetail + "dic", CacheId.dataItem); cache.Remove(cacheKeyDetail + classifyEntity.F_ItemCode, CacheId.dataItem); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }