private void button1_Click(object sender, EventArgs e) { if (dgvPedidos.RowCount > 0) { if ((int)dgvPedidos.Rows[dgvPedidos.CurrentRow.Index].Cells["DESPACHADO"].Value == 0) { if (MessageBox.Show("Desea entregar el pedido?", "Entrega", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { consultaSQL = null; consultaSQL = "UPDATE PEDIDO SET DESPACHADO = 1 WHERE ID_PEDIDO = " + txtPedido.Text + ";"; con.EjecutarSQL(consultaSQL); MessageBox.Show("Su pedido ha sido entregado. ", "Entregado", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { if (MessageBox.Show("Desea cancelar la entrega de este pedido?", "Cancelar entrega", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { consultaSQL = null; consultaSQL = "UPDATE PEDIDO SET DESPACHADO = 0 WHERE ID_PEDIDO = " + txtPedido.Text + ";"; con.EjecutarSQL(consultaSQL); MessageBox.Show("Se ha cancelado la entrega.", "Entregado", MessageBoxButtons.OK, MessageBoxIcon.Information); } } mostrarImagen(); } mostrarPedidos(); LimpiarObjetos(); }
private void btnPedido_Click(object sender, EventArgs e) { consultaSQLL = null; consultaSQLL = "SELECT count(ID_PEDIDO)+1 FROM PEDIDO"; ClaseCompartida.numeroDePedidos = con.EjecutarNSQL(consultaSQLL); // MessageBox.Show(" N se " + ClaseCompartida.numeroDePedidos + " ddd "+ClaseCompartida.idMenu, "Validacion " + ClaseCompartida.clienteid, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); consultaSQLL = null; //consultaSQLL = "INSERT INTO PEDIDO(ID_PEDIDO, DESPACHADO, ID_MENU, ID_CLIENTE) VALUES ("+(ClaseCompartida.numeroDePedidos+1)+ ", 0, "+(ClaseCompartida.numeroDePedidos+1)+", "+ClaseCompartida.clienteid+");"; consultaSQLL += "INSERT INTO PEDIDO(ID_PEDIDO, DESPACHADO, ID_MENU, ID_CLIENTE) VALUES ('"; consultaSQLL += (ClaseCompartida.numeroDePedidos + 1) + "','0"; consultaSQLL += "','"; consultaSQLL += (ClaseCompartida.idMenu) + "','"; consultaSQLL += ClaseCompartida.clienteid + "')"; con.EjecutarSQL(consultaSQLL); if (MessageBox.Show("Se ha añadido el pedido! , Desea seguir comprando?", "Validacion ", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { ClaseCompartida.bandera = true; this.Close(); } else { MessageBox.Show("GRACIAS POR SU COMPRA", "DESPEDIDA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); ClaseCompartida.bandera = false; this.Close(); } }
public void button_Click(object sender, EventArgs e) { if (Validar()) { Button button = sender as Button; //Dando valor a ID_CLIENTE y asignandolo a la variable clienteid consultaSQL = null; // si bandera es igual false significa que es un cliente diferente si no es el mismo cliente. if (ClaseCompartida.bandera == false) { consultaSQL = null; consultaSQL = "SELECT count(ID_CLIENTE)+1 FROM CLIENTE"; ClaseCompartida.clienteid = con.EjecutarNSQL(consultaSQL); //Insertando lo que hay en el txtnombre y lo que tiene clinteid consultaSQL = null; consultaSQL = "INSERT INTO CLIENTE(ID_CLIENTE, NOM_CLIENTE) VALUES(" + ClaseCompartida.clienteid + ", '" + txtNombre.Text + "')"; con.EjecutarSQL(consultaSQL); } else { //MessageBox.Show("mismo cliente", "", MessageBoxButtons.OK); consultaSQL = null; consultaSQL = "SELECT count(ID_CLIENTE) FROM CLIENTE"; ClaseCompartida.clienteid = con.EjecutarNSQL(consultaSQL); } ClaseCompartida.idMenu = 0; ClaseCompartida.idMenu = int.Parse(button.Text); // mensajes prueba //ClaseCompartida.mensaje = "Se ha seleccionado el boton " + button.Name + " que tiene el id_menu " + button.Text; // MessageBox.Show("encontrado" + button.Name + " y text" + button.Text, " ?aaaaaa ", MessageBoxButtons.YesNo, MessageBoxIcon.Information); epError.Clear(); Desplegable frm = new Desplegable(); frm.Show(); } }