예제 #1
0
        /// <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;
        }
예제 #2
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");
        }
    }