示例#1
0
        private HttpClient PrepareClient()
        {
            HttpClient client = new HttpClient();

            ParentResource.PopulateAuthHeaders(client);
            return(client);
        }
示例#2
0
        /// Algo
        ///1. Document Information.
        ///2. List of Resource Information
        ///     2.a. String Information
        ///         2.a.i. Removal Information
        public List <DocumentInformation> GetAllEnglishStrings(EnglishStringPayload payload)
        {
            m_payload = payload;
            List <DocumentInformation> documentInformationList = new List <DocumentInformation>();

            try
            {
                m_removalStringList = m_functionService.Udf_GetRemovedStrings(payload.BranchId.Value, payload.ModifiedDateUTC);
                foreach (var resourceId in payload.ResourceIds)
                {
                    ///DocumentContent
                    DocumentInformation documentInformation = new DocumentInformation
                    {
                        DocumentContent = m_functionService.GetDocumentContent(resourceId),
                        VoScriptIds     = m_dbContext.TVoscript
                                          .Where(x => x.BranchId == payload.BranchId)
                                          .Where(x => x.ParentResourceId == resourceId)
                                          .Where(x => x.IsActive)
                                          .Select(x => x.VoscriptId)
                                          .ToList()
                    };

                    var resourceVersionIdList = new List <int> {
                        documentInformation.DocumentContent.ResourceVersionId
                    };

                    foreach (var resourceVersionId in resourceVersionIdList)
                    {
                        ParentResource parentResource = new ParentResource
                        {
                            LocalizationResourceId        = resourceId,       //parentResourceAttributes.ResourceID,
                            LocalizationResourceVersionId = resourceVersionId //resourceVersionId,
                        };
                        documentInformation.ResourceInformation.AddRange(GetTextInformation(resourceVersionId, parentResource));
                    }
                    documentInformationList.Add(documentInformation);
                }
            }
            catch (Exception ex)
            {
                m_loggerService.LogError(ex.Message);
            }

            return(documentInformationList);
        }
示例#3
0
        public List <TextInfomationDto> GetTextInformation(int resourceVersionId, ParentResource parentResource)
        {
            var resourceInformationList = new List <TextInfomationDto>();

            var resourceString = m_procedureService.GetStringDataForResourceVersionIDs(resourceVersionId);
            var lineOrder      = 1;

            foreach (var item in resourceString.stringDataForResourceVersionID)
            {
                TextInfomationDto textInfomationDto = new TextInfomationDto
                {
                    Description           = GetDescription(item),
                    CurrentText           = item.Text,
                    IsTranslationEligible = item.IsTranslationEligible,
                    FriendlyStringId      = item.FriendlyStringId,
                    StringId           = item.StringId,
                    LocalizedVersionId = item.LocalizedVersionId,
                    MaxCharacterLength = item.MaxCharacterLength,
                    RecordingTypeName  = item.RecordingTypeName,
                    TimingRestriction  = ConvertStringTimeConstraintToDocumentTimingRestriction(item.TimingRestriction),
                    WordCount          = item.WordCount,
                    LineOrder          = lineOrder++,
                };
                GetStringTypeInformation(item, textInfomationDto);
                bool             previouslyExported = SetPreviousText(resourceString, item, textInfomationDto);
                TranslationState translationState   = previouslyExported ? TranslationState.Unchanged : TranslationState.DoNotTranslate;
                textInfomationDto.RequiresTranslationState = ConvertToRequiresTranslationState(translationState);
                GetSetGrammarInformation(resourceString, item, textInfomationDto);

                Links link = new Links();
                link.Parent.AddRange(m_functionService.Udf_GetConversationLineParent(resourceVersionId, textInfomationDto.StringId));
                link.Children.AddRange(GetChildLinkInfo(resourceVersionId, textInfomationDto));
                textInfomationDto.Links.Add(link);

                textInfomationDto.ParentResource.Add(parentResource);

                textInfomationDto.Speakers.Add(m_functionService.Udf_GetResourceVersionStringListener(resourceVersionId, item.StringId));

                GetSetEnglishStrings(textInfomationDto);
                resourceInformationList.Add(textInfomationDto);
            }
            return(resourceInformationList);
        }
示例#4
0
 /// <inheritdoc />
 public void ConstructEndpoint(StringBuilder sb)
 {
     ParentResource.ConstructEndpoint(sb);
     sb.Append(Endpoint);
 }
示例#5
0
 /// <inheritdoc />
 public void PopulateAuthHeaders(HttpClient client) => ParentResource.PopulateAuthHeaders(client);