Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         try
         {
             DropDownList1.DataSource     = objProceso.D_consultarProceso();
             DropDownList1.DataTextField  = "Nombre";
             DropDownList1.DataValueField = "IdProceso";
             DropDownList1.DataBind();
             DropDownList2.DataSource     = objPersona.D_consultarPersonaPorProceso();
             DropDownList2.DataTextField  = "Nombre";
             DropDownList2.DataValueField = "IdPersona";
             DropDownList2.DataBind();
             DropDownList2.Items.Add(new ListItem("Todos", "-1"));
         }
         catch
         {
         }
     }
     else
     {
         if (int.Parse(DropDownList2.SelectedValue) != -1)
         {
             ReportDocument crystalrpt = new ReportDocument();
             path = Server.MapPath("");
             crystalrpt.Load(Server.MapPath(@"~/Reportes/ReporteGenerico.rpt"));
             //crystalrpt.SetDatabaseLogon("adminSAEDI", "SAEDI.2018*");
             crystalrpt.Refresh();
             crystalrpt.SetParameterValue("@IdProceso", DropDownList1.SelectedValue);
             crystalrpt.SetParameterValue("@IdPersona", DropDownList2.SelectedValue);
             //crystalrpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "ReporteCuestionario" + DropDownList2.SelectedItem.Text);
             crystalrpt.Refresh();
             //CrystalReportViewer1.ReportSource = crystalrpt;
             //CrystalReportViewer1.DataBind();
         }
         else
         {
             ReportDocument crystalrpt = new ReportDocument();
             path = Server.MapPath("");
             crystalrpt.Load(Server.MapPath(@"~/Reportes/ReporteGenericoTodos.rpt"));
             // crystalrpt.SetDatabaseLogon("adminSAEDI", "SAEDI.2018*");
             crystalrpt.Refresh();
             crystalrpt.SetParameterValue("@IdProceso", DropDownList1.SelectedValue);
             //crystalrpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "ReporteCuestionario");
             crystalrpt.Refresh();
             //CrystalReportViewer1.ReportSource = crystalrpt;
             //CrystalReportViewer1.DataBind();
         }
     }
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         try
         {
             DropDownList1.DataSource     = objProceso.D_consultarProceso();
             DropDownList1.DataTextField  = "Nombre";
             DropDownList1.DataValueField = "IdProceso";
             DropDownList1.DataBind();
             DropDownList2.DataSource     = objPersona.D_consultarPersonaPorProceso();
             DropDownList2.DataTextField  = "Nombre";
             DropDownList2.DataValueField = "IdPersona";
             DropDownList2.DataBind();
             DropDownList2.Items.Add(new ListItem("Todos", "-1"));
         }
         catch
         {
         }
     }
     else
     {
         if (int.Parse(DropDownList2.SelectedValue) != -1)
         {
             ReportDocument crystalrpt = new ReportDocument();
             path = Server.MapPath("");
             crystalrpt.Load(Server.MapPath(@"~/Reportes/ReporteGenerico.rpt"));
             crystalrpt.Refresh();
             crystalrpt.SetParameterValue("@IdProceso", DropDownList1.SelectedValue);
             crystalrpt.SetParameterValue("@IdPersona", DropDownList2.SelectedValue);
             CrystalReportViewer1.ReportSource = crystalrpt;
             CrystalReportViewer1.DataBind();
         }
         else
         {
             ReportDocument crystalrpt = new ReportDocument();
             path = Server.MapPath("");
             crystalrpt.Load(Server.MapPath(@"~/Reportes/ReporteGenericoTodos.rpt"));
             crystalrpt.Refresh();
             crystalrpt.SetParameterValue("@IdProceso", DropDownList1.SelectedValue);
             CrystalReportViewer1.ReportSource = crystalrpt;
             CrystalReportViewer1.DataBind();
         }
     }
 }