Пример #1
0
        /// <inheritdoc />
        public async Task OnEndProcessTask(string taskId, Instance instance)
        {
            await RunProcessTaskEnd(taskId, instance);

            _logger.LogInformation($"OnEndProcessTask for {instance.Id}. Locking data elements connected to {taskId}");

            List <DataType> dataTypesToLock = _appMetadata.DataTypes.FindAll(dt => dt.TaskId == taskId);

            foreach (DataType dataType in dataTypesToLock)
            {
                bool generatePdf = dataType.AppLogic != null;

                foreach (DataElement dataElement in instance.Data.FindAll(de => de.DataType == dataType.Id))
                {
                    dataElement.Locked = true;
                    _logger.LogInformation($"Locking data element {dataElement.Id} of dataType {dataType.Id}.");
                    Task updateData = _dataService.Update(instance, dataElement);

                    if (generatePdf)
                    {
                        Task createPdf = _pdfService.GenerateAndStoreReceiptPDF(instance, dataElement);
                        await Task.WhenAll(updateData, createPdf);
                    }
                    else
                    {
                        await updateData;
                    }
                }
            }

            await Task.CompletedTask;
        }
Пример #2
0
        /// <inheritdoc />
        public async Task OnEndProcess(string endEvent, Instance instance)
        {
            _logger.LogInformation($"OnEndProcess for {instance.Id}, endEvent: {endEvent}");

            if (endEvent != null && endEvent.Equals("EndEvent_1"))
            {
                await _pdfService.GenerateAndStoreReceiptPDF(instance);
            }

            // Set archived status
            instance.Status ??= new InstanceStatus();
            instance.Status.Archived = DateTime.UtcNow;
        }