Esempio n. 1
0
        public static void DeleteAnswer(Question question, int number)
        {
            Answer answer = AnswerData.Get(question.UserID, question.QueryNumber, question.Number, number);

            AnswerData.Delete(answer);
            question.Answers = QuestionData.GetAnswers(question.UserID, question.QueryNumber, question.Number);
        }
Esempio n. 2
0
        public static void DeleteQuestion(Query query, int number)
        {
            Question question = QuestionData.Get(query.UserID, query.Number, number);

            QuestionData.Delete(question);
            query.Questions = QueryData.GetQuestions(query.UserID, query.Number);
        }
Esempio n. 3
0
        public static void AddQuestion(Query query, string name = "", int order = 0)
        {
            string usedName = name == "" ? "New Question" : name;

            QuestionData.Add(query.UserID, query.Number, usedName, order);
            query.Questions = QueryData.GetQuestions(query.UserID, query.Number);
        }
Esempio n. 4
0
 public static void AddAnswer(Question question, int order = 0, string name = "")
 {
     AnswerData.Add(question.UserID,
                    question.QueryNumber,
                    question.Number,
                    (order == 0) ? question.Answers.Count + 1 : order,
                    (name == "") ? "New Answer" : name);
     question.Answers = QuestionData.GetAnswers(question.UserID, question.QueryNumber, question.Number);
 }
Esempio n. 5
0
 public static void SetFirstActive(Query query)
 {
     try
     {
         int number = query.Questions[0].Number;
         QuestionData.SetActive(number, query.Code);
     }
     catch (IndexOutOfRangeException ex)
     { }
 }
Esempio n. 6
0
        public static Question GetActive(int currentQuestionNumber, string code, bool hasAnswered)
        {
            Question activeQuestion = QuestionData.GetActive(code);

            if (activeQuestion != null && activeQuestion.Number == currentQuestionNumber)
            {
                activeQuestion.IsAnswered = hasAnswered;
            }

            return(activeQuestion);
        }
Esempio n. 7
0
        public Question(DataRow dr)
        {
            bool IsFullLoad = (dr.Table.Columns.Contains("userID"));

            if (dr["number"] != null)
            {
                Number = int.Parse(dr["number"].ToString());
            }
            if (dr["name"] != null)
            {
                Name = dr["name"].ToString();
            }
            if (dr["ordinality"] != null)
            {
                Order = int.Parse(dr["ordinality"].ToString());
            }

            IsAnswered = false;

            if (IsFullLoad)
            {
                if (dr["userID"] != null)
                {
                    UserID = int.Parse(dr["UserID"].ToString());
                }
                if (dr["queryNumber"] != null)
                {
                    QueryNumber = int.Parse(dr["queryNumber"].ToString());
                }
                if (dr["activeCode"] != null)
                {
                    Code = dr["activeCode"].ToString();
                }

                Answers = QuestionData.GetAnswers(UserID, QueryNumber, Number);
            }
        }
Esempio n. 8
0
 public static Question Load(Query query, int number)
 {
     return(QuestionData.Get(query.UserID, query.Number, number));
 }
Esempio n. 9
0
 public static void SetNextActive(Question currentQuestion, int number)
 {
     QuestionData.SetActive(number, currentQuestion.Code);
 }
Esempio n. 10
0
 public static void Save(Question question)
 {
     QuestionData.Save(question);
 }