//统计信息
    public void CalculateCourseAttention()
    {
        DalOperationAboutCourses doac = new DalOperationAboutCourses();
        DalOperationStudentSpecility dalspeciality = new DalOperationStudentSpecility();

        Courses courses=doac.FindCourseByNo(courseNo,classID,termtag);

        if (courses != null)
        {
            //调用统计方法
            Hashtable ht = doac.CalculateCourseAttentionNumber(courseNo,classID,termtag);
            int total = 0;
            result.Text = "";

            result.Text += "<tr>";
            result.Text += "<td>" + "课程编号:" + courseNo + "</td>";
            result.Text += "<td>" + "课程名称:" + courses.courseName + "</td>";
            result.Text += "</tr>";

            result.Text += "<tr>";
            result.Text += "<td>" + "专业名称" + "</td>";
            result.Text += "<td>" + "关注人数 (单位:名)" + "</td>";
            result.Text += "</tr>";

            //分专业统计关注人数信息
            foreach (DictionaryEntry objDE in ht)
            {
                result.Text += "<tr>";
                result.Text += "<td>" + dalspeciality.FindSpecilityNameByMajorTypeID(objDE.Key.ToString()) + "</td>";
                result.Text += "<td>" + objDE.Value.ToString() + "</td>";
                result.Text += "</tr>";
                total += int.Parse(objDE.Value.ToString());
            }

            result.Text += "<tr>";
            result.Text += "<td>" + "总人数:" + "</td>";
            result.Text += "<td>" + total.ToString() + "</td>";
            result.Text += "</tr>";
        }
    }
        /// <summary>
        /// 统计各个专业的课程关注人数信息
        /// </summary>
        /// <param name="courseNo">课程编号</param>
        /// <returns>哈希表</returns>
        public Hashtable CalculateCourseAttentionNumber(string courseNo,string classID,string termTag)
        {
            DalOperationStudentSpecility dalspeciality = new DalOperationStudentSpecility();
            DataTable dtSpeciality = dalspeciality.FindAllStudentSpecilitye().Tables[0];

            int dtSpecialityCount = dtSpeciality.Rows.Count;

            Hashtable ht = new Hashtable(dtSpecialityCount);

            Parallel.For(0, dtSpecialityCount, delegate(int i)
            {
                ht.Add(dtSpeciality.Rows[i]["MajorTypeID"].ToString().Trim(), 0);
            });

            string sql = "SELECT [courseAttentionId],usta_StudentsList.[studentNo],[courseNo],MajorType ";
            sql += "FROM [usta_CoursesAttention], usta_StudentsList ";
            sql += "where [usta_CoursesAttention].studentNo=usta_StudentsList.studentNo ";
            sql += "and courseNo=@courseNo AND classID=@classID AND termTag=@termTag";
            SqlParameter[] parameters = new SqlParameter[3] {
                new SqlParameter("@courseNo", courseNo) ,
                new SqlParameter("@classID", classID) ,
                new SqlParameter("@termTag", termTag)
            };
            DataSet ds = SqlHelper.ExecuteDataset(conn, CommandType.Text, sql, parameters);
            DataTable dt = ds.Tables[0];
            string speciality = string.Empty;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                speciality = dt.Rows[i]["MajorType"].ToString().Trim();
                ht[speciality] = int.Parse(ht[speciality].ToString().Trim()) + 1;
            }
            conn.Close();
            return ht;
        }
