private void Buscar() { try { dataGridView1.DataSource = N_Bodega.Buscar(txtBuscar.Text); this.formato(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void CargasrResponsable() { try { cboResponsable.DataSource = N_Bodega.Seleccionar(); cboResponsable.ValueMember = "idResponsable"; cboResponsable.DisplayMember = "NombreResponsable"; } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void cmdDelete_Click(object sender, EventArgs e) { try { if (dataGridView1.SelectedRows.Count > 0) { txtIdeProduccion.Text = dataGridView1.CurrentRow.Cells["ideprodu"].Value.ToString(); DialogResult Opcion; Opcion = MessageBox.Show("Eliminar", "D Criollo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { int Codigo; String Rpta = ""; Codigo = Convert.ToInt32(txtIdeProduccion.Text); Rpta = N_Bodega.Eliminar(Codigo, " ", " ", 0); if (Rpta.Equals("OK")) { this.MensajeOk("Registro Eliminado"); } else { this.MensajeError(Rpta); } } this.Listar(); } else { MessageBox.Show("Seleccione una Bodega"); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void cmdSave_Click(object sender, EventArgs e) { if (txtCual.Text == "1") { try { string Rpta = ""; if (txtNombre.Text == string.Empty) { this.MensajeError("Falta de Ingresar"); ErrorIcono.SetError(txtNombre, "Ingrese Nombre de Bodega"); } else if (txtDireccion.Text == string.Empty) { this.MensajeError("Falta de Ingresar"); ErrorIcono.SetError(txtDireccion, "Ingrese Direccion Bodega"); } else { Rpta = N_Bodega.Insertar(txtNombre.Text.Trim(), txtDireccion.Text.Trim(), Convert.ToInt32(cboResponsable.SelectedValue)); if (Rpta.Equals("OK")) { this.MensajeOk("Se Registro un Nueva Bodega"); this.Limpiar(); this.Listar(); tabControl1.SelectedIndex = 0; } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } } if (txtCual.Text == "2") { try { string Rpta = ""; if (txtNombre.Text == string.Empty) { this.MensajeError("Falta de Ingresar"); ErrorIcono.SetError(txtNombre, "Ingrese Nombre de Bodega"); } else if (txtDireccion.Text == string.Empty) { this.MensajeError("Falta de Ingresar"); ErrorIcono.SetError(txtDireccion, "Ingrese Direccion de Bodega"); } else { Rpta = N_Bodega.Actualizar(Convert.ToInt32(txtCodigo.Text), txtNombre.Text.Trim(), txtDireccion.Text.Trim(), Convert.ToInt32(cboResponsable.SelectedValue)); if (Rpta.Equals("OK")) { this.MensajeOk("Se Actaulizo los Datos de la Bodega"); this.Limpiar(); this.Listar(); tabControl1.SelectedIndex = 0; } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } } }