/// <summary>
        /// Разбор записи.
        /// </summary>
        public static MagazineInfo Parse
        (
            IrbisRecord record
        )
        {
            if (ReferenceEquals(record, null))
            {
                throw new ArgumentNullException("record");
            }

            MagazineInfo result = new MagazineInfo
            {
                Index        = record.FM("903"),
                Title        = record.FM("200", 'a'),
                SubTitle     = record.FM("200", 'e'),
                Cumulation   = MagazineCumulation.Parse(record),
                SeriesNumber = record.FM("923", 'h'),
                SeriesTitle  = record.FM("923", 'i'),
                Mfn          = record.Mfn
            };

            if (string.IsNullOrEmpty(result.Title) ||
                string.IsNullOrEmpty(result.Index)
                //|| string.IsNullOrEmpty(result.MagazineKind)
                //|| string.IsNullOrEmpty(result.MagazineType)
                )
            {
                return(null);
            }

            return(result);
        }
示例#2
0
        public static MorphologyEntry Parse
        (
            [NotNull] IrbisRecord record
        )
        {
            if (ReferenceEquals(record, null))
            {
                throw new ArgumentException("record");
            }

            MorphologyEntry result = new MorphologyEntry
            {
                MainTerm   = record.FM("10"),
                Dictionary = record.FM("11"),
                Language   = record.FM("12"),
                Forms      = record.FMA("20")
            };

            return(result);
        }
示例#3
0
        internal void CopyRecord(string fromMfn, string toMfn, string recordIndex)
        {
            _recordIndex = "(" + recordIndex + ") ";
            recordFrom   = client.ReadRecord(Int32.Parse(fromMfn));
            recordTo     = client.ReadRecord(Int32.Parse(toMfn));
            try
            {
                RecordField fiedl922 = new RecordField("922");
                AddSubfield(fiedl922, 'C', "200", 'A');
                AddSubfield(fiedl922, 'F', "700", 'A');
                AddSubfield(fiedl922, '?', "700", 'G');
                AddSubfield(fiedl922, '1', "700", '1');
                AddSubfield(fiedl922, 'A', "700", 'C');
                recordTo.Fields.Add(fiedl922);

                CopyField("300");
                CopyField("331");
                CopySubField("215", 'A');
                CopySubField("316", 'A');


                foreach (RecordField field210 in recordFrom.Fields.GetField("210"))
                {
                    if (!field210.ToString().Contains("^5"))
                    {
                        _recordIndex = _recordIndex.Replace(" ", "");
                    }

                    var field   = new RecordField("210");
                    var sub2105 = new SubField('5', _recordIndex + field210.GetFirstSubFieldText('5'));
                    var sub210d = new SubField('D', field210.GetFirstSubFieldText('d'));
                    field.SubFields.Add(sub210d);
                    field.SubFields.Add(sub2105);
                    logging.WriteLine(field.Text);
                    recordTo.Fields.Add(field);
                    logging.WriteLine(recordTo.FM("210"));
                }



                client.WriteRecord
                (
                    recordTo,
                    false,
                    true
                );
            }
            catch (Exception ex)
            {
                logging.WriteLine("ERROR DURING COPYING RECORD! ");
                logging.WriteLine(ex.StackTrace);
                logging.WriteLine(ex.ToString());
            }
        }
示例#4
0
        public static BookRequest Parse(IrbisRecord record)
        {
            BookRequest result = new BookRequest
            {
                Mfn               = record.Mfn,
                BookDescription   = record.FM("201"),
                BookCode          = record.FM("903"),
                RequestDate       = record.FM("40"),
                ReaderID          = record.FM("30"),
                ReaderDescription = record.FM("31"),
                Database          = record.FM("1"),
                RejectInfo        = record.FM("44"),
                Place             = record.FM("102"),
                ResponsiblePerson = record.FM("50"),
                Record            = record
            };

            return(result);
        }
