Пример #1
0
        public byte[] GenerarReporte(string sp, Dictionary <string, string> datos, string id, Resumen objresumen)
        {
            System.Text.StringBuilder sDocumento = new System.Text.StringBuilder();
            string        html = string.Empty;
            LogicaNegocio Ln   = new LogicaNegocio();

            try
            {
                String xml = String.Empty;
                string descTipoTransaccion = System.Web.HttpUtility.HtmlDecode(Page.Request.QueryString["idTT"] as string);

                //IF PARA CADA REPORTE
                DataSet res1 = new DataSet();
                if (sp == "PorFacturacion")
                {
                    res1 = Ln.ConsultaDatosContabilidadXML(objresumen.idEmpresa.ToString(), objresumen.idOperacion.ToString(),
                                                           objresumen.idUsuario, objresumen.descCargo, descTipoTransaccion);
                    xml = res1.Tables[0].Rows[0][0].ToString();; //GenerarXMLContratoSubFianza(res1);
                }

                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);
        }