/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of VPURPurchaseOrderCollection</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 11/4/2015 9:57:47 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static VPURPurchaseOrderCollection PopulateObjectsFromReader(IDataReader rdr) { VPURPurchaseOrderCollection list = new VPURPurchaseOrderCollection(); while (rdr.Read()) { VPURPurchaseOrder obj = new VPURPurchaseOrder(); PopulateObjectFromReader(obj, rdr); list.Add(obj); } return(list); }
/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of VPURPurchaseOrderCollection</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 11/4/2015 9:57:47 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static VPURPurchaseOrderCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) { VPURPurchaseOrderCollection list = new VPURPurchaseOrderCollection(); if (rdr.Read()) { VPURPurchaseOrder obj = new VPURPurchaseOrder(); PopulateObjectFromReader(obj, rdr); list.Add(obj); while (rdr.Read()) { obj = new VPURPurchaseOrder(); PopulateObjectFromReader(obj, rdr); list.Add(obj); } oDatabaseHelper.Dispose(); return(list); } else { oDatabaseHelper.Dispose(); return(null); } }
internal static VPURPurchaseOrderCollection PopulateObjectsFromReader(IDataReader rdr) { VPURPurchaseOrderCollection list = new VPURPurchaseOrderCollection(); while (rdr.Read()) { VPURPurchaseOrder obj = new VPURPurchaseOrder(); obj.SupplierID = rdr.GetInt32(rdr.GetOrdinal(VPURPurchaseOrderFields.SupplierID)); obj.SupplierName = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.SupplierName)); if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.Qty))) { obj.Qty = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.Qty)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.PurchaseLineID))) { obj.PurchaseLineID = rdr.GetInt32(rdr.GetOrdinal(VPURPurchaseOrderFields.PurchaseLineID)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.TotalQty))) { obj.TotalQty = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.TotalQty)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.UnitPrice))) { obj.UnitPrice = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.UnitPrice)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.BatchNumber))) { obj.BatchNumber = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.BatchNumber)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ExpiryDate))) { obj.ExpiryDate = rdr.GetDateTime(rdr.GetOrdinal(VPURPurchaseOrderFields.ExpiryDate)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.TaxValue))) { obj.TaxValue = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.TaxValue)); } obj.PurcaseHeaderID = rdr.GetInt32(rdr.GetOrdinal(VPURPurchaseOrderFields.PurcaseHeaderID)); obj.PurchaseDate = rdr.GetDateTime(rdr.GetOrdinal(VPURPurchaseOrderFields.PurchaseDate)); if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.InvoiceNumber))) { obj.InvoiceNumber = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.InvoiceNumber)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.InvoiceDate))) { obj.InvoiceDate = rdr.GetDateTime(rdr.GetOrdinal(VPURPurchaseOrderFields.InvoiceDate)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.PaymentTypeID))) { obj.PaymentTypeID = rdr.GetInt32(rdr.GetOrdinal(VPURPurchaseOrderFields.PaymentTypeID)); } obj.TotalDiscountRatio = rdr.GetDouble(rdr.GetOrdinal(VPURPurchaseOrderFields.TotalDiscountRatio)); if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.TaxTypeName))) { obj.TaxTypeName = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.TaxTypeName)); } obj.IsClosed = rdr.GetBoolean(rdr.GetOrdinal(VPURPurchaseOrderFields.IsClosed)); obj.IsVoid = rdr.GetBoolean(rdr.GetOrdinal(VPURPurchaseOrderFields.IsVoid)); if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ChequeNumber))) { obj.ChequeNumber = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.ChequeNumber)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductName))) { obj.ProductName = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductName)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductCode))) { obj.ProductCode = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductCode)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.IsAcceptBatch))) { obj.IsAcceptBatch = rdr.GetBoolean(rdr.GetOrdinal(VPURPurchaseOrderFields.IsAcceptBatch)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.UserFullName))) { obj.UserFullName = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.UserFullName)); } if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductID))) { obj.ProductID = rdr.GetInt32(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductID)); } list.Add(obj); } return(list); }