Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox4.Text == "")
            {
                MessageBox.Show("Please select any salesman...");
                GridUpdate();
            }
            else
            {
                DialogResult res = MessageBox.Show("Are You Sure?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (res.Equals(DialogResult.Yes))
                {
                    string id = textBox4.Text;
                    if (s.DeleteSalesman(id))
                    {
                        GridUpdate();
                        MessageBox.Show("Successfully deleted");
                        ManagerProfile m = new ManagerProfile();
                        this.Hide();
                        m.Show();
                    }
                }

                else
                {
                    dataGridView1.DataSource = s.GetAllSalesman();
                }
            }
            textBox4.Text = string.Empty;
        }