Exemplo n.º 1
0
        private void btnDeleteFinishProduct_Click(object sender, EventArgs e)
        {
            if (this.FinishProductSelect)
            {
                DialogResult dr = MessageBox.Show(this, "Are you sure, You want to Delete selected Record?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    try
                    {
                        int x = objFinishProductDL.Delete(OriginalFinishProductCode);
                        gvFinishProduct.DataSource = objFinishProductDL.GetDataView("Primary", cmbBasicProduct.SelectedValue.ToString());



                        if (x > 0)
                        {
                            MessageBox.Show(this, "Succesfully Deleted From Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            ClearFinishProduct();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                MessageBox.Show(this, "Select a Record from the List", "Select a Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }