-
-
Save wanion/6476488ec4bd381897ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using BatchCat; | |
using System.Collections; | |
namespace Batch | |
{ | |
class Program | |
{ | |
private ClassBatchCat batch; | |
public Program() { | |
batch = new ClassBatchCat(); | |
} | |
static void Main(string[] args) | |
{ | |
Program p = new Program(); | |
p.Connect("username", "password"); | |
// create reader & open file | |
TextReader tr = new StreamReader("../../input.txt"); | |
// read a line of text | |
String id; | |
while ((id = tr.ReadLine()) != null) | |
{ | |
p.DeleteMFHD(Convert.ToInt32(id)); | |
} | |
// close the stream | |
tr.Close(); | |
} | |
Boolean Connect(String username, String password) | |
{ | |
ConnectReturnCodes result; | |
result = this.batch.Connect("C:/Voyager", username, password); | |
if (result == ConnectReturnCodes.crSuccess) | |
{ | |
Console.WriteLine("Connect successful."); | |
return true; | |
} | |
else | |
{ | |
Console.WriteLine("Connect failed!"); | |
return false; | |
} | |
} | |
Boolean DeleteMFHD(int id) | |
{ | |
Console.Write("Delete MFHD " + id + ": "); | |
DeleteHoldingReturnCode result; | |
result = this.batch.DeleteHoldingRecord(id); | |
if (result == DeleteHoldingReturnCode.dhSuccess) | |
{ | |
Console.WriteLine("Success"); | |
return true; | |
} | |
else if (result == DeleteHoldingReturnCode.dhUnknownError) | |
{ | |
Console.WriteLine("Error, Unknown Error"); | |
return false; | |
} | |
else if (result == DeleteHoldingReturnCode.dhInvalidRecordID) | |
{ | |
Console.WriteLine("Error, Invalid Record ID"); | |
return false; | |
} | |
else if (result == DeleteHoldingReturnCode.dhItemsRecordsAttached) | |
{ | |
Console.WriteLine("Error, Item Records Attached"); | |
return false; | |
} | |
else if (result == DeleteHoldingReturnCode.dhLineItemsCopyAttached) | |
{ | |
Console.WriteLine("Error, Line Items Copy Attached"); | |
return false; | |
} | |
else if (result == DeleteHoldingReturnCode.dhEItemsAttached) | |
{ | |
Console.WriteLine("Error, Electronic Items Attached"); | |
return false; | |
} | |
else if (result == DeleteHoldingReturnCode.dhOpacRequestAttached) | |
{ | |
Console.WriteLine("Error, OPAC Request Attached"); | |
return false; | |
} | |
else if (result == DeleteHoldingReturnCode.dhCallslipAttached) | |
{ | |
Console.WriteLine("Error, Callslip Attached"); | |
return false; | |
} | |
else if (result == DeleteHoldingReturnCode.dhHoldRecallAttached) | |
{ | |
Console.WriteLine("Error, Hold/Recall Attached"); | |
return false; | |
} | |
else if (result == DeleteHoldingReturnCode.dhReadOnly) | |
{ | |
Console.WriteLine("Error, Read Only"); | |
return false; | |
} | |
else | |
{ | |
Console.WriteLine("Error"); | |
return false; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment