private IList <Document> GetPrintJobs() { IList <Document> documents = new List <Document>(); IDataReader reader; _printQueue.Getprintjobs(5, 10, out reader); if (reader != null) { try { while (reader.Read()) { Document document = new Document(); if (reader["PRINTJOBID"] == DBNull.Value) { document.PrintJobId = null; } else { document.PrintJobId = Convert.ToDouble(reader["PRINTJOBID"]); } if (reader["SEQNUM"] == DBNull.Value) { document.SeqNum = 0; //null; } else { document.SeqNum = Convert.ToInt32(reader["SEQNUM"]); } if (reader["DOCUMENT"] == DBNull.Value) { document.Data = ""; } else { document.Data = reader["DOCUMENT"] as String; } if (reader["WHID"] == DBNull.Value) { document.WarehouseId = ""; } else { document.WarehouseId = reader["WHID"] as String; } documents.Add(document); } } finally { if (reader != null) { reader.Close(); } } } return(documents); }