Beispiel #1
0
        private void LoadSettings()
        {
            PageId         = WebUtils.ParseInt32FromQueryString("pageid", -1);
            surveyPageGuid = WebUtils.ParseGuidFromQueryString("SurveyPageGuid", Guid.Empty);
            ModuleId       = WebUtils.ParseInt32FromQueryString("mid", true, -1);

            if (surveyPageGuid == Guid.Empty)
            {
                surveyGuid = WebUtils.ParseGuidFromQueryString("SurveyGuid", Guid.Empty);
            }
            else
            {
                surveyPage = new Business.Page(surveyPageGuid);
                surveyGuid = surveyPage.SurveyGuid;
            }

            if (surveyGuid != Guid.Empty)
            {
                survey = new Survey(surveyGuid);

                if (survey.SiteGuid != siteSettings.SiteGuid)
                {
                    surveyGuid = Guid.Empty;
                    survey     = null;

                    surveyPageGuid = Guid.Empty;
                    surveyPage     = null;
                }
            }

            AddClassToBody("surveypageedit");
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            Page.Validate("survey");

            if (Page.IsValid)
            {
                Question question = new Question(questionGuid);
                SaveQuestion(question);

                if (
                    question.QuestionTypeId != (int)QuestionType.TextBox ||
                    question.QuestionTypeId != (int)QuestionType.Date
                    )
                {
                    DeleteOldQuestionOptions();
                    SaveQuestionOptions(question);
                }

                Business.Page page = new Business.Page(question.SurveyPageGuid);

                WebUtils.SetupRedirect(
                    this,
                    $"{SiteRoot}/Survey/SurveyQuestions.aspx?SurveyGuid={page.SurveyGuid.ToString()}&SurveyPageGuid={page.SurveyPageGuid.ToString()}&pageid={PageId.ToInvariantString()}&mid={ModuleId.ToInvariantString()}"
                    );
            }
        }
        private void LoadSettings()
        {
            surveyGuid     = WebUtils.ParseGuidFromQueryString("SurveyGuid", Guid.Empty);
            surveyPageGuid = WebUtils.ParseGuidFromQueryString("SurveyPageGuid", Guid.Empty);
            PageId         = WebUtils.ParseInt32FromQueryString("pageid", -1);
            ModuleId       = WebUtils.ParseInt32FromQueryString("mid", -1);

            currentModule = GetModule(ModuleId, Survey.FeatureGuid);

            if (surveyGuid != Guid.Empty)
            {
                survey = new Survey(surveyGuid);

                if (survey.SiteGuid != siteSettings.SiteGuid)
                {
                    surveyGuid = Guid.Empty;
                    survey     = null;
                }
                else
                {
                    if (surveyPageGuid != Guid.Empty)
                    {
                        surveyPage = new Business.Page(surveyPageGuid);

                        if (surveyPage.SurveyGuid != survey.SurveyGuid)
                        {
                            surveyPageGuid = Guid.Empty;
                            surveyPage     = null;
                        }
                    }
                }
            }

            AddClassToBody("surveyquestions");
        }
Beispiel #4
0
        private void SavePage(Business.Page page)
        {
            page.PageTitle   = txtPageTitle.Text;
            page.PageEnabled = chkPageEnabled.Checked;

            if (surveyPageGuid == Guid.Empty)
            {
                page.SurveyGuid = surveyGuid;
            }

            page.Save();
        }
Beispiel #5
0
        private void LoadSettings()
        {
            surveyGuid     = WebUtils.ParseGuidFromQueryString("SurveyGuid", Guid.Empty);
            PageId         = WebUtils.ParseInt32FromQueryString("PageId", -1);
            ModuleId       = WebUtils.ParseInt32FromQueryString("mid", true, -1);
            surveyPageGuid = WebUtils.ParseGuidFromQueryString("SurveyPageGuid", Guid.Empty);

            survey    = new Survey(surveyGuid);
            page      = new Business.Page(surveyPageGuid);
            questions = Question.GetAll(surveyPageGuid);

            AddClassToBody("surveypage");
        }
Beispiel #6
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            Page.Validate("survey");

            if (Page.IsValid)
            {
                Business.Page page = new Business.Page(surveyPageGuid);
                SavePage(page);

                WebUtils.SetupRedirect(
                    this,
                    $"{SiteRoot}/Survey/SurveyPages.aspx?SurveyGuid={page.SurveyGuid.ToString()}&pageid={PageId.ToInvariantString()}&mid={ModuleId.ToInvariantString()}"
                    );
            }
        }
