/// <summary> /// 更新模板 /// </summary> /// <param name="schemeInfoId">模板信息主键</param> /// <param name="schemeId">模板主键</param> public void UpdateScheme(string schemeInfoId, string schemeId) { try { FormSchemeEntity formSchemeEntity = GetSchemeEntity(schemeId); FormSchemeInfoEntity entity = new FormSchemeInfoEntity { F_Id = schemeInfoId, F_SchemeId = schemeId }; if (formSchemeEntity.F_Type != 1) { entity.F_EnabledMark = 0; } 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="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); } } }
/// <summary> /// 更新自定义表单模板状态 /// </summary> /// <param name="schemeInfoId">模板信息主键</param> /// <param name="state">状态1启用0禁用</param> public void UpdateState(string schemeInfoId, int state) { try { FormSchemeInfoEntity entity = new FormSchemeInfoEntity { F_Id = schemeInfoId, F_EnabledMark = state }; 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 VirtualDelete(string keyValue) { try { FormSchemeInfoEntity entity = new FormSchemeInfoEntity() { F_Id = keyValue, F_DeleteMark = 1 }; this.BaseRepository().Update(entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }