public clsBorrowerCollection() { //var for the index Int32 Index = 0; //var to store the record count Int32 RecordCount = 0; //object for data connection clsDataConnection DB = new clsDataConnection(); //execute the stored procodure DB.Execute("sproc_BorrowerTable_SelectAll"); //get the count of records RecordCount = DB.Count; //while there are records to process while (Index < RecordCount) { //Create a blank Customer clsBorrower AnBorrower = new clsBorrower(); AnBorrower.BorrowerID = Convert.ToInt32(DB.DataTable.Rows[Index]["BorrowerID"]); AnBorrower.FK_BorrowerTypeID = Convert.ToString(DB.DataTable.Rows[Index]["FK_BorrowerTypeID"]); AnBorrower.FirstName = Convert.ToString(DB.DataTable.Rows[Index]["FirstName"]); AnBorrower.LastName = Convert.ToString(DB.DataTable.Rows[Index]["LastName"]); AnBorrower.Email = Convert.ToString(DB.DataTable.Rows[Index]["Email"]); AnBorrower.TelephoneNo = Convert.ToString(DB.DataTable.Rows[Index]["TelephoneNo"]); AnBorrower.Address1 = Convert.ToString(DB.DataTable.Rows[Index]["Address1"]); AnBorrower.Address2 = Convert.ToString(DB.DataTable.Rows[Index]["Address2"]); AnBorrower.City = Convert.ToString(DB.DataTable.Rows[Index]["City"]); AnBorrower.PostCode = Convert.ToString(DB.DataTable.Rows[Index]["PostCode"]); AnBorrower.City = Convert.ToString(DB.DataTable.Rows[Index]["City"]); AnBorrower.BorrowerStatus = Convert.ToString(DB.DataTable.Rows[Index]["BorrowerStatus"]); AnBorrower.BorrowerRecords = Convert.ToString(DB.DataTable.Rows[Index]["BorrowerRecords"]); AnBorrower.BorrowerPassword = Convert.ToString(DB.DataTable.Rows[Index]["BorrowerPassword"]); //add the records into a private data member mBorrowerList.Add(AnBorrower); //point to the next record Index++; } }
void PopulateArray(clsDataConnection DB) { //populates array list based on the data table in the parameter DB //var for the index Int32 Index = 0; //var to store the record count. Int32 RecordCount; //get the count of records RecordCount = DB.Count; //clear the private array lsit mBorrowerList = new List <clsBorrower>(); //while there are records to process while (Index < RecordCount) { clsBorrower AnBorrower = new clsBorrower(); AnBorrower.BorrowerID = Convert.ToInt32(DB.DataTable.Rows[Index]["BorrowerID"]); AnBorrower.FK_BorrowerTypeID = Convert.ToString(DB.DataTable.Rows[Index]["FK_BorrowerTypeID"]); AnBorrower.FirstName = Convert.ToString(DB.DataTable.Rows[Index]["FirstName"]); AnBorrower.LastName = Convert.ToString(DB.DataTable.Rows[Index]["LastName"]); AnBorrower.Email = Convert.ToString(DB.DataTable.Rows[Index]["Email"]); AnBorrower.TelephoneNo = Convert.ToString(DB.DataTable.Rows[Index]["TelephoneNo"]); AnBorrower.Address1 = Convert.ToString(DB.DataTable.Rows[Index]["Address1"]); AnBorrower.Address2 = Convert.ToString(DB.DataTable.Rows[Index]["Address2"]); AnBorrower.City = Convert.ToString(DB.DataTable.Rows[Index]["City"]); AnBorrower.PostCode = Convert.ToString(DB.DataTable.Rows[Index]["PostCode"]); AnBorrower.City = Convert.ToString(DB.DataTable.Rows[Index]["City"]); AnBorrower.BorrowerStatus = Convert.ToString(DB.DataTable.Rows[Index]["BorrowerStatus"]); AnBorrower.BorrowerRecords = Convert.ToString(DB.DataTable.Rows[Index]["BorrowerRecords"]); AnBorrower.BorrowerPassword = Convert.ToString(DB.DataTable.Rows[Index]["BorrowerPassword"]); //add the records into a private data member mBorrowerList.Add(AnBorrower); //point to the next record Index++; } }