/// <summary> /// 返回答案 /// </summary> /// <returns></returns> public Dictionary <string, string> GetChoiceinformation() { if (ChoiceChar.Equals("")) { return(new Dictionary <string, string>() { { "error", QuestionIndex.ToString() } }); } return(new Dictionary <string, string>() { { ChoiceChar, ChoiceString } }); }
// Question public QuestionIndex BuildQuestionIndexViewModel(string username, string[] userRoles, string title, IEnumerable <Question> questions, List <int> itemsPerPage) { var viewModel = new QuestionIndex { Title = title, SubTitle = GeneralConstants.PortalTitle, PortalTitle = GeneralConstants.PortalTitle, Icon = "Icon", Breadcrumb = _breadcrumbFactory.BuildBreadcrumb(), LeftNav = _leftNavFactory.BuildLeftNav(LeftNavigationItems.Requests, userRoles), TopNav = _topNavFactory.BuildTopNav(GeneralConstants.PortalTitle, username), QuestionTable = questions != null && questions.Any() ? _tableFactory.BuildQuestionsTable(questions, itemsPerPage, string.Concat("Question ", title)) : null, }; return(viewModel); }
private void btnAdd_Click(object sender, EventArgs e) { if (gAnswers.DataSource == null) { DataTable dt = new DataTable(); dt.Columns.Add("MultiChoice_View_Answer_AnswerText", typeof(string)); dt.Columns.Add("MultiChoice_View_Answer_AnswerIndex", typeof(int)); dt.Columns.Add("MultiChoice_View_Answer_AnswerCodes_VariableName", typeof(string)); dt.Columns.Add("MultiChoice_View_Answer_AnswerCodes_UnCheckedCode", typeof(int)); dt.Columns.Add("MultiChoice_View_Answer_AnswerCodes_CheckedCode", typeof(int)); dt.Columns.Add("MultiChoice_View_Answer_AnswerCodes_OtherSpecify", typeof(Boolean)); dt.Columns.Add("MultiChoice_View_Answer_AnswerCodes_OtherSpecify_VariableName", typeof(string)); dt.Columns.Add("MultiChoice_View_Answer_AnswerCodes_OtherSpecify_InType", typeof(string)); gAnswers.DataSource = dt; } gvAnswers.AddNewRow(); int rowHandle = gvAnswers.GetRowHandle(gvAnswers.DataRowCount); if (gvAnswers.IsNewItemRow(rowHandle)) { gvAnswers.SetRowCellValue(rowHandle, "MultiChoice_View_Answer_AnswerText", txtAnswerText.Text.Trim()); gvAnswers.SetRowCellValue(rowHandle, "MultiChoice_View_Answer_AnswerIndex", gvAnswers.DataRowCount + 1); gvAnswers.SetRowCellValue(rowHandle, "MultiChoice_View_Answer_AnswerCodes_VariableName", "A_" + QuestionIndex.ToString() + "_" + (gvAnswers.DataRowCount + 1).ToString()); gvAnswers.SetRowCellValue(rowHandle, "MultiChoice_View_Answer_AnswerCodes_UnCheckedCode", 0); gvAnswers.SetRowCellValue(rowHandle, "MultiChoice_View_Answer_AnswerCodes_CheckedCode", 1); gvAnswers.SetRowCellValue(rowHandle, "MultiChoice_View_Answer_AnswerCodes_OtherSpecify", false); gvAnswers.SetRowCellValue(rowHandle, "MultiChoice_View_Answer_AnswerCodes_OtherSpecify_VariableName", "S_" + QuestionIndex.ToString() + "_" + (gvAnswers.DataRowCount + 1).ToString()); gvAnswers.SetRowCellValue(rowHandle, "MultiChoice_View_Answer_AnswerCodes_OtherSpecify_InType", "Normal TextBox"); txtAnswerText.Text = String.Empty; } gvAnswers.UpdateCurrentRow(); }
void ShowingUp() { TextBox.Hide(); QuestionIndex.Hide(); TypesOfAnswers.Hide(); AnswerTypeLabel.Hide(); AnswersLabel.Hide(); SelectionOfAnswers.Hide(); AnswerTextBoxLabel.Hide(); AnswerTextBox.Hide(); CorrectAnswerChecker.Hide(); ExampleButton1.Hide(); ExampleButton2.Hide(); TextBox.ReadOnly = false; if (ModeSelection.SelectedItem != null && FunctionSelection.SelectedItem != null) { QuestionLabel.Show(); if (mode == 0) { TextBox.Show(); if (function == 1) { TextBox.ReadOnly = true; } else { TypesOfAnswers.Show(); AnswerTypeLabel.Show(); ExampleButton1.Show(); ExampleButton2.Show(); } if (function > 0) { QuestionIndex.Show(); } } else if (mode == 1) { TextBox.Show(); TextBox.ReadOnly = true; AnswersLabel.Show(); SelectionOfAnswers.Show(); QuestionIndex.Show(); if (QuestionIndex.Value >= Questions.Count) { QuestionIndex.Value = 0; } else { TextBox.Text = Questions[(int)QuestionIndex.Value].Text; } if (function == 0 || function == 2) { AnswerTextBoxLabel.Show(); AnswerTextBox.Show(); CorrectAnswerChecker.Show(); } else { TextBox.ReadOnly = false; } } } }