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); }
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); }
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); }
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); }
public static void SetFirstActive(Query query) { try { int number = query.Questions[0].Number; QuestionData.SetActive(number, query.Code); } catch (IndexOutOfRangeException ex) { } }
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); }
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); } }
public static Question Load(Query query, int number) { return(QuestionData.Get(query.UserID, query.Number, number)); }
public static void SetNextActive(Question currentQuestion, int number) { QuestionData.SetActive(number, currentQuestion.Code); }
public static void Save(Question question) { QuestionData.Save(question); }