Exemple #1
0
 protected void btn_ShowList_Click(object sender, EventArgs e)
 {
     img_ExportToExcel1.Visible = false;
     img_ExportToExcel2.Visible = false;
     if (ddl_Term.SelectedValue == null || ddl_Term.SelectedValue == "0")
     {
         RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
     }
     else
     {
         LAD.CodeOstad = txt_CodeOstad.Text;
         LAD.FromDate  = txt_FromDate.Text;
         LAD.ToDate    = txt_ToDate.Text;
         LAD.AzJobrani = txt_AzJobrani.Text;
         LAD.TaJobrani = txt_ToJobrani.Text;
         if (txt_AzJobrani.Text == "")
         {
             txt_AzJobrani.Text = "  /  /  ";
         }
         if (txt_ToJobrani.Text == "")
         {
             txt_ToJobrani.Text = "  /  /  ";
         }
         if (txt_FromDate.Text == "")
         {
             txt_FromDate.Text = "  /  /  ";
         }
         if (txt_ToDate.Text == "")
         {
             txt_ToDate.Text = "  /  /  ";
         }
         if (ddl_GroupOstad.SelectedValue == null)
         {
             ddl_GroupOstad.SelectedValue = "0";
         }
         if (ddl_Daneshkade.SelectedValue == null)
         {
             ddl_Daneshkade.SelectedValue = "0";
         }
         if (txt_AzJobrani.Text == string.Empty)
         {
             txt_AzJobrani.Text = "0";
         }
         if (txt_ToJobrani.Text == string.Empty)
         {
             txt_ToJobrani.Text = "0";
         }
         if (txt_FromDate.Text == string.Empty)
         {
             txt_FromDate.Text = "0";
         }
         if (txt_FromDate.Text == string.Empty)
         {
             txt_FromDate.Text = "0";
         }
         if (txt_NumberAbsence.Text == string.Empty)
         {
             txt_NumberAbsence.Text = "0";
         }
         if (txt_CodeOstad.Text == null || txt_CodeOstad.Text == "")
         {
             txt_CodeOstad.Text = "0";
         }
         if (rdb_YesAbsencesNoCountervailing.Checked == true)
         {
             if ((txt_FromDate.Text == "  /  /  ") || (txt_ToDate.Text == "  /  /  "))
             {
                 RadWindowManager1.RadAlert("لطفا از تاریخ ، تا تاریخ را پر کنید", 0, 100, "پیام", "");
             }
             else
             {
                 DataTable dtResault = FRB.GetAbsenceButNoCompensationProf(ddl_Term.SelectedValue, int.Parse(ddl_GroupOstad.SelectedValue), int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(txt_CodeOstad.Text), txt_FromDate.Text, txt_ToDate.Text, int.Parse(txt_NumberAbsence.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/ReportAbsenceButNoCompensation.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_AbsenceButNoCompensation]"].Parameters["@Term"].ParameterValue         = ddl_Term.SelectedValue;
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@Departman"].ParameterValue    = int.Parse(ddl_GroupOstad.SelectedValue);
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@Daneshkade"].ParameterValue   = int.Parse(ddl_Daneshkade.SelectedValue);
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@CodeOstad"].ParameterValue    = int.Parse(txt_CodeOstad.Text);
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@FromDate"].ParameterValue     = txt_FromDate.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@ToDate"].ParameterValue       = txt_ToDate.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@CountAbsence"].ParameterValue = int.Parse(txt_NumberAbsence.Text);
                     rpt.RegData(dtResault);
                     rpt.Dictionary.Synchronize();
                     //rpt.Show();
                     StiWebViewer1.Report  = rpt;
                     StiWebViewer1.Visible = true;
                     //rpt.Print(true);
                 }
             }
         }
         if (rdb_YesAbsenceYesCountervailing.Checked == true)
         {
             if (txt_FromDate.Text == "  /  /  " || txt_ToDate.Text == "  /  /  ")
             {
                 RadWindowManager1.RadAlert("لطفا از تاریخ تا تاریخ  پر کنید", 0, 100, "پیام", "");
             }
             if (txt_AzJobrani.Text == "  /  /  " || txt_ToJobrani.Text == "  /  /  ")
             {
                 RadWindowManager1.RadAlert("لطفا از تاریخ جبرانی تا تاریخ جبرانی را پر کنید", 0, 100, "پیام", "");
             }
             else
             {
                 DataTable dtResault = FRB.GetAbsenceAndCompensationProf(ddl_Term.SelectedValue, int.Parse(ddl_GroupOstad.SelectedValue), int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(txt_CodeOstad.Text), txt_FromDate.Text, txt_ToDate.Text, int.Parse(txt_NumberAbsence.Text), txt_AzJobrani.Text, txt_ToJobrani.Text);
                 if (dtResault.Rows.Count == 0)
                 {
                     RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
                 }
                 else
                 {
                     img_ExportToExcel2.Visible = true;
                     this.StiWebViewer1.ResetReport();
                     StiWebViewer1.Visible = true;
                     StiReport rpt = new StiReport();
                     rpt.Load(Server.MapPath("../Report/ReportAbsenceAndCompensation.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_AbsenceAndCompensation]"].Parameters["@Term"].ParameterValue         = ddl_Term.SelectedValue;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@Departman"].ParameterValue    = int.Parse(ddl_GroupOstad.SelectedValue);
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@Daneshkade"].ParameterValue   = int.Parse(ddl_Daneshkade.SelectedValue);
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@CodeOstad"].ParameterValue    = int.Parse(txt_CodeOstad.Text);
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@AzJobrani"].ParameterValue    = txt_AzJobrani.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@TaJobrani"].ParameterValue    = txt_ToJobrani.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@FromDate"].ParameterValue     = txt_FromDate.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@ToDate"].ParameterValue       = txt_ToDate.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@CountAbsence"].ParameterValue = int.Parse(txt_NumberAbsence.Text);
                     rpt.RegData(dtResault);
                     rpt.Dictionary.Synchronize();
                     //rpt.Show();
                     StiWebViewer1.Report  = rpt;
                     StiWebViewer1.Visible = true;
                     //rpt.Print(true);
                 }
             }
         }
     }
 }