public string DrawQuestionById(int questionId) { Question q = new Question(db); Question qq = q.Get(questionId); DataTable dt = this.GetAnswersDataTableByQuestionId(questionId); StringBuilder sb = new StringBuilder(); //if (q.QuestionTypeId == 1) //TODO: в зависимости от типа вопрос будет выглядить по разному if (true) { sb.Append(@"<StackPanel xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>"); sb.Append(String.Format(@"<TextBlock xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' Margin='12, 12, 12, 0' TextWrapping='Wrap' Text='{0}'></TextBlock>", qq.QuestionText)); foreach (DataRow dr in dt.Rows) { sb.Append(String.Format(@"<RadioButton GroupName = 'Os' Content = '{0}' IsChecked = 'False' />", dr["answer_text"])); } sb.Append("</StackPanel>"); } else { // } return sb.ToString(); }
public Question GetQuestionById(int questionId) { Question q = new Question(db); return q.Get(questionId); }