示例#1
0
 public CauHoi(string ma, ChuDe cd, string ndung, string dapan, string daydu)
 {
     maCauHoi   = ma;
     chuDe      = cd;
     noiDung    = ndung;
     dapAn      = dapan;
     dapAnDayDu = daydu;
 }
示例#2
0
        public override CauHoi GetQuestion(ChuDe cd)
        {
            List <CauHoi> l = data.GetQuestion(cd);

            Random rdm = new Random();
            bool   isSame;
            int    ques;
            int    count = 0;

            for (int i = 0; i < cauHoi.Count; i++)
            {
                for (int j = 0; j < l.Count; j++)
                {
                    if (cauHoi[i].Topic.IDTopic == l[j].Topic.IDTopic && cauHoi[i].IDQuestion == l[j].IDQuestion)
                    {
                        count++;
                    }
                }
            }
            do
            {
                isSame = false;
                ques   = rdm.Next(l.Count);
                int i;
                for (i = 0; i < cauHoi.Count; i++)
                {
                    if (cauHoi[i].IDQuestion == l[ques].IDQuestion)
                    {
                        isSame = true;
                    }
                }
                if (i == cauHoi.Count && isSame == true && count == l.Count)
                {
                    return(new CauHoi("", cd, "", "", ""));
                }
            } while (isSame);

            cauHoi.Add(l[ques]);
            return(l[ques]);
        }
示例#3
0
 public override CauHoi GetQuestion(ChuDe cd)
 {
     throw new NotImplementedException();
 }
示例#4
0
 public abstract CauHoi GetQuestion(ChuDe cd);