private void button1_Click(object sender, EventArgs e) { if (comboBox1.Equals("") || comboBox2.Equals("") || comboBox3.Equals("")) { MessageBox.Show("No puede dejar los campos vacios!"); } else { try { BDconnection.realizarAccion($"INSERT INTO APPORDER(createDate, idProduct, idAddress) VALUES (" + $"'{DateTime.Today}'," + $"{comboBox1.SelectedItem}," + $"{comboBox2.SelectedItem})"); MessageBox.Show("ORDEN ANADIDA"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Equals("")) { MessageBox.Show("No puede dejar los campos vacios"); } else { try { string query = $"SELECT idaddress FROM ADDRESS WHERE address ='{comboBox1.SelectedItem.ToString()}'"; var dt = BDconnection.realizarConsulta(query); var dr = dt.Rows[0]; var idaddress = Convert.ToInt32(dr[0].ToString()); string nonQuery = $"UPDATE ADDRESS SET address = '{textBox1.Text}' WHERE idAddress = {idaddress}"; BDconnection.realizarAccion(nonQuery); MessageBox.Show("Se ha modificado la direccion"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error!"); } } }
private void button1_Click(object sender, EventArgs e) { var dn = BDconnection.realizarConsulta($"SELECT username FROM APPUSER WHERE username = '******'"); var dr1 = dn.Rows[0]; var dc2 = BDconnection.realizarConsulta($"SELECT password FROM APPUSER WHERE username = '******'"); var dr2 = dc2.Rows[0]; if (dr1[0].ToString().Equals(textBox1.Text) && dr2[0].ToString().Equals(textBox2.Text)) { try { string query = $"SELECT idUser FROM APPUSER WHERE username ='******'"; var dt = BDconnection.realizarConsulta(query); var dr = dt.Rows[0]; var idUser = Convert.ToInt32(dr[0].ToString()); string nonQuery = $"UPDATE APPUSER SET password = '******' WHERE idUser = {idUser}"; BDconnection.realizarAccion(nonQuery); MessageBox.Show("Se ha modificado la direccion"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error!"); } } else { MessageBox.Show("Datos incorrectos"); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Equals("") || textBox2.Equals("")) { MessageBox.Show("No puede dejar los campos vacios!"); } else { try { BDconnection.realizarAccion($"INSERT INTO APPUSER(fullname, username, password, userType) VALUES(" + $"'{textBox1.Text}'," + $"'{textBox2.Text}'," + $"'{textBox3.Text}'," + $"{comboBox1.SelectedItem})"); MessageBox.Show("USUARIO ANADIDO"); } catch (Exception esg) { MessageBox.Show("Ha ocurrido un error"); } } }
private void button1_Click(object sender, EventArgs e) { string nonQuery = $"DELETE FROM ADDRESS WHERE idAddress='{comboBox1.SelectedItem.ToString()}'"; BDconnection.realizarAccion(nonQuery); MessageBox.Show("Direccion Eliminada"); }
private void button1_Click(object sender, EventArgs e) { try{ string nonQuery = $"DELETE FROM BUSINESS WHERE idBusiness = {textBox1.Text}"; BDconnection.realizarAccion(nonQuery); MessageBox.Show("Negocio Eliminado"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error!"); } }
private void button1_Click(object sender, EventArgs e) { //DELETE FROM APPORDER WHERE idOrder = 1 try { string nonQuery = $"DELETE FROM APPORDER WHERE idOrder ='{textBox1.Text}'"; BDconnection.realizarAccion(nonQuery); MessageBox.Show("Orden Eliminada"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Equals("")) { MessageBox.Show("No puede dejar los campos vacios"); } else { try { BDconnection.realizarAccion($"INSERT INTO PRODUCT(idBusiness, name) VALUES({comboBox1.SelectedItem}, '{textBox1.Text}');"); MessageBox.Show("Se ha registrado el producto"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error!"); } } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Equals("")) { MessageBox.Show("No puede dejar los campos vacios"); } else { try { BDconnection.realizarAccion($"INSERT INTO BUSINESS(name, description) VALUES('{textBox1.Text}', '{textBox2.Text}');"); MessageBox.Show("Se ha guardado el negocio"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error!"); } } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Equals("")) { MessageBox.Show("No puede dejar los campos vacios"); } else { try { BDconnection.realizarAccion($"INSERT INTO ADDRESS(idUser, address) VALUES ({textBox1.Text}, '{textBox2.Text}');"); MessageBox.Show("Se ha registrado la direccion"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error!"); } } }