예제 #1
0
        protected virtual bool SubItemTScore(int paperId, int[] scoreArray, string userName, ref string resultText, out int[] subitemIds, out float[] subitemScoreArray)
        {
            DataSet ds           = SubItem.GetPaperSubItems(paperId, 1);
            int     subitemCount = ds.Tables[0].Rows.Count;
            //int subitemCount = ds.Tables[0].Rows.Count;
            bool result;

            if (subitemCount <= 0)
            {
                subitemIds        = null;
                subitemScoreArray = null;
                result            = false;
            }
            else
            {
                resultText = "";
                subitemIds = new int[subitemCount];
                float[] T = new float[subitemCount];
                float[] X = new float[subitemCount];
                float[] M = new float[subitemCount];
                float[] S = new float[subitemCount];
                for (int i = 0; i < subitemCount; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    subitemIds[i] = (int)dr["Fsubitemid"];
                    X[i]          = 0f;
                    string[] questionIds = dr["Fquestions"].ToString().Split(new char[]
                    {
                        '|'
                    });
                    float[] tmpArray = new float[questionIds.Length];
                    for (int j = 0; j < questionIds.Length; j++)
                    {
                        int     questionId = int.Parse(questionIds[j]);
                        float[] array;
                        IntPtr  intPtr;
                        (array = X)[(int)(intPtr = (IntPtr)i)] = array[(int)intPtr] + (float)scoreArray[questionId - 1];
                        tmpArray[j] = (float)scoreArray[questionId - 1];
                    }
                    M[i] = X[i] / (float)questionIds.Length;
                    S[i] = this.computeStandardDeviation(tmpArray, M[i]);
                    if (S[i] != 0f)
                    {
                        T[i] = (float)Math.Round((double)(50f + 10f * (X[i] - M[i]) / S[i]), 2);
                    }
                    string subitemName = dr["Fsubitemname"].ToString();
                    resultText = resultText + subitemName + "的得分是:" + T[i].ToString();
                    if (i != subitemCount - 1)
                    {
                        resultText += "<br/>";
                    }
                }
                subitemScoreArray = T;
                result            = true;
            }
            return(result);
        }
예제 #2
0
        protected virtual bool SubItemScore(int paperId, int[] scoreArray, bool average, ref string resultText, out int[] subitemIds, out float[] subitemScoreArray)
        {
            DataSet ds           = SubItem.GetPaperSubItems(paperId, 1);
            int     subitemCount = ds.Tables[0].Rows.Count;
            bool    result;

            if (subitemCount <= 0)
            {
                subitemIds        = null;
                subitemScoreArray = null;
                result            = false;
            }
            else
            {
                resultText        = "";
                subitemIds        = new int[subitemCount];
                subitemScoreArray = new float[subitemCount];
                for (int i = 0; i < subitemCount; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    //DataRow dr = ds.get_Tables().get_Item(0).get_Rows().get_Item(i);
                    subitemIds[i]        = (int)dr["Fsubitemid"];
                    subitemScoreArray[i] = 0f;
                    string[] questionIds = dr["Fquestions"].ToString().Split(new char[]
                    {
                        '|'
                    });
                    for (int j = 0; j < questionIds.Length; j++)
                    {
                        int     questionId = int.Parse(questionIds[j]);
                        float[] array;
                        IntPtr  intPtr;
                        (array = subitemScoreArray)[(int)(intPtr = (IntPtr)i)] = array[(int)intPtr] + (float)scoreArray[questionId - 1];
                    }
                    if (average)
                    {
                        subitemScoreArray[i] = (float)Math.Round((double)(subitemScoreArray[i] / (float)questionIds.Length), 2);
                    }
                    string subitemName = dr["Fsubitemname"].ToString();
                    resultText = resultText + subitemName + "的得分是:" + subitemScoreArray[i].ToString();
                    if (i != subitemCount - 1)
                    {
                        resultText += "<br/>";
                    }
                }
                result = true;
            }
            return(result);
        }
예제 #3
0
        public static Hashtable GetPaperSubItemIdMap(int paperid, int level)
        {
            Hashtable result = new Hashtable();
            DataTable dt     = SubItem.GetPaperSubItems(paperid, level).Tables[0];
            Hashtable result2;

            if (dt.Rows.Count <= 0)
            {
                result2 = result;
            }
            else
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //result.set_Item(dt.get_Rows().get_Item(i).get_Item("Fsubitemname"), dt.get_Rows().get_Item(i).get_Item("Fsubitemid"));
                    result.Add(dt.Rows[i]["Fsubitemname"], dt.Rows[i]["Fsubitemid"]);
                }
                result2 = result;
            }
            return(result2);
        }
