示例#1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            Profesion prof = new Profesion();

            prof.nombreProfesion = txtProfesion.Text.Trim();
            prof.id = int.Parse(grdProfesiones.CurrentRow.Cells["id_Profesiones"].Value.ToString());
            string msjAlert = "Desea eliminar la Profesion: \n " + prof.nombreProfesion;

            MessageBoxButtons buttons = MessageBoxButtons.YesNo;

            MessageBox.Show(msjAlert, "Error", buttons);


            bool resultado = AD_Profesiones.EliminarProfesion(prof);

            if (resultado)
            {
                MessageBox.Show("Cliente Eliminado exitosamente");
                LimpiarCampos();
                CargarGrilla();
                btnGuardar.Enabled    = true;
                btnEliminar.Enabled   = false;
                btnActualizar.Enabled = false;
            }
            else
            {
                MessageBox.Show("Error al actualizar Cliente");
            }
        }
示例#2
0
 private void CargarGrilla()
 {
     try
     {
         grdProfesiones.DataSource = AD_Profesiones.ObtenerListadoProfesionesReducido();
     }
     catch (Exception)
     {
         MessageBox.Show("Error al obtener clientes");
     }
 }
示例#3
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Profesion prof = new Profesion();

            prof.nombreProfesion = txtProfesion.Text.Trim();

            bool resultado = AD_Profesiones.AgregaProfesionABD(prof);

            if (resultado)
            {
                MessageBox.Show("Cliente agregado correctamente");
                LimpiarCampos();
                CargarGrilla();
            }
            else
            {
                MessageBox.Show("No se pudo cargar el cliente");
            }
        }
示例#4
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            Profesion prof = new Profesion();

            prof.nombreProfesion = txtProfesion.Text.Trim();
            prof.id = int.Parse(grdProfesiones.CurrentRow.Cells["id_Profesiones"].Value.ToString());


            bool resultado = AD_Profesiones.ActualizarProfesion(prof);

            if (resultado)
            {
                MessageBox.Show("Profesion actualizada con exito");
                LimpiarCampos();
                CargarGrilla();
                btnGuardar.Enabled    = true;
                btnEliminar.Enabled   = false;
                btnActualizar.Enabled = false;
            }
            else
            {
                MessageBox.Show("Error al actualizar Profesion");
            }
        }