public override bool Equals(System.Object obj) { // If parameter is null return false. if (obj == null) { return(false); } NSAComponent compare = obj as NSAComponent; if ((System.Object)compare == null) { return(false); } // Return true if the ids match: return((componentID == compare.componentID) && (componentID == compare.componentID)); }
public NSAComponent[] getComponents() { Dictionary <int, string> categories = getCategories(); MySqlDataReader componentReader = CustomQuery("SELECT componentid, name, categoryid FROM components WHERE storeid = " + StoreNumber.ToString() + " and deleted = 0;"); List <NSAComponent> itemList = new List <NSAComponent>(); if (componentReader != null) { while (componentReader.Read()) { NSAComponent newcomponent = new NSAComponent(); newcomponent.ComponentID = (int)componentReader["componentid"]; newcomponent.Name = (string)componentReader["name"]; newcomponent.Category = categories[(int)componentReader["categoryid"]]; itemList.Add(newcomponent); } } componentReader.Close(); return(itemList.ToArray()); }