Beispiel #1
0
 public void LoadReport(ReportState rptState)
 {
     Rptdoc = new ReportDocument();
     try
     {
         string st;
         string str;
         if (rptState != ReportState.FromPostBack)
         {
             Reportdata data = new Reportdata();
             if (ddlStatus.SelectedValue == "Approved")
             {
                 st  = "select * from Apprecord where Session='" + ddlSession.SelectedValue + txtYear.Text + "' and FormType like '%" + ddlSelect.SelectedValue + "%' and Status!='NotApproved' and Status!='Hold' order by AppNo";
                 str = ddlSession.SelectedValue + txtYear.Text + " " + ddlSelect.SelectedValue + " Approved";
             }
             else
             {
                 st  = "select * from Apprecord where Session='" + ddlSession.SelectedValue + txtYear.Text + "' and FormType like '%" + ddlSelect.SelectedValue + "%' and Status='" + ddlStatus.SelectedValue + "' order by AppNo";
                 str = ddlSession.SelectedValue + txtYear.Text + " " + ddlSelect.SelectedValue + " " + ddlStatus.SelectedValue;
             }
             string FileName = "FormTypeCrt.rpt";
             data.Report(Rptdoc, str, con, st, FileName, FormType);
             Session["cr"] = Rptdoc;
         }
         else
         {
             FormType.ReportSource = (ReportDocument)Session["cr"];
         }
     }
     catch (Exception ex)
     {
         FormType.Visible = false;
     }
 }
    public void LoadReport(ReportState rptState)
    {
        Rptdoc = new ReportDocument();
        try
        {
            string st;
            string str;
            dtinfo.DateSeparator    = "/";
            dtinfo.ShortDatePattern = "dd/MM/yyyy";
            if (rptState != ReportState.FromPostBack)
            {
                Reportdata data = new Reportdata();
                if (ddlStatus.SelectedValue == "Approved")
                {
                    st  = "select * from Apprecord where (subDate between '" + Convert.ToDateTime(txtDate1.Text, dtinfo) + "' and '" + Convert.ToDateTime(txtDate2.Text, dtinfo) + "' and FormType like '%" + ddlSelect.SelectedValue + "%') and Status!='NotApproved' and Status!='Hold' order by AppNo";
                    str = ddlSelect.SelectedValue + " Approved";
                }
                else
                {
                    st  = "select * from Apprecord where (subDate between '" + Convert.ToDateTime(txtDate1.Text, dtinfo) + "' and '" + Convert.ToDateTime(txtDate2.Text, dtinfo) + "' and FormType like '%" + ddlSelect.SelectedValue + "%') and Status='" + ddlStatus.SelectedValue + "' order by AppNo";
                    str = ddlSelect.SelectedValue + " " + ddlStatus.SelectedValue;
                }

                string FileName = "FormTypeCrt.rpt";
                data.Report(Rptdoc, str, con, st, FileName, FormType);
                Session["cr"] = Rptdoc;
            }
            else
            {
                FormType.ReportSource = (ReportDocument)Session["cr"];
            }
        }
        catch (Exception ex)
        {
            FormType.Visible = false;
        }
    }