Exemple #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool CHK = DBLayer.CHK_B4_DEL_NUKH(txtName.Text);

            if (CHK)
            {
                MessageBox.Show("Cannot Delete! Already in use", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult result = MessageBox.Show("Are You Sure You Want to Delete", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    usp_SEL_tblNukhTableAdapter.Delete1(Convert.ToInt32(txtID.Text));
                    usp_SEL_tblNukhTableAdapter.Fill(comDataSet.usp_SEL_tblNukh);
                    MessageBox.Show("Deleted Succesfully!", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemple #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool CHK = DBLayer.CHK_B4_DEL_NUKH(txtAid.Text);

            if (CHK)
            {
                MessageBox.Show("Cannot Delete! Already in use", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult result = MessageBox.Show("Are You Sure You Want to Delete", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    int ID = Convert.ToInt32(dgvAid.CurrentRow.Cells[0].Value);
                    tblAidsTableAdapter.DeleteAid(ID);
                    tblAidsTableAdapter.Fill(dataset2.tblAids);
                    MessageBox.Show("Deleted Succesfully!", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }