コード例 #1
0
        public override DataSet Clone()
        {
            QuestionSectionOptionData data = (QuestionSectionOptionData)base.Clone();

            data.InitVars();
            return(data);
        }
        private void UpdateQuestionButton_Click(object sender, System.EventArgs e)
        {
            if (QuestionFreeTextBox.Text.Length == 0)
            {
                MessageLabel.Visible = true;
                ((PageBase)Page).ShowErrorMessage(MessageLabel, ((PageBase)Page).GetPageResource("MissingQuestionMessage"));
            }
            else
            {
                // Removes any single paragraph description
                if (QuestionFreeTextBox.Text.StartsWith("<p>") &&
                    QuestionFreeTextBox.Text.EndsWith("</p>") &&
                    QuestionFreeTextBox.Text.IndexOf("<p>", 3) < 0)
                {
                    QuestionFreeTextBox.Text = QuestionFreeTextBox.Text.Substring(3, QuestionFreeTextBox.Text.Length - 7);
                }

                // creates a BE and update the question
                QuestionData question = new QuestionData();
                QuestionData.QuestionsRow updatedQuestion =
                    question.Questions.NewQuestionsRow();

                // Set the updated fields
                updatedQuestion.QuestionId = _parentQuestionId;
                updatedQuestion.SurveyId = getSurveyId();
                updatedQuestion.QuestionText = QuestionFreeTextBox.Text.Length > 3900 ?
                  Server.HtmlDecode(QuestionFreeTextBox.Text.Substring(0, 3900)) : Server.HtmlDecode(QuestionFreeTextBox.Text);
                updatedQuestion.MinSelectionRequired = int.Parse(MinSelectionDropDownList.SelectedValue);
                updatedQuestion.MaxSelectionAllowed = int.Parse(MaxAllowedDropDownList.SelectedValue);
                updatedQuestion.RatingEnabled = RatingCheckbox.Checked;
                updatedQuestion.RandomizeAnswers = false;
                updatedQuestion.QuestionIdText = txtQuestionID.Text;
                updatedQuestion.ShowHelpText = chbShowHelpText.Checked;
                updatedQuestion.Alias = txtAlias.Text;
                updatedQuestion.HelpText = txtHelpText.Text;
                updatedQuestion.QuestionIdText = txtQuestionID.Text;
                updatedQuestion.SetQuestionGroupIDNull();
                if (ddlGroup.SelectedIndex != 0)
                    updatedQuestion.QuestionGroupID = int.Parse(ddlGroup.SelectedValue);
                if (ddlSubGroup.SelectedIndex != 0)
                    updatedQuestion.QuestionGroupID = int.Parse(ddlSubGroup.SelectedValue);
                if (MultipleChoiceCheckbox.Checked)
                {
                    updatedQuestion.SelectionModeId = (int)QuestionSelectionMode.MultiMatrix;
                }
                else
                {
                    updatedQuestion.SelectionModeId = (int)QuestionSelectionMode.Matrix;
                }

                question.Questions.AddQuestionsRow(updatedQuestion);

                new Question().UpdateQuestion(question, LanguagesDropdownlist.SelectedValue);

                // Matrix can be repeated
                if (RepeatSectionCheckbox.Checked)
                {
                    // creates a BE and update the options
                    QuestionSectionOptionData sectionOptions = new QuestionSectionOptionData();
                    QuestionSectionOptionData.QuestionSectionOptionsRow updatedSectionOption =
                        sectionOptions.QuestionSectionOptions.NewQuestionSectionOptionsRow();

                    // Set the updated fields
                    updatedSectionOption.QuestionId = _parentQuestionId;
                    updatedSectionOption.RepeatableSectionModeId = (int)RepeatableSectionMode.FullAnswers;
                    updatedSectionOption.DeleteSectionLinkText = DeleteSectionLinkTextBox.Text;
                    updatedSectionOption.AddSectionLinkText = AddSectionLinkTextBox.Text;
                    sectionOptions.QuestionSectionOptions.AddQuestionSectionOptionsRow(updatedSectionOption);
                    new Question().UpdateQuestionSectionOptions(sectionOptions, LanguagesDropdownlist.SelectedValue);
                }
                else
                {
                    new Question().DeleteQuestionSectionOptions(_parentQuestionId);
                    DeleteSectionLinkTextBox.Text = string.Empty;
                    AddSectionLinkTextBox.Text = string.Empty;
                }

                MessageLabel.Visible = true;
                ((PageBase)Page).ShowNormalMessage(MessageLabel, ((PageBase)Page).GetPageResource("OptionsUpdatedMessage"));


                BindQuestionOptions();
                BindAnswerOptions();
            }

        }
