/// <summary> /// 保存模板基础信息 /// </summary> /// <param name="keyValue">主键</param> /// <param name="schemeInfoEntity">模板基础信息</param> public void SaveSchemeInfoEntity(string keyValue, FormSchemeInfoEntity schemeInfoEntity) { try { if (!string.IsNullOrEmpty(keyValue)) { schemeInfoEntity.Modify(keyValue); this.BaseRepository().Update(schemeInfoEntity); } else { schemeInfoEntity.Create(); this.BaseRepository().Insert(schemeInfoEntity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 保存模板信息 /// </summary> /// <param name="keyValue">主键</param> /// <param name="schemeInfoEntity">模板基础信息</param> /// <param name="schemeEntity">模板信息</param> public void SaveEntity(string keyValue, FormSchemeInfoEntity schemeInfoEntity, FormSchemeEntity schemeEntity) { IRepository db = new RepositoryFactory().BaseRepository().BeginTrans(); try { if (string.IsNullOrEmpty(keyValue)) { schemeInfoEntity.Create(); } else { schemeInfoEntity.Modify(keyValue); } #region 模板信息 if (schemeEntity != null) { schemeEntity.F_SchemeInfoId = schemeInfoEntity.F_Id; schemeEntity.Create(); db.Insert(schemeEntity); schemeInfoEntity.F_SchemeId = schemeEntity.F_Id; } #endregion #region 模板基础信息 if (!string.IsNullOrEmpty(keyValue)) { db.Update(schemeInfoEntity); } else { db.Insert(schemeInfoEntity); } #endregion db.Commit(); } catch (Exception ex) { db.Rollback(); if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }