//protected void btn_Exit_Click(object sender, EventArgs e)
 //{
 //    Session["code_ostad"]=null;
 //    Response.Redirect("FacultyReports.aspx");
 //}
 protected void btn_ShowList_Click(object sender, EventArgs e)
 {
     img_ExportToExcel1.Visible = false;
     if (ddl_Term.SelectedValue == null || ddl_Term.SelectedValue == "0")
     {
         RadWindowManager1.RadAlert("لطفا ترم را انتخاب بفرمایید", 0, 100, "پیام", "");
     }
     else
     {
         if (ddl_Daneshkade.SelectedValue == null)
         {
             ddl_Daneshkade.SelectedValue = "0";
         }
         if (txt_CodeOstad.Text == string.Empty)
         {
             txt_CodeOstad.Text = "0";
             LTD.CodeOstad      = txt_CodeOstad.Text;
         }
         else
         {
             LTD.CodeOstad = txt_CodeOstad.Text;
         }
         if (txt_CodeOstad.Text == null || txt_CodeOstad.Text == "")
         {
             txt_CodeOstad.Text = "0";
         }
         if (ddl_CodeGroup.SelectedValue == null)
         {
             ddl_CodeGroup.SelectedValue = "0";
         }
         if (ddl_Cooperation.SelectedValue == null)
         {
             ddl_Cooperation.SelectedValue = "0";
         }
         if (rdb_Tuition.Checked == true)
         {
             DataTable dt = FRB.GetListTuition(ddl_Term.SelectedValue, int.Parse(ddl_Cooperation.SelectedValue), int.Parse(ddl_CodeGroup.SelectedValue), int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(txt_CodeOstad.Text));
             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.Load(Server.MapPath("../Report/ReportTuition.mrt"));
                 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_Tuition"].Parameters["@Term"].ParameterValue        = ddl_Term.SelectedValue;
                 rpt.CompiledReport.DataSources["Faculty.SP_Tuition"].Parameters["@Cooperation"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                 rpt.CompiledReport.DataSources["Faculty.SP_Tuition"].Parameters["@Departman"].ParameterValue   = int.Parse(ddl_CodeGroup.SelectedValue);
                 rpt.CompiledReport.DataSources["Faculty.SP_Tuition"].Parameters["@Daneshkade"].ParameterValue  = int.Parse(ddl_Daneshkade.SelectedValue);
                 rpt.CompiledReport.DataSources["Faculty.SP_Tuition"].Parameters["@CodeOstad"].ParameterValue   = int.Parse(txt_CodeOstad.Text);
                 rpt.RegData(dt);
                 rpt.Dictionary.Synchronize();
                 //rpt.Show();
                 StiWebViewer1.Report  = rpt;
                 StiWebViewer1.Visible = true;
                 //rpt.Print(true);
             }
         }
         else
         {
             DataTable dt = FRB.GetListTuition2(ddl_Term.SelectedValue, int.Parse(ddl_Cooperation.SelectedValue), int.Parse(ddl_CodeGroup.SelectedValue), int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(txt_CodeOstad.Text));
             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.Load(Server.MapPath("../Report/ReportListTaition.mrt"));
                 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_ListTuition]"].Parameters["@Term"].ParameterValue        = ddl_Term.SelectedValue;
                 rpt.CompiledReport.DataSources["[Faculty].[SP_ListTuition]"].Parameters["@Cooperation"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                 rpt.CompiledReport.DataSources["[Faculty].[SP_ListTuition]"].Parameters["@Departman"].ParameterValue   = int.Parse(ddl_CodeGroup.SelectedValue);
                 rpt.CompiledReport.DataSources["[Faculty].[SP_ListTuition]"].Parameters["@Daneshkade"].ParameterValue  = int.Parse(ddl_Daneshkade.SelectedValue);
                 rpt.CompiledReport.DataSources["[Faculty].[SP_ListTuition]"].Parameters["@CodeOstad"].ParameterValue   = int.Parse(txt_CodeOstad.Text);
                 rpt.RegData(dt);
                 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;
     }
 }