Ejemplo n.º 1
0
 /// <summary>
 /// 保存模板基础信息
 /// </summary>
 /// <param name="keyValue">主键</param>
 /// <param name="schemeInfoEntity">模板基础信息</param>
 public void SaveSchemeInfoEntity(string keyValue, WfSchemeInfoEntity 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);
         }
     }
 }
Ejemplo 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);
                }
            }
        }