Exemple #1
0
        private void RemoveCheckedProduct_Click(object sender, EventArgs e)
        {
            List <ProductRawData> removeList = new List <ProductRawData>();

            for (int i = 0; i < ProductsList.Items.Count; i++)
            {
                if (ProductsList.GetItemChecked(i))
                {
                    ProductRawData tempData = new ProductRawData();
                    tempData.RefactorString(ProductsList.Items[i].ToString());
                    removeList.Add(tempData);
                }
            }

            for (int i = 0; i < removeList.Count; i++)
            {
                bool DONE = controller.RemoveProduct(removeList[i].ID);
                if (DONE)
                {
                    MessageBox.Show(removeList[i].ToString() + " Removed");
                }
                else
                {
                    MessageBox.Show(removeList[i].ToString() + " Remove Failed");
                }
            }

            RefreshProductsList_Click(sender, e);
        }