96 lines
3.3 KiB
Java
96 lines
3.3 KiB
Java
package it.acxent.anag.servlet;
|
|
|
|
import it.acxent.anag.Contratto;
|
|
import it.acxent.anag.ContrattoCR;
|
|
import it.acxent.anag.TipoContratto;
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.CRAdapter;
|
|
import it.acxent.db.DBAdapter;
|
|
import it.acxent.db.ResParm;
|
|
import it.acxent.newsletter.TemplateMsg;
|
|
import javax.servlet.annotation.WebServlet;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
@WebServlet(urlPatterns = {"/admin/anag/Contratto.abl"})
|
|
public class ContrattoSvlt extends _AnagAdapterSvlt {
|
|
private static final long serialVersionUID = -1708108941973176059L;
|
|
|
|
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
|
|
|
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
|
|
req.setAttribute("listaTipoContratto", new TipoContratto(getApFull(req))
|
|
.findAll());
|
|
}
|
|
|
|
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
req.setAttribute("listaTipoContratto", new TipoContratto(apFull)
|
|
.findAll());
|
|
req.setAttribute("listaTemplateMsg", new TemplateMsg(apFull)
|
|
.findAll());
|
|
}
|
|
|
|
protected DBAdapter getBean(HttpServletRequest req) {
|
|
return new Contratto(getApFull(req));
|
|
}
|
|
|
|
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
|
return new ContrattoCR(getApFull(req));
|
|
}
|
|
|
|
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
req.setAttribute("listaTipoContratto", new TipoContratto(apFull)
|
|
.findAll());
|
|
Contratto bean = new Contratto(apFull);
|
|
bean.setId_clifor(getRequestLongParameter(req, "id_clifor"));
|
|
req.setAttribute("bean", bean);
|
|
}
|
|
|
|
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
if (getCmd(req).equals("crea1CodaSmsD") ||
|
|
getCmd(req).equals("crea1CodaSmsCR")) {
|
|
long l_id = getRequestLongParameter(req, "id_contratto");
|
|
Contratto bean = new Contratto(apFull);
|
|
bean.findByPrimaryKey(l_id);
|
|
ResParm rp = new ResParm(true);
|
|
if (getCmd(req).equals("crea1CodaSmsD")) {
|
|
ContrattoCR CR = new ContrattoCR(apFull);
|
|
fillObject(req, CR);
|
|
bean.save();
|
|
}
|
|
if (bean.getDBState() == 1) {
|
|
rp = bean.creaCodaMessaggio();
|
|
} else {
|
|
rp.setStatus(false);
|
|
rp.setMsg("Errore!. Impossibile salvare contratto");
|
|
}
|
|
if (rp.getStatus()) {
|
|
sendMessage(req, "Creazione coda messaggio avvenuto con successo");
|
|
} else {
|
|
sendMessage(req, rp.getMsg());
|
|
}
|
|
if (getCmd(req).equals("crea1CodaSmsD")) {
|
|
showBean(req, res);
|
|
} else {
|
|
search(req, res);
|
|
}
|
|
} else if (getCmd(req).equals("creaCodaSms")) {
|
|
Contratto bean = new Contratto(apFull);
|
|
ContrattoCR CR = new ContrattoCR(apFull);
|
|
fillObject(req, CR);
|
|
ResParm rp = new ResParm(true);
|
|
rp = bean.creaCodaMessaggiSms(CR);
|
|
if (rp.getStatus()) {
|
|
sendMessage(req, "Creazione coda messaggi ok. " +
|
|
rp.getStatus());
|
|
} else {
|
|
sendMessage(req, rp.getMsg());
|
|
}
|
|
search(req, res);
|
|
}
|
|
super.otherCommands(req, res);
|
|
}
|
|
}
|