/// <summary> /// 虚拟删除区域 /// </summary> /// <param name="keyValue">主键</param> public void VirtualDelete(string keyValue) { try { AreaEntity entity = areaService.GetEntity(keyValue); cache.Remove(cacheKey + entity.F_ParentId, CacheId.area); areaService.VirtualDelete(keyValue); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }
/// <summary> /// 虚拟删除区域 /// </summary> /// <param name="keyValue">主键</param> public void VirtualDelete(string keyValue) { try { AreaEntity entity = new AreaEntity() { F_AreaId = 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> /// <param name="areaEntity">区域实体</param> /// <returns></returns> public void SaveEntity(string keyValue, AreaEntity areaEntity) { try { cache.Remove(cacheKey + areaEntity.F_ParentId, CacheId.area); if (!string.IsNullOrEmpty(keyValue)) { AreaEntity entity = areaService.GetEntity(keyValue); cache.Remove(cacheKey + entity.F_ParentId, CacheId.area); } if (areaEntity.F_ParentId != "0") { AreaEntity entity = GetEntity(areaEntity.F_ParentId); if (entity != null) { areaEntity.F_Layer = entity.F_Layer + 1; } } else { areaEntity.F_Layer = 1; } areaService.SaveEntity(keyValue, areaEntity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }