Ejemplo n.º 1
0
 protected void btn_ShowList_Click(object sender, EventArgs e)
 {
     img_ExportToExcel1.Visible = false;
     RMD.FromDate = txt_FromDate.Text;
     RMD.ToDate   = txt_ToDate.Text;
     if (txt_FromDate.Text == "  /  /  " && txt_ToDate.Text == "  /  /  ")
     {
         RadWindowManager1.RadAlert("لطفا تاریخ را وارد نمایید", 0, 100, "پیام", "");
     }
     else
     {
         if (ddl_Term.SelectedValue == null || chk_Term.Checked == true)
         {
             ddl_Term.SelectedValue = "0";
         }
         if (txt_CodeOstad.Text == "")
         {
             txt_CodeOstad.Text = "0";
         }
         DataTable dtResault = FRB.ReferToProf(ddl_Term.SelectedValue, txt_CodeOstad.Text, txt_FromDate.Text, txt_ToDate.Text);
         if (dtResault.Rows.Count == 0)
         {
             RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
         }
         else
         {
             img_ExportToExcel1.Visible = true;
             this.StiWebViewer1.ResetReport();
             StiWebViewer1.Visible = true;
             StiReport rpt = new StiReport();
             rpt.Load(Server.MapPath("../Report/ReportReferToMaster.mrt"));
             rpt.ReportCacheMode = StiReportCacheMode.On;
             rpt.ReportCacheMode = StiReportCacheMode.On;
             rpt.Dictionary.Databases.Clear();
             rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString()));
             rpt.Compile();
             rpt.CompiledReport.DataSources["[Faculty].[SP_ReferToMaster]"].Parameters["@Term"].ParameterValue      = ddl_Term.SelectedValue;
             rpt.CompiledReport.DataSources["[Faculty].[SP_ReferToMaster]"].Parameters["@CodeOstad"].ParameterValue = txt_CodeOstad.Text;
             rpt.CompiledReport.DataSources["[Faculty].[SP_ReferToMaster]"].Parameters["@FromDate"].ParameterValue  = txt_FromDate.Text;
             rpt.CompiledReport.DataSources["[Faculty].[SP_ReferToMaster]"].Parameters["@ToDate"].ParameterValue    = txt_ToDate.Text;
             rpt.RegData(dtResault);
             rpt.Dictionary.Synchronize();
             //rpt.Show();
             StiWebViewer1.Report  = rpt;
             StiWebViewer1.Visible = true;
             //rpt.Print(true);
         }
         if (txt_CodeOstad.Text == "0" || txt_CodeOstad.Text == "")
         {
             txt_CodeOstad.Text    = "";
             Session["code_ostad"] = null;;
         }
         txt_CodeOstad.Text    = "";
         Session["code_ostad"] = null;
     }
 }