private void FrmMenu_Load(object sender, EventArgs e)
        {
            ManejadorSQL sql = new ManejadorSQL();

            Hardcodeo.Ventas();
            Hardcodeo.Productos();
            auxSonido.SoundLocation = String.Concat(directorio, "\\sonido.wav");
        }
Example #2
0
        private void dgvListaProductos_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string auxNombre;
            double auxPrecio;
            int    idProducto;
            int    auxCantidad;
            int    auxStock;



            if (int.TryParse(this.txtCantidad.Text, out auxCantidad))
            {
                auxNombre  = (string)dgvListaProductos.CurrentRow.Cells["Nombre"].Value;
                auxPrecio  = (double)dgvListaProductos.CurrentRow.Cells["Precio"].Value;
                idProducto = (int)dgvListaProductos.CurrentRow.Cells["IdProducto"].Value;
                auxStock   = (int)dgvListaProductos.CurrentRow.Cells["Stock"].Value;

                if (Hardcodeo.ValidarCantidad(auxNombre, auxCantidad))
                {
                    listaVenta.Add(new Compras(auxNombre, idProducto, auxPrecio, auxCantidad));


                    for (int i = 0; i < Hardcodeo.listaProductos.Count; i++)
                    {
                        if (auxNombre == Hardcodeo.listaProductos[i].Nombre)
                        {
                            Hardcodeo.listaProductos[i].Stock = Hardcodeo.listaProductos[i].Stock - auxCantidad;
                        }
                    }


                    auxPrecioTotal     += (auxPrecio * auxCantidad);
                    lblPrecioTotal.Text = auxPrecioTotal.ToString();
                    this.dgvListaProductos.DataSource    = null;
                    this.dgvListaProductos.DataSource    = Hardcodeo.listaProductos;
                    this.dgvProductosElegidos.DataSource = null;
                    this.dgvProductosElegidos.DataSource = this.listaVenta;
                }
                else
                {
                    MessageBox.Show("No hay suficiente stock del producto solicitados");
                }
            }
            else
            {
                MessageBox.Show("Por favor, agregue cantidad antes de continuar");
            }

            this.txtCantidad.Clear();
        }
Example #3
0
        public void Test_ValidarCantidad()
        {
            bool ret = Hardcodeo.ValidarCantidad("Leche", 200);

            Assert.IsFalse(ret);
        }