protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { string Detalle = GridView2.SelectedRow.Cells[0].Text; string total = GridView2.SelectedRow.Cells[2].Text; int w = GridView2.SelectedRow.RowIndex; dtable.Rows.RemoveAt(w); int contador = 0; servicio prueba = Encontrarservicio(contador, w); GridView2.DataSource = dtable; GridView2.DataBind(); Buscadores bus = new Buscadores(); string a = txtpatente.Value; servicio oservicio = new servicio(); int z = int.Parse(lblprecio.Text) - int.Parse(total); lblprecio.Text = z.ToString(); oservicio = LSAC.Find(ser => ser.id_servicios == prueba.id_servicios); LSAC.Remove(oservicio); List <serviciostock> Lserstock = Lserviciostock(oservicio.id_servicios.ToString()); List <stock> Nstock = Lstockuso(Lserstock); List <stock> Copia = Lstock; foreach (stock ostock in Nstock) { stock oostock = Lstock.Find(x => x.id_stock == ostock.id_stock); Lstock.Remove(oostock); } oservicio.precio = "1"; VerGrid(oservicio); //Queda remover la lista de stock }
protected void CargarServicios(object sender, EventArgs e) { StockError.Visible = false; StockWarning.Visible = false; List <servicio> Lse = new List <servicio>(); List <servicio> Lservicios = new List <servicio>(); lblpreciototal.Visible = true; lblprecio.Visible = true; if ((GridView2.Rows.Count < 5) && (DropServicio.SelectedValue.ToString() != "")) { Buscadores bus = new Buscadores(); string id = DropServicio.SelectedValue.ToString(); int id_servicio = int.Parse(id); servicio oservicio = bus.buscarservicio(id_servicio); Lse = LSM; foreach (servicio x in Lse) { if (id_servicio == x.id_servicios) { oservicio = x; } } Lse.Remove(oservicio); Lservi = Lse; string detalle = oservicio.detalle; string precio = oservicio.precio; string total = (double.Parse(oservicio.precio) * double.Parse(txtcantidad.Text)).ToString(); string cantidad = txtcantidad.Text; Cantidad oCantidad = new Cantidad(oservicio.id_servicios, int.Parse(cantidad)); Lcantidades.Add(oCantidad); List <serviciostock> Lserstock = Lserviciostock(id_servicio.ToString()); List <stock> Nstock = Lstockuso(Lserstock);//revisar esto LSAC.Add(oservicio); dtable.Rows.Add(detalle, precio, cantidad, total); lblprecio.Visible = true; int a = int.Parse(lblprecio.Text) + int.Parse(total); lblprecio.Text = a.ToString(); foreach (stock ostock in Nstock) { Lstock.Add(ostock); if (int.Parse(ostock.cantidad) <= int.Parse(ostock.minimo)) { StockError.Visible = true; Label1.Text = "¡ATENCION! EL STOCK ES MENOR AL MINIMO: " + ostock.detalle; } if ((int.Parse(ostock.cantidad) >= int.Parse(ostock.minimo)) && (int.Parse(ostock.cantidad) <= (int.Parse(ostock.minimo) + 5)) && (StockError.Visible == false)) { StockWarning.Visible = true; //Aca alerta queda poco stock Queda restar Label2.Text = "¡ATENCION! EL STOCK ESTA CERCANO AL MINIMO: " + ostock.detalle; } } NoAuto.Visible = false; //Lservi = Lse; GridView2.DataSource = dtable; GridView2.DataBind(); VerGrid(oservicio); Calculaelprimero(); } else { NoAuto.Visible = true; Label3.Text = "No ingrese mas de 5 servicios"; } }