protected void OnBotonAceptarClicked(object sender, System.EventArgs e) { TreeModel tModel; treeView.Selection.Mode = SelectionMode.Multiple; TreeSelection tSelect = treeView.Selection; tSelect.SelectAll(); //selecciona todas las filas necesario para obtener la informacion de todas. Array treePaths = tSelect.GetSelectedRows(out tModel); foreach(TreePath tPath in treePaths) { TreeIter iter; if(listStore.GetIter(out iter, tPath)) { string nombre = (string)listStore.GetValue(iter,1); string tamano = (string)listStore.GetValue(iter,2); string precio = (string)listStore.GetValue(iter,3); string cantidad = (string)listStore.GetValue(iter,4); if(!cantidad.Equals("0")) { IDbCommand dbCommand = dbConnection.CreateCommand (); dbCommand.CommandText = "insert into pedidos (nombre, tamano, precio,cantidad) values (:nombre, :tamano, :precio,:cantidad)"; DbCommandExtensions.AddParameter (dbCommand, "nombre",nombre); DbCommandExtensions.AddParameter (dbCommand, "tamano", tamano); DbCommandExtensions.AddParameter (dbCommand, "precio", Convert.ToDouble(precio)); DbCommandExtensions.AddParameter (dbCommand, "cantidad", Convert.ToInt32(cantidad)); dbCommand.ExecuteNonQuery (); Destroy (); } } } CalculoLabelMain calculoLabel = new CalculoLabelMain(); calculoLabel.calculoLabelTotal(totalMainWindow,botonNuevoPedidoMainWindow); }
protected void OnBotonAceptarClicked(object sender, System.EventArgs e) { if((comboboxBebida.Active != 0)&&(comboboxBocadillo.Active !=0)&&(comboboxCafe.Active!=0)&&(spinbuttonCantidad.Value!=0)){ string cadena = "Almuerzo Completo: "+valorComboBebida+", "+valorComboBocadillo +", "+valorComboCafe; IDbCommand dbCommand = dbConnection.CreateCommand (); dbCommand.CommandText = "insert into pedidos (nombre, tamano, precio,cantidad) values (:nombre, :tamano, :precio,:cantidad)"; DbCommandExtensions.AddParameter (dbCommand, "nombre",cadena); DbCommandExtensions.AddParameter (dbCommand, "tamano", "Normal"); DbCommandExtensions.AddParameter (dbCommand, "precio", Convert.ToDouble(comboboxPrecio.ActiveText)); DbCommandExtensions.AddParameter (dbCommand, "cantidad", Convert.ToInt32(spinbuttonCantidad.Value)); dbCommand.ExecuteNonQuery (); CalculoLabelMain calculoLabel = new CalculoLabelMain(); calculoLabel.calculoLabelTotal(totalMainWindow,botonNuevoPedidoMainWindow); Destroy (); }else{ MensajeComboInfo mensaje = new MensajeComboInfo(); mensaje.Show(); } }