private void queryDistribution(ScoreDistributionItem args) { if (args.Scores == null || args.Scores.Count == 0) { try { ScoreDistributionHelper.QueryScoreDistribution(args); } catch (Exception e) { MessageBox.Show("数据查询出错!\n详细信息:" + e.Message); } } String[][] listViewItems = new String[args.Scores.Count][]; DataPoint[] dps = new DataPoint[args.Scores.Count]; for (int i = 0; i < args.Scores.Count; i++) { ScoreItem si = args.Scores[i]; String percentage = ((double)si.StudentCount / args.StudentCount).ToString("P"); listViewItems[i] = new String[] { si.DisplayValue, si.StudentCount.ToString(), percentage }; dps[i] = new DataPoint(0, si.StudentCount); dps[i].Label = si.DisplayValue; dps[i].AxisLabel = si.DisplayValue; dps[i].LabelBorderWidth = 100; dps[i].ToolTip = si.DisplayValue + " " + si.StudentCount + "人"; } scoreDistributionChartPanel1.SetPanelType(ScoreDistributionChartPanelType.SCORE_DISTRIBUTION_COURSE); scoreDistributionChartPanel1.RefreshData(listViewItems, dps); }
private void queryCourse(Object args) { disableView(); Object[] o = (Object[])args; String semester = (String)o[0]; String lessonCodeContains = (String)o[1]; String lessonNameContains = (String)o[2]; String teacherNameContains = (String)o[3]; int ignoreLessThan = (int)o[4]; int limit = (int)o[5]; bool ignoreImcompleteInfo = (bool)o[6]; String orderBy = (String)o[7]; List <ScoreDistributionItem> list = null; try { list = ScoreDistributionHelper.Query(semester, lessonCodeContains, lessonNameContains , teacherNameContains, ignoreLessThan, limit, ignoreImcompleteInfo, orderBy); loadCourseListViewHandler(list); } catch (Exception e) { MessageBox.Show("请检查数据文件data.s3db是否被破坏或删除!\n详细信息:" + e.Message, "数据查询出错"); } finally { enableView(); } }
private void LoadDataHandler() { if (File.Exists("data.s3db")) { this.comboBox1.Items.AddRange(ScoreDistributionHelper.LoadAllSemesters().ToArray()); if (this.comboBox1.Items.Count > 0) { this.comboBox1.SelectedIndex = 0; } } }
private void queryAnalyticsSD(Object o) { ScoreDistributionItem args = (ScoreDistributionItem)((Object[])o)[0]; String analyticsType = (String)((Object[])o)[1]; bool isSemesterAnalytics = "Semester".Equals(analyticsType); busyAnalysticView(); List <ScoreDistributionItem> list = null; try { if (isSemesterAnalytics) { list = ScoreDistributionHelper.QueryTeacherSDChangeBySemester(args); } else { list = ScoreDistributionHelper.QueryLessonSDChangeByTeacher(args); } } catch (Exception e) { unBusyAnalysticView(); MessageBox.Show("数据查询出错!\n详细信息:" + e.Message); return; } String[][] listViewItems = new String[list.Count][]; DataPoint[] dps = new DataPoint[list.Count]; for (int i = 0; i < list.Count; i++) { ScoreDistributionItem sdi = list[i]; dps[i] = new DataPoint(0, sdi.AverageScore); dps[i].AxisLabel = " "; listViewItems[i] = new String[] { isSemesterAnalytics?sdi.Semester : sdi.Teacher, sdi.AverageScore.ToString("0.00"), sdi.Remark }; dps[i].ToolTip = (isSemesterAnalytics ? "学期:" + sdi.Semester : "教师:" + sdi.Teacher) + "\n平均成绩:" + sdi.AverageScore.ToString("0.00") + " (" + Lesson.GetScoreDetailString(sdi.AverageScore) + ")\n比例最大的成绩:" + sdi.Remark; dps[i].MarkerStyle = MarkerStyle.Circle; dps[i].MarkerSize = 10; } this.setSDChartPanelHandler(isSemesterAnalytics ? ScoreDistributionChartPanelType.SCORE_DISTRIBUTION_SEMESTER : ScoreDistributionChartPanelType.SCORE_DISTRIBUTION_TEACHER , listViewItems, dps); unBusyAnalysticView(); }