public static DatosComanda Instance() { if (datos == null) { datos = new DatosComanda(); } return(datos); }
public static DatosComanda Instance() { if (datos == null) { datos = new DatosComanda(); } return datos; }
private void buttonIngresar_Click(object sender, EventArgs e) { if (buttonIngresar.Text.Equals("ENVIAR")) { if (idComanda == null) { DatosComanda datos = DatosComanda.Instance(); ComandaConnect cc = new ComandaConnect(); string rutgarzon = cc.SelectRutGarzon(nombreGarzon); //agrega la comanda string comanda = cc.InsertComanda(rutgarzon, mesa); string nombre, cantidad, idprod; int cantProductos = dgProdComanda.Rows.Count; for (int i = 0; i < cantProductos; i++) { nombre = dgProdComanda.Rows[i].Cells[0].Value.ToString(); Console.WriteLine("nomprod:" + nombre); idprod = cc.SelectIDProducto(nombre); Console.WriteLine("idprod: " + idprod); cantidad = dgProdComanda.Rows[i].Cells[1].Value.ToString(); cc.InsertProdComanda(comanda, idprod, cantidad, "comanda"); Console.WriteLine(i); } CompleteEvents.RaiseEvent(mesa, comanda, nombreGarzon); //enviar informacion a la mierda de mesas this.Close(); } else { string idprod, nombreProd; Console.WriteLine("hay COmanda: " + idComanda); ComandaConnect cc = new ComandaConnect(); int cantProductos = dgProdComanda.Rows.Count; for (int i = 0; i < cantProductos; i++) { if (dgProdComanda.Rows[i].DefaultCellStyle.BackColor != Color.LightGreen) { Console.WriteLine("fila"); nombreProd = dgProdComanda.Rows[i].Cells[0].Value.ToString(); idprod = cc.SelectIDProducto(nombreProd); cantidad = dgProdComanda.Rows[i].Cells[1].Value.ToString(); cc.InsertProdComanda(idComanda, idprod, cantidad, "comanda"); } } this.Close(); } } else { this.Close(); } }