/// <summary>
        /// 显示成绩统计界面
        /// </summary>
        void ShowScoreCount()
        {
            ClassStudentDao         classStudentDao  = new ClassStudentDao();
            StudentDao              studentDaoDao    = new StudentDao();
            List <ClassStudentBean> classStudentList = classStudentDao.FindListById(new ClassStudentBean(CourseClass.Id, 0, 0, 0, 0, 0));

            if (classStudentList.Count == 0)
            {
                return;
            }
            //计算平均分、最高分、最低分、分段统计
            int   stuId_MaxScore = classStudentList[0].Student_Id;
            int   stuId_MinScore = classStudentList[0].Student_Id;
            int   maxScore       = classStudentList[0].Score;
            int   minScore       = classStudentList[0].Score;
            float avgScore       = 0;
            int   及格人数           = 0;
            int   及格人数           = 0;
            int   九十分及以上人数       = 0;

            foreach (ClassStudentBean bean in classStudentList)
            {
                if (bean.Score > maxScore)
                {
                    maxScore       = bean.Score;
                    stuId_MaxScore = bean.Student_Id;
                }
                if (bean.Score < minScore)
                {
                    minScore       = bean.Score;
                    stuId_MinScore = bean.Student_Id;
                }
                if (bean.Score >= 90)
                {
                    九十分及以上人数++;
                }
                else if (bean.Score >= 60)
                {
                    及格人数++;
                }
                else
                {
                    及格人数++;
                }

                avgScore += bean.Score;
            }
            avgScore = avgScore / classStudentList.Count;

            //打印
            StudentBean stu_maxScore = studentDaoDao.FindById(new StudentBean(stuId_MaxScore));
            StudentBean stu_minScore = studentDaoDao.FindById(new StudentBean(stuId_MinScore));

            label3.Text = "班级平均分 : " + avgScore;
            label4.Text = "班级最高分 : " + maxScore + "(" + stu_maxScore.Name + ")";
            label5.Text = "班级最低分 : " + minScore + "(" + stu_minScore.Name + ")";;
            label6.Text = "各分段统计 :不及格人数= " + 及格人数 + " 及格人数= " + 及格人数 + " 九十分及以上人数= " + 九十分及以上人数;
        }
Пример #2
0
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="student"></param>
        public StudentHomeForm(StudentBean student, Form preForm)
        {
            InitializeComponent();
            this.ControlBox = false;   // 设置不出现关闭按钮

            this.student          = student;
            this.preForm          = preForm;
            this.classBean        = new ClassDao().FindById(new ClassBean(student.Class_Id));
            this.major            = new MajorDao().FindById(new MajorBean(classBean.Major_id));
            this.educationProgram = new EducationProgramDao().FindByMajorId(new EducationProgramBean(null, null, null, 0, null, 0, 0, classBean.Major_id));

            skinLabel1.Text = "[姓  名]:" + student.Name + "  [学号]:" + student.SCode;
            skinLabel2.Text = "[专业名]:" + major.Name + " [班级名]:" + classBean.Name;
            skinLabel3.Text = "[培养方案]:" + educationProgram.Name;
        }