Пример #1
0
  public void eventoClickCombo(String nroCuenta) {
    Long nroCuentaSeleccionada = 0L;

    for (Cuenta cuenta : Banco.recuperarMiBanco().getListaCajasDeAhorro().values()) {
      if (cuenta.toString().equals(nroCuenta)) {
        nroCuentaSeleccionada = cuenta.getNumeroCuenta();
      }
    }

    if (nroCuentaSeleccionada == 0) {
      for (Cuenta cuenta : Banco.recuperarMiBanco().getListaCuentasCorriente().values()) {
        if (cuenta.toString().equals(nroCuenta)) {
          nroCuentaSeleccionada = cuenta.getNumeroCuenta();
        }
      }
    }

    double saldo =
        Banco.recuperarMiBanco()
            .verCliente(dni)
            .getCuentasMonetarias()
            .get(nroCuentaSeleccionada)
            .getSaldoActual();
    saldoResultado.setText(String.valueOf(saldo));
    saldoResultado.setVisible(true);
  }
  // excluir
  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    try {

      Banco.abrirConexao();

      Banco.abrirConexao()
          .prepareStatement("DELETE FROM produto WHERE p_id = " + req.getParameter("id") + "")
          .execute();

      System.out.println("excluido");

      Banco.abrirConexao().close();

      resp.sendRedirect("listarBuscar");

    } catch (Exception e) {
    }
  }
Пример #3
0
  public ConsultaSaldoJFrame(final long dni, ConsultasJFrame consulta) {
    this.dni = dni;
    this.padre = consulta;
    setBackground(Color.WHITE);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 300);
    contentPane = new JPanel();
    contentPane.setBackground(Color.WHITE);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JButton cerrar = new JButton("");
    cerrar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cerrarSesion();
          }
        });
    cerrar.setIcon(new ImageIcon("./src/imagenes/shut-down.png"));
    cerrar.setHorizontalAlignment(SwingConstants.LEFT);
    cerrar.setBounds(396, 228, 48, 44);
    contentPane.add(cerrar);

    int i = 0;
    int cantCuentas = Banco.recuperarMiBanco().verCliente(dni).getCuentasMonetarias().size();
    final String[] nombreCuentas = new String[cantCuentas];

    for (Long nroCuenta :
        Banco.recuperarMiBanco().verCliente(dni).getCuentasMonetarias().keySet()) {
      nombreCuentas[i] =
          Banco.recuperarMiBanco().verCliente(dni).getCuentasMonetarias().get(nroCuenta).toString();
      i++;
    }

    // no se porque aca me tira que tengo que agregarle un final
    final JComboBox cuentas = new JComboBox(nombreCuentas);
    cuentas.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String aux = cuentas.getSelectedItem().toString();
            if (aux != msjDefault) eventoClickCombo(aux);
          }
        });
    cuentas.setBounds(125, 119, 209, 50);
    contentPane.add(cuentas);

    cuentas.addItem(msjDefault);

    cuentas.setBounds(168, 119, 166, 50);
    contentPane.add(cuentas);

    JLabel label = new JLabel("");
    label.setIcon(new ImageIcon("./src/imagenes/LOGO BBV.gif"));
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setForeground(new Color(0, 191, 255));
    label.setFont(
        label
            .getFont()
            .deriveFont(
                label.getFont().getStyle() | Font.BOLD | Font.ITALIC,
                label.getFont().getSize() + 9f));
    label.setBackground(Color.LIGHT_GRAY);
    label.setBounds(6, 6, 440, 62);
    contentPane.add(label);

    JLabel lblNewLabel = new JLabel("SELECCIONE \nLA CUENTA");
    lblNewLabel.setFont(
        lblNewLabel
            .getFont()
            .deriveFont(lblNewLabel.getFont().getStyle() | Font.BOLD | Font.ITALIC));
    lblNewLabel.setForeground(new Color(30, 144, 255));
    lblNewLabel.setBounds(168, 92, 200, 34);
    contentPane.add(lblNewLabel);
    JLabel lblNewLabel_1 = new JLabel("Su saldo es:");
    lblNewLabel_1.setFont(new Font("Lucida Grande", Font.ITALIC, 13));
    lblNewLabel_1.setHorizontalAlignment(SwingConstants.RIGHT);
    lblNewLabel_1.setForeground(new Color(30, 144, 255));
    lblNewLabel_1.setBounds(83, 167, 93, 16);
    contentPane.add(lblNewLabel_1);

    saldoResultado = new JTextField();
    saldoResultado.setEditable(false);
    saldoResultado.setBounds(188, 161, 179, 28);
    contentPane.add(saldoResultado);
    saldoResultado.setColumns(10);

    JButton home = new JButton("");
    home.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clickAtras();
          }
        });
    home.setIcon(new ImageIcon("./src/imagenes/home.png"));
    home.setHorizontalAlignment(SwingConstants.LEFT);
    home.setBounds(6, 228, 48, 44);
    contentPane.add(home);
    saldoResultado.setVisible(false);
  }
Пример #4
0
 public void cerrarSesion() {
   Banco.save(Banco.recuperarMiBanco());
   this.padre.cerrarSesion();
   this.dispose();
 }
Пример #5
0
 public void clickAtras() {
   Banco.save(Banco.recuperarMiBanco());
   this.padre.clickAtras();
   this.dispose();
 }