示例#1
0
        //ramezanian
        protected void btn_PrintList_Click(object sender, EventArgs e)
        {
            img_ExportToExcel1.Visible = false;
            if (ddl_Term.SelectedValue == null || ddl_Term.SelectedValue == "0")
            {
                RadWindowManager1.RadAlert("لطفا ترم را انتخاب فرمایید", 0, 100, "پیغام", "");
            }
            else
            {
                int NumberClass   = 0;
                int LocationClass = 0;
                if (ddl_NumberClass.SelectedValue != null && ddl_NumberClass.SelectedValue != "")
                {
                    NumberClass = int.Parse(ddl_NumberClass.SelectedValue);
                }
                if (ddl_LocationClass.SelectedValue != null && ddl_NumberClass.SelectedValue != "")
                {
                    LocationClass = int.Parse(ddl_LocationClass.SelectedValue.ToString());
                }

                string    Term = ddl_Term.SelectedValue.ToString();
                DataTable dt   = new DataTable();
                dt = ERB.SelectListClass(NumberClass, Term, LocationClass);
                DataTable dt1 = ERB.GetNameClass(NumberClass);
                if (dt.Rows.Count == 0)
                {
                    RadWindowManager1.RadAlert("رکوردی یافت نشد", 0, 100, "پیغام", "");
                }
                else
                {
                    img_ExportToExcel1.Visible = true;
                    this.StiWebViewer1.ResetReport();
                    StiWebViewer1.Visible = true;
                    StiReport rpt = new StiReport();
                    rpt.CacheAllData = false;
                    rpt.ClearAllStates();
                    rpt.Load(Server.MapPath("../Report/ReportّFinal.mrt"));
                    rpt.Dictionary.Databases.Clear();
                    rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString()));
                    rpt.Compile();
                    rpt.CompiledReport.DataSources["[Education].[SP_PrintListClass]"].Parameters["@Number"].ParameterValue   = NumberClass;
                    rpt.CompiledReport.DataSources["[Education].[SP_PrintListClass]"].Parameters["@Term"].ParameterValue     = Term;
                    rpt.CompiledReport.DataSources["[Education].[SP_PrintListClass]"].Parameters["@Location"].ParameterValue = LocationClass;
                    rpt.CompiledReport.DataSources["[Education].[SP_GetNameClass]"].Parameters["@id"].ParameterValue         = NumberClass;
                    rpt.RegData(dt);
                    rpt.RegData(dt1);
                    rpt.Dictionary.Synchronize();
                    //rpt.Show();
                    StiWebViewer1.Report  = rpt;
                    StiWebViewer1.Visible = true;
                    //rpt.Print(true);
                }
            }
        }