private void pictureBox2_Click(object sender, EventArgs e) { if (producto == null) { producto = new Eproductos(); } #region No duplicar valor en dataGrid try { foreach (DataGridViewRow row in dataGridView1.Rows) { if (txtDescRProducto.Text == row.Cells["referencia"].Value.ToString()) { MessageBox.Show("YA SE INSERTO ESTE PRODUCTO"); txtDescRProducto.Clear(); txtDescRProducto.Focus(); return; } } } catch { } #endregion ; producto.a = "Buscar"; producto.descripcion = txtDescRProducto.Text; producto.refencia = txtDescRProducto.Text; if (Acceso_Productos.BuscarProductos(producto)) { gvDatos.DataSource = Acceso_Productos.datos; id_producto = int.Parse(gvDatos.CurrentRow.Cells["id_producto"].Value.ToString()); txtDescri.Text = gvDatos.CurrentRow.Cells["descripcion"].Value.ToString(); txtRef.Text = gvDatos.CurrentRow.Cells["referencia"].Value.ToString(); txtMarca.Text = gvDatos.CurrentRow.Cells["marca"].Value.ToString(); txtFabri.Text = gvDatos.CurrentRow.Cells["fabricante"].Value.ToString(); txtCan.Text = gvDatos.CurrentRow.Cells["cantidad"].Value.ToString(); txtPreCom.Text = gvDatos.CurrentRow.Cells["precio_compra"].Value.ToString(); txtPreMa.Text = gvDatos.CurrentRow.Cells["precio_por_mayor"].Value.ToString(); txtPreVen.Text = gvDatos.CurrentRow.Cells["precio_venta"].Value.ToString(); btnAdd.Enabled = true; txtDescu.Enabled = true; } else if (MessageBox.Show("ESTE PRODUCTO NO EXISTE DESEA AGREGAR ESTE PRODUCTO", "PARA CONTINUAR:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { habilitarText(); } }
private void BtnVerTodos_Click(object sender, EventArgs e) { producto.a = "Todos"; producto.descripcion = ""; producto.refencia = ""; if (Acceso_Productos.BuscarProductos(producto)) { gvDatos.DataSource = Acceso_Productos.datos; } else { MessageBox.Show("NO EXISTEN NINGUN PRODUCTO", "PARA CONTINUAR:", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnBuscar_Click(object sender, EventArgs e) { producto.a = "Buscar"; producto.descripcion = txtDescR.Text; producto.refencia = txtDescR.Text; if (Acceso_Productos.BuscarProductos(producto)) { gvDatos.DataSource = Acceso_Productos.datos; } else { MessageBox.Show("ESTE PRODUCTO NO EXISTE", "PARA CONTINUAR:", MessageBoxButtons.OK, MessageBoxIcon.Information); txtDescR.Clear(); txtDescR.Focus(); } }
private void btnAgregar_Click(object sender, EventArgs e) { #region Editar Todos Los Productos Ingresados foreach (DataGridViewRow row in dataGridView1.Rows) { try { int id = 0; id = Convert.ToInt32(row.Cells["idproducto"].Value); producto.a = "Editar"; producto.Id = id; producto.cantidad = Convert.ToInt32(row.Cells["cantidad"].Value); if (Acceso_Productos.ActualizarProductos(producto)) { gvDatos.DataSource = Acceso_Productos.datos; } } catch { } } #endregion if (txtTipo.Text == "CREDITO") { Guardar(); BorrarDatagrid(); Limpiar(); } else { Consultas.Pago_Compras pago = new Consultas.Pago_Compras(); producto.total = int.Parse(txtTotal.Text); MessageBox.Show(producto.total.ToString()); pago.textBox1.Text = producto.total.ToString(); pago.ShowDialog(); Guardar(); BorrarDatagrid(); } }