public void PopulateArray(clsDataConnection DB) { // populates the array list based on the data table in the parameter DB // var for the index Int32 Index = 0; Int32 RecordCount; RecordCount = DB.Count; //clear the private array mSupplyList = new List <clsSupply>(); //while there are records to process while (Index < RecordCount) { //create a blank address clsSupply Supplier = new clsSupply(); //read in the fields from the current record Supplier.InStock = Convert.ToBoolean(DB.DataTable.Rows[Index]["InStock"]); } }
public clsSupplyCollection() { Int32 Index = 0; Int32 Recordcount = 0; clsDataConnection DB = new clsDataConnection(); DB.Execute("sproc_tblSupply_SelectAll"); Recordcount = DB.Count; while (Index < Recordcount) { clsSupply Supplier = new clsSupply(); Supplier.ProductID = Convert.ToInt32(DB.DataTable.Rows[Index]["ProductID"]); Supplier.DeliveryDate = Convert.ToDateTime(DB.DataTable.Rows[Index]["DeliveryDate"]); Supplier.Price = Convert.ToDouble(DB.DataTable.Rows[Index]["Price"]); Supplier.Name = Convert.ToString(DB.DataTable.Rows[Index]["Name"]); Supplier.InStock = Convert.ToBoolean(DB.DataTable.Rows[Index]["InStock"]); Supplier.Quantity = Convert.ToInt32(DB.DataTable.Rows[Index]["Quantity"]); mSupplyList.Add(Supplier); Index++; } }