/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import LoginDb.DbHandler;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author 986137
 */
public class BatchExecutionFailedOperation {

    Connection con = null;
    Statement st = null;
    boolean SuccessFlag = false;

    public boolean BatchExecutionFailedOperation(String PageName, String hdrID) {


        try {
            con = DbHandler.getDBConnection();
            st = con.createStatement();

            if (PageName.equalsIgnoreCase("pdsSellItem.jsp")) {

                ResultSet rs = st.executeQuery("delete from PDS_SALES_HDR where SALES_REF_NO='" + hdrID + "'");

            }
            if (PageName.equalsIgnoreCase("DepositKYCCreation.jsp")) {

                ResultSet rs = st.executeQuery("Delete from KYC_HDR where CIF_NO = '" + hdrID + "' ");

            }
           // con.commit();
            SuccessFlag=true;

        } catch (Exception e) {
            System.out.println("Error occurred during processing.");
            
        } finally {
                try {
                    if(st !=null)
                        st.close();
                    if (con != null)
                    con.close();

            } catch (Exception e) {               
               System.out.println("Error Occurred during connection close.");
            }
            }
       
        return SuccessFlag;
    }
}