示例#5
0
 private void CopyField(string tagFrom)
 {
     if (!String.IsNullOrEmpty(recordFrom.FM(tagFrom)))
     {
         foreach (string field in recordFrom.FMA(tagFrom))
         {
             recordTo.Fields.Add(new RecordField(tagFrom, _recordIndex + field));
         }
     }
 }
        /// <summary>
        /// Разбор записи.
        /// </summary>
        public static MagazineIssueInfo Parse
        (
            IrbisRecord record
        )
        {
            if (ReferenceEquals(record, null))
            {
                throw new ArgumentNullException("record");
            }

            MagazineIssueInfo result = new MagazineIssueInfo
            {
                Mfn          = record.Mfn,
                DocumentCode = record.FM("903"),
                MagazineCode = record.FM("933"),
                Year         = record.FM("934"),
                Volume       = record.FM("935"),
                Number       = record.FM("936"),
                Supplement   = record.FM("931", 'c'),
                Worksheet    = record.FM("920"),
                Articles     = record.Fields
                               .GetField("922")
                               .Select(MagazineArticleInfo.Parse)
                               .ToArray(),
                Exemplars = record.Fields
                            .GetField("910")
                            .Select(ExemplarInfo.Parse)
                            .ToArray()
            };

            if (string.IsNullOrEmpty(result.Number))
            {
                return(null);
            }

            return(result);
        }
示例#7
0
        public static ReaderInfo Parse(IrbisRecord record)
        {
            ReaderInfo result = new ReaderInfo
            {
                FamilyName             = record.FM("10"),
                FirstName              = record.FM("11"),
                Patronym               = record.FM("12"),
                Birthdate              = record.FM("21"),
                Ticket                 = record.FM("30"),
                Sex                    = record.FM("23"),
                Category               = record.FM("50"),
                Address                = record.FM("13"),
                Work                   = record.FM("15"),
                Education              = record.FM("20"),
                HomePhone              = record.FM("17"),
                RegistrationDateString = record.FM("51"),
                Registrations          = record.Fields
                                         .GetField("52")
                                         .Select(field => RegistrationInfo.Parse(field))
                                         .ToArray(),
                EnabledPlaces  = record.FM("56"),
                DisabledPlaces = record.FM("57"),
                Rights         = record.FM("29"),
                Remarks        = record.FM("33"),
                PhotoFile      = record.FM("950"),
                Visits         = record.Fields
                                 .GetField("40")
                                 .Select(field => VisitInfo.Parse(field))
                                 .ToArray()
            };

            string fio = result.FamilyName;

            if (!string.IsNullOrEmpty(result.FirstName))
            {
                fio = fio + " " + result.FirstName;
            }
            if (!string.IsNullOrEmpty(result.Patronym))
            {
                fio = fio + " " + result.Patronym;
            }
            result.Fio = fio;

            return(result);
        }
示例#8
0
        public static ReaderInfo Parse
        (
            [JetBrains.Annotations.NotNull] IrbisRecord record
        )
        {
            if (ReferenceEquals(record, null))
            {
                throw new ArgumentNullException("record");
            }

            ReaderInfo result = new ReaderInfo
            {
                FamilyName = record.FM("10"),
                FirstName  = record.FM("11"),
                Patronym   = record.FM("12"),
                Birthdate  = record.FM("21"),
                Ticket     = record.FM("30"),
                Gender     = record.FM("23"),
                Category   = record.FM("50"),
                Address    = ReaderAddress.Parse
                             (
                    record.Fields
                    .GetField("13")
                    .FirstOrDefault()
                             ),
                Work      = record.FM("15"),
                Education = record.FM("20"),
                Email     = record.FM("32"),
                HomePhone = record.FM("17"),
                RegistrationDateString = record.FM("51"),
                Enrolment = record.Fields
                            .GetField("51")
                            .Select(ReaderRegistration.Parse)
                            .ToArray(),
                Registrations = record.Fields
                                .GetField("52")
                                .Select(ReaderRegistration.Parse)
                                .ToArray(),
                EnabledPlaces  = record.FM("56"),
                DisabledPlaces = record.FM("57"),
                Rights         = record.FM("29"),
                Remarks        = record.FM("33"),
                PhotoFile      = record.FM("950"),
                Visits         = record.Fields
                                 .GetField("40")
                                 .Select(VisitInfo.Parse)
                                 .ToArray(),
                Profiles = IriProfile.ParseRecord(record)
            };

            foreach (ReaderRegistration registration in result.Registrations)
            {
                registration.Reader = result;
            }
            foreach (VisitInfo visit in result.Visits)
            {
                visit.Reader = result;
            }

            string fio = result.FamilyName;

            if (!string.IsNullOrEmpty(result.FirstName))
            {
                fio = fio + " " + result.FirstName;
            }
            if (!string.IsNullOrEmpty(result.Patronym))
            {
                fio = fio + " " + result.Patronym;
            }
            result.Fio = fio;

            return(result);
        }