12345678910111213141516171819202122232425262728293031323334353637 |
- using System.Threading.Tasks;
- using Datory;
- using GxPress.EnumConst;
- using System.Transactions;
- namespace GxPress.Service.Implement
- {
- public partial class FlowService
- {
-
-
-
-
-
- public async Task<bool> RecallAsync(int flowId, int userId)
- {
- try
- {
- using (var transactions = new TransactionScope())
- {
- var flow = await _flowRepository.GetAsync(flowId);
- if (flow == null || flow.UserId != userId)
- throw new Common.Exceptions.BusinessException("非本人操作!");
-
- await middleRepository.DeleteAsync(Q.Where(nameof(Entity.Middle.Middle.FolderType), AllTypeConst.Inbox.GetHashCode()).Where(nameof(Entity.Middle.Middle.MiddleId), flowId).WhereNot(nameof(Entity.Middle.Middle.UserId), flow.UserId));
-
- await middleRepository.UpdateAsync(Q.Where(nameof(Entity.Middle.Middle.FolderType), AllTypeConst.Inbox.GetHashCode()).Where(nameof(Entity.Middle.Middle.MiddleId), flowId).Where(nameof(Entity.Middle.Middle.UserId), flow.UserId).Set(nameof(Entity.Middle.Middle.IsRecall), true));
- transactions.Complete();
- }
- }
- catch
- {
- return false;
- }
- return true;
- }
- }
- }
|