private void removeProduct() { try { if (ProductTo.SelectedItem != null) { List <ClientProductProxy> removeList = new List <ClientProductProxy>(); ClientProductProxy thisProduct = null; ProjectProductProxy thisRecord = (ProjectProductProxy)ProductTo.SelectedItem; if (thisRecord.ClientID > 0) { thisProduct = ClientFunctions.ClientsWithProduct(false, thisRecord.ProductID).FirstOrDefault(cwp => cwp.ClientID == thisRecord.ClientID); if (thisProduct == null) { MessageFunctions.InfoAlert("No client product record found for client " + thisRecord.ClientName() + " with product " + thisRecord.ProductName + ". A 'dummy' record will be used instead.", null); thisProduct = ProjectFunctions.DummyClientProduct(thisRecord.Product); } } else { thisProduct = ProjectFunctions.DummyClientProduct(thisRecord.Product); } removeList.Add(thisProduct); bool success = ProjectFunctions.ToggleProjectProducts(removeList, false, Globals.SelectedProjectProxy); if (success) { refreshProductSummaries(false); CommitButton.IsEnabled = true; } } else { MessageFunctions.Error("Error removing products from project: no product selected.", null); } } catch (Exception generalException) { MessageFunctions.Error("Error removing products from project", generalException); } }