Esempio n. 1
0
        public void ConvertStudQuizDataDef()
        {
            StudQuizDataDefDict.Clear();

            _QuizDef = _UDTTransfer.GetAllQuizData();

            Dictionary <int, string> qNameDict = new Dictionary <int, string>();

            foreach (UDT_QuizDef qd in _QuizDef)
            {
                int id = int.Parse(qd.UID);
                qNameDict.Add(id, qd.QuizName);
            }

            _StudQuizDataDefList = _UDTTransfer.GetStudQuizDataByStudentIDList(_StudentIDList);
            foreach (StudentInfo si in _StudentInfoList)
            {
                if (!StudQuizDataDefDict.ContainsKey(si.StudentID))
                {
                    StudQuizDataDefDict.Add(si.StudentID, new Dictionary <string, UDT_StudQuizDataDef>());
                }

                int id = int.Parse(si.StudentID);
                foreach (UDT_StudQuizDataDef data in _StudQuizDataDefList.Where(x => x.StudentID == id))
                {
                    string qName = "";
                    if (qNameDict.ContainsKey(data.QuizID))
                    {
                        qName = qNameDict[data.QuizID];
                    }

                    if (qName != "")
                    {
                        if (!StudQuizDataDefDict[si.StudentID].ContainsKey(qName))
                        {
                            StudQuizDataDefDict[si.StudentID].Add(qName, data);
                        }
                    }
                }
            }
        }