Пример #1
0
        /// <summary>
        /// Binds Questions belonging to selected Meta Survey
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BindQuestionsGrid(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(SurveyList.Value))
            {
                SurveyQuestionsGrid.Visible = true;
                SaveBtn.Visible             = true;
                PreviewBtn.Visible          = true;

                int    metaSurveyId   = int.Parse(SurveyList.Value);
                string metaSurveyName = SurveyList.SelectedItem.Text;

                // Set Preview URL
                string previewURL = "~/Plugins/SurveyPlugin/SurveyWizardPage.aspx?surveyType=" + metaSurveyName + "&preview=true";
                PreviewBtn.NavigateUrl = previewURL;
                //MetadataSurveyQuestion metaQuestion = new MetadataSurveyQuestion();
                //metaQuestion.GetByParent(metaSurveyId);

                //DataView questionsView = metaQuestion.DataSourceView;
                DataView questionsView = BusinessObject.GetByParentAsDataView <MetadataSurveyQuestion>(metaSurveyId);
                questionsView.Table.Columns.Add(new DataColumn("ColSortOrder", typeof(Int32), "ISNULL(SortNumber," + int.MaxValue + ")"));
                questionsView.Sort             = "ColSortOrder ASC";
                SurveyQuestionsGrid.DataSource = questionsView;
                SurveyQuestionsGrid.DataBind();

                // set survey fields, title version etc...
                MetadataSurvey biz = new MetadataSurvey();
                biz.Get(metaSurveyId);
                CICHelper.SetFieldValues(SurveyFields.Controls, biz);

                SurveyFields.Visible = true;
                PreviewBtn.Visible   = true;
                DeleteBtn.Visible    = true;
            }
            else
            {
                SurveyFields.Visible        = false;
                SurveyQuestionsGrid.Visible = false;
                SaveBtn.Visible             = false;
                PreviewBtn.Visible          = false;
                DeleteBtn.Visible           = false;
            }
        }
Пример #2
0
        /// <summary>
        /// Saves the metadata for Survey and its questions and responses
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveQuestions(object sender, EventArgs e)
        {
            int metaSurveyId = int.Parse(SurveyList.Value);

            // update survey if needed
            if (surveyDirty)
            {
                MetadataSurvey biz = new MetadataSurvey();
                biz.Get(metaSurveyId);
                CICHelper.SetBOValues(SurveyFields.Controls, biz, -1);
                biz.Save();
                // rebuild survey list to reflect updated title,etc...
                BuildSurveyList();
                // select survey
                SurveyList.Value = metaSurveyId.ToString();
            }

            SurveyQuestionsGrid.Save(metaSurveyId);

            // Rebind Grid
            BindQuestionsGrid(sender, e);
        }