示例#1
0
        public MarcRecord WriteRecord(MarcRecord record)
        {
            string database = record.Database;

            if (Utility.IsNullOrEmpty(database))
            {
                database = Database;
            }
            Query query = new Query(this, "D");

            query.AddAnsi(database);
            query.Add(0);
            query.Add(1);
            query.AddUtf(record.Encode());
            using (Response response = ExecuteQuery(query))
            {
                response.CheckReturnCode(-201, -600, -602, -603);
                record.Database = Database;
                string line1 = response.ReadUtf();
                string line2 = response.ReadUtf();
                if (string.IsNullOrEmpty(line1) ||
                    string.IsNullOrEmpty(line2))
                {
                    // If AUTOIN.GBL missin from the database,
                    // server returns no updated record
                    return(record);
                }

                MarcRecord.ParseOneOfMany(record,
                                          line1 + Utility.ShortDelimiter + line2);
                return(record);
            }
        }
示例#2
0
        public string FormatRecord(string format,
                                   MarcRecord record)
        {
            Query query = new Query(this, "G");

            query.AddAnsi(Database);
            query.AddAnsi(format);
            query.Add(-2);
            query.AddUtf(record.Encode());
            using (Response response = ExecuteQuery(query))
            {
                response.CheckReturnCode();
                return(response.ReadUtf().Trim());
            }
        }