private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Equals("") || textBox2.Text.Equals("") || textBox3.Text.Equals("")) { MessageBox.Show("No se pueden dejar campos vacios"); } else { try { if (radioButton1.Checked) { ConnectionBD.ExecuteNonQuery($"INSERT INTO APPUSER (fullname, username, password, userType) " + $"VALUES ('{textBox1.Text}', " + $"'{textBox2.Text}', '{textBox3.Text}' ,'{false}')"); MessageBox.Show("Se ha registrado un usuario!"); } else { ConnectionBD.ExecuteNonQuery($"INSERT INTO APPUSER (fullname, username, password, userType) " + $"VALUES ('{textBox1.Text}', " + $"'{textBox2.Text}', '{textBox3.Text}' ,'{true}')"); MessageBox.Show("Se ha registrado un usuario!"); } } catch (Exception ex) { Console.WriteLine("Ha ocurrido un error!"); } } }
private void button1_Click_1(object sender, EventArgs e) { if (textBox1.Text.Equals("")) { MessageBox.Show("Debe cambiar la contraseña"); } else { try { string aux = comboBox1.SelectedItem.ToString(); /*string consulta = $"select password from appuser where username='******'"; * var dt = ConnectionBD.ExecuteQuery(consulta); * var dr = dt.Rows[0]; * var contra = Convert.ToString(dr[0].ToString());*/ string accion = $"update appuser set password = '******'" + $" where username = '******'"; ConnectionBD.ExecuteNonQuery(accion); MessageBox.Show("Se ha actualizado la contraseña"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } } }
private void button1_Click(object sender, EventArgs e) { if (comboBox1.SelectedItem == null) { throw new NoRestaurantSelected("No se ha seleccionado un restaurante"); } else { try { ConnectionBD.ExecuteNonQuery($"INSERT INTO PRODUCT(idBusiness, name) " + $"VALUES('{comboBox1.SelectedValue}', '{textBox1.Text}');"); MessageBox.Show("Se ha agregado el producto"); } catch (NoRestaurantSelected ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } } }
private void button1_Click(object sender, EventArgs e) { if (comboBox1.SelectedItem == null || comboBox2.SelectedItem == null) { MessageBox.Show("Llene los campos"); } else { try { DateTime d = DateTime.Now; ConnectionBD.ExecuteNonQuery($"INSERT INTO APPORDER(createDate, idProduct, idAddress) " + $"VALUES('{d}', '{comboBox1.SelectedValue}', '{comboBox2.SelectedValue}'); "); MessageBox.Show("Se ha procesado su orden"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } } }
private void button1_Click(object sender, EventArgs e) { try { string nonQuery = $"DELETE FROM BUSINESS WHERE idBusiness ={comboBox1.SelectedValue}"; ConnectionBD.ExecuteNonQuery(nonQuery); MessageBox.Show("Se ha eliminado el negocio"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } }
private void button1_Click(object sender, EventArgs e) { try { if (comboBox1.SelectedItem == null) { MessageBox.Show("No se ha escogido un producto"); } else { ConnectionBD.ExecuteNonQuery($"DELETE FROM PRODUCT WHERE idProduct = '{comboBox1.SelectedValue}'"); MessageBox.Show("Se ha eliminado el producto"); } } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } }
private void button1_Click(object sender, EventArgs e) { try { if (comboBox1.SelectedItem == null) { MessageBox.Show("Escoga una dirección"); } else { ConnectionBD.ExecuteNonQuery($"DELETE FROM ADDRESS WHERE idAddress = '{comboBox1.SelectedValue}'"); PoblarControles(); MessageBox.Show("Se ha eliminado la direccion"); } } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Equals("") || textBox2.Text.Equals("")) { MessageBox.Show("No se pueden dejar campos vacios"); } else { try { ConnectionBD.ExecuteNonQuery($"INSERT INTO BUSINESS(name, description) " + $"VALUES('{textBox1.Text}', '{textBox2.Text}');"); MessageBox.Show("Se ha agregado 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("Necesita una dirección"); } else { try { ConnectionBD.ExecuteNonQuery($"INSERT INTO ADDRESS(idUser, address) " + $"VALUES('{logged.IdUser}', '{textBox1.Text}')"); MessageBox.Show("Se ha agregado la direccion"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } } }
private void button1_Click(object sender, EventArgs e) { try { string query = $"SELECT idUser FROM APPUSER WHERE username = '******'"; var dt = ConnectionBD.ExecuteQuery(query); var dr = dt.Rows[0]; var idUsuario = Convert.ToInt32(dr[0].ToString()); string nonQuery = $"DELETE FROM APPUSER WHERE idUser = {idUsuario}"; ConnectionBD.ExecuteNonQuery(nonQuery); MessageBox.Show("Se ha eliminado el usuario"); } catch (Exception exception) { MessageBox.Show("Ha ocurrido un error!"); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Equals("")) { MessageBox.Show("No se pueden dejar campos vacio"); } else { try { ConnectionBD.ExecuteNonQuery($"UPDATE ADDRESS SET address = '{textBox1.Text}' " + $"WHERE idAddress = {comboBox1.SelectedValue}"); PoblarControles(); MessageBox.Show("Se ha modificado la direccion"); } catch (Exception ex) { MessageBox.Show("Ha ocurrido un erros"); } } }
private void button1_Click(object sender, EventArgs e) { ConnectionBD.ExecuteNonQuery($"DELETE FROM APPORDER WHERE idOrder = '{comboBox1.SelectedValue}'"); MessageBox.Show("Orden eliminada"); }