protected override void RemoveItem(int index) { ActiveInventoryObject item = this[index]; UPCDictionary.Remove(item.UPC.ToUpperInvariant()); SKUDictionary.Remove(item.SKU.ToUpperInvariant()); ProductIDDictionary.Remove(item.ProductID); item.UnSubscribeToChangeEvents(item_UPCChanged, item_SKUChanged); base.RemoveItem(index); TotalInvested -= (item.WholeSalePrice + item.AdditionalOverhead) * item.Quantity; }
void item_SKUChanged(object sender, ItemChangedEventArgs e) { string key = e.OldValue as string; if (!string.IsNullOrEmpty(key)) { key = key.ToUpperInvariant(); int index = SKUDictionary[key]; SKUDictionary.Remove(key); key = e.NewValue as string; AddSKUItem(key, index); } }