Esempio n. 1
0
        protected void btn_ShowReport_Click(object sender, EventArgs e)
        {
            img_ExportToExcel1.Visible = false;
            img_ExportToExcel2.Visible = false;
            img_ExportToExcel3.Visible = false;
            img_ExportToExcel4.Visible = false;
            img_ExportToExcel5.Visible = false;
            img_ExportToExcel6.Visible = false;
            if (rdb_ListSabegheByTerm.Checked == true)
            {
                if (txt_CodeOstad.Text == string.Empty)
                {
                    txt_CodeOstad.Text = "0";
                }
                if (ddl_Daneshkade.SelectedValue == null)
                {
                    ddl_Daneshkade.SelectedValue = "0";
                }
                if (ddl_Departman.SelectedValue == null)
                {
                    ddl_Departman.SelectedValue = "0";
                }
                if (ddl_Cooperation.SelectedValue == null)
                {
                    ddl_Cooperation.SelectedValue = "0";
                }
                string AzTerm = txt_FromTerm.Text;
                string TaTerm = txt_ToTerm.Text;
                dtResault = FRB.GetTeachingExperienceProf(txt_CodeOstad.Text, int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(ddl_Departman.SelectedValue), int.Parse(ddl_Cooperation.SelectedValue), AzTerm, TaTerm);

                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/ReportListOfSelectedCoursesTeachersByTerm1.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_TeachingExprerienceProfByTerm]"].Parameters["@idostad"].ParameterValue  = txt_CodeOstad.Text;
                    rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProfByTerm]"].Parameters["@Tatterm"].ParameterValue  = TaTerm;
                    rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProfByTerm]"].Parameters["@iddanesh"].ParameterValue = int.Parse(ddl_Daneshkade.SelectedValue);
                    rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProfByTerm]"].Parameters["@idgroup"].ParameterValue  = int.Parse(ddl_Departman.SelectedValue);
                    rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProfByTerm]"].Parameters["@idnahveh"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                    rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProfByTerm]"].Parameters["@Aztterm"].ParameterValue  = AzTerm;
                    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;
            }
            else if (ddl_Term.SelectedValue == null || ddl_Term.SelectedValue == "0")
            {
                RadWindowManager1.RadAlert("لطفا ترم مورد نظر را انتخاب بفرمایید", 0, 100, "پیام", "");
            }
            else
            {
                if (rdb_EblaghAsatid.Checked == true)
                {
                    //if (rdb_EblaghBarAsasGroup.Checked == true)
                    //{
                    //    order = 1;
                    //}
                    //if (rdb_EblaghBarAsasName.Checked == true)
                    //{
                    //    order = 2;
                    //}
                    order = 1;
                    if (txt_CodeOstad.Text == string.Empty)
                    {
                        txt_CodeOstad.Text = "0";
                    }
                    if (ddl_Daneshkade.SelectedValue == null)
                    {
                        ddl_Daneshkade.SelectedValue = "0";
                    }
                    if (ddl_Departman.SelectedValue == null)
                    {
                        ddl_Departman.SelectedValue = "0";
                    }
                    if (ddl_Cooperation.SelectedValue == null)
                    {
                        ddl_Cooperation.SelectedValue = "0";
                    }

                    dtResault = FRB.GetNotificationProf(txt_CodeOstad.Text, ddl_Term.SelectedValue, int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(ddl_Departman.SelectedValue), int.Parse(ddl_Cooperation.SelectedValue), order);

                    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/ReportNotificationProfByGroup.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_NotificationProfessors]"].Parameters["@idostad"].ParameterValue  = txt_CodeOstad.Text;
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@tterm"].ParameterValue    = ddl_Term.SelectedValue;
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@iddanesh"].ParameterValue = int.Parse(ddl_Daneshkade.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@idgroup"].ParameterValue  = int.Parse(ddl_Departman.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@idnahveh"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@order"].ParameterValue    = order;
                        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;
                }

                else if (rdb_EblaghExam.Checked == true)
                {
                    //if (rdb_EblaghBarAsasGroup.Checked == true)
                    //{
                    //    order = 1;
                    //}
                    //if (rdb_EblaghBarAsasName.Checked == true)
                    //{
                    //    order = 2;
                    //}
                    order = 1;
                    if (txt_CodeOstad.Text == string.Empty)
                    {
                        txt_CodeOstad.Text = "0";
                    }
                    if (ddl_Daneshkade.SelectedValue == null)
                    {
                        ddl_Daneshkade.SelectedValue = "0";
                    }
                    if (ddl_Departman.SelectedValue == null)
                    {
                        ddl_Departman.SelectedValue = "0";
                    }
                    if (ddl_Cooperation.SelectedValue == null)
                    {
                        ddl_Cooperation.SelectedValue = "0";
                    }
                    dtResault = FRB.GetNotificationProf(txt_CodeOstad.Text, ddl_Term.SelectedValue, int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(ddl_Departman.SelectedValue), int.Parse(ddl_Cooperation.SelectedValue), order);

                    if (dtResault.Rows.Count == 0)
                    {
                        RadWindowManager1.RadAlert("رکوردی یافت نشد ", 0, 100, "پیام", "");
                    }
                    else if (chk_koli.Checked == true)
                    {
                        img_ExportToExcel3.Visible = true;
                        this.StiWebViewer1.ResetReport();
                        StiWebViewer1.Visible = true;
                        StiReport rpt = new StiReport();
                        rpt.Load(Server.MapPath("../Report/ReportNotificationReportAll.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_NotificationProfessors]"].Parameters["@idostad"].ParameterValue  = txt_CodeOstad.Text;
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@tterm"].ParameterValue    = ddl_Term.SelectedValue;
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@iddanesh"].ParameterValue = int.Parse(ddl_Daneshkade.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@idgroup"].ParameterValue  = int.Parse(ddl_Departman.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@idnahveh"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@order"].ParameterValue    = order;
                        rpt.RegData(dtResault);
                        rpt.Dictionary.Synchronize();
                        //rpt.Show();
                        StiWebViewer1.Report  = rpt;
                        StiWebViewer1.Visible = true;
                        //rpt.Print(true);
                    }
                    else
                    {
                        img_ExportToExcel4.Visible = true;
                        this.StiWebViewer1.ResetReport();
                        StiWebViewer1.Visible = true;
                        StiReport rpt = new StiReport();
                        rpt.Load(Server.MapPath("../Report/ReportNotificationProfessors.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_NotificationProfessors]"].Parameters["@idostad"].ParameterValue  = txt_CodeOstad.Text;
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@tterm"].ParameterValue    = ddl_Term.SelectedValue;
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@iddanesh"].ParameterValue = int.Parse(ddl_Daneshkade.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@idgroup"].ParameterValue  = int.Parse(ddl_Departman.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@idnahveh"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_NotificationProfessors]"].Parameters["@order"].ParameterValue    = order;
                        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;
                }
                else if (rdb_TedadVahed.Checked == true)
                {
                    //if (rdb_EblaghBarAsasGroup.Checked == true)
                    //{
                    //    order = 1;
                    //}
                    //if (rdb_EblaghBarAsasName.Checked == true)
                    //{
                    //    order = 2;
                    //}
                    order = 1;
                    if (txt_CodeOstad.Text == string.Empty)
                    {
                        txt_CodeOstad.Text = "0";
                    }
                    if (ddl_Daneshkade.SelectedValue == null)
                    {
                        ddl_Daneshkade.SelectedValue = "0";
                    }
                    if (ddl_Departman.SelectedValue == null)
                    {
                        ddl_Departman.SelectedValue = "0";
                    }
                    if (ddl_Cooperation.SelectedValue == null)
                    {
                        ddl_Cooperation.SelectedValue = "0";
                    }

                    dtResault = FRB.GetListOfSelectedCoursesTeachers(txt_CodeOstad.Text, ddl_Term.SelectedValue, int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(ddl_Departman.SelectedValue), int.Parse(ddl_Cooperation.SelectedValue));

                    if (dtResault.Rows.Count == 0)
                    {
                        RadWindowManager1.RadAlert("رکوردی یافت نشد ", 0, 100, "پیام", "");
                    }
                    else
                    {
                        //Report ...
                        img_ExportToExcel5.Visible = true;
                        this.StiWebViewer1.ResetReport();
                        StiWebViewer1.Visible = true;
                        StiReport rpt = new StiReport();
                        rpt.Load(Server.MapPath("../Report/ReportListOfSelectedCoursesTeachers.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_TeachingExprerienceProf]"].Parameters["@idostad"].ParameterValue  = txt_CodeOstad.Text;
                        rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProf]"].Parameters["@Term"].ParameterValue     = ddl_Term.SelectedValue;
                        rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProf]"].Parameters["@iddanesh"].ParameterValue = int.Parse(ddl_Daneshkade.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProf]"].Parameters["@idgroup"].ParameterValue  = int.Parse(ddl_Departman.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProf]"].Parameters["@idnahveh"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                        //rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExprerienceProf]"].Parameters["@order"].ParameterValue = order;
                        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;
                }
                else if (rdb_ListSabegheByTerm.Checked == true)
                {
                }
                else if (rdb_ListSavabeghRuz.Checked == true)
                {
                    if (txt_ListSavabeghRuz.Text == string.Empty)
                    {
                        txt_ListSavabeghRuz.Text = "0";
                    }
                    string Number = txt_ListSavabeghRuz.Text;

                    if (txt_CodeOstad.Text == string.Empty)
                    {
                        txt_CodeOstad.Text = "0";
                    }
                    if (ddl_Daneshkade.SelectedValue == null)
                    {
                        ddl_Daneshkade.SelectedValue = "0";
                    }
                    if (ddl_Departman.SelectedValue == null)
                    {
                        ddl_Departman.SelectedValue = "0";
                    }
                    if (ddl_Cooperation.SelectedValue == null)
                    {
                        ddl_Cooperation.SelectedValue = "0";
                    }
                    dtResault = FRB.TeachingExperienceMoreThanADay(ddl_Term.SelectedValue, int.Parse(txt_CodeOstad.Text), int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(ddl_Departman.SelectedValue), int.Parse(ddl_Cooperation.SelectedValue), int.Parse(txt_ListSavabeghRuz.Text));
                    if (dtResault.Rows.Count == 0)
                    {
                        RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
                    }
                    else
                    {
                        img_ExportToExcel6.Visible = true;
                        this.StiWebViewer1.ResetReport();
                        StiWebViewer1.Visible = true;
                        StiReport rpt = new StiReport();
                        rpt.Load(Server.MapPath("../Report/ReportTeachingExperienceMoreThanADay.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_TeachingExperienceMoreThanADay]"].Parameters["@Term"].ParameterValue        = ddl_Term.SelectedValue;
                        rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExperienceMoreThanADay]"].Parameters["@Number"].ParameterValue      = int.Parse(Number);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExperienceMoreThanADay]"].Parameters["@Departman"].ParameterValue   = int.Parse(ddl_Departman.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExperienceMoreThanADay]"].Parameters["@Cooperation"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                        rpt.CompiledReport.DataSources["[Faculty].[SP_TeachingExperienceMoreThanADay]"].Parameters["@Daneshkade"].ParameterValue  = int.Parse(ddl_Daneshkade.SelectedValue);
                        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;
                }
            }
        }