Examples of DataConnection


Examples of nu.lazy8.ledger.jdbc.DataConnection

   *
   * @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

Examples of nu.lazy8.ledger.jdbc.DataConnection

          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

Examples of nu.lazy8.ledger.jdbc.DataConnection

   */
  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

Examples of nu.lazy8.ledger.jdbc.DataConnection

   * @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

Examples of nu.lazy8.ledger.jdbc.DataConnection

   *
   * @param  bIsAddOnly   Description of the Parameter
   * @param  sAccountNum  Description of the Parameter
   */
  private void initialize(boolean bIsAddOnly, String sAccountNum) {
    DataConnection dc = DataConnection.getInstance(view);
    if (dc == null || !dc.bIsConnectionMade) {
      Exit();
      return;
    }
    /*
 
View Full Code Here

Examples of nu.lazy8.ledger.jdbc.DataConnection

    rightButton.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          DataConnection dc = DataConnection.getInstance(null);
          if (dc == null || !dc.bIsConnectionMade) {
            return;
          }
          File ff = new File("");
          boolean bFoundFile = true;
          try {
            ff = Fileio.getFile("AccountPlan." + SetupInfo.getProperty(SetupInfo.PRESENT_LANGUAGE) + ".bin",
                "testdata", false, false);
            if (ff == null || !ff.isFile()) {
              bFoundFile = false;
            }
          } catch (Exception ee) {
            bFoundFile = false;
          }
          if (!bFoundFile) {
            try {
              ff = Fileio.getFile("AccountPlan.en.bin",
                  "testdata", false, false);
            } catch (Exception eee) {
              SystemLog.ErrorPrint("Cant find test database : " + eee.getMessage());
              return;
            }
          }
          Lazy8LedgerPlugin.createRestoreFile(dc.con, true, ff.getAbsolutePath(), iCompId, frameParent);
          //name was destroyed in the last operation
          CompanyForm.quickAndDirtyChangeCompany(iCompId, sCompName);
          //period destroyed also...
          try {
            PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
                "INSERT INTO AccountingPeriods (CompId,StartPeriod,EndPeriod) VALUES(?,?,?)"));
            stmt.setInt(1, iCompId);
            stmt.setDate(2, new java.sql.Date(dateField1.getDate().getTime()));
            stmt.setDate(3, new java.sql.Date(dateField2.getDate().getTime()));
            stmt.executeUpdate();
View Full Code Here

Examples of nu.lazy8.ledger.jdbc.DataConnection

                    Translator.getTranslation("The StartPeriod must be less than the EndPeroid"),
                    Translator.getTranslation("Update not entered"),
                    JOptionPane.PLAIN_MESSAGE);
              } else {
                try {
                  DataConnection dc = DataConnection.getInstance(null);
                  if (dc == null || !dc.bIsConnectionMade) {
                    return;
                  }
                  PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
                      "INSERT INTO AccountingPeriods (CompId,StartPeriod,EndPeriod) VALUES(?,?,?)"));
                  stmt.setInt(1, iCompId);
                  stmt.setDate(2, new java.sql.Date(dateField1.getDate().getTime()));
                  stmt.setDate(3, new java.sql.Date(dateField2.getDate().getTime()));
                  stmt.executeUpdate();
View Full Code Here

Examples of org.apache.ftpserver.ftplet.DataConnection

            // get data connection
            session.write(LocalizedFtpReply.translate(session, request, context,
                    FtpReply.REPLY_150_FILE_STATUS_OKAY, "MLSD", null));

            // print listing data
            DataConnection dataConnection;
            try {
                dataConnection = session.getDataConnection().openConnection();
            } catch (Exception e) {
                LOG.debug("Exception getting the output data stream", e);
                session.write(LocalizedFtpReply.translate(session, request, context,
                        FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION, "MLSD",
                        null));
                return;
            }

            boolean failure = false;
            try {
                // parse argument
                ListArgument parsedArg = ListArgumentParser.parse(request
                        .getArgument());

                FileFormater formater = new MLSTFileFormater((String[]) session
                        .getAttribute("MLST.types"));

                dataConnection.transferToClient(session.getFtpletSession(), directoryLister.listFiles(
                        parsedArg, session.getFileSystemView(), formater));
            } catch (SocketException ex) {
                LOG.debug("Socket exception during data transfer", ex);
                failure = true;
                session.write(LocalizedFtpReply.translate(session, request, context,
View Full Code Here

Examples of org.apache.ftpserver.ftplet.DataConnection

            // get data connection
            session.write(LocalizedFtpReply.translate(session, request, context,
                    FtpReply.REPLY_150_FILE_STATUS_OKAY, "APPE", fileName));

            DataConnection dataConnection;
            try {
                dataConnection = session.getDataConnection().openConnection();
            } catch (Exception e) {
                LOG.debug("Exception when getting data input stream", e);
                session.write(LocalizedDataTransferFtpReply.translate(session, request, context,
                        FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION, "APPE",
                        fileName, file));
                return;
            }

            // get data from client
            boolean failure = false;
            OutputStream os = null;
            long transSz = 0L;
            try {

                // find offset
                long offset = 0L;
                if (file.doesExist()) {
                    offset = file.getSize();
                }

                // open streams
                os = file.createOutputStream(offset);

                // transfer data
                transSz = dataConnection.transferFromClient(session.getFtpletSession(), os);

                // attempt to close the output stream so that errors in
                // closing it will return an error to the client (FTPSERVER-119)
                if(os != null) {
                    os.close();
View Full Code Here

Examples of org.apache.ftpserver.ftplet.DataConnection

            session.write(
                    LocalizedFtpReply.translate(session, request, context,
                            FtpReply.REPLY_150_FILE_STATUS_OKAY, "STOR",
                            fileName)).awaitUninterruptibly(10000);

            DataConnection dataConnection;
            try {
                dataConnection = session.getDataConnection().openConnection();
            } catch (Exception e) {
                LOG.debug("Exception getting the input data stream", e);
                session.write(LocalizedDataTransferFtpReply.translate(session, request, context,
                        FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION, "STOR",
                        fileName, file));
                return;
            }

            // transfer data
            boolean failure = false;
            OutputStream outStream = null;
            long transSz = 0L;
            try {
                outStream = file.createOutputStream(skipLen);
                transSz = dataConnection.transferFromClient(session.getFtpletSession(), outStream);

                // attempt to close the output stream so that errors in
                // closing it will return an error to the client (FTPSERVER-119)
                if(outStream != null) {
                    outStream.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.