Package org.blueoxygen.common.dal

Examples of org.blueoxygen.common.dal.DbBean


                String role_id="";
                role_id="";
                pass="";
                char password[] = new char[100];
                try {
                    DbBean db = new DbBean();
                    db.connect();
                    String mySQL = "SELECT * FROM backend_user WHERE username like '" + lpLogin.getUserName() + "'";
                    ResultSet rs = db.execSQL(mySQL);
                    StringUtils stringutils = new StringUtils();
                    while (rs.next()) {
                        password = (stringutils.decodeBase64(rs.getString("password"))).toCharArray();
                        role_id = rs.getString("role_id");
                    }
                    db.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }
View Full Code Here


            Calendar cal = new GregorianCalendar();
            date = cal.get(Calendar.DATE) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.YEAR;           
            g.setFont(theFont);
            g.drawString("Postila",80,10);
            try{                                  
                    DbBean db = new DbBean();                       
                    db.connect();            

                    int id = 0;
                    String mySQL = "SELECT MAX(id) from pos";
                    ResultSet rs = db.execSQL(mySQL);                      
                    while (rs.next()) {
                       id = rs.getInt(1);
                    }            
                    g.drawString("No.",10,20);
                    g.drawString(String.valueOf(id),25,20);
                   
                    int x=5,y=35;
                    mySQL = "SELECT posId, name, quantity, price FROM product_pos a JOIN pos b on a.posId=b.id JOIN product c on c.code=a.productCode WHERE posId = '" + id + "'";
                    rs = db.execSQL(mySQL);
                    while (rs.next()) {
                        name = (rs.getString("name"));
                        qty = (rs.getInt("quantity"));                       
                        subtotal = qty * (rs.getDouble("price"));
                        total = total + subtotal;                        
                        len = String.valueOf(subtotal).length() * 6;
                        len1 = String.valueOf(qty).length() * 5;
                       
                        g.drawString(name, x, y); x+=100;
                        g.drawString(String.valueOf(Check.viewMoney(new BigDecimal(qty))), x-len1, y); x+=80;
                        g.drawString(String.valueOf(Check.viewMoney(new BigDecimal(subtotal))), x-len, y);
                        x=5; y+=10;                       
                    }          
                    g.drawString(date,130,20);
                    len = String.valueOf(total).length() * 6;
                    g.drawLine(180-len,y-7,180,y-7);
                    g.drawString(String.valueOf(Check.viewMoney(new BigDecimal(total))), 185-len, y+7);
                    db.close();
                    } catch (SQLException e) {                           
                        e.printStackTrace();
                    } catch (ClassNotFoundException e) {
                        e.printStackTrace();
               }
View Full Code Here

        }
        if(!txtCode.getText().equalsIgnoreCase("")){
            String code = "";
            if(evt.getKeyCode()=='\n'){
                try {
                    DbBean db = new DbBean();
                    db.connect();
                    String mySQL = "SELECT * FROM items WHERE itemsCode like '" + txtCode.getText() + "'";
                    ResultSet rs = db.execSQL(mySQL);
                    while (rs.next()) {
                        lblName.setText(rs.getString("itemsName"));
                        code = rs.getString("itemsCode");
                        price = Double.parseDouble(rs.getString("price"));
                    }
                    db.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                } catch (ClassNotFoundException e) {
                   
                    e.printStackTrace();
View Full Code Here

    }//GEN-LAST:event_paymentTypeKeyPressed

    private void jPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPrintActionPerformed
        if(!txtReturn.getText().equalsIgnoreCase("") || !txtNumber.getText().equalsIgnoreCase("")){
            try {
                DbBean db = new DbBean();     
                db.connect();
                String date = "";
                Calendar cal = new GregorianCalendar();
                date =cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.DATE;
                String mySQL = "INSERT INTO pos (create_date, pembulatan) VALUES ('" + date + "','" + pembulatan + "')";
                db.execute(mySQL);

                //mySQL = "INSERT INTO pos_transaction (create_date) VALUES ('" + date + "')";
                //db.execute(mySQL);

                if(paymentType.getSelectedItem().equals("Cash")){
                    mySQL = "INSERT INTO pos_transaction(paymentType, totalPayment, totalReturn, create_date) VALUES('" + paymentType.getSelectedItem() + "'," + pay + "," + payReturn + ",'" + date + "')";
                    db.execute(mySQL);                           
                }else{
                    mySQL = "INSERT INTO pos_transaction(paymentType, name, creditCardNo, create_date) VALUES('" + paymentType.getSelectedItem() + "','" + txtName.getText() + "','" + txtNumber.getText() + "','" + date + "')";
                    db.execute(mySQL);
                }

                int id = 0;
                mySQL = "SELECT MAX(id) from pos";
                ResultSet rs = db.execSQL(mySQL);                      
                while (rs.next()) {
                    id = rs.getInt(1);
                }                    

                int transId = 0;
                mySQL = "SELECT MAX(id) from pos_transaction";
                rs = db.execSQL(mySQL);                      
                while (rs.next()) {
                    transId = rs.getInt(1);
                }

                int a = model.getRowCount();
                for(int i=0 ; i<a ; i++){
                    mySQL = "INSERT INTO product_pos (posId, Quantity, productCode, pos_transId) VALUES (" + id + "," + model.getValueAt(i,3) + ",'" + model.getValueAt(i,0) + "'," + transId + ")";
                    db.execute(mySQL);                       
                }                           

                db.close();
            } catch (SQLException e) {     
                e.printStackTrace();
            } catch (ClassNotFoundException e) {     
                e.printStackTrace();
            }
View Full Code Here

        LoginService ls = new LoginService() {
            public boolean authenticate(String string, char[] c, String string0) throws Exception {
                StringUtils stringutils = new StringUtils();
                char password[] = new char[100];
                try {
                    DbBean db = new DbBean();
                    db.connect();
                    String mySQL = "SELECT * FROM backend_user WHERE username = '"+string+"'";
                    ResultSet rs = db.execSQL(mySQL);
                    while (rs.next()) {
                        password = (stringutils.decodeBase64(rs.getString("password"))).toCharArray();
                        user_id = rs.getString("id");
                    }
                    db.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }
View Full Code Here

TOP

Related Classes of org.blueoxygen.common.dal.DbBean

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.