Ejemplo n.º 1
0
        private async Task <bool> UploadNotes(SearchRequestEntity newSearchRequestEntity)
        {
            NotesEntity note = new NotesEntity
            {
                StatusCode        = 1,
                Description       = newSearchRequestEntity.Notes,
                InformationSource = InformationSourceType.Request.Value,
                SearchRequest     = _uploadedSearchRequest
            };
            SSG_Notese ssgNote = await _searchRequestService.CreateNotes(note, _cancellationToken);

            if (ssgNote == null)
            {
                _logger.LogError("Create new notes failed.");
                return(false);
            }
            _logger.LogInformation("Create new notes successfully.");
            return(true);
        }
Ejemplo n.º 2
0
        private async Task <bool> UploadNotes(SearchRequestEntity newSearchRequestEntity, SSG_SearchRequest existedSearchRequest)
        {
            string previousNoteStr = existedSearchRequest.Notes;

            if (existedSearchRequest.SSG_Notes != null && existedSearchRequest.SSG_Notes?.Length > 0)
            {
                try
                {
                    previousNoteStr =
                        existedSearchRequest.SSG_Notes.Last(m => m.InformationSource == InformationSourceType.Request.Value).Description;
                }catch (Exception)
                {
                    _logger.LogInformation("notes does not contain notes from request. It is ok.");
                }
            }

            string newNotes = UpdateCurrentNote(newSearchRequestEntity.Notes, previousNoteStr);

            if (newNotes != null)
            {
                NotesEntity note = new NotesEntity
                {
                    StatusCode        = 1,
                    Description       = newNotes,
                    InformationSource = InformationSourceType.Request.Value,
                    SearchRequest     = _uploadedSearchRequest,
                    UpdatedByApi      = true
                };
                SSG_Notese ssgNote = await _searchRequestService.CreateNotes(note, _cancellationToken);

                if (ssgNote == null)
                {
                    _logger.LogError("Create new notes failed.");
                    return(false);
                }
                _logger.LogInformation("Create new notes successfully.");
            }
            return(true);
        }