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="editViewPropertyLoan")
@ViewScoped
public class EditViewPropertyLoanBean implements Serializable
{DataBaseMethods obj=new DataBaseMethods();
	private static final long serialVersionUID = 1L;
	ArrayList<LoanInfo> prpList;
	LoanInfo selectedLoan;

	public LoanInfo getSelectedLoan() {
		return selectedLoan;
	}

	public void setSelectedLoan(LoanInfo selectedLoan) {
		this.selectedLoan = selectedLoan;
	}

	public ArrayList<LoanInfo> getprpList() {
		return prpList;
	}

	public void setprpList(ArrayList<LoanInfo> prpList) {
		this.prpList = prpList;
	}
	
	public String viewPropertyLoan()
	{
		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		ss.setAttribute("selectedLoan", selectedLoan);
		ss.setAttribute("pageName","editViewPropertyLoan.xhtml");
		return "viewPropertyLoan";
	}
	
	public String editPropertyLoan()
	{
		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		ss.setAttribute("selectedLoan", selectedLoan);
		
		return "editPropertyLoan";

	}

	public EditViewPropertyLoanBean()
	{
		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		 int branchId = (int) ss.getAttribute("branchId");
		prpList = obj.propertyLoanList(branchId,"All");
	}

}
