Ejemplo n.º 1
0
        private void CopyExistingQuestionButton_Click(object sender, System.EventArgs e)
        {
            if (_libraryId == -1)
            {
                int questionId;
                if (SourceDropDownList.SelectedValue == "0")
                {
                    questionId = int.Parse(LibraryQuestionsDropDownList.SelectedValue);
                }
                else
                {
                    questionId = int.Parse(SurveyQuestionListDropdownlist.SelectedValue);
                }


                new Question().CopyQuestionById(questionId,
                                                SurveyId, _displayOrder, _pageNumber);

                UINavigator.NavigateToSurveyBuilder(SurveyId, MenuIndex);
            }
            else
            {
                new Question().CopyQuestionToLibrary(int.Parse(SurveyQuestionListDropdownlist.SelectedValue), _libraryId);
                UINavigator.NavigateToLibraryTemplates(getSurveyId(), _libraryId, MenuIndex);
            }
        }
Ejemplo n.º 2
0
        private void ImportXMLButton_Click(object sender, System.EventArgs e)
        {
            if (ImportFile.PostedFile != null)
            {
                NSurveyQuestion importedQuestions = new NSurveyQuestion();
                try
                {
                    importedQuestions.ReadXml(System.Xml.XmlReader.Create(ImportFile.PostedFile.InputStream, (new System.Xml.XmlReaderSettings()
                    {
                        XmlResolver = null
                    })));


                    SetImportedQuestionsDefaults(importedQuestions);
                    new Question().ImportQuestions(importedQuestions, NSurveyUser.Identity.UserId);
                    if (_libraryId == -1)
                    {
                        UINavigator.NavigateToSurveyBuilder(SurveyId, MenuIndex);
                    }
                    else
                    {
                        UINavigator.NavigateToLibraryTemplates(getSurveyId(), _libraryId, MenuIndex);
                    }
                }
                catch (Exception ex)
                {
                    ((PageBase)Page).ShowErrorMessage(MessageLabel, ex.Message);
                    MessageLabel.Visible = true;
                }
            }
        }
Ejemplo n.º 3
0
        private void AddQuestion()
        {
            if (QuestionDropDownList.SelectedValue == "single")
            {
                // Adds the new single question


                QuestionData newQuestion =
                    new Question().AddDefaultSingleQuestion(SurveyId, _displayOrder, _pageNumber,
                                                            Server.HtmlDecode(QuestionFreeTextBox.Text), txtQuestionID.Text);

                UINavigator.NavigateToSingleQuestionEdit(getSurveyId(), newQuestion.Questions[0].QuestionId, _libraryId, MenuIndex);
            }
            else if (QuestionDropDownList.SelectedValue == "matrix")
            {
                // Adds the new parent matrix question H:\SurveyProject\SurveyWAP\Images\
                QuestionData newQuestion =
                    new Question().AddDefaultMatrixQuestion(SurveyId, _displayOrder, _pageNumber,
                                                            Server.HtmlDecode(QuestionFreeTextBox.Text), txtQuestionID.Text);

                UINavigator.NavigateToMatrixQuestionEdit(SurveyId, newQuestion.Questions[0].QuestionId, _libraryId, MenuIndex);
            }
            else
            {
                new Question().AddStaticInformationText(SurveyId, _displayOrder, _pageNumber, QuestionFreeTextBox.Text, txtQuestionID.Text);
                UINavigator.NavigateToSurveyBuilder(SurveyId, MenuIndex);
            }
        }