Exemplo n.º 1
0
        public override RuleReport CheckRecord
        (
            RuleContext context
        )
        {
            BeginCheck(context);

            if (IsBook())
            {
                RecordField[] fields = GetFields();

                if (fields.Length == 0)
                {
                    AddDefect
                    (
                        "60",
                        3,
                        "Отстутсвует поле 60: Раздел знаний"
                    );
                }

                _menu = CacheMenu("rzn.mnu", _menu);
            }

            return(EndCheck());
        }
Exemplo n.º 2
0
        /// <inheritdoc cref="IrbisRule.CheckRecord"/>
        public override RuleReport CheckRecord
        (
            RuleContext context
        )
        {
            BeginCheck(context);

            RecordField[] fields = GetFields();
            if (fields.Length == 0)
            {
                AddDefect
                (
                    "102",
                    10,
                    "Не заполнено поле 102: Страна"
                );
            }

            MustBeUniqueField
            (
                fields
            );

            _menu = CacheMenu("str.mnu", _menu);
            foreach (RecordField field in fields)
            {
                CheckField(field);
            }

            return(EndCheck());
        }
Exemplo n.º 3
0
        public string DecodeViaDictionary
        (
            string format
        )
        {
            if (string.IsNullOrEmpty(format))
            {
                return(string.Empty);
            }

            char delimiter = format.Contains('!')
                ? '!'
                : '\\';

            bool caseSensitive = delimiter == '\\';

            string[] parts = format.Split(delimiter);
            if (parts.Length != 2)
            {
                return(string.Empty);
            }

            IrbisMenu menu = IrbisMenu.Read
                             (
                Context.Client,
                parts[0]
                             );
            string result = caseSensitive
                ? menu.GetStringSensitive(parts[1], string.Empty)
                : menu.GetString(parts[1], string.Empty);

            return(result);
        }
Exemplo n.º 4
0
        protected IrbisMenu CacheMenu
        (
            [NotNull] string name,
            [CanBeNull] IrbisMenu menu
        )
        {
            menu = menu ?? IrbisMenu.Read(Client, name);

            return(menu);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Check the value against the menu.
        /// </summary>
        protected bool CheckForMenu
        (
            [CanBeNull] IrbisMenu menu,
            [CanBeNull] string value
        )
        {
            if (ReferenceEquals(menu, null))
            {
                return(true);
            }
            if (string.IsNullOrEmpty(value))
            {
                return(true);
            }

            IrbisMenu.Entry entry = menu.GetEntrySensitive(value);

            return(entry != null);
        }
Exemplo n.º 6
0
        /// <inheritdoc cref="IrbisRule.CheckRecord"/>
        public override RuleReport CheckRecord
        (
            RuleContext context
        )
        {
            BeginCheck(context);

            if (!IsBook())
            {
                goto DONE;
            }

            RecordField[] fields = GetFields();
            if (fields.Length == 0)
            {
                AddDefect
                (
                    "910",
                    10,
                    "Нет сведений об экземплярах: поле 910"
                );
            }

            _statusMenu = CacheMenu("ste.mnu", _statusMenu);
            _placeMenu  = CacheMenu("mhr.mnu", _placeMenu);

            foreach (RecordField field in fields)
            {
                CheckField(field);
            }

            MustBeUniqueSubfield
            (
                fields,
                'b'
            );

            DONE : return(EndCheck());
        }