Exemple #1
0
        public static StatResult calc(DataTable dt)
        {
            //1、设置查询条件
            CheckCellCondition condition0 = new CheckCellCondition(0, null, "*");
            CheckCellCondition condition1 = new CheckCellCondition(1, null, "*");
            CheckCellCondition condition2 = new CheckCellCondition(2, null, "*");
            CheckCellCondition condition3 = new CheckCellCondition(3, null, "*", true);
            List<CheckCellCondition> queryList = new List<CheckCellCondition>();
            queryList.Add(condition0);
            queryList.Add(condition1);
            queryList.Add(condition2);
            queryList.Add(condition3);

            //2、获取到正确的行记录
            DataRowCollection rows = dt.Rows;
            List<DataRow> nrows =  DataRowManager.findAllRightRows(rows,queryList);
            if (null == nrows || nrows.Count == 0)
            {
                return null;
            }
            DataTable rightDataTable = DataTableManager.newDataTable(dt.Columns, nrows);

            //3、排序 根据score由高到底排序
            List<Student> studentList = StudentManager.rows2StudentList(nrows);

            //4、统计平均值
            StatResult result = new StatResult();
            float totalScore = 0;
            int uv = 0;
            foreach(Student stu in studentList) {
                totalScore += stu.getScore();
                uv += 1;
            }

               return null;
        }
Exemple #2
0
 /**
  * 设置过滤条件
  * */
 private static List<CheckCellCondition> getConditionList()
 {
     List<CheckCellCondition> conditionList = new List<CheckCellCondition>();
     CheckCellCondition condition0 = new CheckCellCondition(0, null, "*");
     CheckCellCondition condition1 = new CheckCellCondition(1, null, "*");
     CheckCellCondition condition2 = new CheckCellCondition(2, null, "*");
     CheckCellCondition condition3 = new CheckCellCondition(3, "float", "*", true);
     CheckCellCondition condition4 = new CheckCellCondition(4, null, "*", true);
     conditionList.Add(condition0);
     conditionList.Add(condition1);
     conditionList.Add(condition2);
     conditionList.Add(condition3);
     conditionList.Add(condition4);
     return conditionList;
 }