Exemplo n.º 1
0
    public void BindDataset(string type, string date, string date2)
    {
        var objectDataSource = new Telerik.Reporting.ObjectDataSource();
        //Getting Datasouce
        SqlConnection con = new SqlConnection(Repository.Connection.DBConnectionString());


        SqlCommand mySqlCommand = con.CreateCommand();

        switch (type)
        {
        case "1":
            mySqlCommand.CommandText = "Active_Percaptia_Search_sp";
            mySqlCommand.Parameters.Add("@Mode", SqlDbType.NVarChar, 30).Value  = "DOB";
            mySqlCommand.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = Convert.ToDateTime(date);
            mySqlCommand.Parameters.Add("@EndDate", SqlDbType.DateTime).Value   = Convert.ToDateTime(date2);
            break;

        case "2":
            mySqlCommand.CommandText = "Active_Percaptia_N_sp";
            break;

        default:
            mySqlCommand.CommandText = "Active_Percaptia_N_sp";
            break;
        }

        mySqlCommand.CommandType = CommandType.StoredProcedure;

        SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();

        mySqlDataAdapter.SelectCommand = mySqlCommand;
        DataTable dt = new DataTable();

        con.Open();
        mySqlDataAdapter.Fill(dt);


        //Report
        objectDataSource.DataSource = dt;


        ReportPercapita Percapita = new ReportPercapita();

        Percapita.DataSource = objectDataSource;

        Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
        reportSource.ReportDocument = Percapita;


        ReportViewer1.ReportSource = reportSource;
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        menu.GenerateMenu("Reports");
        Submenu.GenerateMenu("Percapita-Active");
        if (!IsPostBack)
        {
            Noreportlbl.Visible = false;

            ReportPercapita report = new ReportPercapita();

            ReportViewer1.Visible = true;
            ReportViewer1.Report  = report;
        }
        datelbl.Style["display"]   = "none";
        statuslbl.Style["display"] = "none";
        datelbl2.Style["display"]  = "none";
    }