Пример #1
0
        /// <summary>
        /// 更新流程模板
        /// </summary>
        /// <param name="schemeInfoId">模板信息主键</param>
        /// <param name="schemeId">模板主键</param>
        public void UpdateScheme(string schemeInfoId, string schemeId)
        {
            try
            {
                NWFSchemeEntity nWFSchemeEntity = GetSchemeEntity(schemeId);

                NWFSchemeInfoEntity entity = new NWFSchemeInfoEntity
                {
                    F_Id       = schemeInfoId,
                    F_SchemeId = schemeId
                };
                if (nWFSchemeEntity.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="infoEntity">模板基础信息</param>
 /// <param name="schemeEntity">模板信息</param>
 /// <param name="authList">模板权限信息</param>
 public void SaveEntity(string keyValue, NWFSchemeInfoEntity infoEntity, NWFSchemeEntity schemeEntity, List <NWFSchemeAuthEntity> authList)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         NWFSchemeEntity oldNWFSchemeEntity = GetSchemeEntity(infoEntity.F_SchemeId);
         if (oldNWFSchemeEntity.F_Content == schemeEntity.F_Content && oldNWFSchemeEntity.F_Type == schemeEntity.F_Type)
         {
             schemeEntity = null;
         }
     }
     nWFSchemeService.SaveEntity(keyValue, infoEntity, schemeEntity, authList);
 }
Пример #3
0
        /// <summary>
        /// 保存模板信息
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="infoEntity">模板基础信息</param>
        /// <param name="schemeEntity">模板信息</param>
        /// <param name="authList">模板权限信息</param>
        public void SaveEntity(string keyValue, NWFSchemeInfoEntity infoEntity, NWFSchemeEntity schemeEntity, List <NWFSchemeAuthEntity> authList)
        {
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                if (string.IsNullOrEmpty(keyValue))
                {
                    infoEntity.Create();
                }
                else
                {
                    infoEntity.Modify(keyValue);
                }

                #region 模板信息
                if (schemeEntity != null)
                {
                    schemeEntity.F_SchemeInfoId = infoEntity.F_Id;
                    schemeEntity.Create();
                    db.Insert(schemeEntity);
                    infoEntity.F_SchemeId = schemeEntity.F_Id;
                }
                #endregion

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

                #region 流程模板权限信息
                string schemeInfoId = infoEntity.F_Id;
                db.Delete <NWFSchemeAuthEntity>(t => t.F_SchemeInfoId == schemeInfoId);
                foreach (var item in authList)
                {
                    item.Create();
                    item.F_SchemeInfoId = schemeInfoId;
                    db.Insert(item);
                }
                #endregion

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