return new ForwardResolution("/WEB-INF/jsp/adaugaBeneficiar.jsp");
}
public Resolution submit() {
int proiect = Integer.parseInt(getContext().getRequest().getSession().getAttribute("creazaProiect").toString());
IBeneficiarDao beneficiarDao = new BeneficiarDao();
if (proiect == 0) {
if ((getNume() == null) || (getCnp() == null)) {
setCampuriNecompletate(true);
return new ForwardResolution("/WEB-INF/jsp/adaugaBeneficiar.jsp");
}
if (cnp.length() != 13) {
setCnpIncorect(true);
return new ForwardResolution("/WEB-INF/jsp/adaugaBeneficiar.jsp");
} else if (!isNumeric(cnp)) {
setCnpIncorect(true);
return new ForwardResolution("/WEB-INF/jsp/adaugaBeneficiar.jsp");
}
Beneficiar beneficiar = new Beneficiar(nume, cnp, mentiuni, null);
beneficiarDao.saveOrUpdate(beneficiar);
Beneficiar bAux = beneficiarDao.getBeneficiarCnp(cnp);
int idGeolog = getIdGeologLogat();
IGeologBeneficiarDao geologBeneficiarDao = new GeologBeneficiarDao();
geologBeneficiarDao.saveOrUpdate(new GeologBeneficiar(idGeolog, bAux.getIdBeneficiar()));
setBeneficiarAdaugat(true);
return new ForwardResolution("/WEB-INF/jsp/adaugaBeneficiar.jsp");
} //daca cream un proiect
else if (proiect == 1) {
if (getBtnRadio() == null) {
setRadioNeselectat(true);
return new ForwardResolution("/WEB-INF/jsp/adaugaBeneficiar.jsp");
} else if (getBtnRadio().equals("1")) {
Beneficiar beneficiarSelectat = beneficiarDao.getBeneficiarByID(Integer.parseInt(getSelectBeneficiarFilter()));
IGeologBeneficiarDao geologBeneficiarDao = new GeologBeneficiarDao();
int idGeolog = getIdGeologLogat();
geologBeneficiarDao.saveOrUpdate(new GeologBeneficiar(idGeolog, beneficiarSelectat.getIdBeneficiar()));
getContext().getRequest().getSession(true).setAttribute("beneficiarProiect", beneficiarSelectat);
return new ForwardResolution("/WEB-INF/jsp/proiect.jsp");
} else if (getBtnRadio().equals("2")) {
if ((getNume() == null) || (getCnp() == null)) {
setCampuriNecompletate(true);
return new ForwardResolution("/WEB-INF/jsp/adaugaBeneficiar.jsp");
}
if (cnp.length() != 13) {
setCnpIncorect(true);
return new ForwardResolution("/WEB-INF/jsp/adaugaBeneficiar.jsp");
} else if (!isNumeric(cnp)) {
setCnpIncorect(true);
return new ForwardResolution("/WEB-INF/jsp/adaugaBeneficiar.jsp");
}
Beneficiar beneficiar = new Beneficiar(nume, cnp, mentiuni, null);
beneficiarDao.saveOrUpdate(beneficiar);
Beneficiar bAux = beneficiarDao.getBeneficiarCnp(cnp);
int idGeolog = getIdGeologLogat();
IGeologBeneficiarDao geologBeneficiarDao = new GeologBeneficiarDao();
geologBeneficiarDao.saveOrUpdate(new GeologBeneficiar(idGeolog, bAux.getIdBeneficiar()));
getContext().getRequest().getSession(true).setAttribute("beneficiarProiect", bAux);
return new ForwardResolution("/WEB-INF/jsp/proiect.jsp");