Beispiel #3
0
    //========
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //控制Tab的显示

            if (Request["fragment"] != null)
            {
                fragmentFlag = Request["fragment"];
            }

            CommonUtility.ShowLiControl(fragmentFlag, liFragment1, liFragment2, liFragment3, liFragment4
                , liFragment5, liFragment6, liFragment7, liFragment8, liFragment9, divFragment1, divFragment2, divFragment3, divFragment4, divFragment5, divFragment6, divFragment7, divFragment8, divFragment9);

            if (fragmentFlag.Equals("1"))
            {
                startTime.Attributes.Remove("class");
                endTime.Attributes.Remove("class");
                DalOperationAboutGradeCheck doan = new DalOperationAboutGradeCheck();
                DataTable dt = doan.GetTermYear().Tables[0];

                ddlSearchYear.Items.Add(new ListItem("所有", "all"));

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ddlSearchYear.Items.Add(new ListItem("20" + dt.Rows[i]["termYear"].ToString().Trim() + "学年", dt.Rows[i]["termYear"].ToString().Trim()));
                }

                if (!string.IsNullOrEmpty(_ddlSearchYear))
                {
                    for (int i = 0; i < ddlSearchYear.Items.Count; i++)
                    {
                        if (ddlSearchYear.Items[i].Value == _ddlSearchYear.Trim())
                        {
                            ddlSearchYear.SelectedIndex = i;
                            break;
                        }
                    }
                }

                DalOperationStudentSpecility doss = new DalOperationStudentSpecility();

                dt = doss.FindAllStudentSpecilitye().Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ddlSearchMajor.Items.Add(new ListItem(dt.Rows[i]["specilityName"].ToString().Trim(), dt.Rows[i]["MajorTypeID"].ToString().Trim()));
                }

                if (!string.IsNullOrEmpty(_ddlSearchMajor))
                {
                    for (int i = 0; i < ddlSearchMajor.Items.Count; i++)
                    {
                        if (ddlSearchMajor.Items[i].Value == _ddlSearchMajor.Trim())
                        {
                            ddlSearchMajor.SelectedIndex = i;
                            break;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(_ddlSearchYear) || (!string.IsNullOrEmpty(_ddlSearchMajor)))
                {
                    GetSchoolClassList();
                }

                if (!string.IsNullOrEmpty(_ddlSearchSchoolClass))
                {
                    for (int i = 0; i < ddlSearchSchoolClass.Items.Count; i++)
                    {
                        if (ddlSearchSchoolClass.Items[i].Value == _ddlSearchSchoolClass.Trim())
                        {
                            ddlSearchSchoolClass.SelectedIndex = i;
                            break;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(_ddlGradeCheckDegree))
                {
                    for (int i = 0; i < ddlGradeCheckDegree.Items.Count; i++)
                    {
                        if (ddlGradeCheckDegree.Items[i].Value == _ddlGradeCheckDegree.Trim())
                        {
                            ddlGradeCheckDegree.SelectedIndex = i;
                            break;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(_ddlGradeCheckLocale))
                {
                    for (int i = 0; i < ddlGradeCheckLocale.Items.Count; i++)
                    {
                        if (ddlGradeCheckLocale.Items[i].Value == _ddlGradeCheckLocale.Trim())
                        {
                            ddlGradeCheckLocale.SelectedIndex = i;
                            break;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(_keyword))
                {
                    txtKeyword.Text = _keyword;
                }

                DataListBind();
            }

            if (fragmentFlag.Equals("2"))
            {
                startTime.Attributes.Remove("class");
                endTime.Attributes.Remove("class");
                DataBindTermTagList(); DataBindSearchCourse();
            }

            if (fragmentFlag.Equals("3"))
            {
                //txtKeyword.Attributes.Add("class", "required");
                DataListBindGradeCheckApplyReason();
            }

            if (fragmentFlag.Equals("5"))
            {
                DalOperationAboutGradeCheck doan = new DalOperationAboutGradeCheck();
                DataTable dt = doan.GetTermYear().Tables[0];

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ddlTermYear.Items.Add(new ListItem("20" + dt.Rows[i]["termYear"].ToString().Trim() + "学年", dt.Rows[i]["termYear"].ToString().Trim()));
                }

                DataListBindGradeCheck();
            }

            if (fragmentFlag.Equals("6"))
            {
                DalOperationAboutGradeCheck doan = new DalOperationAboutGradeCheck();
                DataTable dt = doan.GetTermYear().Tables[0];

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ddlTermYearImportExcelData.Items.Add(new ListItem("20" + dt.Rows[i]["termYear"].ToString().Trim() + "学年", dt.Rows[i]["termYear"].ToString().Trim()));
                }
            }

            if (Request["studentNo"] != null && fragmentFlag.Equals("4"))
            {
                liFragment4.Visible = true;
                studentNo = Request["studentNo"];

                //删除
                if (Request["del"] == "true" && Request["courseNo"] != null && Request["coursesStudentsCorrelationId"] != null)
                {
                    DalOperationAboutStudent dalw = new DalOperationAboutStudent();
                    string coursesStudentsCorrelationId = Request["coursesStudentsCorrelationId"].ToString().Trim();
                    dalw.DelChooseCourseByCoursesStudentsCorrelationId(coursesStudentsCorrelationId);
                }

                DalOperationAboutStudent dal = new DalOperationAboutStudent();
                lblstudentName.Text = dal.GetStudentById(Request["studentNo"]).studentName;
                DalOperationAboutStudent dal1 = new DalOperationAboutStudent();
                DataSet ds = dal1.GetCoursesByStudentNo(Request["studentNo"].ToString().Trim());
                dlstcourses.DataSource = ds.Tables[0];
                dlstcourses.DataBind();
            }

            if (fragmentFlag.Equals("6"))
            {
                BindGradeCheckExcelTemplate(spanAttachment2, false);
            }

            if (Request["studentNo"] != null && fragmentFlag.Equals("7"))
            {
                liFragment7.Visible = true;
                studentNo = Request["studentNo"];
                DlstStudentSchoolClassNameDataBind();
                DlstStudentGradeCheckDataBind();

                if (Request["action"] != null && Request["action"].ToString().Trim() == "delete")
                {
                    dlstStudentGradeCheckDetail_Delete();
                }
            }

            if (fragmentFlag.Equals("8"))
            {
                BindGradeCheckExcelTemplate(spanExcelTemplate, true);

                if (!IsPostBack)
                {
                    Javascript.ExcuteJavascriptCode("initBeforeUnloadEvent('温馨提示:当前页面相关操作必须点击提交才能生效~(此为提示,并不代表您真正未保存数据),确定离开吗?');", Page);
                }
            }

            if (fragmentFlag.Equals("9"))
            {

                BindGradeCheckAllowTime();

                BindGradeCheckNotify();

                if (!IsPostBack)
                {
                    txtNotifyTitle.CssClass = "required";
                    Javascript.ExcuteJavascriptCode("initBeforeUnloadEvent('温馨提示:当前页面数据可能未保存哟~(此为提示,并不代表您真正未保存数据),确定离开吗?');", Page);
                }
            }
        }

        if (fragmentFlag.Equals("1") || fragmentFlag.Equals("2") || fragmentFlag.Equals("6") || fragmentFlag.Equals("8") || fragmentFlag.Equals("9"))
        {
            startTime.Attributes.Remove("class");
            endTime.Attributes.Remove("class");
        }
    }