package main_package;

import java.io.Serializable;
import java.util.ArrayList;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

@ManagedBean(name = "editViewVechieleLoan")
@ViewScoped
public class EditViewVechieleLoanBean implements Serializable
{
	DataBaseMethods obj=new DataBaseMethods();
	private static final long serialVersionUID = 1L;
	ArrayList<LoanInfo> pList;
	LoanInfo selectedLoan;

	public EditViewVechieleLoanBean() 
	{
		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		 int branchId = (int) ss.getAttribute("branchId");
		pList = obj.vehicleLoanList(branchId,"All");
	}
	
	public String viewVehicleLoan()
	{
		HttpSession ss = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		ss.setAttribute("selectedLoan", selectedLoan);
		ss.setAttribute("pageName","editViewVechileLoan.xhtml");
		return "viewVehicleLoan";
	}
	
	public String editVehicleLoan()
	{
		HttpSession ss = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		ss.setAttribute("selectedLoan", selectedLoan);
		return "editVehicleLoan";
	}
	
	public LoanInfo getSelectedLoan() {
		return selectedLoan;
	}
	public void setSelectedLoan(LoanInfo selectedLoan) {
		this.selectedLoan = selectedLoan;
	}
	public ArrayList<LoanInfo> getpList() {
		return pList;
	}
	public void setpList(ArrayList<LoanInfo> pList) {
		this.pList = pList;
	}
}
