Esempio n. 1
0
 /// <summary>
 /// 保存模板信息
 /// </summary>
 /// <param name="keyValue">主键</param>
 /// <param name="wfSchemeInfoEntity">模板基础信息</param>
 /// <param name="wfSchemeEntity">模板信息</param>
 public void SaveEntity(string keyValue, WfSchemeInfoEntity wfSchemeInfoEntity, WfSchemeEntity wfSchemeEntity, List <WfSchemeAuthorizeEntity> wfSchemeAuthorizeList)
 {
     try
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             WfSchemeEntity wfSchemeEntityOld = GetWfSchemeEntity(wfSchemeInfoEntity.F_SchemeId);
             if (wfSchemeEntityOld.F_Scheme == wfSchemeEntity.F_Scheme && wfSchemeEntityOld.F_Type == wfSchemeEntity.F_Type)
             {
                 wfSchemeEntity = null;
             }
             cache.Remove(cacheKey + wfSchemeInfoEntity.F_Code, CacheId.workflow);
             cache.Remove(cacheKey + wfSchemeInfoEntity.F_SchemeId, CacheId.workflow);
         }
         wfSchemeService.SaveEntity(keyValue, wfSchemeInfoEntity, wfSchemeEntity, wfSchemeAuthorizeList);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 保存模板信息
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="wfSchemeInfoEntity">模板基础信息</param>
        /// <param name="wfSchemeEntity">模板信息</param>
        public void SaveEntity(string keyValue, WfSchemeInfoEntity wfSchemeInfoEntity, WfSchemeEntity wfSchemeEntity, List <WfSchemeAuthorizeEntity> wfSchemeAuthorizeList)
        {
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                if (string.IsNullOrEmpty(keyValue))
                {
                    wfSchemeInfoEntity.Create();
                }
                else
                {
                    wfSchemeInfoEntity.Modify(keyValue);
                }
                #region 模板信息
                if (wfSchemeEntity != null)
                {
                    wfSchemeEntity.F_SchemeInfoId = wfSchemeInfoEntity.F_Id;
                    wfSchemeEntity.Create();
                    db.Insert(wfSchemeEntity);
                    wfSchemeInfoEntity.F_SchemeId = wfSchemeEntity.F_Id;
                }
                #endregion

                #region 模板基础信息
                if (!string.IsNullOrEmpty(keyValue))
                {
                    db.Update(wfSchemeInfoEntity);
                }
                else
                {
                    db.Insert(wfSchemeInfoEntity);
                }
                #endregion

                #region 流程模板权限信息
                string schemeInfoId = wfSchemeInfoEntity.F_Id;
                db.Delete <WfSchemeAuthorizeEntity>(t => t.F_SchemeInfoId == schemeInfoId);
                foreach (var wfSchemeAuthorize in wfSchemeAuthorizeList)
                {
                    wfSchemeAuthorize.F_SchemeInfoId = schemeInfoId;
                    db.Insert(wfSchemeAuthorize);
                }
                #endregion

                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }