Example #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sysScore"></param>
        /// <param name="HomeWorkScore"></param>
        /// <returns></returns>
        public double ObjectiveScore(SysScore sysScore, double HomeWorkScore)
        {
            double BlogScore, LearnTimeScore, GroupScore, MsgScore;
            //博客帖子数量计算出博客成绩
            if (sysScore.CreatBlogCount > 10)
            {
                BlogScore = 100.0;
            }
            else if (sysScore.CreatBlogCount <= 0)
            {
                BlogScore = 0;
            }
            else
            {
                BlogScore = sysScore.CreatBlogCount * 10;
            }

            //学习时长计算成绩----------- todo
            //LearnTime.TotalMinutes
            TimeSpan LearnTime = sysScore.ExitCourseTime - sysScore.EnterCourseTime;
            LearnTimeScore = GetLearnTimeScore(LearnTime);

            //计算小组分数-----------todo
            GroupScore = GetGroupScore(sysScore.CreatGroupCount);

            //消息分数------------todo
            MsgScore = GetMsgScore(sysScore.CreatMsgCount);

            this.objectiveScore = BlogScore * Config.BlogScorePercent + HomeWorkScore * Config.HomeWorkScorePercent + LearnTimeScore * Config.LearnTimeScorePercent + GroupScore * Config.GroupNumScorePercent + MsgScore * Config.MsgNumScorePercent;

            return this.objectiveScore;
        }
 public SysScore GetSysScore(Guid studentId, Guid teacherId, int courseId)
 {
     //获得学生创建博客数量
     int countBlog = db.BlogTitle.SqlQuery("select * from BlogTitles t where t.CourseId=@courseId and t.CreatId=@studentId", new SqlParameter[] {
         new SqlParameter("@courseId", courseId),
         new SqlParameter("@studentId",studentId)
     }).Count<BlogTitle>();
     //获得学生创建小组数量
     int countGroup = db.CourseGroupTitle.SqlQuery("select * from CourseGroupTitles t where t.CourseId=@courseId and t.CourseGroupCreatId=@studentId", new SqlParameter[] {
         new SqlParameter("@courseId", courseId),
         new SqlParameter("@studentId",studentId)
     }).Count<CourseGroupTitle>();
     //获得学生消息数量
     int countMsg = db.Question.SqlQuery("select * from Questions t where t.FromId=@studentId and t.ToId=@teacherId", new SqlParameter[] {
         new SqlParameter("@studentId", studentId),
         new SqlParameter("@teacherId",teacherId)
     }).Count<Question>();
     SysScore sysScore = new SysScore() {
         CreatMsgCount = countMsg,
         CreatGroupCount=countGroup,
         CreatBlogCount=countBlog
     };
     return sysScore;
 }