Пример #1
0
        private void ExportCosts()
        {
            // filtro
            DropDownList ddlCompany = this.Parent.FindControl("ddlCompany") as DropDownList;
            RadioButtonList rblQuery = this.Parent.FindControl("rblQuery") as RadioButtonList;
            DAL.Filters.ExportCostFilter filter = new DAL.Filters.ExportCostFilter()
            {
                Export_Company = ddlCompany.SelectedItem.Text,
                Export_Query = (rblQuery.SelectedItem != null) ? rblQuery.SelectedItem.Text : "No Liquidados"
            };

            // totales
            TextBox txtTP = this.Parent.FindControl("txtTP") as TextBox;
            TextBox txtAMLA = this.Parent.FindControl("txtAMLA") as TextBox;
            TextBox txtOPE = this.Parent.FindControl("txtOPE") as TextBox;
            TextBox txtGsExport = this.Parent.FindControl("txtGsExport") as TextBox;

            // exporto la página
            using (ExportCostsPDF page = BuildManager.CreateInstanceFromVirtualPath(this.PagePath, typeof(Page)) as ExportCostsPDF)
            {
                page.AppRelativeVirtualPath = this.PagePath;
                page.Filter = filter;
                page.ExportCosts = (this.Parent.Parent.Parent as ucExportCosts).ExportCosts;
                page.TP = txtTP.Text;
                page.AMLA = txtAMLA.Text;
                page.OPE = txtOPE.Text;
                page.GsExport = txtGsExport.Text;

                StringWriter sw = new StringWriter();
                HttpContext.Current.Server.Execute(page, sw, true);

                byte[] pdf = PdfHelper.Convert(sw.ToString(), "Gastos de Exportación");
                FileHelper.DownloadFile(string.Format("{0}_{1}.pdf", this.FileName, DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss")), pdf, this.Context);
            }
        }
Пример #2
0
        private DAL.Filters.ExportCostFilter ReadFilter()
        {
            this.revExportDate.Validate();

            DAL.Filters.ExportCostFilter filter = new DAL.Filters.ExportCostFilter();
            filter.IsLiquidate = this.rblQuery.SelectedValue == "true";
            if (!string.IsNullOrEmpty(this.ddlCompany.SelectedValue))
                filter.COMP_Id = int.Parse(this.ddlCompany.SelectedValue);

            return filter;
        }