package it.acxent.tarop.servlet; import it.acxent.contab.Documento; import it.acxent.db.CRAdapter; import it.acxent.db.DBAdapter; import it.acxent.db.ResParm; import it.acxent.tarop.Opzione; import it.acxent.tarop.OpzioneCR; import it.acxent.tarop.Tariffa; import it.acxent.tarop.TariffaCR; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(urlPatterns = {"/Tariffa.abl"}) public class TariffaSvlt extends _TaropSvlt { protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { Tariffa bean = (Tariffa)l_bean; if (getCmd(req).equals("md")) req.setAttribute("listaOpzioniTariffa", bean.getOpzioni(0, 0)); } protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} protected DBAdapter getBean(HttpServletRequest req) { return new Tariffa(getApFull(req)); } protected CRAdapter getBeanCR(HttpServletRequest req) { return new TariffaCR(getApFull(req)); } protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} protected void refreshPayment(HttpServletRequest req, HttpServletResponse res) { try { long l_id_documento = getRequestLongParameter(req, "id_documento"); Documento bean = new Documento(getApFull(req)); bean.findByPrimaryKey(l_id_documento); long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento"); bean.setId_tipoPagamento(l_id_tipoPagamento); ResParm rp = bean.save(); String theMsg = ""; req.setAttribute("bean", bean); forceJspPageRelative("Documento.jsp", req); callJsp(req, res); } catch (Exception e) { e.printStackTrace(); forceMessage(req, e.getMessage()); showBean(req, res); } } protected String getCRAttribute(HttpServletRequest req) { return "CRT"; } protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { String cmd = getCmd(req); if (cmd.equals("main")) { main(req, res); } else if (cmd.equals("detail")) { dettaglio(req, res); } else { search(req, res); } } protected void main(HttpServletRequest req, HttpServletResponse res) { forceJspPageRelative("tariffePromozioni.jsp", req); callJsp(req, res); } protected void dettaglio(HttpServletRequest req, HttpServletResponse res) { try { setJspPageRelative("tariffaCR.jsp", req); TariffaCR CR = new TariffaCR(getApFull(req)); fillObject(req, CR); req.setAttribute("CRT", CR); Tariffa bean = new Tariffa(getApFull(req)); req.setAttribute("list", bean.findWebByCR(CR, 0, 0)); Opzione opzione = new Opzione(getApFull(req)); OpzioneCR CRO = new OpzioneCR(getApFull(req)); fillObject(req, CRO); req.setAttribute("listaOpzioni", opzione.findWebByCR(CRO, 0, 0)); callJsp(req, res); } catch (Exception e) { e.printStackTrace(); forceMessage(req, e.getMessage()); } showBean(req, res); } }