Exemplo n.º 1
0
        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 SurveyFeature.Business.Page(surveyPageGuid);
                        if (surveyPage.SurveyGuid != survey.SurveyGuid)
                        {
                            surveyPageGuid = Guid.Empty;
                            surveyPage     = null;
                        }
                    }
                }
            }

            AddClassToBody("surveyquestions");
        }
        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);

            if (CurrentPage.ContainsModule(moduleId))
            {
                currentModule = new Cynthia.Business.Module(moduleId);
            }

            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 SurveyFeature.Business.Page(surveyPageGuid);
                        if (surveyPage.SurveyGuid != survey.SurveyGuid)
                        {
                            surveyPageGuid = Guid.Empty;
                            surveyPage     = null;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
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 SurveyFeature.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");
        }
        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 SurveyFeature.Business.Page(surveyPageGuid);
            questions = Question.GetAll(surveyPageGuid);
        }
Exemplo n.º 5
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            Page.Validate("survey");
            if (Page.IsValid)
            {
                SurveyFeature.Business.Page page = new SurveyFeature.Business.Page(surveyPageGuid);
                SavePage(page);

                WebUtils.SetupRedirect(this, SiteRoot + "/Survey/SurveyPages.aspx?SurveyGuid="
                    + page.SurveyGuid.ToString() + "&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString());
            }
        }
Exemplo n.º 6
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            Page.Validate("survey");
            if (Page.IsValid)
            {
                SurveyFeature.Business.Page page = new SurveyFeature.Business.Page(surveyPageGuid);
                SavePage(page);

                WebUtils.SetupRedirect(this, SiteRoot + "/Survey/SurveyPages.aspx?SurveyGuid="
                                       + page.SurveyGuid.ToString() + "&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString());
            }
        }
Exemplo n.º 7
0
        private void SavePage(SurveyFeature.Business.Page page)
        {
            page.PageTitle   = txtPageTitle.Text;
            page.PageEnabled = chkPageEnabled.Checked;

            if (surveyPageGuid == Guid.Empty)
            {
                //new question so we need to know the page it will live on
                page.SurveyGuid = surveyGuid;
            }

            page.Save();
        }
Exemplo n.º 8
0
        private void LoadSettings()
        {
            pageId       = WebUtils.ParseInt32FromQueryString("PageId", -1);
            questionGuid = WebUtils.ParseGuidFromQueryString("QuestionGuid", Guid.Empty);
            moduleId     = WebUtils.ParseInt32FromQueryString("mid", -1);

            if (CurrentPage.ContainsModule(moduleId))
            {
                currentModule = new Cynthia.Business.Module(moduleId);
            }

            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 SurveyFeature.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;
                }
            }
        }
Exemplo n.º 9
0
        void BtnCancel_Click(object sender, EventArgs e)
        {
            Guid redirectSurveyGuid = Guid.Empty;

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

            WebUtils.SetupRedirect(this, SiteRoot + "/Survey/SurveyPages.aspx?SurveyGuid="
                                   + redirectSurveyGuid.ToString() + "&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString());
        }
Exemplo n.º 10
0
        void BtnCancel_Click(object sender, EventArgs e)
        {
            SurveyFeature.Business.Page page;

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


            WebUtils.SetupRedirect(this, SiteRoot + "/Survey/SurveyQuestions.aspx?SurveyPageGuid=" + page.SurveyPageGuid
                                   + "&SurveyGuid=" + page.SurveyGuid.ToString() + "&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString());
        }
Exemplo n.º 11
0
        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 SurveyFeature.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");
        }
Exemplo n.º 12
0
        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);
                }

                SurveyFeature.Business.Page page = new SurveyFeature.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());
            }
        }
Exemplo n.º 13
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                Question question = new Question(questionGuid);
                SaveQuestion(question);

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

                SurveyFeature.Business.Page page = new SurveyFeature.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());
            }
        }
Exemplo n.º 14
0
        ///// <summary>
        ///// Returns the count of questions on the given page
        ///// </summary>
        ///// <param name="pageGuid"> pageGuid </param>
        ///// <returns></returns>
        //public static int QuestionCount(Guid pageGuid)
        //{
        //    return DB.PageQuestionsCount(pageGuid);
        //}
        /// <summary>
        /// Gets an IList with all instances of Page.
        /// </summary>
        public static List<Page> GetAll(Guid surveyGuid)
        {
            List<Page> pageList
                = new List<Page>();

            using (IDataReader reader = DBSurveyPage.GetAll(surveyGuid))
            {
                while (reader.Read())
                {
                    Page page = new Page();
                    page.pageGuid = new Guid(reader["PageGuid"].ToString());
                    page.surveyGuid = new Guid(reader["SurveyGuid"].ToString());
                    page.pageTitle = reader["PageTitle"].ToString();
                    page.pageOrder = Convert.ToInt32(reader["PageOrder"], CultureInfo.CurrentCulture);
                    page.pageEnabled = Convert.ToBoolean(reader["PageEnabled"], CultureInfo.CurrentCulture);
                    page.questionCount = Convert.ToInt32(reader["QuestionCount"]);
                    pageList.Add(page);
                }
            }

            return pageList;
        }
Exemplo n.º 15
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 SurveyFeature.Business.Page(surveyPageGuid);
            questions = Question.GetAll(surveyPageGuid);

            AddClassToBody("surveypage");
        }
Exemplo n.º 16
0
        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 SurveyFeature.Business.Page(surveyPageGuid);
                        if (surveyPage.SurveyGuid != survey.SurveyGuid)
                        {
                            surveyPageGuid = Guid.Empty;
                            surveyPage = null;

                        }
                    }
                }
            }

            AddClassToBody("surveyquestions");
        }
Exemplo n.º 17
0
        void BtnCancel_Click(object sender, EventArgs e)
        {
            SurveyFeature.Business.Page page;

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

            WebUtils.SetupRedirect(this, SiteRoot + "/Survey/SurveyQuestions.aspx?SurveyPageGuid=" + page.SurveyPageGuid
                + "&SurveyGuid=" + page.SurveyGuid.ToString() + "&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString());
        }
Exemplo n.º 18
0
        void grdSurveyPages_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            List <SurveyFeature.Business.Page> pages = SurveyFeature.Business.Page.GetAll(surveyGuid);
            Guid currentPageGuid = new Guid(e.CommandArgument.ToString());

            SurveyFeature.Business.Page currentPage = null;

            SurveyFeature.Business.Page swapPage;

            int currentItemIndex = -1;
            int i = 0;

            foreach (SurveyFeature.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":
                //ImageButton button = (ImageButton)e.CommandSource;
                SurveyFeature.Business.Page.Delete(currentPageGuid);
                break;
            }

            WebUtils.SetupRedirect(this, Request.RawUrl);
            //BindGrid();
        }
Exemplo n.º 19
0
        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 SurveyFeature.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");
        }
Exemplo n.º 20
0
        void BtnCancel_Click(object sender, EventArgs e)
        {
            Guid redirectSurveyGuid = Guid.Empty;

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

            WebUtils.SetupRedirect(this, SiteRoot + "/Survey/SurveyPages.aspx?SurveyGuid="
                + redirectSurveyGuid.ToString() + "&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString());
        }
Exemplo n.º 21
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 SurveyFeature.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");
        }