예제 #4
0
        public static Hashtable GetPaperSubItemIndexMap(int paperid, int level)
        {
            Hashtable result = new Hashtable();
            //DataTable dt = SubItem.GetPaperSubItems(paperid, level).get_Tables().get_Item(0);
            DataTable dt = SubItem.GetPaperSubItems(paperid, level).Tables[0];
            Hashtable result2;

            if (dt.Rows.Count <= 0)
            {
                result2 = result;
            }
            else
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //result.Item(dtRows.Item[i]["Fsubitemname"], i);
                    result.Add(dt.Rows[i]["Fsubitemname"], i);
                }
                result2 = result;
            }
            return(result2);
        }
예제 #5
0
        public override bool SeniorScore(int paperId, string answers, int[] scoreArray, string userName, ref string resultText, out int[] subitemIds, out float[] subitemScoreArray)
        {
            Hashtable M = new Hashtable();
            Hashtable S = new Hashtable();

            M.Add("女l", 4.12);
            M.Add("女f", 2.73);
            M.Add("女k", 12.37);
            M.Add("女hs", 12.95);
            M.Add("女d", 19.25);
            M.Add("女hy", 19.01);
            M.Add("女pd", 18.8);
            M.Add("女mf_m", 28.66);
            M.Add("女pa", 8.03);
            M.Add("女pt", 25.2);
            M.Add("女sc", 22.39);
            M.Add("女ma", 16.6);
            M.Add("女si", 24.62);
            S.Add("女l", 2.94);
            S.Add("女f", 4.55);
            S.Add("女k", 5.26);
            S.Add("女hs", 4.92);
            S.Add("女d", 5.15);
            S.Add("女hy", 5.63);
            S.Add("女pd", 4.24);
            S.Add("女mf_m", 4.81);
            S.Add("女pa", 3.49);
            S.Add("女pt", 6.08);
            S.Add("女sc", 6.52);
            S.Add("女ma", 4);
            S.Add("女si", 9.62);
            DataSet ds           = SubItem.GetPaperSubItems(paperId, 1);
            int     subitemCount = ds.Tables[0].Rows.Count;// ds.get_Tables().get_Item(0).get_Rows().get_Count();
            bool    result;

            if (subitemCount <= 0)
            {
                subitemIds        = null;
                subitemScoreArray = null;
                result            = false;
            }
            else
            {
                resultText = "";
                subitemIds = new int[subitemCount];
                float[]  T           = new float[subitemCount];
                float[]  X           = new float[subitemCount];
                string[] answerArray = answers.Split(new char[]
                {
                    '|'
                });
                for (int i = 0; i < subitemCount; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    subitemIds[i] = (int)dr["Fsubitemid"];
                    X[i]          = 0f;
                    string[] questionIds = dr["Fquestions"].ToString().Split(new char[]
                    {
                        '|'
                    });
                    for (int j = 0; j < questionIds.Length; j++)
                    {
                        int     questionId = int.Parse(questionIds[j]);
                        int     select     = int.Parse(answerArray[questionId - 1]);
                        int     score      = this.GetScore(questionId, dr["Fsubitemname"].ToString(), select, scoreArray);
                        float[] array;
                        IntPtr  intPtr;
                        (array = X)[(int)(intPtr = (IntPtr)i)] = array[(int)intPtr] + (float)score;
                    }
                }
                Hashtable subitemIndexMap = SubItem.GetPaperSubItemIndexMap(paperId, 1);
                float     K = X[(int)subitemIndexMap["k"]];
                float[]   array2;
                IntPtr    intPtr2;
                (array2 = X)[(int)(intPtr2 = (IntPtr)((int)subitemIndexMap["hs"]))] = array2[(int)intPtr2] + 0.5f * K;
                float[] array3;
                IntPtr  intPtr3;
                (array3 = X)[(int)(intPtr3 = (IntPtr)((int)subitemIndexMap["pd"]))] = array3[(int)intPtr3] + 0.4f * K;
                float[] array4;
                IntPtr  intPtr4;
                (array4 = X)[(int)(intPtr4 = (IntPtr)((int)subitemIndexMap["pt"]))] = array4[(int)intPtr4] + 1f * K;
                float[] array5;
                IntPtr  intPtr5;
                (array5 = X)[(int)(intPtr5 = (IntPtr)((int)subitemIndexMap["sc"]))] = array5[(int)intPtr5] + 1f * K;
                float[] array6;
                IntPtr  intPtr6;
                (array6 = X)[(int)(intPtr6 = (IntPtr)((int)subitemIndexMap["ma"]))] = array6[(int)intPtr6] + 0.2f * K;
                for (int k = 0; k < subitemCount; k++)
                {
                    DataRow dr2         = ds.Tables[0].Rows[k];
                    string  subitemName = dr2["Fsubitemname"].ToString();
                    string  key         = "女" + subitemName;
                    T[k]       = (float)Math.Round((double)(50f + 10f * (X[k] - float.Parse(M[key].ToString())) / float.Parse(S[key].ToString())), 2);
                    resultText = resultText + subitemName + "的得分是:" + T[k].ToString();
                    if (k != subitemCount - 1)
                    {
                        resultText += "<br/>";
                    }
                }
                subitemScoreArray = T;
                result            = true;
            }
            return(result);
        }
예제 #6
0
        protected override bool SubItemTScore(int paperId, int[] scoreArray, string userName, ref string resultText, out int[] subitemIds, out float[] subitemScoreArray)
        {
            Hashtable M = new Hashtable();
            Hashtable S = new Hashtable();

            S.Add("男P", 2.86);
            M.Add("男P", 5.29);
            S.Add("男E", 4.33);
            M.Add("男E", 10.17);
            S.Add("男N", 4.18);
            M.Add("男N", 11.45);
            S.Add("男L", 3.64);
            M.Add("男L", 11.91);
            S.Add("女P", 2.88);
            M.Add("女P", 4.43);
            S.Add("女E", 4.44);
            M.Add("女E", 7.67);
            S.Add("女N", 4.6);
            M.Add("女N", 12.5);
            S.Add("女L", 3.67);
            M.Add("女L", 12.83);
            DataSet ds           = SubItem.GetPaperSubItems(paperId, 1);
            int     subitemCount = ds.Tables[0].Rows.Count;

            bool result;

            if (subitemCount <= 0)
            {
                subitemIds        = null;
                subitemScoreArray = null;
                result            = false;
            }
            else
            {
                resultText = "";
                subitemIds = new int[subitemCount];
                float[] T = new float[subitemCount];
                float[] X = new float[subitemCount];
                for (int i = 0; i < subitemCount; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    subitemIds[i] = (int)dr["Fsubitemid"];
                    X[i]          = 0f;
                    string[] questionIds = dr["Fquestions"].ToString().Split(new char[]
                    {
                        '|'
                    });
                    for (int j = 0; j < questionIds.Length; j++)
                    {
                        int     questionId = int.Parse(questionIds[j]);
                        float[] array;
                        IntPtr  intPtr;
                        (array = X)[(int)(intPtr = (IntPtr)i)] = array[(int)intPtr] + (float)scoreArray[questionId - 1];
                    }
                    string subitemName = dr["Fsubitemname"].ToString();
                    // DataRow drStu = SchoolDB.GetStudent(userName);
                    string key = SchoolDB.GetStudent(userName);
                    key       += subitemName;
                    T[i]       = (float)Math.Round((double)(50f + 10f * (X[i] - float.Parse(M[key].ToString())) / float.Parse(S[key].ToString())), 2);
                    resultText = resultText + subitemName + "的得分是:" + T[i].ToString();
                    if (i != subitemCount - 1)
                    {
                        resultText += "<br/>";
                    }
                }
                subitemScoreArray = T;
                result            = true;
            }
            return(result);
        }
