Esempio n. 1
0
        public async Task <string> Create(StockportGovUK.NetStandard.Models.Verint.Case crmCase)
        {
            crmCase.InteractionReference = await _interactionService.CreateAsync(crmCase);

            var caseDetails = _caseToFWTCaseCreateMapper.Map(crmCase);

            try
            {
                var result = _verintConnection.createCaseAsync(caseDetails).Result.CaseReference;
                if (crmCase.UploadNotesWithAttachmentsAfterCaseCreation)
                {
                    _logger.LogError($"CaseService.create: (crmCase.Note.Count) Notes {crmCase.NotesWithAttachments.Count}. ");
                    crmCase.NotesWithAttachments.ForEach(note => note.CaseRef = Convert.ToInt64(result));
                    await CacheNotesWithAttachments(result, crmCase.NotesWithAttachments);
                }
                else
                {
                    crmCase.NotesWithAttachments.ForEach(async note => {
                        note.CaseRef = Convert.ToInt64(result);
                        await CreateNotesWithAttachment(note);
                    });
                }

                return(result);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"CaseService.Create:{crmCase.ID} Verint create case failed");
                throw ex;
            }
        }