private void AgregarProducto(object sender, DataGridViewCellEventArgs e) { if (!String.IsNullOrEmpty(this.tb_tipoCambio.Text)) { var IdProducto = dg_productos.Rows[e.RowIndex].Cells[0].Value; productoSeleccionado = productos.Where(x => x.ID == Convert.ToInt32(IdProducto)).FirstOrDefault(); bool productoEnFactura = false; if (productoSeleccionado.Stock > 0) { if (!ComprobarProductoEnFactura(productoEnFactura)) { dg_orden.Rows.Add(productoSeleccionado.ID, productoSeleccionado.Modelo, "0", "0", productoSeleccionado.Comision1, productoSeleccionado.Comision2, productoSeleccionado.Comision3, productoSeleccionado.Comision4, productoSeleccionado.Precio1, productoSeleccionado.Precio2, productoSeleccionado.Precio3, productoSeleccionado.Precio4, "0"); this.tb_filtro.Text = ""; } else { MessageBox.Show("El producto ya se encuentra en factura", APP_NAME, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("El producto " + productoSeleccionado.Modelo + " se agotó en Inventario", APP_NAME, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Aún no ingresa la tasa de cambio", APP_NAME, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void VerDetalleProducto(object sender, DataGridViewCellEventArgs e) { var IdProducto = dg_productos.Rows[e.RowIndex].Cells[0].Value; productoSeleccionado = productos.Where(x => x.ID == Convert.ToInt32(IdProducto)).FirstOrDefault(); AsignarValores(productoSeleccionado); this.btn_guardar.Enabled = false; }
private void SeleccionarProducto(object sender, DataGridViewCellEventArgs e) { var IdProducto = dg_productos.Rows[e.RowIndex].Cells[0].Value; productoSeleccionado = productos.Where(x => x.ID == Convert.ToInt32(IdProducto)).FirstOrDefault(); AsignarValores(productoSeleccionado); this.btn_cancelar.Visible = true; }
private void btn_nuevo_Click(object sender, EventArgs e) { Controles.LimpiarControles(this.Controls); Controles.DeshabilitarBotones(this.ToolStrip1.Items); productoSeleccionado = null; btn_guardar.Enabled = true; btn_cancelar.Visible = true; btn_cancelar.Enabled = true; }
private void AsignarValores(Entity.ProductoViewModel productoSeleccionado) { this.tb_marca.Text = productoSeleccionado.Marca; this.tb_modelo.Text = productoSeleccionado.Modelo; this.tb_costo.Text = productoSeleccionado.CostoImpo.ToString(); this.tb_stock.Text = productoSeleccionado.Stock.ToString(); this.tb_minimo.Text = productoSeleccionado.Minimo.ToString(); this.txt_descripcion.Text = productoSeleccionado.Descripcion; this.tb_linea.Text = productoSeleccionado.Linea; this.tb_precio1.Text = productoSeleccionado.Precio1.ToString(); this.tb_precio2.Text = productoSeleccionado.Precio2.ToString(); this.tb_precio3.Text = productoSeleccionado.Precio3.ToString(); this.tb_precio4.Text = productoSeleccionado.Precio4.ToString(); this.tb_comision1.Text = productoSeleccionado.Comision1.ToString(); this.tb_comision2.Text = productoSeleccionado.Comision2.ToString(); this.tb_comision3.Text = productoSeleccionado.Comision3.ToString(); this.tb_comision4.Text = productoSeleccionado.Comision4.ToString(); }
private void AsignarValores(Entity.ProductoViewModel productoSeleccionado) { this.tb_modelo.Text = productoSeleccionado.Modelo; }