Beispiel #1
0
        private void toolBaja_Click(object sender, EventArgs e)
        {
            DialogResult respuesta = MessageBox.Show("¿Quiere eliminar el puesto?", "Confirmación", MessageBoxButtons.YesNo);

            if (respuesta == DialogResult.Yes)
            {
                string cdn  = ConfigurationManager.ConnectionStrings["cdnNomina"].ConnectionString;
                int    fila = dgvPuestos.CurrentCell.RowIndex;
                int    id   = int.Parse(dgvPuestos.Rows[fila].Cells[0].Value.ToString());
                cnx            = new MySqlConnection(cdn);
                cmd            = new MySqlCommand();
                cmd.Connection = cnx;
                Puestos.Core.PuestosHelper ph = new Puestos.Core.PuestosHelper();
                ph.Command = cmd;
                Puestos.Core.Puestos puesto = new Puestos.Core.Puestos();
                puesto.id      = id;
                puesto.estatus = 0;
                try
                {
                    cnx.Open();
                    ph.bajaPuesto(puesto);
                    cnx.Close();
                    cnx.Dispose();
                    ListaPuestos();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }
            }
        }