private void mnuEditEmployee_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmEmployeeEdit pFrmEmployeeEdit = new frmEmployeeEdit(mFormName);

            pFrmEmployeeEdit.ShowDialog();
        }
Beispiel #2
0
 private void grdEmployeeDetailDisplay_CellContentClick(object sender, DataGridViewCellEventArgs e)
 //=================================================================================================
 {
     if (e.ColumnIndex == 9)
     {
         int pUserId = Convert.ToInt32(grdEmployeeDetailDisplay.Rows[e.RowIndex].Cells[e.ColumnIndex - 9].Value.ToString());
         Program.gBE.UserId = pUserId;
         string          pFormName        = "Employee Details";
         frmEmployeeEdit pFrmEmployeeEdit = new frmEmployeeEdit(pFormName);
         pFrmEmployeeEdit.ShowDialog();
     }
     if (e.ColumnIndex == 10)
     {
         int pUserId = Convert.ToInt32(grdEmployeeDetailDisplay.Rows[e.RowIndex].Cells[e.ColumnIndex - 10].Value.ToString());
         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();
                     frmEmployeeDetails pFrmEmployeeDetails = new frmEmployeeDetails(mFormName);
                     pFrmEmployeeDetails.ShowDialog();
                 }
             }
         }
     }
 }