Esempio n. 1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete employee ", "Confirm Option", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dialogResult == DialogResult.Yes)
         {
             manageUsers myU = new manageUsers();
             myU.getByEmpId(this.empId);
             myU.deleteUser(myU.userId);
             manageUserDetails myD = new manageUserDetails();
             myD.deleteUser(myU.userId);
             manageEmployees myE = new manageEmployees();
             if (myE.deleteEmployee(this.empId) == true)
             {
                 MessageBox.Show("Employee deleted from system system", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 string sql = "SELECT employeeId,Fname,Sname,Dpt,Email FROM wizemployes";
                 this.fillEmployee(sql);
             }
             else
             {
                 MessageBox.Show(" failed to deleted from system system", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in btnDelete_Click()" + ex.Message);
     }
 }
Esempio n. 2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         manageUsers myU = new manageUsers();
         myU.getUser(this.userId);
         DialogResult dialogResult = MessageBox.Show("All information associated with this account will be lost are you sure you want to proceed", "Confirm Option", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dialogResult == DialogResult.OK || dialogResult == DialogResult.Yes)
         {
             if (myU.deleteUser(this.userId) == true)
             {
                 MessageBox.Show("account deleted success ", "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("failed to delete ", "System Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in btnDelete_Click() " + ex.Message);
     }
 }