private void WritePDF(string nome) { Business.Campeonatos.Support.Campeonato campeonatoModel = new BolaoNet.Business.Campeonatos.Support.Campeonato(base.UserName, nome); //Response.BinaryWrite(doc.DocContents); Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "inline; filename=ParProcess.pdf;"); //Response.AppendHeader("content-disposition", "attachment; filename=item.pdf" ); Business.PDF.Support.CopaMundoPdfCreator pdfCreator = new BolaoNet.Business.PDF.Support.CopaMundoPdfCreator(base.UserName); pdfCreator.CreateJogos(Response.OutputStream, System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Images\\Database", campeonatoModel); Response.End(); }
static void Main(string[] args) { //Business.Excel.TemplateExcelBase excel = new BolaoNet.Business.Excel.TemplateExcelBase(null, @"..\..\..\Utils\Default.xls"); //excel.SaveUserFile(new BolaoNet.Model.Boloes.Bolao ("Copa do Mundo 2010"), // new BolaoNet.Model.Campeonatos.Campeonato ("Copa do Mundo 2010"), // new Framework.Security.Model.UserData("ExcelFileTest22")); //return; using (FileStream fs = new FileStream("C:\\temp\\mynew.pdf", FileMode.Create)) { Business.PDF.Support.CopaMundoPdfCreator pdf = new BolaoNet.Business.PDF.Support.CopaMundoPdfCreator(null); List <Framework.Security.Model.UserData> users = new List <Framework.Security.Model.UserData>(); users.Add(new Framework.Security.Model.UserData("thoris")); users.Add(new Framework.Security.Model.UserData("thoris2")); users.Add(new Framework.Security.Model.UserData("teste")); //pdf.CreateApostasUsers(fs, // @"C:\Thoris\PROJS\BolaoNet\BolaoNet.WebSite\Images\database\", // new BolaoNet.Model.Boloes.Bolao("Copa do Mundo 2010"), // users); //pdf.CreateApostasUser(fs, @"C:\Thoris\PROJS\BolaoNet\BolaoNet.WebSite\Images\database\", // new BolaoNet.Model.Boloes.Bolao("Copa do Mundo 2010"), // new Framework.Security.Model.UserData("thoris")); pdf.CreateApostasPontosUser(fs, @"C:\Thoris\PROJS\BolaoNet\BolaoNet.WebSite\Images\database\", new BolaoNet.Model.Boloes.Bolao("Copa do Mundo 2010"), new Framework.Security.Model.UserData("Thoris")); System.Diagnostics.Process.Start("c:\\mynew.pdf"); } }
private void WritePDF(string bolao, string userName) { Business.Boloes.Support.Bolao bolaoModel = new BolaoNet.Business.Boloes.Support.Bolao(base.UserName, bolao); Framework.Security.Model.UserData userModel = new Framework.Security.Model.UserData(userName); //Response.BinaryWrite(doc.DocContents); Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "inline; filename=ParProcess.pdf;"); //Response.AppendHeader("content-disposition", "attachment; filename=item.pdf" ); Business.PDF.Support.CopaMundoPdfCreator pdfCreator = new BolaoNet.Business.PDF.Support.CopaMundoPdfCreator(base.UserName); pdfCreator.CreateApostasUser(Response.OutputStream, System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Images\\Database", bolaoModel, userModel); Response.End(); }
protected void btnGerarApostasFinais_Click(object sender, EventArgs e) { List <Framework.Security.Model.UserData> users = new List <Framework.Security.Model.UserData>(); IList <Framework.DataServices.Model.EntityBaseData> list = (IList <Framework.DataServices.Model.EntityBaseData>)ViewState["Users"]; foreach (Model.Boloes.ApostasRestantesUser user in list) { if (!string.IsNullOrEmpty(user.UserName)) { users.Add(user); } } #region Criando o pdf string file = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Images\\Database\\PDF\\" + CurrentBolao.Nome + "fim.pdf"; if (System.IO.File.Exists(file)) { System.IO.File.Delete(file); } using (FileStream fs = new FileStream(file, FileMode.Create)) { Business.PDF.Support.CopaMundoPdfCreator pdf = new BolaoNet.Business.PDF.Support.CopaMundoPdfCreator(base.UserName); pdf.CreateApostasUsersFim(fs, System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Images\\Database", CurrentCampeonato, CurrentBolao, users); } #endregion #region Criando o ZIP // Zip up the files - From SharpZipLib Demo Code using (ZipOutputStream s = new ZipOutputStream(File.Create(file.Replace(".pdf", ".zip")))) { s.SetLevel(9); // 0-9, 9 being the highest compression byte[] buffer = new byte[4096]; ZipEntry entry = new ZipEntry(Path.GetFileName(file)); entry.DateTime = DateTime.Now; s.PutNextEntry(entry); using (FileStream fs = File.OpenRead(file)) { int sourceBytes; do { sourceBytes = fs.Read(buffer, 0, buffer.Length); s.Write(buffer, 0, sourceBytes); } while (sourceBytes > 0); } s.Finish(); s.Close(); } #endregion ShowStatusPDFFileFim(); }