Esempio n. 1
0
        private void DeleteSubCategory()
        {
            Cursor.Current = Cursors.WaitCursor;
            ProductSubcategory psc = new ProductSubcategory();
            int subID = 0;

            try
            {
                subID = Int32.Parse(lblSubcategoryID.Text);
            }
            catch
            {
                MessageBox.Show("Select a subcategory to delete", "Product Subcategories", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Cursor.Current = Cursors.Default;
                return;
            }
            try
            {
                psc.ProductSubcategoryID = subID;
                psc.RemoveProductSubcategory(subID);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Product Subcategories", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Cursor.Current = Cursors.Default;
            }
            finally
            {
                psc = null;
            }

            Cursor.Current = Cursors.Default;
        }