Example #1
0
        private void GetSetEnglishStrings(TextInfomationDto textInfomationDto)
        {
            textInfomationDto.EnglishStrings = m_procedureService.StringExportStatusAndInfos(m_payload.IsLocalizationReady,
                                                                                             m_payload.ModifiedDateUTC,
                                                                                             textInfomationDto.StringId,
                                                                                             m_payload.BranchId.Value);

            if (textInfomationDto.EnglishStrings == null || !textInfomationDto.EnglishStrings.SourceStringId.HasValue || !textInfomationDto.EnglishStrings.IsClone)
            {
                textInfomationDto.IsClone = false;
            }
            textInfomationDto.SourceCloneStringId = textInfomationDto.EnglishStrings.SourceStringId ?? 0;
            GetSetEnglishStringRemovalInformation(textInfomationDto);
        }
Example #2
0
        private void GetSetEnglishStringRemovalInformation(TextInfomationDto textInfomationDto)
        {
            var removeStrings = m_removalStringList.Where(x => x.StringId == textInfomationDto.StringId).FirstOrDefault();

            if (removeStrings == null)
            {
                textInfomationDto.EnglishStrings.RemoveStrings = null;
            }
            else
            {
                RemovedStringDto RemoveStrings = new RemovedStringDto
                {
                    RemovalTypeId = removeStrings.RemovalTypeId,
                    RemovalType   = removeStrings.RemovalType
                };
                textInfomationDto.EnglishStrings.RemoveStrings = removeStrings;
            }
        }
Example #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);
        }
Example #4
0
 private void GetStringTypeInformation(StringDataForResourceVersionID item, TextInfomationDto textInfomationDto)
 {
     textInfomationDto.StringType.StringTypeId   = item.StringTypeId;
     textInfomationDto.StringType.StringTypeName = item.StringTypeName;
 }
Example #5
0
        private static bool SetPreviousText(Attributes resourceString, StringDataForResourceVersionID item, TextInfomationDto textInfomationDto)
        {
            bool previouslyExported = resourceString != null;

            if (previouslyExported)
            {
                textInfomationDto.PreviousText = item.Text;
            }
            else
            {
                textInfomationDto.PreviousText = string.Empty;
            }

            return(previouslyExported);
        }
Example #6
0
        private static void GetSetGrammarInformation(Attributes resourceString, StringDataForResourceVersionID item, TextInfomationDto textInfomationDto)
        {
            var grammarInformation = resourceString.GrammarInfo.Where(x => x.StringId == item.StringId).ToList();

            if (grammarInformation.Count > 0)
            {
                foreach (var gInfo in grammarInformation)
                {
                    GrammarInfo grammar = new GrammarInfo
                    {
                        WordClassId        = gInfo.WordClassId,
                        PhraseTemplateId   = gInfo.PhraseTemplateId,
                        PhraseElementId    = gInfo.PhraseElementId,
                        ModifierPositionId = gInfo.ModifierPositionId
                    };
                    textInfomationDto.GrammarInfo.Add(grammar);
                }
            }
        }
Example #7
0
        private List <GetConversationLineChildren> GetChildLinkInfo(int resourceVersionId, TextInfomationDto textInfomationDto)
        {
            var child = m_functionService.Udf_GetConversationLineChildren(resourceVersionId, textInfomationDto.StringId);

            foreach (var childItem in child)
            {
                var conversationLines = m_dbContext.TConversationLine
                                        .Where(x => x.ResourceVersionId == resourceVersionId)
                                        .Where(x => x.TextStringId == childItem.StringId);
                var hoverTextStringId = conversationLines.Select(x => x.HoverTextStringId).FirstOrDefault();
                childItem.HoverTextStringId = hoverTextStringId ?? 0;
                childItem.HasHoverText      = hoverTextStringId.HasValue;
                if (!textInfomationDto.IsHoverText && childItem.HasHoverText)
                {
                    textInfomationDto.IsHoverText = true;
                }
                var paraphraseStringID = conversationLines.Select(x => x.ParaphraseStringId).FirstOrDefault();
                childItem.ParaphraseStringId = paraphraseStringID ?? 0;
                childItem.HasParaphrase      = paraphraseStringID.HasValue;
                if (!textInfomationDto.IsParaphrase && childItem.HasParaphrase)
                {
                    textInfomationDto.IsParaphrase = true;
                }
            }

            return(child);
        }