Esempio n. 1
0
        private void buttonEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dataGridViewTransporte.Rows.Count > 0)
                {
                    DialogResult confirmacion = MessageBox.Show("¿Seguro deseas eliminar este transportista?", "Eliminar Transportista",
                                                                MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

                    if (confirmacion == DialogResult.OK)
                    {
                        String mensaje = NTransportistas.Eliminar(Convert.ToInt32(ObtenerSeleccion().Cells["ID"].Value));
                        if (mensaje == "Y")
                        {
                            Mensaje(String.Format("El Transportista {0} ha sido ELIMINADO",
                                                  Convert.ToString(ObtenerSeleccion().Cells["NOMBRE"].Value)));
                            Refrescar();
                        }
                        else
                        {
                            MensajeError(mensaje);
                            Refrescar();
                        }
                    }
                }
                else
                {
                    MensajeError("Debes seleccionar una fila para eliminar");
                }
            }
            catch (Exception ex)
            {
                MensajeError(ex.Message);
            }
        }
Esempio n. 2
0
 public void Buscar()
 {
     try
     {
         this.dataGridViewTransporte.DataSource = NTransportistas.Buscar(this.textBoxBuscarNombre.Text);
     }
     catch (Exception ex)
     {
         MensajeError(ex.Message);
     }
 }
Esempio n. 3
0
 public void Mostrar()
 {
     try
     {
         this.Dock = DockStyle.Fill;
         this.dataGridViewTransporte.DataSource         = NTransportistas.Mostrar(numeroPagina, registrosPorPagina);
         this.dataGridViewTransporte.Columns[0].Visible = false;
         cantidadPaginas       = NTransportistas.Tamaño(registrosPorPagina);
         this.labelPagina.Text = String.Format("Página {0} de {1}", numeroPagina, cantidadPaginas);
     }
     catch (Exception ex)
     {
         MensajeError(ex.Message);
     }
 }
Esempio n. 4
0
        private void buttonGuardar_Click(object sender, EventArgs e)
        {//No importa el try ya que no hay conversiones
            String mensaje = NTransportistas.Editar(this.Id_Transportista, this.textBoxNombre.Text, this.textBoxDireccion.Text,
                                                    this.textBoxCiudad.Text, this.textBoxRegion.Text, this.textBoxPais.Text, this.textBoxTelefono.Text);

            if (mensaje == "Y")
            {
                this._owner.Mensaje(String.Format("El Transporte {0} ha sido EDITADO", this.textBoxNombre.Text));
                this._owner.Refrescar();
                this.Close();
            }
            else
            {
                MensajeError(mensaje);
            }
        }
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            String mensaje = NTransportistas.Insertar(this.textBoxNombre.Text, this.textBoxDireccion.Text,
                                                      this.textBoxCiudad.Text, this.textBoxRegion.Text, this.textBoxPais.Text, this.textBoxTelefono.Text);

            if (mensaje == "Y")
            {
                this._owner.Mensaje(String.Format("El Transporte {0} ha sido AGREGADO", this.textBoxNombre.Text));
                this._owner.Refrescar();
                this.Close();
            }
            else
            {
                MensajeError(mensaje);
            }
        }
 public void CargarTransportistas()
 {
     this.comboBoxTransportes.DataSource    = NTransportistas.ListaTransportistas();
     this.comboBoxTransportes.ValueMember   = "ID";
     this.comboBoxTransportes.DisplayMember = "NOMBRE";
 }