private void cargArt(C_ARTICULOS art) { int c1 = art.getCant(); if (c1 > 0) { ped = fac.listaPedidos.Find(p => p.getArt() == art); if (ped == null) { fac.listaPedidos.Add(new C_PEDIDOS(1, art)); --c1; art.setCant(c1); llenarArticulos(); } else { int c = ped.getCant(); if (c >= 0) { ++c; --c1; ped.setCant(c); art.setCant(c1); llenarArticulos(); } } } else { MessageBox.Show("No hay mas articulos de ese modelo"); } llenarListaPedido(); vender_btn.Enabled = true; }
private void art_dgv_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow fila = art_dgv.Rows[e.RowIndex]; art = listaArticulos.Find(a => a.datos()[0] == Convert.ToString(fila.Cells["code"].Value)); cargArt(art); } }
private void llenarListaPedido() { venta_dgv.Rows.Clear(); string[] d = new string[4]; foreach (C_PEDIDOS p in fac.listaPedidos) { art = p.getArt(); d[0] = art.datos()[0]; d[1] = art.datos()[1]; d[2] = Convert.ToString(p.getCant()); d[3] = Convert.ToString(p.total()); venta_dgv.Rows.Add(d); } total_box.Text = Convert.ToString(fac.total()); }