예제 #7
0
        public override bool SeniorScore(int paperId, string answers, int[] scoreArray, string userName, ref string resultText, out int[] subitemIds, out float[] subitemScoreArray)
        {
            Hashtable M = new Hashtable();
            Hashtable S = new Hashtable();

            M.Add("男Do", 9.15);
            S.Add("男Do", 3.44);
            M.Add("男Cs", 6.11);
            S.Add("男Cs", 2.27);
            M.Add("男Sy", 9.2);
            S.Add("男Sy", 3.23);
            M.Add("男Sp", 8.64);
            S.Add("男Sp", 2.88);
            M.Add("男Sa", 4.75);
            S.Add("男Sa", 2.5);
            M.Add("男Wb", 14.64);
            S.Add("男Wb", 3.16);
            M.Add("男Re", 10.16);
            S.Add("男Re", 2.41);
            M.Add("男So", 13.44);
            S.Add("男So", 3.11);
            M.Add("男Sc", 15.8);
            S.Add("男Sc", 4.6);
            M.Add("男To", 9.7);
            S.Add("男To", 3);
            M.Add("男Gi", 10.5);
            S.Add("男Gi", 3.8);
            M.Add("男Cm", 9.88);
            S.Add("男Cm", 1.85);
            M.Add("男Ac", 8.91);
            S.Add("男Ac", 2.55);
            M.Add("男Ai", 6.9);
            S.Add("男Ai", 2.36);
            M.Add("男Ie", 10);
            S.Add("男Ie", 2.37);
            M.Add("男Py", 5.8);
            S.Add("男Py", 2);
            M.Add("男Fx", 5);
            S.Add("男Fx", 2.5);
            M.Add("男Fe", 7.23);
            S.Add("男Fe", 2.29);
            M.Add("女Do", 8.78);
            S.Add("女Do", 3.11);
            M.Add("女Cs", 5.61);
            S.Add("女Cs", 2.56);
            M.Add("女Sy", 9.24);
            S.Add("女Sy", 3.17);
            M.Add("女Sp", 8.53);
            S.Add("女Sp", 2.69);
            M.Add("女Sa", 4.52);
            S.Add("女Sa", 2.2);
            M.Add("女Wb", 14.52);
            S.Add("女Wb", 3.22);
            M.Add("女Re", 11.06);
            S.Add("女Re", 2.34);
            M.Add("女So", 13.77);
            S.Add("女So", 2.97);
            M.Add("女Sc", 16.19);
            S.Add("女Sc", 4.9);
            M.Add("女To", 10);
            S.Add("女To", 3.12);
            M.Add("女Gi", 10);
            S.Add("女Gi", 3.85);
            M.Add("女Cm", 10);
            S.Add("女Cm", 1.79);
            M.Add("女Ac", 9);
            S.Add("女Ac", 2.35);
            M.Add("女Ai", 6.8);
            S.Add("女Ai", 2.32);
            M.Add("女Ie", 9.76);
            S.Add("女Ie", 2.41);
            M.Add("女Py", 6);
            S.Add("女Py", 2);
            M.Add("女Fx", 5);
            S.Add("女Fx", 2.63);
            M.Add("女Fe", 9.16);
            S.Add("女Fe", 2.41);
            DataSet ds           = SubItem.GetPaperSubItems(paperId, 1);
            int     subitemCount = ds.Tables[0].Rows.Count;
            bool    result;

            if (subitemCount <= 0)
            {
                subitemIds        = null;
                subitemScoreArray = null;
                result            = false;
            }
            else
            {
                resultText = "";
                subitemIds = new int[subitemCount];
                float[] T = new float[subitemCount];
                float[] X = new float[subitemCount];
                for (int i = 0; i < subitemCount; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    subitemIds[i] = (int)dr["Fsubitemid"];
                    X[i]          = 0f;
                    string[] questionIds = dr["Fquestions"].ToString().Split(new char[]
                    {
                        '|'
                    });
                    for (int j = 0; j < questionIds.Length; j++)
                    {
                        int     questionId = int.Parse(questionIds[j]);
                        float[] array;
                        IntPtr  intPtr;
                        (array = X)[(int)(intPtr = (IntPtr)i)] = array[(int)intPtr] + (float)scoreArray[questionId - 1];
                    }
                    string subitemName = dr["Fsubitemname"].ToString();
                    // DataRow drStu = SchoolDB.GetStudent(userName);
                    string key = SchoolDB.GetStudent(userName);
                    key       += subitemName;
                    T[i]       = (float)Math.Round((double)(50f + 10f * (X[i] - float.Parse(M[key].ToString())) / float.Parse(S[key].ToString())), 2);
                    resultText = resultText + subitemName + "的得分是:" + T[i].ToString();
                    if (i != subitemCount - 1)
                    {
                        resultText += "<br/>";
                    }
                }
                subitemScoreArray = T;
                result            = true;
            }
            return(result);
        }