示例#1
0
        public static bool IsSegmentWithComments(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            if (!rowInfo.IsSegment)
            {
                return(false);
            }

            var success = settings.SegmentReviewTypes.ToList()
                          .Any(status => string.Compare(status, DisplayFilterSettings.SegmentReviewType.WithComments.ToString()
                                                        , StringComparison.OrdinalIgnoreCase) == 0);

            var visitor = new CommentDataVisitor();

            // check if comments exist in the target segment
            if (success && !visitor.GetComments(rowInfo.SegmentPair.Target).Any())
            {
                // check if comments exit in the source segment
                if (!visitor.GetComments(rowInfo.SegmentPair.Source).Any())
                {
                    success = false;
                }
            }

            return(success);
        }
        public static bool IsOriginTypeFound(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            if (!rowInfo.IsSegment)
            {
                return(false);
            }

            var success = false;

            var translationType = rowInfo.SegmentPair.GetOriginType();

            if (!IsCompoundOriginType(translationType) && settings.OriginTypes.ToList().Any(status
                                                                                            => string.Compare(status, translationType.ToString(), StringComparison.OrdinalIgnoreCase) == 0))
            {
                success = true;
            }

            if (!success)
            {
                success = rowInfo.IsFuzzyMatchRepairOriginTypeFound(settings);
            }

            if (!success)
            {
                success = rowInfo.IsEditedFuzzyMatchFound(settings);
            }

            if (!success)
            {
                success = rowInfo.IsUnEditedFuzzyMatchFound(settings);
            }

            return(success);
        }
示例#3
0
        public DisplayFilter(DisplayFilterSettings settings, CustomFilterSettings customSettings, Document document)
        {
            ActiveDocument = document;

            Settings       = settings;
            CustomSettings = customSettings;
        }
示例#4
0
        public static bool IsUniqueRepetition(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            if (!rowInfo.IsSegment)
            {
                return(false);
            }

            if (settings.RepetitionTypes.Any(a => a == DisplayFilterSettings.RepetitionType.UniqueOccurrences.ToString()))
            {
                var isFirst = rowInfo.IsRepetitionsFirstOccurrences(new DisplayFilterSettings
                {
                    RepetitionTypes = new List <string> {
                        DisplayFilterSettings.RepetitionType.FirstOccurrences.ToString()
                    }
                });

                if (isFirst)
                {
                    return(true);
                }

                if (rowInfo.SegmentPair.Properties.TranslationOrigin != null)
                {
                    var isRepeated = rowInfo.SegmentPair.Properties.TranslationOrigin.IsRepeated;
                    return(!isRepeated);
                }
            }

            return(false);
        }
示例#5
0
        public static bool IsSegmentLockingTypes(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            var success = rowInfo.IsSegmentLockingTypeLocked(settings) ||
                          rowInfo.IsSegmentLockingTypeUnLocked(settings);

            return(success);
        }
示例#6
0
        private static bool AreBothSourceAndTargetTrackedSelected(DisplayFilterSettings settings)
        {
            var hasSourceTrackedChangesSelected = HasReviewTypeSelected(DisplayFilterSettings.SegmentReviewType.WithSourceTrackedChanges.ToString(), settings.SegmentReviewTypes);
            var hasTargetTrackedChangesSelected = HasReviewTypeSelected(DisplayFilterSettings.SegmentReviewType.WithTargetTrackedChanges.ToString(), settings.SegmentReviewTypes);

            return(hasSourceTrackedChangesSelected && hasTargetTrackedChangesSelected);
        }
        public static bool IsSegmentContentTypes(this DisplayFilterRowInfo rowInfo,
                                                 DisplayFilterSettings settings)
        {
            var success = rowInfo.IsSegmentContentTypeNumbersOnly(settings) ||
                          rowInfo.IsSegmentContentTypeExcludingNumberOnly(settings);

            return(success);
        }
示例#8
0
        public DisplayFilter(DisplayFilterSettings settings, CustomFilterSettings customSettings, bool reverseSearch,
                             Document document)
        {
            ActiveDocument = document;

            Settings       = settings;
            CustomSettings = customSettings;
            ReverseSearch  = reverseSearch;
        }
示例#9
0
        public static bool IsSegmentReviewTypes(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            var success = rowInfo.IsSegmentWithTQAs(settings) ||
                          rowInfo.IsSegmentWithTrackedChanges(settings) ||
                          rowInfo.IsSegmentWithComments(settings) ||
                          rowInfo.IsSegmentWithMessages(settings);

            return(success);
        }
示例#10
0
        public static bool IsRepetitionTypes(this DisplayFilterRowInfo rowInfo,
                                             DisplayFilterSettings settings)
        {
            var success = rowInfo.IsRepetitionsAll(settings) ||
                          rowInfo.IsRepetitionsFirstOccurrences(settings) ||
                          rowInfo.IsRepetitionsExcludingFirstOccurrences(settings);

            return(success);
        }
