private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtPrecio.Text == string.Empty) { MensajeError("Falta ingresar Algunos Datos, seran Remarcados"); errorIcono.SetError(txtPrecio, "Ingrese un Nombre"); } else { if (this.IsNuevo) { rpta = NRepuesto.Insertar(this.txtDescripcion.Text.Trim(), this.txtMarca.Text.Trim(), Convert.ToInt32(this.txtStock.Text.Trim()), Convert.ToSingle(this.txtPrecio.Text.Trim())); } else { rpta = NRepuesto.Editar(Convert.ToInt32(this.txtIdRepuesto.Text), this.txtDescripcion.Text.Trim(), this.txtMarca.Text.Trim(), Convert.ToInt32(this.txtStock.Text.Trim()), Convert.ToSingle(this.txtPrecio.Text.Trim())); } if (rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOk("Se inserto Correctamente El Registro"); } else { this.MensajeOk("Se Actualizo Correctamente El Registro"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); this.pRegistro.Visible = false; this.pListas.Visible = true; } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void dataListado_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataListado.Columns["Eliminar"].Index) { DialogResult Opcion; Opcion = MessageBox.Show("Realmente desea Eliminar El Registro", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { String Codigo; String Rpta = ""; Codigo = Convert.ToString(this.dataListado.CurrentRow.Cells["idEquipo"].Value); Rpta = NRepuesto.Eliminar(Convert.ToInt32(Codigo)); if (Rpta.Equals("OK")) { this.MensajeOk("Se ELimino Correctamente el Registro"); } else { this.MensajeError(Rpta); } this.Mostrar(); } } else { if (e.ColumnIndex == dataListado.Columns["Editar"].Index) { this.txtIdRepuesto.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["idRepuesto"].Value); this.txtDescripcion.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["descripcion"].Value); this.txtMarca.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["marca"].Value); this.txtStock.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["serie"].Value); this.txtPrecio.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["precio"].Value); pListas.Visible = false; Habilitar(true); pRegistro.Visible = true; } } }
private void cargarComboRespuesto() { this.txtRepuesto.DropDownList.Columns.Clear(); this.txtRepuesto.DropDownList.Columns.Add("descripcion").Width = 300; this.txtRepuesto.DropDownList.Columns.Add("modelo").Width = 200; this.txtRepuesto.DropDownList.Columns.Add("marca").Width = 100; this.txtRepuesto.DropDownList.Columns.Add("precio").Width = 100; this.txtRepuesto.DropDownList.Columns["descripcion"].Caption = "Descripcion"; this.txtRepuesto.DropDownList.Columns["modelo"].Caption = "Modelo"; this.txtRepuesto.DropDownList.Columns["marca"].Caption = "Marca"; this.txtRepuesto.ValueMember = "idRepuesto"; this.txtRepuesto.DisplayMember = "modelo"; this.descripcion = txtRepuesto.Text; this.txtRepuesto.DisplayMember = "marca"; this.marca = txtRepuesto.Text; this.txtRepuesto.DisplayMember = "precio"; this.precio = txtRepuesto.Text; this.txtRepuesto.DisplayMember = "descripcion"; this.txtRepuesto.DataSource = NRepuesto.BuscarNombre(this.txtRepuesto.Text.Trim()); this.txtRepuesto.Refresh(); }
// Metodo BuscarNombre private void BuscarNombre() { this.dataListado.DataSource = NRepuesto.BuscarNombre(this.txtBuscar.Text.Trim()); this.OcultarColumnas(); lblTotal.Text = "Total de Registro: " + Convert.ToString(dataListado.Rows.Count); }
//Metodo Mostrar private void Mostrar() { this.dataListado.DataSource = NRepuesto.Mostrar(); this.OcultarColumnas(); lblTotal.Text = "Total de Registro: " + Convert.ToString(dataListado.Rows.Count); }
private void PRepuesto_Load(object sender, EventArgs e) { Repuesto = new NRepuesto(); dataGridView1.DataSource = Repuesto.ShowRepuestos(); }