コード例 #1
0
        public void SSG_Notese_should_map_to_RepsonseNote_correctly()
        {
            SSG_Notese notese = new SSG_Notese
            {
                Description = "note"
            };

            ResponseNote n = _mapper.Map <ResponseNote>(notese);

            Assert.AreEqual("note", n.Description);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }