/// <summary>
        /// The subfield must not contain bad characters.
        /// </summary>
        protected void MustNotContainBadCharacters
        (
            [NotNull] RecordField field,
            [NotNull] SubField subField
        )
        {
            string text = subField.Text;

            if (!string.IsNullOrEmpty(text))
            {
                int position = RuleUtility.BadCharacterPosition(text);
                if (position >= 0)
                {
                    AddDefect
                    (
                        field,
                        subField,
                        3,
                        "Подполе {0}^{1} содержит"
                        + "запрещённые символы: {2}",
                        field.Tag,
                        subField.Code,
                        GetTextAtPosition(text, position)
                    );
                }
            }
        }
Beispiel #2
0
        public RecordReport CheckRecord
        (
            [NotNull] RuleContext context
        )
        {
            RecordReport result = new RecordReport
            {
                Description = context.Client.FormatRecord
                              (
                    context.BriefFormat,
                    context.Record.Mfn
                              ),
                Index = context.Record.FM("903"),
                Mfn   = context.Record.Mfn
            };

            RuleUtility.RenumberFields
            (
                context.Record
            );

            result.Gold = 1000;
            int bonus = 0;

            foreach (IrbisRule rule in Rules)
            {
                RuleReport oneReport = rule.CheckRecord(context);
                result.Defects.AddRange(oneReport.Defects);
                result.Gold -= oneReport.Damage;
                bonus       += oneReport.Bonus;
            }

            if (result.Gold >= 900)
            {
                result.Gold += bonus;
            }

            return(result);
        }