/// <summary> /// 保存岗位(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="postEntity">岗位实体</param> /// <returns></returns> public void SaveEntity(string keyValue, PostEntity postEntity) { try { if (!string.IsNullOrEmpty(keyValue)) { postEntity.Modify(keyValue); this.BaseRepository().Update(postEntity); } else { postEntity.Create(); this.BaseRepository().Insert(postEntity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 虚拟删除 /// </summary> /// <param name="keyValue">主键</param> public void VirtualDelete(string keyValue) { var db = this.BaseRepository().BeginTrans(); try { PostEntity entity = new PostEntity() { F_PostId = keyValue, F_DeleteMark = 1 }; db.Update(entity); db.ExecuteBySql(" Detete From LR_BASE_USERRELATION where F_OBJECTID = @keyValue ", new { keyValue = keyValue }); //db.Delete<UserRelationEntity>(t=>t.F_ObjectId == keyValue); db.Commit(); } catch (Exception ex) { db.Rollback(); if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 保存岗位(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="postEntity">岗位实体</param> /// <returns></returns> public void SaveEntity(string keyValue, PostEntity postEntity) { try { cache.Remove(cacheKey + postEntity.F_CompanyId, CacheId.post); postService.SaveEntity(keyValue, postEntity); } 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 { PostEntity entity = GetEntity(keyValue); cache.Remove(cacheKey + entity.F_CompanyId, CacheId.post); postService.VirtualDelete(keyValue); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }