Ejemplo n.º 1
0
        public byte[] GenerarReporte(int idEmpresa)
        {
            System.Text.StringBuilder sDocumento = new System.Text.StringBuilder();
            string        html = string.Empty;
            LogicaNegocio Ln   = new LogicaNegocio();

            try
            {
                String  xml  = String.Empty;
                DataSet res1 = new DataSet();

                res1 = Ln.ConsultaReporteScoring(idEmpresa, "usuario", "perfil");
                for (int i = 0; i < res1.Tables[0].Rows.Count; 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/" + "Scoring" + ".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);
        }