예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Login"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            ControlConfig             = (C_Configuracion)Session["ControlConfig"];
            ControlEmpleado           = (C_Empleado)Session["ControlEmpleado"];
            TodosEmpleados.DataSource = ControlEmpleado.Listar();
            TodosEmpleados.DataBind();
            TodosEmpleados.Columns[1].Visible = true;
            if (ControlEmpleado.Listar().Count == 0)
            {
                BtnConvtExcel.Enabled = false;
                BtnConvtPDF.Enabled   = false;
                BtnConvtWord.Enabled  = false;
                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "erroralert();", true);
            }

            if (!IsPostBack)
            {
                TodosEmpleados.PageSize   = ControlConfig.DevolverNroMaxPaginacion();
                TodosEmpleados.DataSource = ControlEmpleado.Listar();
                TodosEmpleados.DataBind();
            }
        }
예제 #2
0
 protected void TodosEmpleados_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     TodosEmpleados.PageIndex  = e.NewPageIndex;
     TodosEmpleados.DataSource = ControlEmpleado.Listar();
     TodosEmpleados.DataBind();
     TodosEmpleados.PageSize = ControlConfig.DevolverNroMaxPaginacion();
 }
예제 #3
0
        public void ConvertWord()
        {
            Response.Clear();
            Response.Buffer = true;
            Response.AddHeader("content-disposition",
                               "attachment;filename=ListaEmpleadoWord.doc");
            Response.Charset     = "";
            Response.ContentType = "application/vnd.ms-word ";
            StringWriter   sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            TodosEmpleados.AllowPaging = false;
            TodosEmpleados.DataBind();
            TodosEmpleados.RenderControl(hw);
            Response.Output.Write(sw.ToString());
            Response.Flush();
            Response.End();
            Response.Write("<script type='text/javascript'> alert(' Se Exporto a Word Correctamente !!') </script>");
        }
예제 #4
0
        public void ConvertPDF()
        {
            Response.AddHeader("content-disposition", "attachment;filename=ListaEmpleadoPDF.pdf");
            Response.ContentType = "application/pdf ";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter   sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            TodosEmpleados.AllowPaging = false;
            TodosEmpleados.DataBind();
            TodosEmpleados.RenderControl(hw);
            StringReader sr     = new StringReader(sw.ToString());
            Document     DocPDF = new Document(PageSize.A3, 10f, 10f, 10f, 0f);
            PdfWriter    writer = PdfWriter.GetInstance(DocPDF, Response.OutputStream);

            DocPDF.Open();
            XMLWorkerHelper.GetInstance().ParseXHtml(writer, DocPDF, sr);
            DocPDF.Close();
            Response.Write(DocPDF);
            Response.End();
            Response.Write("<script type='text/javascript'> alert(' Se Exporto a PDF Correctamente !!') </script>");
        }