/// <summary> /// 保存公司表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="companyEntity">公司实体</param> /// <returns></returns> public void SaveEntity(string keyValue, CompanyEntity companyEntity) { try { if (!string.IsNullOrEmpty(keyValue)) { companyEntity.Modify(keyValue); this.BaseRepository().Update(companyEntity); } else { companyEntity.Create(); this.BaseRepository().Insert(companyEntity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 获取公司信息实体 /// </summary> /// <param name="keyValue">主键</param> /// <returns></returns> public CompanyEntity GetEntity(string keyValue) { try { List <CompanyEntity> list = GetList(); CompanyEntity entity = list.Find(t => t.F_CompanyId.Equals(keyValue)); return(entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }
/// <summary> /// 保存公司信息(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="companyEntity">公司实体</param> /// <returns></returns> public void SaveEntity(string keyValue, CompanyEntity companyEntity) { try { cache.Remove(cacheKey, CacheId.company); cache.Remove(cacheKey + "dic", CacheId.company); companyService.SaveEntity(keyValue, companyEntity); } 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 { CompanyEntity entity = new CompanyEntity() { F_CompanyId = keyValue, F_DeleteMark = 1 }; this.BaseRepository().Update(entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }