Beispiel #1
0
        public Dictionary <string, List <string> > GetQADictionaryByType(Info.theType type)
        {
            Dictionary <string, List <string> > dictionary = new Dictionary <string, List <string> >();

            foreach (string question in GetQuestionsByType(type))
            {
                if (!dictionary.ContainsKey(question))
                {
                    dictionary.Add(question, GetAnswersByQuestion(question, type));
                }
            }
            return(dictionary);
        }
Beispiel #2
0
        public bool MeetsSearchCriteria(string question, string answer, Info.theType type)
        {
            if (Deleted)
            {
                return(false);
            }
            if (answer == "Not filled in yet")
            {
                return(MeetsSearchCriteria(question));
            }
            foreach (Info info in TheInfo)
            {
                if (info.Question.ToLower() == question.ToLower() && info.Type == type)
                {
                    if (type == Info.theType.aBool)
                    {
                        if (answer.ToLower() == "false")
                        {
                            return(info.Answer.ToLower() == "false" || info.Answer.ToLower() == "no");
                        }
                        else
                        {
                            return(info.Answer.ToLower() == "true" || info.Answer.ToLower() == "yes");
                        }
                    }
                    else if (type == Info.theType.aInt)
                    {
                        if (answer.Contains('='))
                        {
                            return(Convert.ToInt32(answer.Split(' ')[0]) == Convert.ToInt32(question));
                        }

                        else if (answer.Contains('>'))
                        {
                            return(Convert.ToInt32(answer.Split(' ')[0]) > Convert.ToInt32(question));
                        }

                        else
                        {
                            return(Convert.ToInt32(answer.Split(' ')[0]) < Convert.ToInt32(question));
                        }
                    }
                    else
                    {
                        return(info.Answer.ToLower() == answer);
                    }
                }
            }
            return(false);
        }
Beispiel #3
0
        public List <string> GetAnswersByQuestion(string question, Info.theType type)
        {
            List <string> i = new List <string>();

            foreach (Juror j in TheJurors)
            {
                if (!j.Deleted)
                {
                    foreach (Info info in j.TheInfo)
                    {
                        if (info.Type == type && info.Question.ToLower() == question && !i.Contains(info.Answer.ToLower()))
                        {
                            i.Add(info.Answer.ToLower());
                        }
                    }
                }
            }
            return(i);
        }
Beispiel #4
0
        private void SearchButtons(string question, string answer, Info.theType type)
        {
            int max = 0;

            foreach (Control c in jurorButtonPanel.Controls)
            {
                Button b = c as Button;

                Juror j = TheCase.TheJurors[Convert.ToInt16(b.Text) - 1];
                if (j.MeetsSearchCriteria(question, answer, type))
                {
                    int i = (int)c.Tag;
                    b.BackColor = colors[i + numberOfSearchs];
                    b.Tag       = i + 1;
                    if (i > max)
                    {
                        max = i;
                    }
                }
            }

            //for (int n = max; n >= 0; n--)
            //    searchButtons[n].Visible = true;
        }