Пример #1
0
 /// <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);
         }
     }
 }
Пример #2
0
        /// <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);
                }
            }
        }