Beispiel #7
0
        void BtnCancel_Click(object sender, EventArgs e)
        {
            Guid redirectSurveyGuid = Guid.Empty;

            if (surveyPageGuid == Guid.Empty)
            {
                redirectSurveyGuid = surveyGuid;
            }
            else
            {
                Business.Page page = new Business.Page(surveyPageGuid);
                redirectSurveyGuid = page.SurveyGuid;
            }

            WebUtils.SetupRedirect(
                this,
                $"{SiteRoot}/Survey/SurveyPages.aspx?SurveyGuid={redirectSurveyGuid.ToString()}&pageid={PageId.ToInvariantString()}&mid={ModuleId.ToInvariantString()}"
                );
        }
        private void LoadSettings()
        {
            PageId        = WebUtils.ParseInt32FromQueryString("PageId", PageId);
            questionGuid  = WebUtils.ParseGuidFromQueryString("QuestionGuid", Guid.Empty);
            ModuleId      = WebUtils.ParseInt32FromQueryString("mid", ModuleId);
            currentModule = GetModule(ModuleId, Survey.FeatureGuid);
            question      = new Question(questionGuid);

            if (questionGuid != Guid.Empty)
            {
                surveyPageGuid = question.SurveyPageGuid;
            }
            else
            {
                //we have no question guid so must be a new question
                string questionTypeParam = Request.QueryString["NewQuestionType"];
                questionType = EnumHelper <QuestionType> .Parse(questionTypeParam);

                surveyPageGuid          = WebUtils.ParseGuidFromQueryString("SurveyPageGuid", Guid.Empty);
                question.SurveyPageGuid = surveyPageGuid;
            }

            if (surveyPageGuid != Guid.Empty)
            {
                surveyPage = new Business.Page(surveyPageGuid);
                survey     = new Survey(surveyPage.SurveyGuid);
                surveyGuid = survey.SurveyGuid;

                if (survey.SiteGuid != siteSettings.SiteGuid)
                {
                    surveyGuid = Guid.Empty;
                    survey     = null;

                    surveyPageGuid = Guid.Empty;
                    surveyPage     = null;

                    questionGuid = Guid.Empty;
                    question     = null;
                }
            }

            AddClassToBody("surveyquestionedit");
        }
        void BtnCancel_Click(object sender, EventArgs e)
        {
            Business.Page page;

            if (surveyPageGuid == Guid.Empty)
            {
                Question question = new Question(questionGuid);
                page = new Business.Page(question.SurveyPageGuid);
            }
            else
            {
                page = new Business.Page(surveyPageGuid);
            }


            WebUtils.SetupRedirect(
                this,
                $"{SiteRoot}/Survey/SurveyQuestions.aspx?SurveyPageGuid={page.SurveyPageGuid}&SurveyGuid={page.SurveyGuid.ToString()}&pageid={PageId.ToInvariantString()}&mid={ModuleId.ToInvariantString()}"
                );
        }
Beispiel #10
0
        void GrdSurveyPages_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            List <Business.Page> pages = SurveyFeature.Business.Page.GetAll(SurveyGuid);
            Guid currentPageGuid       = new Guid(e.CommandArgument.ToString());

            Business.Page currentPage = null;

            Business.Page swapPage;

            int currentItemIndex = -1;
            int i = 0;

            foreach (Business.Page p in pages)
            {
                if (p.SurveyPageGuid == currentPageGuid)
                {
                    currentPage      = p;
                    currentItemIndex = i;
                }

                i += 1;
            }

            if (currentPage == null)
            {
                return;
            }

            switch (e.CommandName)
            {
            case "up":

                if (currentItemIndex > 0)
                {
                    swapPage = pages[currentItemIndex - 1];

                    currentPage.PageOrder = currentItemIndex - 1;
                    swapPage.PageOrder    = currentItemIndex;

                    currentPage.Save();
                    swapPage.Save();
                }

                break;

            case "down":
                if (currentItemIndex < pages.Count - 1)
                {
                    swapPage = pages[currentItemIndex + 1];

                    currentPage.PageOrder = currentItemIndex + 1;
                    swapPage.PageOrder    = currentItemIndex;

                    currentPage.Save();
                    swapPage.Save();
                }

                break;

            case "delete":
                Business.Page.Delete(currentPageGuid);

                break;
            }

            WebUtils.SetupRedirect(this, Request.RawUrl);
        }