private void tbtnEliminar_Click(object sender, EventArgs e) { if (txtId.Text != "") { nSubCategoria objSub = new nSubCategoria(); objSub.Idsub = Convert.ToInt32(txtId.Text); //objSub.eliminarSubcategoria(); MessageBox.Show("Sub Categoria eliminada con exito"); } else { MessageBox.Show("Debe ingresar una ID a eliminar"); txtId.Focus(); } }
private void tbtnGuardar_Click(object sender, EventArgs e) { if (txtNombre.Text != "" && txtDescripcion.Text != "" && txtIdCategoria.Text != "") { nSubCategoria objSub = new nSubCategoria(); objSub.Nombre = txtNombre.Text; objSub.Descripcion = txtDescripcion.Text; objSub.Idcategoria = Convert.ToInt32(txtIdCategoria.Text); //objSub.CrearSubCategoria(); MessageBox.Show("Sub Categoria ingresada con exito"); } else { MessageBox.Show("No deben haber campos vacios"); } }
private void tbtnActualizar_Click(object sender, EventArgs e) { if (txtId.Text != "") { nSubCategoria objSub = new nSubCategoria(); objSub.Idsub = Convert.ToInt32(txtId.Text); objSub.Nombre = txtNombre.Text; objSub.Descripcion = txtDescripcion.Text; objSub.Idcategoria = Convert.ToInt32(txtIdCategoria.Text); //objSub.editarSubCategoria(); MessageBox.Show("Sub Categoria editada con exito"); } else { MessageBox.Show("Debe ingresar una ID a editar"); } }