Exemplo n.º 1
0
        /// <summary>
        ///  Form will delete  Supplier , after delete form will be cleared and make form open for New Mode .
        /// </summary>
        private void btnDelete_Click(object sender, System.EventArgs e)
        {
            try
            {
                //If no item is selected, then on click system displays “Please select at least one item.”
                if (string.IsNullOrEmpty(editSupplierCode))
                {
                    MessageBox.Show("Please select at least one item.");
                    return;
                }

                //On click of delete the system prompts “ Are you sure you wish to delete the selected items”

                if (MessageBox.Show("Are you sure you wish to delete the selected items", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (supplierManager.DeleteByID(this.supplierModel.SupplierCode))
                    {
                        MessageBox.Show("Delete successfully");
                        clearForm();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }