Ejemplo n.º 1
0
    private string ObtenerClientes(string sTipoBusqueda, string strCli, string sInterno, string sSoloActivos, string sTipoCliente)
    {
        try
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<table id='tblDatos' class='texto MA' style='width: 550px;'>");
            sb.Append("<colgroup><col style='width:450px;'><col style='width:100px;'></colgroup>");
            sb.Append("<tbody>");
            SqlDataReader dr = CLIENTE.SelectByNombreSAP(strCli, sTipoBusqueda, (sSoloActivos == "1") ? true : false, (sInterno == "1") ? true : false, sTipoCliente);

            int  i       = 0;
            bool bExcede = false;
            while (dr.Read())
            {
                sb.Append("<tr id='" + dr["t302_idcliente"].ToString() + "' ");
                sb.Append(" nif='" + dr["NIF"].ToString() + "' ");
                if ((bool)dr["t302_efactur"])
                {
                    sb.Append(" ef='S' ");                          //cliente de facturación electrónica
                }
                else
                {
                    sb.Append(" ef='N' ");
                }

                if ((int)dr["t302_estado"] == 1)
                {
                    sb.Append(" onclick=\"ms(this)\" ondblclick=\"aceptarClick(this.rowIndex)\" style='height:16px;'");
                }
                else
                {
                    sb.Append("style='height:16px;cursor:default;color:gray;'");
                }

                sb.Append("><td style='padding-left:5px;'><img src='../../../../images/img" + dr["tipo"].ToString() + ".gif' ");
                if (dr["tipo"].ToString() == "M")
                {
                    sb.Append("style='margin-right:5px;'");
                }
                else
                {
                    sb.Append("style='margin-left:15px;margin-right:5px;'");
                }
                sb.Append("><nobr class='NBR W400'>" + dr["t302_denominacion"].ToString() + "</nobr></td>");
                sb.Append("<td>" + dr["NIF"].ToString() + "</td>");
                sb.Append("</tr>");
                i++;
                if (i > Constantes.nNumMaxTablaCatalogo)
                {
                    bExcede = true;
                    break;
                }
            }
            dr.Close();
            dr.Dispose();
            if (!bExcede)
            {
                sb.Append("</tbody>");
                sb.Append("</table>");
            }
            else
            {
                sb.Length = 0;
                sb.Append("EXCEDE");
            }

            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener los clientes", ex));
        }
    }