/// <summary> /// Convert an IDataReader instance's contents into a stream of DocumentInfo objects /// </summary> /// <param name="reader">IDataReader instance to convert</param> /// <returns>Enumeration of DocumentInfo</returns> public static IEnumerable <DocumentInfo> FromDataReader(IDataReader reader) { while (reader.Read()) { DocumentInfo res = null; try { if (UserChecks.IsAdmin) { res = new UpatableDocumentInfo(); } else { res = new DocumentInfo(); } res.DocumentID = reader.LongValue(0) ?? 0; res.ClientName = reader.StringValue(1); res.CaseName = reader.StringValue(2); res.DocType = reader.StringValue(3); res.DocDescription = reader.StringValue(4); res.CheckedOut = reader.DateTimeValue(5); res.CheckoutUser = reader.StringValue(6); res.CheckoutLocation = reader.StringValue(7); res.CheckoutUserID = reader.IntValue(8); } catch { } if (res == null) { yield break; } yield return(res); } }
/// <summary> /// Convert an IDataReader instance's contents into a stream of DocumentInfo objects /// </summary> /// <param name="reader">IDataReader instance to convert</param> /// <returns>Enumeration of DocumentInfo</returns> public static IEnumerable<DocumentInfo> FromDataReader(IDataReader reader) { while (reader.Read()) { DocumentInfo res = null; try { if (UserChecks.IsAdmin) res = new UpatableDocumentInfo(); else res = new DocumentInfo(); res.DocumentID = reader.LongValue(0) ?? 0; res.ClientName = reader.StringValue(1); res.CaseName = reader.StringValue(2); res.DocType = reader.StringValue(3); res.DocDescription = reader.StringValue(4); res.CheckedOut = reader.DateTimeValue(5); res.CheckoutUser = reader.StringValue(6); res.CheckoutLocation = reader.StringValue(7); res.CheckoutUserID = reader.IntValue(8); } catch { } if (res == null) yield break; yield return res; } }