
08/07/2008, 12:46
|
| | Fecha de Ingreso: enero-2006
Mensajes: 88
Antigüedad: 19 años, 1 mes Puntos: 0 | |
problema con if hola a todos quiero saber si estos if los puedo pasar a un switch es posible
String cadena = "";
if (this.txtComprobanteN.Text != "" && this.cldFechaDesde.Checked == true && this.cldFechaHasta.Checked == true && this.txtBodega.Text != "")
{
cadena = cadena + "PdpNumero=" + "'" + txtComprobanteN.Text + "'" + " " + "AND" + " " + "PdpFechaTransaccion" + " " + "BETWEEN" + " " + "'" + this.cldFechaDesde.Value + "'" + " " + "AND" + " " + "'" + this.cldFechaHasta.Value + "'" + " " + "AND" + " " + "PdpIdBodega_Origen=" + "'" + this.objfrmBusquedaDeBodegas.PdpBodega.PdpIdBodega + "'";
}
else if (this.txtComprobanteN.Text != "")
{
cadena = cadena + "PdpNumero=" + "'" + txtComprobanteN.Text + "'";
}
else if (this.txtBodega.Text != " " && this.cldFechaDesde.Checked == true)
{
cadena = cadena + "PdpIdBodega_Origen=" + "'" + this.objfrmBusquedaDeBodegas.PdpBodega.PdpIdBodega + "'" + " " + "AND" + " " + "PdpFechaTransaccion=" + "'" + this.cldFechaDesde.Value + "'";
}
else if (this.txtBodega.Text != " " && this.cldFechaHasta.Checked == true)
{
cadena = cadena + "PdpIdBodega_Origen=" + "'" + this.objfrmBusquedaDeBodegas.PdpBodega.PdpIdBodega + "'" + " " + "AND" + " " + "PdpFechaTransaccion=" + "'" + this.cldFechaHasta.Value + "'";
}
else if (this.txtBodega.Text != "")
{
cadena = cadena + "PdpIdBodega_Origen=" + "'" + this.objfrmBusquedaDeBodegas.PdpBodega.PdpIdBodega + "'";
}
else if (this.cldFechaHasta.Checked == true)
{
cadena = cadena + "PdpNumero=" + "'" + txtComprobanteN.Text + "'" + " " + "AND" + " " + "PdpFechaTransaccion=" + " " + "'" + cldFechaHasta.Value + "'";
}
else if (this.cldFechaDesde.Checked == true)
{
cadena = cadena + "PdpNumero=" + "'" + txtComprobanteN.Text + "'" + " " + "AND" + " " + "PdpFechaTransaccion=" + "'" + cldFechaDesde.Value + "'";
}
else if (this.txtComprobanteN.Text != " " && this.txtBodega.Text != " ")
{
cadena = cadena + "PdpNumero=" + "'" + txtComprobanteN.Text + "'" + " " + "AND" + " " + "PdpIdBodega_Origen=" + "'" + this.objfrmBusquedaDeBodegas.PdpBodega.PdpIdBodega + "'";
}
else if (this.txtComprobanteN.Text != "" && this.cldFechaDesde.Checked == true)
{
cadena = cadena + "PdpNumero=" + "'" + txtComprobanteN.Text + "'" + " " + "AND" + " " + "PdpFechaTransaccion=" + "'" + this.cldFechaDesde.Value + "'";
}
else if (this.txtComprobanteN.Text != " " && this.cldFechaHasta.Checked == true)
{
cadena = cadena + "PdpNumero=" + "'" + txtComprobanteN.Text + "'" + "'" + " " + "AND" + " " + "PdpFechaTransaccion=" + "'" + this.cldFechaHasta.Value + "'";
}
else if (this.cldFechaDesde.Checked && this.cldFechaHasta.Checked)
{
cadena = cadena + "PdpFechaTransaccion" + " " + "between" + " " + "'" + this.cldFechaDesde.Value + "'" + " " + "AND" + " " + "'" + this.cldFechaHasta.Value + "'";
}
return cadena;
de antemano gracias por su ayuda |