예제 #1
0
        public void ExportarRelatorio1(string NomeRelatorio, enTipoRelatorio TipoRel)
        {
            ServerReport sReport = new ServerReport();

            sReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["Relatorios"]);
            sReport.ReportPath      = NomeRelatorio;
            Byte[] mybytes1 = sReport.Render(TipoRel.ToString());
        }
예제 #2
0
        public string ExportarRelatorio(string NomeRelatorio, enTipoRelatorio TipoRel)
        {
            ServerReport sReport = new ServerReport();

            sReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["Relatorios"]);
            sReport.ReportPath      = NomeRelatorio;

            sReport.ReportServerCredentials = new MyCredentials("saRelatorio", "rona3007");
            //sReport.ReportServerCredentials = new MyCredentials("", "");

            Byte[] mybytes1 = sReport.Render(TipoRel.ToString());

            return(SalvarRelatorio(mybytes1, TipoRel));
        }
예제 #3
0
        private string SalvarRelatorio(Byte[] bytRelatorio, enTipoRelatorio TipoRel)
        {
            Random rd        = new Random(10);
            string diretorio = ConfigurationManager.AppSettings["ArquivosRelatorios"];

            ExcluirArquivos(diretorio);

            string nomeRelatorio = +rd.Next() + ExtenssaoArq(TipoRel);
            string dirRelatorio  = diretorio + @"\" + nomeRelatorio;

            System.IO.FileStream pdfFile = new System.IO.FileStream(dirRelatorio, System.IO.FileMode.Create);
            pdfFile.Write(bytRelatorio, 0, bytRelatorio.Length);
            pdfFile.Close();

            return(ConfigurationManager.AppSettings["EndRelatorios"] + @"/" + nomeRelatorio);
        }
예제 #4
0
        private string ExtenssaoArq(enTipoRelatorio tipo)
        {
            switch (tipo)
            {
            case enTipoRelatorio.PDF:
                return(".pdf");

                break;

            case enTipoRelatorio.WORD:
                return(".doc");

                break;

            case enTipoRelatorio.EXCEL:
                return(".xls");

                break;

            default:
                break;
            }
            return("");
        }
예제 #5
0
        public void ExportarRelatorio(System.Web.UI.Page Pagina, string NomeRelatorio, enTipoRelatorio TipoRel, ReportParameter[] parameters)
        {
            ServerReport sReport = new ServerReport();

            sReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["Relatorios"]);
            sReport.ReportPath      = NomeRelatorio;

            sReport.ReportServerCredentials = new MyCredentials("", "");

            sReport.SetParameters(parameters);
            Byte[] mybytes1 = sReport.Render(TipoRel.ToString());

            string nomeRel = SalvarRelatorio(mybytes1, TipoRel);

            nomeRel = nomeRel.Replace("\\", "/");

            Pagina.Response.Write("<SCRIPT language=javascript>window.open('" + nomeRel + "', '_blank', 'width=1200, height=900, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</SCRIPT>");
        }