示例#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);
        }
示例#2
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);
 }
示例#3
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);
            }
        }