public byte[] GenerarReporte(string sp, Dictionary <string, string> datos, string id) { LogicaNegocio MTO = new LogicaNegocio(); try { String xml = String.Empty; //IF PARA CADA REPORTE DataSet res1 = new DataSet(); if (sp == "Ficha_Comercial") { res1 = MTO.ConsultaFichaComercial(datos["IdEmpresa"], "ReportePosicionCliente"); for (int i = 0; i <= res1.Tables[0].Rows.Count - 1; i++) { xml = xml + res1.Tables[0].Rows[i][0].ToString(); } } XDocument newTree = new XDocument(); XslCompiledTransform xsltt = new XslCompiledTransform(); using (XmlWriter writer = newTree.CreateWriter()) { xsltt.Load(@"C:/inetpub/wwwroot/wss/VirtualDirectories/80/xsl/request/" + sp + ".xslt"); } using (var sw = new StringWriter()) using (var sr = new StringReader(xml)) using (var xr = XmlReader.Create(sr)) { xsltt.Transform(xr, null, sw); html = sw.ToString(); } try { sDocumento.Append(html); return(util.ConvertirAPDF_Control(sDocumento)); } catch { } } catch (Exception ex) { LoggingError.PostEventRegister(ex, ConfigurationManager.AppSettings["pathLog"].ToString(), "", "", ConfigurationManager.AppSettings["logName"].ToString(), Convert.ToBoolean(ConfigurationManager.AppSettings["enabledLog"].ToString()), Convert.ToBoolean(ConfigurationManager.AppSettings["enabledEventViewer"].ToString()), ConfigurationManager.AppSettings["registerEventsTypes"].ToString(), EventLogEntryType.Error); } return(null); }