Package nu.lazy8.ledger.jdbc

Examples of nu.lazy8.ledger.jdbc.TransactionAccess


   *
   * @param  view  Description of the Parameter
   */
  public CompanyForm(JFrame view) {
    super("company", view, "lazy8ledger-company");
    DataConnection dc = DataConnection.getInstance(view);
    if (dc == null || !dc.bIsConnectionMade) {
      Exit();
      return;
    }
    /*
 
View Full Code Here


   *
   * @return    Description of the Return Value
   */
  public boolean IsDeleteOK() {
    try {
      DataConnection dc = DataConnection.getInstance(view);
      if (dc == null || !dc.bIsConnectionMade) {
        return false;
      }
      PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
          "SELECT * FROM Activity2 where CompId=?"));
      stmt.setInt(1, textField1.getInteger().intValue());
      ResultSet rs = stmt.executeQuery();
      if (rs.next()) {
        CannotUpdateMessage();
        return false;
      }
      stmt.close();
      rs.close();
      stmt = dc.con.prepareStatement(dc.filterSQL(
          "SELECT * FROM Account where CompId=?"));
      stmt.setInt(1, textField1.getInteger().intValue());
      rs = stmt.executeQuery();
      if (rs.next()) {
        CannotUpdateMessage();
        return false;
      }
      stmt.close();
      rs.close();
      stmt = dc.con.prepareStatement(dc.filterSQL(
          "SELECT * FROM Customer2 where CompId=?"));
      stmt.setInt(1, textField1.getInteger().intValue());
      rs = stmt.executeQuery();
      if (rs.next()) {
        CannotUpdateMessage();
View Full Code Here

   * @return            Description of the Return Value
   */
  public static boolean doesNumberExist(int intToTest) {
    boolean returnValue = false;
    try {
      DataConnection dc = DataConnection.getInstance(null);
      if (dc == null || !dc.bIsConnectionMade) {
        return false;
      }
      PreparedStatement stmt = dc.con.prepareStatement(
          "SELECT * FROM Company where CompId=?");
View Full Code Here

   * @param  iCompId    Description of the Parameter
   * @param  sCompName  Description of the Parameter
   */
  public static void quickAndDirtyAddCompany(int iCompId, String sCompName) {
    try {
      DataConnection dc = DataConnection.getInstance(null);
      if (dc == null || !dc.bIsConnectionMade) {
        return;
      }
      PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
          "INSERT INTO Company (CompId,Name) VALUES(?,?)"));
      stmt.setInt(1, iCompId);
      stmt.setString(2, sCompName);
      stmt.executeUpdate();
      stmt.close();
View Full Code Here

   * @param  iCompId    Description of the Parameter
   * @param  sCompName  Description of the Parameter
   */
  public static void quickAndDirtyChangeCompany(int iCompId, String sCompName) {
    try {
      DataConnection dc = DataConnection.getInstance(null);
      if (dc == null || !dc.bIsConnectionMade) {
        return;
      }
      PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
          "UPDATE Company set Name=? where CompId=?"));
      stmt.setString(1, sCompName);
      stmt.setInt(2, iCompId);
      stmt.executeUpdate();
      stmt.close();
View Full Code Here

    rightButton.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          //create the test company
          DataConnection dc = DataConnection.getInstance(null);
          if (dc == null || !dc.bIsConnectionMade) {
            return;
          }
          File ff = new File("");
          boolean bFoundFile = true;
View Full Code Here

   *
   * @return    Description of the Return Value
   */
  public boolean IsDeleteOK() {
    try {
      DataConnection dc = DataConnection.getInstance(view);
      if (dc == null || !dc.bIsConnectionMade) {
        return false;
      }
      PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
          "SELECT * FROM Amount where CompId=? and Customer=?"));
      stmt.setInt(1, ((Integer) cc.comboBox.getSelectedItemsKey()).intValue());
      stmt.setInt(2, textField1.getInteger().intValue());
      ResultSet rs = stmt.executeQuery();
      if (rs.next()) {
View Full Code Here

          Translator.getTranslation("Update not entered"),
          JOptionPane.PLAIN_MESSAGE);
      return false;
    }
    try {
      DataConnection dc = DataConnection.getInstance(view);
      if (dc == null || !dc.bIsConnectionMade) {
        return false;
      }
      PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
          "SELECT * FROM Customer2 where CompId=? and CustId=?"));
      stmt.setInt(1, ((Integer) cc.comboBox.getSelectedItemsKey()).intValue());
      stmt.setInt(2, textField1.getInteger().intValue());
      ResultSet rs = stmt.executeQuery();
      if (rs.next()) {
View Full Code Here

   */
  public void clearFields() {
    textField1.setText("");
    //Get the next available number for the customer
    try {
      DataConnection dc = DataConnection.getInstance(null);
      if (dc == null || !dc.bIsConnectionMade) {
        return;
      }
      Statement st = dc.con.createStatement();
      ResultSet rs = st.executeQuery(dc.filterSQL(
          "SELECT MAX(CustId) FROM Customer2 WHERE CompId=" + ((Integer) cc.comboBox.getSelectedItemsKey()).intValue()));
      if (rs.next()) {
        int highestId = rs.getInt(1);
        highestId++;
        textField1.setInteger(new Integer(highestId));
View Full Code Here

   * @param  iCompId  Description of the Parameter
   * @return          The defaultAccount value
   */
  public static int getDefaultAccount(int iCustId, int iCompId) {
    try {
      DataConnection dc = DataConnection.getInstance(null);
      if (dc == null || !dc.bIsConnectionMade) {
        return 0;
      }
      Statement stmt = dc.con.createStatement();
      ResultSet rs = stmt.executeQuery(dc.filterSQL("SELECT DefaultAcc FROM Customer2 where CompId=" + iCompId + " and CustId=" + iCustId));
      if (rs.next()) {
        return rs.getInt(1);
      }
      return 0;
    } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of nu.lazy8.ledger.jdbc.TransactionAccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.