protected void btnReport_Click(object sender, EventArgs e)
        {
            try
            {
                List <Entities.ExternalDesignation> listExternalDesignation = ExternalDesignationBLL.getInstance().getAll();
                System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                text::Document         pdfDoc       = new text::Document(text::PageSize.A4, 10, 10, 10, 10);
                pdfDoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
                PdfWriter.GetInstance(pdfDoc, memoryStream);
                pdfDoc.Open();

                String imagepath           = Server.MapPath("../../images/page-icons");
                iTextSharp.text.Image deas = iTextSharp.text.Image.GetInstance(imagepath + "/DEAS-logo.jpg");
                deas.ScaleToFit(140f, 120f);
                //Give space before image
                deas.SpacingBefore = 10f;
                //Give some space after the image
                deas.SpacingAfter = 1f;
                deas.Alignment    = text::Element.ALIGN_LEFT;
                pdfDoc.Add(deas);

                text::Paragraph title = new text::Paragraph();
                title.Font      = text::FontFactory.GetFont("dax-black", 32, new text::BaseColor(0, 51, 102));
                title.Alignment = text::Element.ALIGN_CENTER;
                title.Add("\n\n Reporte de Nombramientos Externos\n\n");
                pdfDoc.Add(title);


                if (listExternalDesignation.Count > 0)
                {
                    foreach (Entities.ExternalDesignation pExternalDesignation in listExternalDesignation)
                    {
                        PdfPTable oPTable = new PdfPTable(5);
                        oPTable.TotalWidth = 100;
                        oPTable.AddCell("Funcionario");
                        oPTable.AddCell("Cargo");
                        oPTable.AddCell("Lugar de Trabajo");
                        oPTable.AddCell("Inicio - Fin");
                        oPTable.AddCell("Horas");
                        oPTable.AddCell(pExternalDesignation.oTeacher.name + " " + pExternalDesignation.oTeacher.lastName);
                        oPTable.AddCell(pExternalDesignation.position);
                        oPTable.AddCell(pExternalDesignation.location);
                        oPTable.AddCell(pExternalDesignation.initial_day.ToShortDateString() + " " + pExternalDesignation.final_day.ToShortDateString());
                        oPTable.AddCell(pExternalDesignation.hours.ToString());
                        pdfDoc.Add(oPTable);

                        PdfPTable oPTable2 = new PdfPTable(7);
                        oPTable2.TotalWidth    = 100;
                        oPTable2.SpacingAfter  = 30f;
                        oPTable2.SpacingBefore = 5f;
                        oPTable2.AddCell("Lunes");
                        oPTable2.AddCell("Martes");
                        oPTable2.AddCell("Miércoles");
                        oPTable2.AddCell("Jueves");
                        oPTable2.AddCell("Viernes");
                        oPTable2.AddCell("Sábado");
                        oPTable2.AddCell("Domingo");

                        Int32 count = 1;
                        while (count <= 7)
                        {
                            Boolean ind = false;

                            for (Int32 i = 0; i < pExternalDesignation.journeys.Count; i++)
                            {
                                if (pExternalDesignation.journeys[i].day.code == count)
                                {
                                    ind = true;
                                    oPTable2.AddCell(pExternalDesignation.journeys[i].start + " / " + pExternalDesignation.journeys[i].finish);
                                }
                            }

                            if (!ind)
                            {
                                oPTable2.AddCell("00:00" + " / " + "00:00");
                            }
                            count++;
                        }

                        pdfDoc.Add(oPTable2);
                    }
                }
                else
                {
                    PdfPTable oPTable = new PdfPTable(5);
                    oPTable.TotalWidth    = 100;
                    oPTable.SpacingBefore = 20f;
                    oPTable.SpacingAfter  = 30f;
                    oPTable.AddCell("Funcionario");
                    oPTable.AddCell("Cargo");
                    oPTable.AddCell("Lugar de Trabajo");
                    oPTable.AddCell("Inicio - Fin");
                    oPTable.AddCell("Horas");
                    PdfPCell cell = new PdfPCell(new text::Phrase("No existen nombramientos externos registrados."));
                    cell.Colspan             = 5;
                    cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    oPTable.AddCell(cell);
                    pdfDoc.Add(oPTable);
                }


                pdfDoc.Close();

                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=Nombramiento_Externo.pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer      = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
Пример #2
0
        protected void btnReport_Click(object sender, EventArgs e)
        {
            try
            {
                int code = oUser.oProgram.code;
                List <Entities.Course> listCourse;
                if (code == 1)
                {
                    listCourse = CourseBLL.getInstance().getAll();
                }
                else
                {
                    listCourse = CourseBLL.getInstance().getAllCourseProgram(code);
                }
                System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                text::Document         pdfDoc       = new text::Document(text::PageSize.A4, 10, 10, 10, 10);
                pdfDoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
                PdfWriter.GetInstance(pdfDoc, memoryStream);
                pdfDoc.Open();

                String imagepath           = Server.MapPath("../../images/page-icons");
                iTextSharp.text.Image deas = iTextSharp.text.Image.GetInstance(imagepath + "/DEAS-logo.jpg");
                deas.ScaleToFit(140f, 120f);
                //Give space before image
                deas.SpacingBefore = 10f;
                //Give some space after the image
                deas.SpacingAfter = 1f;
                deas.Alignment    = text::Element.ALIGN_LEFT;
                pdfDoc.Add(deas);

                text::Paragraph title = new text::Paragraph();
                title.Font      = text::FontFactory.GetFont("dax-black", 32, new text::BaseColor(0, 51, 102));
                title.Alignment = text::Element.ALIGN_CENTER;
                title.Add("\n\n Reporte de Cursos\n\n");
                pdfDoc.Add(title);

                PdfPTable oPTable = new PdfPTable(3);
                oPTable.TotalWidth    = 100;
                oPTable.SpacingBefore = 20f;
                oPTable.SpacingAfter  = 30f;
                oPTable.AddCell("Descripción");
                oPTable.AddCell("Programa");
                oPTable.AddCell("Estado");

                if (listCourse.Count > 0)
                {
                    foreach (Entities.Course pCourse in listCourse)
                    {
                        oPTable.AddCell(pCourse.description);
                        oPTable.AddCell(pCourse.oProgram.name);
                        oPTable.AddCell((pCourse.state == 1 ? "Activo" : "Inactivo"));
                    }
                }
                else
                {
                    PdfPCell cell = new PdfPCell(new text::Phrase("No existen cursos registrados."));
                    cell.Colspan             = 2;
                    cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    oPTable.AddCell(cell);
                }

                pdfDoc.Add(oPTable);
                pdfDoc.Close();

                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=Cursos.pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer      = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        } //End report()
Пример #3
0
        protected void printReport(List <Entities.AcademicOffer> pListAcademicOffer, String pPeriodName)
        {
            try
            {
                List <Entities.AcademicOffer> lisOffer = pListAcademicOffer;

                System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                text::Document         pdfDoc       = new text::Document(text::PageSize.A4, 10, 10, 10, 10);
                pdfDoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
                PdfWriter.GetInstance(pdfDoc, memoryStream);
                pdfDoc.Open();

                String imagepath           = Server.MapPath("../../images/page-icons");
                iTextSharp.text.Image deas = iTextSharp.text.Image.GetInstance(imagepath + "/DEAS-logo.jpg");
                deas.ScaleToFit(140f, 120f);
                //Give space before image
                deas.SpacingBefore = 10f;
                //Give some space after the image
                deas.SpacingAfter = 1f;
                deas.Alignment    = text::Element.ALIGN_LEFT;
                pdfDoc.Add(deas);

                text::Paragraph title = new text::Paragraph();
                title.Font      = text::FontFactory.GetFont("dax-black", 32, new text::BaseColor(0, 51, 102));
                title.Alignment = text::Element.ALIGN_CENTER;
                title.Add("\n\n Reporte de ofertas academicas\n\n");
                pdfDoc.Add(title);

                text::Paragraph period = new text::Paragraph();
                period.Font      = text::FontFactory.GetFont("dax-black", 16);
                period.Alignment = text::Element.ALIGN_CENTER;
                period.Add("Período: " + pPeriodName + "\n\n");
                pdfDoc.Add(period);

                PdfPTable oPTable = new PdfPTable(5);
                oPTable.TotalWidth    = 100;
                oPTable.SpacingBefore = 20f;
                oPTable.SpacingAfter  = 30f;
                oPTable.AddCell("Curso");
                oPTable.AddCell("Profesor");
                oPTable.AddCell("Aula");
                oPTable.AddCell("Horario");
                oPTable.AddCell("Precio");

                if (lisOffer.Count > 0)
                {
                    foreach (Entities.AcademicOffer pAcademicOffer in lisOffer)
                    {
                        oPTable.AddCell(pAcademicOffer.oCourse.description);
                        oPTable.AddCell(pAcademicOffer.oteacher.name + " " + pAcademicOffer.oteacher.lastName);
                        oPTable.AddCell(pAcademicOffer.oClassRoom.num_room);
                        oPTable.AddCell(pAcademicOffer.oSchedule.name + " " + pAcademicOffer.oSchedule.startTime.ToShortTimeString() + "-" + pAcademicOffer.oSchedule.endTime.ToShortTimeString());
                        oPTable.AddCell(String.Format("{0:0,0.0}", pAcademicOffer.price));
                    }
                }
                else
                {
                    PdfPCell cell = new PdfPCell(new text::Phrase("No existen ofertas académicas  registrados."));
                    cell.Colspan             = 2;
                    cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    oPTable.AddCell(cell);
                }

                pdfDoc.Add(oPTable);
                pdfDoc.Close();

                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=Oferta_academica.pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer      = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
Пример #4
0
        protected void getReport(List <Entities.WaitingList> pListWaitingList)
        {
            try
            {
                List <Entities.WaitingList> listWaitingList = pListWaitingList;

                System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                text::Document         pdfDoc       = new text::Document(text::PageSize.A4, 10, 10, 10, 10);
                pdfDoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
                PdfWriter.GetInstance(pdfDoc, memoryStream);
                pdfDoc.Open();

                String imagepath           = Server.MapPath("../../images/page-icons");
                iTextSharp.text.Image deas = iTextSharp.text.Image.GetInstance(imagepath + "/DEAS-logo.jpg");
                deas.ScaleToFit(140f, 120f);
                //Give space before image
                deas.SpacingBefore = 10f;
                //Give some space after the image
                deas.SpacingAfter = 1f;
                deas.Alignment    = text::Element.ALIGN_LEFT;
                pdfDoc.Add(deas);

                text::Paragraph title = new text::Paragraph();
                title.Font      = text::FontFactory.GetFont("dax-black", 32, new text::BaseColor(0, 51, 102));
                title.Alignment = text::Element.ALIGN_CENTER;
                title.Add("\n\n Reporte de lista de espera\n\n");
                pdfDoc.Add(title);

                PdfPTable oPTable = new PdfPTable(6);
                oPTable.TotalWidth    = 100;
                oPTable.SpacingBefore = 20f;
                oPTable.SpacingAfter  = 30f;
                oPTable.AddCell("Nombre completo");
                oPTable.AddCell("# Residencial");
                oPTable.AddCell("# Celular");
                oPTable.AddCell("Correo electrónico");
                oPTable.AddCell("Curso");
                oPTable.AddCell("Día");

                if (listWaitingList.Count > 0)
                {
                    foreach (Entities.WaitingList pWaitingList in listWaitingList)
                    {
                        oPTable.AddCell(pWaitingList.name + " " + pWaitingList.lastName);
                        oPTable.AddCell(pWaitingList.homePhone);
                        oPTable.AddCell(pWaitingList.cellPhone);
                        oPTable.AddCell(pWaitingList.email);
                        oPTable.AddCell(pWaitingList.course_name);
                        oPTable.AddCell(pWaitingList.day);
                    }
                }
                else
                {
                    PdfPCell cell = new PdfPCell(new text::Phrase("No existen datos registrados."));
                    cell.Colspan             = 6;
                    cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    oPTable.AddCell(cell);
                }

                pdfDoc.Add(oPTable);
                pdfDoc.Close();

                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=waitingreportmain.pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer      = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
        protected void btnReport_Click(object sender, EventArgs e)
        {
            try
            {
                List <Entities.Schedule> listSchedule = ScheduleBLL.getInstance().getAll();
                System.IO.MemoryStream   memoryStream = new System.IO.MemoryStream();
                text::Document           pdfDoc       = new text::Document(text::PageSize.A4, 10, 10, 10, 10);
                pdfDoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
                PdfWriter.GetInstance(pdfDoc, memoryStream);
                pdfDoc.Open();

                String imagepath           = Server.MapPath("../../images/page-icons");
                iTextSharp.text.Image deas = iTextSharp.text.Image.GetInstance(imagepath + "/DEAS-logo.jpg");
                deas.ScaleToFit(140f, 120f);
                //Give space before image
                deas.SpacingBefore = 10f;
                //Give some space after the image
                deas.SpacingAfter = 1f;
                deas.Alignment    = text::Element.ALIGN_LEFT;
                pdfDoc.Add(deas);

                text::Paragraph title = new text::Paragraph();
                title.Font      = text::FontFactory.GetFont("dax-black", 32, new text::BaseColor(0, 51, 102));
                title.Alignment = text::Element.ALIGN_CENTER;
                title.Add("\n\n Justificación de Apertura\n\n");
                pdfDoc.Add(title);

                PdfPTable oPTable = new PdfPTable(2);
                oPTable.TotalWidth    = 100;
                oPTable.SpacingBefore = 20f;
                oPTable.SpacingAfter  = 30f;
                oPTable.AddCell("Profesor: " + oJustification.oAcademic.oteacher.name + " " + oJustification.oAcademic.oteacher.lastName);
                oPTable.AddCell("Curso: " + oJustification.oAcademic.oCourse.description);
                oPTable.AddCell("Categoría: " + oJustification.oInternal.description);
                oPTable.AddCell("Nombramiento: " + oJustification.oAcademic.hours.ToString());
                oPTable.AddCell("Anualidade: " + oJustification.CauntAnualities);
                oPTable.AddCell("Salario: " + oJustification.Salary.ToString("0.00"));
                oPTable.AddCell("Anualidades: " + oJustification.Anuality.ToString("0.00"));
                oPTable.AddCell("Cargos Sociales: " + oJustification.CCSS.ToString("0.00"));
                oPTable.AddCell("Publicidad: " + oJustification.publicity.ToString("0.00"));
                oPTable.AddCell("Otros: " + oJustification.Others.ToString("0.00"));
                oPTable.AddCell("Total Mensual: " + oJustification.TotalMensual.ToString("0.00"));
                oPTable.AddCell("Tatal Bimensual: " + oJustification.TotalBimensual.ToString("0.00"));
                oPTable.AddCell("Valor del curso: " + oJustification.oAcademic.price.ToString("0.00"));
                oPTable.AddCell("Estudiantes: " + oJustification.Students);
                oPTable.AddCell("Ingresos: " + oJustification.TotalIncome.ToString("0.00"));
                oPTable.AddCell("Diferencia: " + oJustification.Diference.ToString("0.00"));

                pdfDoc.Add(oPTable);
                pdfDoc.Close();

                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=JustificaciónApertura.pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer      = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
Пример #6
0
        protected void getReport(List <Entities.ClassRoom> listClassRoom)
        {
            try
            {
                List <Entities.ClassRoom> listRoom     = listClassRoom;
                System.IO.MemoryStream    memoryStream = new System.IO.MemoryStream();
                text::Document            pdfDoc       = new text::Document(text::PageSize.A4, 10, 10, 10, 10);
                pdfDoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
                PdfWriter.GetInstance(pdfDoc, memoryStream);
                pdfDoc.Open();

                String imagepath           = Server.MapPath("../../images/page-icons");
                iTextSharp.text.Image deas = iTextSharp.text.Image.GetInstance(imagepath + "/DEAS-logo.jpg");
                deas.ScaleToFit(140f, 120f);
                //Give space before image
                deas.SpacingBefore = 10f;
                //Give some space after the image
                deas.SpacingAfter = 1f;
                deas.Alignment    = text::Element.ALIGN_LEFT;
                pdfDoc.Add(deas);

                text::Paragraph title = new text::Paragraph();
                title.Font      = text::FontFactory.GetFont("dax-black", 32, new text::BaseColor(0, 51, 102));
                title.Alignment = text::Element.ALIGN_CENTER;
                title.Add("\n\n Reporte de Aulas\n\n\n\n");
                pdfDoc.Add(title);

                PdfPTable oPTable = new PdfPTable(6);
                oPTable.TotalWidth    = 100;
                oPTable.SpacingBefore = 20f;
                oPTable.SpacingAfter  = 30f;
                oPTable.AddCell("Descripción");
                oPTable.AddCell("Capacidad");
                oPTable.AddCell("Programa");
                oPTable.AddCell("Tipo de Aula");
                oPTable.AddCell("Localizacion");
                oPTable.AddCell("Estado");

                if (listRoom.Count > 0)
                {
                    foreach (Entities.ClassRoom pRoom in listRoom)
                    {
                        oPTable.AddCell(pRoom.num_room);
                        oPTable.AddCell(pRoom.size.ToString());
                        oPTable.AddCell(pRoom.oProgram.name);
                        oPTable.AddCell(pRoom.oClassRoomsType.description);
                        oPTable.AddCell(pRoom.oLocation.oHeadquarters.description + " - " + pRoom.oLocation.building + " - " + pRoom.oLocation.module);
                        oPTable.AddCell((pRoom.state == 1 ? "Activo" : "Inactivo"));
                    }
                }
                else
                {
                    PdfPCell cell = new PdfPCell(new text::Phrase("No existen aulas registrados."));
                    cell.Colspan             = 5;
                    cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    oPTable.AddCell(cell);
                }

                pdfDoc.Add(oPTable);
                pdfDoc.Close();

                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=Aulas.pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer      = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
Пример #7
0
        protected void btnReport_Click(object sender, EventArgs e)
        {
            try
            {
                List <Entities.Teacher> listTeacher  = TeacherBLL.getInstance().getAll();
                System.IO.MemoryStream  memoryStream = new System.IO.MemoryStream();
                text::Document          pdfDoc       = new text::Document(text::PageSize.A4, 10, 10, 10, 10);
                pdfDoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
                PdfWriter.GetInstance(pdfDoc, memoryStream);
                pdfDoc.Open();

                String imagepath           = Server.MapPath("../../images/page-icons");
                iTextSharp.text.Image deas = iTextSharp.text.Image.GetInstance(imagepath + "/DEAS-logo.jpg");
                deas.ScaleToFit(140f, 120f);
                //Give space before image
                deas.SpacingBefore = 10f;
                //Give some space after the image
                deas.SpacingAfter = 1f;
                deas.Alignment    = text::Element.ALIGN_LEFT;
                pdfDoc.Add(deas);

                text::Paragraph title = new text::Paragraph();
                title.Font      = text::FontFactory.GetFont("dax-black", 32, new text::BaseColor(0, 51, 102));
                title.Alignment = text::Element.ALIGN_CENTER;
                title.Add("\n\n Reporte de Profesores \n\n\n\n");
                pdfDoc.Add(title);

                PdfPTable oPTable = new PdfPTable(5);
                oPTable.TotalWidth    = 100;
                oPTable.SpacingBefore = 20f;
                oPTable.SpacingAfter  = 30f;
                oPTable.AddCell("Identificación");
                oPTable.AddCell("Nombre Completo");
                oPTable.AddCell("Teléfono");
                oPTable.AddCell("Correo Electrónico");
                oPTable.AddCell("Estado");

                if (listTeacher.Count > 0)
                {
                    foreach (Entities.Teacher pTeacher in listTeacher)
                    {
                        oPTable.AddCell(pTeacher.id);
                        oPTable.AddCell(pTeacher.name + " " + pTeacher.lastName);
                        oPTable.AddCell(pTeacher.cellPhone);
                        oPTable.AddCell(pTeacher.email);
                        oPTable.AddCell((pTeacher.state == 1 ? "Activo" : "Inactivo"));
                    }
                }
                else
                {
                    PdfPCell cell = new PdfPCell(new text::Phrase("No existen profesores registrados."));
                    cell.Colspan             = 5;
                    cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    oPTable.AddCell(cell);
                }

                pdfDoc.Add(oPTable);
                pdfDoc.Close();

                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=Profesores.pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer      = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }