Regalamiunsorriso/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/PersonaCarico.java

181 lines
4.8 KiB
Java

package it.acxent.anag.tr;
import it.acxent.anag.Clifor;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class PersonaCarico extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1680269653578L;
private long id_personaCarico;
private long id_clifor;
private long id_tipoPersonaCarico;
private String cognomePC;
private String nomePC;
private String codFiscPC;
private double percCarico;
private String notaPC;
private Clifor clifor;
private TipoPersonaCarico tipoPersonaCarico;
public PersonaCarico(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public PersonaCarico() {}
public void setId_personaCarico(long newId_personaCarico) {
this.id_personaCarico = newId_personaCarico;
}
public void setId_clifor(long newId_clifor) {
this.id_clifor = newId_clifor;
setClifor(null);
}
public void setId_tipoPersonaCarico(long newId_tipoPersonaCarico) {
this.id_tipoPersonaCarico = newId_tipoPersonaCarico;
setTipoPersonaCarico(null);
}
public void setCognomePC(String newCognomePC) {
this.cognomePC = newCognomePC;
}
public void setNomePC(String newNomePC) {
this.nomePC = newNomePC;
}
public void setCodFiscPC(String newCodFisc) {
this.codFiscPC = newCodFisc;
}
public void setPercCarico(double newPercCarico) {
this.percCarico = newPercCarico;
}
public long getId_personaCarico() {
return this.id_personaCarico;
}
public long getId_clifor() {
return this.id_clifor;
}
public long getId_tipoPersonaCarico() {
return this.id_tipoPersonaCarico;
}
public String getCognomePC() {
return (this.cognomePC == null) ? "" : this.cognomePC.trim();
}
public String getNomePC() {
return (this.nomePC == null) ? "" : this.nomePC.trim();
}
public String getCodFiscPC() {
return (this.codFiscPC == null) ? "" : this.codFiscPC.trim();
}
public double getPercCarico() {
return this.percCarico;
}
public void setClifor(Clifor newClifor) {
this.clifor = newClifor;
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setTipoPersonaCarico(TipoPersonaCarico newTipoPersonaCarico) {
this.tipoPersonaCarico = newTipoPersonaCarico;
}
public TipoPersonaCarico getTipoPersonaCarico() {
this.tipoPersonaCarico = (TipoPersonaCarico)getSecondaryObject(this.tipoPersonaCarico, TipoPersonaCarico.class, getId_tipoPersonaCarico());
return this.tipoPersonaCarico;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<PersonaCarico> findByCR(PersonaCaricoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from PERSONA_CARICO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator<PersonaCarico> findByCliente(long l_id_clifor, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from PERSONA_CARICO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_clifor=" + l_id_clifor);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public String getCognomeNomePC() {
return getCognomePC() + " " + getCognomePC();
}
public String getDescrizione() {
return getCognomeNomePC() + " " + getCognomeNomePC();
}
public String getNotaPC() {
return (this.notaPC == null) ? "" : this.notaPC.trim();
}
public void setNotaPC(String notaPC) {
this.notaPC = notaPC;
}
}