RetDAO.java (part2) .. will give good points to everyone. Is this logic good?

RetDAO.java (part2) .. will give good points to everyone. Is this logic good?

    public static int delete(Connection conn,String ret_id) throws Exception
    {
        st=conn.createStatement(); 
        rs=st.executeQuery("select * from retailer where retailer_id='"+ret_id+"'");
        rs.next();
        String s1=rs.getString(1);
        String s2=rs.getString(2);
        String s3=rs.getString(3);
        String s4=rs.getString(4);
        int s5=rs.getInt(5);
        String s6=rs.getString(6);
        String s7=rs.getString(8);
        String s8=rs.getString(9);

        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
        System.out.println(s4);
        System.out.println(s5);
        System.out.println(s6);
        System.out.println(s7);
        System.out.println(s8);

        int a=st.executeUpdate("insert into inactive values('"+s1+"','"+s2+"','"+s3+"','"+s4+"',"+s5+",'"+s6+"')");
        System.out.println("a="+a);

        int z=st.executeUpdate("delete from order_table,retailer where retailer_id='"+ret_id+"'");
        return z;
    }

    public static ArrayList viewRequest(Connection conn) throws Exception
      {  
          ArrayList<RetailerBean> l=new ArrayList<RetailerBean>();
          st=conn.createStatement();

          ResultSet rs=st.executeQuery("select * from tag_request_tbl");


          while(rs.next())
          {
              RetailerBean b=new RetailerBean();

              b.setId(rs.getString(1));

             // b.setHandset(rs.getString(3));

              //b.setAccessories(rs.getString(3));
              //b.setSim(rs.getString(3));
              b.setProductid(rs.getInt(2));
              System.out.println(rs.getInt(2));
              l.add(b);
          }

          return l;
      }


      public static void tagApprove(Connection conn,String ret) throws Exception
      {

          st=conn.createStatement(); 
          ResultSet rs=st.executeQuery("select productmodel_id from tag_request_tbl where retailer_id='"+ret+"'");

          //System.out.println(rs.getFetchSize());

          /*while( rs.next())  
          {
              System.out.println(rs.getInt(1));
          }*/

        while( rs.next())  
        {    
         int i=st.executeUpdate("insert into tag_product_tbl values('"+ret+"', "+rs.getInt(1)+")");
         System.out.println("i="+i); 
        }
        int j=st.executeUpdate("delete from tag_request_tbl where  retailer_id='"+ret+"'");
        System.out.println("j="+j);
        }
        //}

      public static void tagReject(Connection conn,String ret) throws Exception
      {
          st=conn.createStatement(); 
          ResultSet rs=st.executeQuery("select productmodel_id from tag_request_tbl where retailer_id='"+ret+"'");

        while( rs.next())

        {    // String product_id=rs.getString(1);
        //  System.out.println(product_id);
        //while (rs.next())  
        //{
            //int i=st.executeUpdate("insert into tag_product_tbl values('"+ret+"', '"+rs.getString(1)+"')");
         //System.out.println(i);
         st.executeUpdate("delete from tag_request_tbl where  retailer_id='"+ret+"'");
        }
    //  }
        }


      public static ArrayList viewRequestRetailer(Connection conn) throws Exception
      {  
          ArrayList<RetailerBean> l=new ArrayList<RetailerBean>();
          st=conn.createStatement();

          ResultSet rs=st.executeQuery("select retailer_id,retailer_name from retailer where status='inactive'");


          while(rs.next())
          {
              RetailerBean b=new RetailerBean();

              b.setId(rs.getString(1));

             // b.setHandset(rs.getString(3));

              //b.setAccessories(rs.getString(3));
              //b.setSim(rs.getString(3));
              b.setName(rs.getString(2));
              l.add(b);
          }

          return l;
      }



      public static void retailerApprove(Connection conn,String ret) throws Exception
      {
          st=conn.createStatement(); 
          System.out.println(ret);
          ResultSet rs=st.executeQuery("select user_name,password from retailer where retailer_id='"+ret+"'");
         int r=st.executeUpdate("update retailer set status='active' where retailer_id='"+ret+"'");
         int h=st.executeUpdate("update login_tbl set status='active' where user_name='"+rs.getString(1)+"' and password='"+rs.getString(2)+"'");
        //while( rs.next())

        //{  // String product_id=rs.getString(1);
        //  System.out.println(product_id);
        //while (rs.next())  
        //{
            //int i=st.executeUpdate("insert into tag_product_tbl values('"+ret+"', '"+rs.getString(1)+"')");
         System.out.println(r);
         System.out.println(h);
    //   st.executeUpdate("delete from tag_request_tbl where  retailer_id='"+ret+"'");
        }
    //  }

      public static void retailerReject(Connection conn,String ret) throws Exception
      {
          st=conn.createStatement(); 
          st=conn.createStatement(); 
          ResultSet rs=st.executeQuery("select user_name,password from retailer where retailer_id='"+ret+"'");
         int r=st.executeUpdate("update retailer set status='reject' where retailer_id='"+ret+"'");
         int h=st.executeUpdate("update login_tbl set status='reject' where user_name='"+rs.getString(1)+"' and password='"+rs.getString(2)+"'");
        //while( rs.next())

        //{  // String product_id=rs.getString(1);
        //  System.out.println(product_id);
        //while (rs.next())  
        //{
            //int i=st.executeUpdate("insert into tag_product_tbl values('"+ret+"', '"+rs.getString(1)+"')");
         System.out.println(r);
         System.out.println(h);
    //   st.executeUpdate("delete from tag_request_tbl where  retailer_id='"+ret+"'");
    //  }
        }
}
View Answers