コード例 #3
0
 /// <summary>
 /// updates a section options, creates it if it doesnt exists
 /// </summary>
 public void UpdateQuestionSectionOptions(QuestionSectionOptionData sectionOptions, string languageCode)
 {
     QuestionFactory.Create().UpdateQuestionSectionOptions(sectionOptions, languageCode);
 }
コード例 #4
0
        /// <summary>
        /// Return the options available for the question's section
        /// </summary>
        public QuestionSectionOptionData GetQuestionSectionOptions(int questionId, string languageCode)
        {
            //SqlParameter[] commandParameters = new SqlParameter[] 
            //{ new SqlParameter("@QuestionId", questionId), 
            //    new SqlParameter("@LanguageCode", languageCode) 
            //};

            ArrayList commandParameters = new ArrayList();
            {
                commandParameters.Add(new SqlParameter("@QuestionId", questionId).SqlValue);
                commandParameters.Add(new SqlParameter("@LanguageCode", languageCode).SqlValue);
            } 
            
            QuestionSectionOptionData dataSet = new QuestionSectionOptionData();
            DbConnection.db.LoadDataSet("vts_spQuestionSectionOptionGetDetails", dataSet, new string[] { "QuestionSectionOptions" }, commandParameters.ToArray());
            return dataSet;
        }
コード例 #5
0
 /// <summary>
 /// updates a section options, creates it if it doesnt exists
 /// </summary>
 public void UpdateQuestionSectionOptions(QuestionSectionOptionData sectionOptions, string languageCode)
 {
     SqlConnection sqlConnection = new SqlConnection(DbConnection.NewDbConnectionString);
     SqlCommand insertCommand = this.GetInsertQuestionSectionCommand(sqlConnection, null, languageCode);
     DbConnection.db.UpdateDataSet(sectionOptions, "QuestionSectionOptions", insertCommand, new SqlCommand(), insertCommand, UpdateBehavior.Transactional);
 }
 public QuestionSectionOptionsRowChangeEvent(QuestionSectionOptionData.QuestionSectionOptionsRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
 public void RemoveQuestionSectionOptionsRow(QuestionSectionOptionData.QuestionSectionOptionsRow row)
 {
     base.Rows.Remove(row);
 }
 public void AddQuestionSectionOptionsRow(QuestionSectionOptionData.QuestionSectionOptionsRow row)
 {
     base.Rows.Add(row);
 }
        private void UpdateSectionsButton_Click(object sender, System.EventArgs e)
        {
            if (int.Parse(RepeatModeDropdownlist.SelectedValue) == (int)RepeatableSectionMode.None)
            {
                // Deletes section options
                new Question().DeleteQuestionSectionOptions(_questionId);
                DeleteSectionLinkTextBox.Text = string.Empty;
                AddSectionLinkTextBox.Text = string.Empty;
                UpdateSectionLinkTextBox.Text = string.Empty;
                EditSectionLinkTextBox.Text = string.Empty;
                AnswersListBox.Items.Clear();
                GridAnswersListBox.Items.Clear();
            }
            else
            {
                // creates a BE and update the options
                QuestionSectionOptionData sectionOptions = new QuestionSectionOptionData();
                QuestionSectionOptionData.QuestionSectionOptionsRow updatedSectionOption =
                    sectionOptions.QuestionSectionOptions.NewQuestionSectionOptionsRow();

                // Set the updated fields
                updatedSectionOption.QuestionId = _questionId;
                updatedSectionOption.RepeatableSectionModeId = int.Parse(RepeatModeDropdownlist.SelectedValue);
                updatedSectionOption.DeleteSectionLinkText = DeleteSectionLinkTextBox.Text;
                updatedSectionOption.AddSectionLinkText = AddSectionLinkTextBox.Text;
                updatedSectionOption.UpdateSectionLinkText = UpdateSectionLinkTextBox.Text;
                updatedSectionOption.EditSectionLinkText = EditSectionLinkTextBox.Text;
                updatedSectionOption.MaxSections = int.Parse(MaxSectionAllowedDropdownlist.SelectedValue);
                sectionOptions.QuestionSectionOptions.AddQuestionSectionOptionsRow(updatedSectionOption);
                new Question().UpdateQuestionSectionOptions(sectionOptions, LanguagesDropdownlist.SelectedValue);
            }

            MessageLabel.Visible = true;
            ((PageBase)Page).ShowNormalMessage(MessageLabel, ((PageBase)Page).GetPageResource("SectionOptionsUpdatedMessage"));

            BindQuestionSectionOptions();
        }