示例#11
0
        public static bool IsConfirmationLevelFound(this DisplayFilterRowInfo rowInfo,
                                                    DisplayFilterSettings settings)
        {
            var success = settings.ConfirmationLevels.ToList().Any(status => string.Compare(status
                                                                                            , rowInfo.SegmentPair.Properties.ConfirmationLevel.ToString()
                                                                                            , StringComparison.OrdinalIgnoreCase) == 0);

            return(success);
        }
示例#12
0
        public static bool IsTextFoundInTarget(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            var text = rowInfo.SegmentPair.Target.GetString(true);

            var success = settings.IsRegularExpression
                                ? RegularExpressionMatch(settings.TargetText, text, settings.IsCaseSensitive)
                                : StringMatch(settings.TargetText, text, settings.IsCaseSensitive);

            return(success);
        }
        public static bool IsOriginTypeFound(this DisplayFilterRowInfo rowInfo,
                                             DisplayFilterSettings settings)
        {
            var translationType =
                rowInfo.SegmentPair.GetOriginType();

            var success = settings.OriginTypes.ToList()
                          .Any(status => string.Compare(status, translationType.ToString()
                                                        , StringComparison.OrdinalIgnoreCase) == 0);

            return(success);
        }
示例#14
0
        public static bool IsSegmentWithTQAs(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            var success = settings.SegmentReviewTypes.ToList()
                          .Any(status => string.Compare(status, DisplayFilterSettings.SegmentReviewType.WithTQA.ToString()
                                                        , StringComparison.OrdinalIgnoreCase) == 0);

            if (success && !rowInfo.ContainsTQAs)
            {
                success = false;
            }

            return(success);
        }
示例#15
0
        public static bool IsRepetitionsAll(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            var success = settings.RepetitionTypes.ToList()
                          .Any(status => string.Compare(status, DisplayFilterSettings.RepetitionType.All.ToString()
                                                        , StringComparison.OrdinalIgnoreCase) == 0);

            if (success)
            {
                success = rowInfo.SegmentPair.Properties.TranslationOrigin.IsRepeated;
            }

            return(success);
        }
示例#16
0
        public static bool IsSegmentContentTypes(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            var success = settings.SegmentContentTypes?[0] == DisplayFilterSettings.SegmentContentType.NumbersOnly.ToString() &&
                          rowInfo.IsSegmentContentTypeNumbersOnly(settings);

            if (!success && settings.SegmentContentTypes?[0] == DisplayFilterSettings.SegmentContentType.ExcludeNumberOnly.ToString() &&
                rowInfo.IsSegmentContentTypeExcludingNumberOnly(settings))
            {
                success = true;
            }

            return(success);
        }
示例#17
0
        public static bool IsTextFoundInComment(this DisplayFilterRowInfo rowInfo,
                                                DisplayFilterSettings settings)
        {
            var success = rowInfo.SegmentPair.Target.GetComments()
                          .Any(comment => StringMatch(settings.CommentText, comment.Text, false));

            if (!success)
            {
                success = rowInfo.SegmentPair.Source.GetComments()
                          .Any(comment => StringMatch(settings.CommentText, comment.Text, false));
            }

            return(success);
        }
示例#18
0
        public static bool IsSegmentContentTypes(this DisplayFilterRowInfo rowInfo,
                                                 DisplayFilterSettings settings)
        {
            if (settings.SegmentContentTypes?[0] == "NumbersOnly")
            {
                return(rowInfo.IsSegmentContentTypeNumbersOnly(settings));
            }
            if (settings.SegmentContentTypes?[0] == "ExcludeNumberOnly")
            {
                return(rowInfo.IsSegmentContentTypeExcludingNumberOnly(settings));
            }

            return(true);
        }
示例#19
0
        public static bool IsSegmentLockingTypeLocked(this DisplayFilterRowInfo rowInfo,
                                                      DisplayFilterSettings settings)
        {
            var success = settings.SegmentLockingTypes.ToList()
                          .Any(status => string.Compare(status, DisplayFilterSettings.SegmentLockingType.Locked.ToString()
                                                        , StringComparison.OrdinalIgnoreCase) == 0);

            if (success)
            {
                success = rowInfo.SegmentPair.Properties.IsLocked;
            }

            return(success);
        }
示例#20
0
        public static bool IsSeverityFoundInComment(this DisplayFilterRowInfo rowInfo,
                                                    DisplayFilterSettings settings)
        {
            var success = rowInfo.SegmentPair.Target.GetComments()
                          .Any(comment => settings.CommentSeverity == (int)comment.Severity);

            if (!success)
            {
                success = rowInfo.SegmentPair.Source.GetComments()
                          .Any(comment => settings.CommentSeverity == (int)comment.Severity);
            }

            return(success);
        }
