Exemplo n.º 1
0
 /// <summary>
 /// 保存实体数据
 /// </summary>
 /// <param name="keyValue"></param>
 /// <param name="entity"></param>
 public void SaveEntity(string keyValue, WFProcessSchemeEntity entity)
 {
     try
     {
         if (string.IsNullOrEmpty(keyValue))
         {
             entity.Create();
             this.BaseRepository().Insert <WFProcessSchemeEntity>(entity);
         }
         else
         {
             entity.Modify(keyValue);
             this.BaseRepository().Update <WFProcessSchemeEntity>(entity);
         }
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 存储工作流实例进程(编辑草稿用)
        /// </summary>
        /// <param name="processInstanceEntity"></param>
        /// <param name="processSchemeEntity"></param>
        /// <param name="wfOperationHistoryEntity"></param>
        /// <returns></returns>
        public int SaveProcess(string processId, WFProcessInstanceEntity processInstanceEntity, WFProcessSchemeEntity processSchemeEntity, WFProcessOperationHistoryEntity wfOperationHistoryEntity = null)
        {
            IRepository db = this.BaseRepository().BeginTrans();

            try
            {
                //草稿不需要流程编号
                processInstanceEntity.Code = "";
                if (string.IsNullOrEmpty(processInstanceEntity.Id))
                {
                    processSchemeEntity.Create();
                    db.Insert(processSchemeEntity);

                    processInstanceEntity.Create();
                    processInstanceEntity.Id = processId;
                    processInstanceEntity.ProcessSchemeId = processSchemeEntity.Id;
                    db.Insert(processInstanceEntity);
                }
                else
                {
                    processInstanceEntity.Modify(processId);
                    db.Update(processInstanceEntity);

                    processSchemeEntity.Modify(processInstanceEntity.ProcessSchemeId);
                    db.Update(processSchemeEntity);
                }
                if (wfOperationHistoryEntity != null)
                {
                    wfOperationHistoryEntity.Create();
                    wfOperationHistoryEntity.ProcessId = processId;
                    db.Insert(wfOperationHistoryEntity);
                }
                db.Commit();
                return(1);
            }
            catch
            {
                db.Rollback();
                throw;
            }
        }