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

package Controller;

import Dao.CashWithdrawlDDSDao;
import Dao.MicroFileProcessingDao;
import DataEntryBean.MicroFileAccountDetBean;
import ServiceLayer.CashWithdrawlDDSService;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author 1004242
 */
public class TotalCashDepositDDSServlet extends HttpServlet {


   @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        HttpSession session = request.getSession(false);
        String pacsId = (String) session.getAttribute("pacsId");
        String tellerId = (String) session.getAttribute("user");
        String tellerName = (String) session.getAttribute("UserName");
        //String agentId = request.getParameter("agntIdname");
       // String amnt = request.getParameter("trAmount");
        String result = null;
        CashWithdrawlDDSDao ddsDao = new CashWithdrawlDDSDao();
      
        try {
                result = ddsDao.TotalCashDepositOperation(tellerId,pacsId,amnt,agentId , request);
                if (result !=null){
                    request.setAttribute("message", result);
                    request.getRequestDispatcher("/DDS/TotalCashDepositDDS.jsp").forward(request, response);
                }else
                {
                     request.setAttribute("message", "Request can not be processed.");
                     request.getRequestDispatcher("/DDS/TotalCashDepositDDS.jsp").forward(request, response);
                }

        } catch (Exception e) {
           // e.printStackTrace();
           System.out.println("Error occurred during processing.");
            request.setAttribute("message", "Request can not be processed.");
            request.getRequestDispatcher("/DDS/TotalCashDepositDDS.jsp").forward(request, response);
       
        } finally {
            System.out.println("Error occurred during processing.");
        }
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */

    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}