示例#21
0
        public static bool IsRepetitionsExcludingFirstOccurrences(this DisplayFilterRowInfo rowInfo,
                                                                  DisplayFilterSettings settings)
        {
            var success = settings.RepetitionTypes.ToList()
                          .Any(status => string.Compare(status, DisplayFilterSettings.RepetitionType.ExcludeFirstOccurrences.ToString()
                                                        , StringComparison.OrdinalIgnoreCase) == 0);

            if (success)
            {
                success = rowInfo.RepetitionExcludeFirstOccurrence;
            }

            return(success);
        }
示例#22
0
        public static bool IsTextFoundInSource(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            if (!rowInfo.IsSegment)
            {
                return(false);
            }

            var text = rowInfo.SegmentPair.Source.GetString(true);

            var success = settings.IsRegularExpression
                                ? RegularExpressionMatch(settings.SourceText, text, settings.IsCaseSensitive)
                                : StringMatch(settings.SourceText, text, settings.IsCaseSensitive);

            return(success);
        }
示例#23
0
        public JsonResult DisplayJobOrderBalanceFill(Display_JobOrderBalanceViewModel vm)
        {
            DisplayFilterSettings SettingParameter = SetCurrentParameterSettings(vm);
            IEnumerable <JobOrderBalancelOrderNoWiseViewModel> JobOrderBalanceJobWorkerWise = _JobOrderBalanceService.JobOrderBalanceDetail(SettingParameter);



            if (JobOrderBalanceJobWorkerWise != null)
            {
                JsonResult json = Json(new { Success = true, Data = JobOrderBalanceJobWorkerWise.ToList() }, JsonRequestBehavior.AllowGet);
                json.MaxJsonLength = int.MaxValue;
                return(json);
            }
            return(Json(new { Success = true }, JsonRequestBehavior.AllowGet));
        }
示例#24
0
        public static bool IsAuthorFoundInComment(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            var visitor = new CommentDataVisitor();

            var success = visitor.GetComments(rowInfo.SegmentPair.Target)
                          .Any(comment => StringMatch(settings.CommentAuthor, comment.Author, false));

            if (!success)
            {
                success = visitor.GetComments(rowInfo.SegmentPair.Source)
                          .Any(comment => StringMatch(settings.CommentAuthor, comment.Author, false));
            }

            return(success);
        }
示例#25
0
        public static bool IsContextInfoTypes(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            var success = false;

            if (rowInfo.ContextInfo.Count <= 0)
            {
                return(false);
            }

            if (rowInfo.ContextInfo.Any(contextInfo => settings.ContextInfoTypes.Contains(contextInfo.ContextType)))
            {
                success = true;
            }

            return(success);
        }
示例#26
0
        public static bool IsSegmentContentTypeNumbersOnly(this DisplayFilterRowInfo rowInfo,
                                                           DisplayFilterSettings settings)
        {
            var success = settings.SegmentContentTypes.ToList()
                          .Any(status => string.Compare(status, DisplayFilterSettings.SegmentContentType.NumbersOnly.ToString()
                                                        , StringComparison.OrdinalIgnoreCase) == 0);

            if (success)
            {
                success = rowInfo.SegmentPair.Source.IsValidFloatingNumber();
                if (!success)
                {
                    success = rowInfo.SegmentPair.Target.IsValidFloatingNumber();
                }
            }
            return(success);
        }
示例#27
0
        public static bool IsRepetitionTypes(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings)
        {
            if (!rowInfo.IsSegment)
            {
                return(false);
            }

            var success = rowInfo.IsRepetitionsAll(settings) ||
                          rowInfo.IsRepetitionsFirstOccurrences(settings) ||
                          rowInfo.IsRepetitionsExcludingFirstOccurrences(settings);

            if (!success)
            {
                success = rowInfo.IsUniqueRepetition(settings);
            }

            return(success);
        }
        public static bool IsPreviousOriginTypeFound(this DisplayFilterRowInfo rowInfo,
                                                     DisplayFilterSettings settings)
        {
            var success = false;

            if (rowInfo.SegmentPair.Properties.TranslationOrigin.OriginBeforeAdaptation != null)
            {
                var previousTranslationType =
                    rowInfo.SegmentPair.GetPreviousTranslationOriginType();
                if (settings.PreviousOriginTypes.ToList()
                    .Any(status => string.Compare(status,
                                                  previousTranslationType.ToString()
                                                  , StringComparison.OrdinalIgnoreCase) == 0))
                {
                    success = true;
                }
            }

            return(success);
        }
示例#29
0
 public ContentMatchingService(DisplayFilterSettings settings, CustomFilterSettings customSettings)
 {
     _settings       = settings;
     _customSettings = customSettings;
 }
示例#30
0
 public CustomFilterService(DisplayFilterSettings settings, CustomFilterSettings customSettings, Document document)
 {
     _settings       = settings;
     _customSettings = customSettings;
     _document       = document;
 }