public void PopulateArray(clsDataConnection db) { // populates array list based on the data table in the parameter // var for index Int32 Index = 0; //var to store record count Int32 RecordCount = db.Count; //clear private Array list mBrandList = new List <clsBrand>(); // while there are records to process while (Index < RecordCount) { // create brand clsBrand Brand = new clsBrand(); Brand.BrandID = Convert.ToInt32(db.DataTable.Rows[Index]["BrandID"]); Brand.BrandName = Convert.ToString(db.DataTable.Rows[Index]["BrandName"]); Brand.TopProduct = Convert.ToInt32(db.DataTable.Rows[Index]["TopProduct"]); Brand.LatestProduct = Convert.ToInt32(db.DataTable.Rows[Index]["LatestProduct"]); Brand.LastRestock = Convert.ToDateTime(db.DataTable.Rows[Index]["LastRestock"]); Brand.AvgPrice = Convert.ToDouble(db.DataTable.Rows[Index]["AvgPrice"]); Brand.IsListed = Convert.ToBoolean(db.DataTable.Rows[Index]["IsListed"]); mBrandList.Add(Brand); // point to next brand Index++; } }
public override bool Equals(Object obj) { if (obj == null || this.GetType().Name != obj.GetType().Name) { return(false); } clsBrand other = (clsBrand)obj; return(this.BrandID == other.BrandID); }