Ejemplo n.º 1
0
        public static string GetAnswerFromQuestion(AGPDefine.QuestionType QType, string Answer)
        {
            string result = string.Empty;

            switch (QType)
            {
            case AGPDefine.QuestionType.MultiSelect:
            {
                var answers = from x in JsonConvert.DeserializeObject <IEnumerable <string> >(Answer)
                              select(char)((char)x.First() + 16);
                answers = answers.Take(26);                                 // A-Z,最多支持26答案
                foreach (var o in answers)
                {
                    result += o.ToString();
                }
            }
            break;

            case AGPDefine.QuestionType.SingleSelect:
            {
                result = string.IsNullOrEmpty(Answer) ? string.Empty : ((char)(Answer.First() + 16)).ToString();
            }
            break;

            case AGPDefine.QuestionType.Check:
            {
                result = string.IsNullOrEmpty(Answer) ? string.Empty :
                         string.Compare(Answer, "true", true) == 0 ? CheckTrue : CheckFalse;
            }
            break;
            }
            return(result);
        }
Ejemplo n.º 2
0
 public void SetModelInfo(int uniqueId, DateTime updateTime, string catalog, string answer, int id, decimal points, int difficulty, AGPDefine.QuestionType qtype, string title)
 {
     UniqueId     = uniqueId;
     UpdateTime   = updateTime;
     Catalog      = catalog;
     Answer       = answer;
     Id           = id;
     Difficulty   = difficulty;
     Points       = points;
     Title        = title;
     QuestionType = qtype;
 }
Ejemplo n.º 3
0
 public void SetModelInfo(int uniqueId, DateTime updateTime, string catalog, string answer, int id, decimal points, int difficulty, AGPDefine.QuestionType qtype, string title)
 {
     UniqueId = uniqueId;
     UpdateTime = updateTime;
     Catalog = catalog;
     Answer = answer;
     Id = id;
     Difficulty = difficulty;
     Points = points;
     Title = title;
     QuestionType = qtype;
 }