Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (label27.Text == "admin123")
            {
                MessageBox.Show("Can not delete primary admin.");
            }
            else
            {
                DialogResult result = MessageBox.Show("Are you sure to dlete this admin?", "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                if (label27.Text == loginUserName)
                {
                    if (result == DialogResult.Yes)
                    {
                        blc.DeleteAdmin(label27.Text);
                        this.Hide();
                        Start obj = new Start();
                        obj.Show();
                        MessageBox.Show("Admin deleted successfully.");
                    }
                }
                else
                {
                    if (result == DialogResult.Yes)
                    {
                        blc.DeleteAdmin(label27.Text);
                        this.Hide();
                        AdminSettings obj = new AdminSettings("admin123");
                        obj.Show();
                        MessageBox.Show("Admin deleted successfully.");
                    }
                }
            }
        }