Related Tutorials/Questions & Answers:
RetDAO.java (part2) .. will give good points to everyone. Is this logic good?
RetDAO.java (part1) ..reference. Is this logic good?
Advertisements
RetDAO.java (part1) ..reference. Is this logic good?
Can you give me some good factory pattern examples?
Pleae help me to give logic and code for this program - Java Beginners
ModuleNotFoundError: No module named 'part2'
RetController.java (do get) (my file for reference for a test.. IS LOGIC good Enough ?
delete retailer jsp file (sir..is this a good logic.. jsp file is useful for what purpose)
LOGIC
LOGIC
Why is everyone Machine Learning?
Web Logic Administrator
calculate reward points.
ModuleNotFoundError: No module named 'points'
plotting of points inside a rectangle
points being displayed in the world
Delete points from database
How to put points on a JButton
Artifacts of com.end-points
Logic and desgin
Free Article Editorial Test of 7 Points
ModuleNotFoundError: No module named 'pinax-points'
ModuleNotFoundError: No module named 'access_points'
ModuleNotFoundError: No module named 'hexlet-points'
ModuleNotFoundError: No module named 'contact-points'
ModuleNotFoundError: No module named 'contact-points'
ModuleNotFoundError: No module named 'contact-points'
give answer
Version of com.end-points>testingrepo dependency
give idea
Logic Building
Logic Iterate.
Logic Iterate.
Business logic vs Presentation logic - JSP-Servlet
ModuleNotFoundError: No module named 'random-geometry-points'
ModuleNotFoundError: No module named 'torch-points-kernels'
ModuleNotFoundError: No module named 'torch-points-kernels'
ModuleNotFoundError: No module named 'dolead-entry-points'
ModuleNotFoundError: No module named 'good'
ModuleNotFoundError: No module named 'good'
Logic and Degin
leap year logic - Java Beginners
What is programming logic ?
Logic and Design
logic-iterate
give the code for servlets session
ModuleNotFoundError: No module named 'give'
ModuleNotFoundError: No module named 'give'
ModuleNotFoundError: No module named 'give'
plz give me answer

Ads