Ejemplo n.º 1
0
        public async Task Handle(CaseInstanceWorkerTaskAddedEvent message, CancellationToken token)
        {
            var caseWorkerTask = CaseWorkerTaskAggregate.New(message);
            await _caseWorkerTaskCommandRepository.Add(caseWorkerTask, token);

            await _caseWorkerTaskCommandRepository.SaveChanges(token);
        }
Ejemplo n.º 2
0
        public Task Add(CaseWorkerTaskAggregate caseWorkerTask, CancellationToken token)
        {
            var record = caseWorkerTask.ToModel();

            _caseManagementDbContext.CaseWorkers.Add(record);
            return(Task.CompletedTask);
        }
        public async Task Consume(ConsumeContext <CaseInstanceWorkerTaskAddedEvent> context)
        {
            var caseWorkerTask = CaseWorkerTaskAggregate.New(context.Message);
            await _caseWorkerTaskCommandRepository.Add(caseWorkerTask, CancellationToken.None);

            await _caseWorkerTaskCommandRepository.SaveChanges(CancellationToken.None);
        }
Ejemplo n.º 4
0
        public async Task Handle(CaseInstanceWorkerTaskRemovedEvent message, CancellationToken token)
        {
            var id     = CaseWorkerTaskAggregate.BuildCaseWorkerTaskIdentifier(message.AggregateId, message.CasePlanInstanceElementId);
            var result = await _caseWorkerTaskQueryRepository.Get(id, token);

            await _caseWorkerTaskCommandRepository.Delete(result, token);

            await _caseWorkerTaskCommandRepository.SaveChanges(token);
        }
        public async Task Consume(ConsumeContext <CaseInstanceWorkerTaskRemovedEvent> context)
        {
            var id     = CaseWorkerTaskAggregate.BuildCaseWorkerTaskIdentifier(context.Message.AggregateId, context.Message.CasePlanInstanceElementId);
            var result = await _caseWorkerTaskCommandRepository.Get(id, CancellationToken.None);

            await _caseWorkerTaskCommandRepository.Delete(result, CancellationToken.None);

            await _caseWorkerTaskCommandRepository.SaveChanges(CancellationToken.None);
        }
 public static CaseWorkerTaskResult ToDTO(CaseWorkerTaskAggregate cwt)
 {
     return(new CaseWorkerTaskResult
     {
         CasePlanInstanceElementId = cwt.CasePlanInstanceElementId,
         CasePlanInstanceId = cwt.CasePlanInstanceId,
         CreateDateTime = cwt.CreateDateTime,
         UpdateDateTime = cwt.UpdateDateTime
     });
 }
 public static CaseWorkerTaskModel ToModel(this CaseWorkerTaskAggregate record)
 {
     return(new CaseWorkerTaskModel
     {
         Id = record.AggregateId,
         Version = record.Version,
         CasePlanInstanceId = record.CasePlanInstanceId,
         CasePlanInstanceElementId = record.CasePlanInstanceElementId,
         CreateDateTime = record.CreateDateTime,
         UpdateDateTime = record.UpdateDateTime
     });
 }
 public static CaseWorkerTaskModel ToModel(this CaseWorkerTaskAggregate record)
 {
     return(new CaseWorkerTaskModel
     {
         Id = record.AggregateId,
         Version = record.Version,
         CasePlanInstanceId = record.CasePlanInstanceId,
         CasePlanInstanceElementId = record.CasePlanInstanceElementId,
         CreateDateTime = record.CreateDateTime,
         UpdateDateTime = record.UpdateDateTime,
         Roles = record.Roles.Select(_ => ToModel(_)).ToList()
     });
 }
Ejemplo n.º 9
0
        public async Task Delete(CaseWorkerTaskAggregate caseWorkerTask, CancellationToken token)
        {
            using (var lck = await _caseManagementDbContext.Lock())
            {
                var record = await _caseManagementDbContext.CaseWorkers.FirstOrDefaultAsync(_ => _.Id == caseWorkerTask.AggregateId, token);

                if (record == null)
                {
                    return;
                }

                _caseManagementDbContext.CaseWorkers.Remove(record);
            }
        }
 public Task Update(CaseWorkerTaskAggregate caseWorkerTask, CancellationToken token)
 {
     _caseWorkerTaskLst.Remove(_caseWorkerTaskLst.First(a => a.AggregateId == caseWorkerTask.AggregateId));
     _caseWorkerTaskLst.Add((CaseWorkerTaskAggregate)caseWorkerTask.Clone());
     return(Task.CompletedTask);
 }
 public Task Add(CaseWorkerTaskAggregate caseWorkerTask, CancellationToken token)
 {
     _caseWorkerTaskLst.Add((CaseWorkerTaskAggregate)caseWorkerTask.Clone());
     return(Task.CompletedTask);
 }
 public Task Update(CaseWorkerTaskAggregate caseWorkerTask, CancellationToken token)
 {
     _caseManagementDbContext.CaseWorkers.Update(caseWorkerTask);
     return(Task.CompletedTask);
 }