private void btnEliminar_Click(object sender, EventArgs e) { if (click == 0) { //MessageBox.Show(Convert.ToString(Click)); MessageBox.Show("Debes seleccionar un item de la lista."); } else { //MessageBox.Show(Convert.ToString(ListaDeEmpleados.SelectedIndices.Count)); try { envio = ObetenerValoresDeLosText(); //Llamo al metodo de modificar(DELETE) envio.Eliminar(envio); CargarDatosDeLaLista(); VaciarTextBox(); click = 0; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void ValoresParaLosText(ClaseEnvio envio) { txtidEnvio.Text = envio.IdEnvio.ToString(); txtidCliente.Text = envio.IdCliente; txtDireccion.Text = envio.direccion; txtTelefono.Text = envio.telefono; txtidSerDeEn.Text = envio.IdServicioEntrega.ToString(); }
private ClaseEnvio ObetenerValoresDeLosText() { ClaseEnvio envio = new ClaseEnvio(); envio.IdEnvio = Convert.ToInt32(txtidEnvio.Text.ToString()); envio.IdCliente = txtidCliente.Text.ToString(); envio.direccion = txtDireccion.Text.ToString(); envio.telefono = txtTelefono.Text.ToString(); envio.IdServicioEntrega = Convert.ToInt32(txtidSerDeEn.Text.ToString()); return(envio); }
private void ListaEnvio_SelectedIndexChanged_1(object sender, EventArgs e) { try { //MessageBox.Show(Convert.ToString(ListaDeEnvio.Text)); //Llamo al metodo BUSCAR(WHERE) que esta en la clase Envio envio = envio.BuscarID(Convert.ToString(ListaEnvio.Text)); ValoresParaLosText(envio); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnGuardar_Click_1(object sender, EventArgs e) { try { envio = ObetenerValoresDeLosText(); //Llamo al metodo de modificar(UPDATE) envio.Modificar(envio); //Mostrar los botones y paneles a su estado natural btnModificar.Visible = true; btnEliminar.Visible = true; //Restauro el valor de click para cuando se realiza otra seleccion la evalue click = 0; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public Ins_Envio() { InitializeComponent(); envio = new ClaseEnvio(); }