Example #1
0
        private void cmdDelete_Click(object sender, EventArgs e)
        //=======================================================
        {
            int pUserId = Convert.ToInt32(txtUserId.Text);

            Program.gBE.UserId = pUserId;
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;

            if (mBA.IsDeleteAdmin(Program.gBE) == "ADMIN")
            {
                DialogResult result = MessageBox.Show("Are you sure you want to delete? Admin deletion will forcefully sign out the application. You have to re-login again.", "Admin Deletion", buttons, MessageBoxIcon.Warning);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    if (mBA.DeleteUser(Program.gBE) > 0)
                    {
                        MessageBox.Show("Admin Deleted Successufully.");
                        Application.Restart();
                    }
                }
            }
            else
            {
                DialogResult result = MessageBox.Show("Are you sure you want to delete?", "User Deletion", buttons, MessageBoxIcon.Warning);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    if (mBA.DeleteUser(Program.gBE) > 0)
                    {
                        MessageBox.Show("User Deleted Successufully.");
                        this.Hide();
                        frmEmployeeDelete pFrmEmployeeDelete = new frmEmployeeDelete();
                        pFrmEmployeeDelete.ShowDialog();
                    }
                }
            }
        }
        private void mnuDeleteEmployee_Click(object sender, EventArgs e)
        //==============================================================
        {
            this.Hide();
            frmEmployeeDelete pFrmEmployeeDelete = new frmEmployeeDelete();

            pFrmEmployeeDelete.ShowDialog();
        }