Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     LoadParameters();
     manager = new SurveyManager(surveyGuid);
     surveyPageGuid = manager.GetSurveyFirstSurveyPageGuid(surveyGuid);
     survey = new Survey(surveyGuid);
     PopulateLabels();
 }
Пример #2
0
        private void LoadSettings()
        {
            surveyGuid = WebUtils.ParseGuidFromQueryString("SurveyGuid", Guid.Empty);
            pageId = WebUtils.ParseInt32FromQueryString("pageid", -1);
            moduleId = WebUtils.ParseInt32FromQueryString("mid", true, -1);

            currentModule = GetModule(moduleId, Survey.FeatureGuid);

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

            AddClassToBody("surveypages");
        }
        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");
        }
Пример #4
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");
        }
Пример #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 SurveyFeature.Business.Page(surveyPageGuid);
            questions = Question.GetAll(surveyPageGuid);

            AddClassToBody("surveypage");
        }
Пример #6
0
        private void LoadSettings()
        {
            surveyGuid = WebUtils.ParseGuidFromQueryString("SurveyGuid", Guid.Empty);
            pageId = WebUtils.ParseInt32FromQueryString("pageid", -1);
            moduleId = WebUtils.ParseInt32FromQueryString("mid", -1);
            responseGuid = WebUtils.ParseGuidFromQueryString("ResponseGuid", Guid.Empty);

            if (surveyGuid == Guid.Empty) return;

            if (responseGuid == Guid.Empty)
            {
                SurveyResponse response = SurveyResponse.GetFirst(surveyGuid);

                if (response == null)
                {
                    WebUtils.SetupRedirect(this, SiteRoot + "/Survey/Surveys.aspx?pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString());
                }
                else
                {
                    WebUtils.SetupRedirect(this, SiteRoot + "/Survey/Results.aspx?SurveyGuid=" + surveyGuid.ToString() +
                        "&ResponseGuid=" + response.ResponseGuid.ToString() + "&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString());
                }
            }
            else
            {
                currentResponse = new SurveyResponse(responseGuid);
                previousResponse = SurveyResponse.GetPrevious(responseGuid);
                nextResponse = SurveyResponse.GetNext(responseGuid);
            }

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

                    responseGuid = Guid.Empty;
                    currentResponse = null;
                    previousResponse = null;
                    nextResponse = null;
                }
            }

            AddClassToBody("surveyresults");
        }
Пример #7
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");
        }
Пример #8
0
        private void PopulateControls()
        {
            if (Page.IsPostBack) return;

            if (surveyGuid != Guid.Empty)
            {
                Survey survey = new Survey(surveyGuid);
                txtSurveyName.Text = survey.SurveyName;
                edWelcomeMessage.Text = survey.StartPageText;
                edThankyouMessage.Text = survey.EndPageText;
            }
        }
Пример #9
0
        void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate("survey");

            if (Page.IsValid)
            {
                Survey survey = new Survey(surveyGuid);
                survey.SurveyName = txtSurveyName.Text;
                survey.SiteGuid = siteSettings.SiteGuid;
                survey.StartPageText = edWelcomeMessage.Text;
                survey.EndPageText = edThankyouMessage.Text;
                survey.Save();

                WebUtils.SetupRedirect(this, SiteRoot + "/Survey/Surveys.aspx?pageid="
                    + pageId.ToInvariantString()
                    + "&mid=" + moduleId.ToInvariantString());
            }
        }
Пример #10
0
        void grdSurveys_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Survey survey;

            switch (e.CommandName)
            {
                case "modAdd":
                    survey = new Survey(new Guid(e.CommandArgument.ToString()));
                    survey.AddToModule(ModuleId);
                    surveyGuid = new Guid(e.CommandArgument.ToString());
                    break;
                case "modRemove":
                    survey = new Survey(new Guid(e.CommandArgument.ToString()));
                    survey.RemoveFromModule(ModuleId);
                    surveyGuid = Guid.Empty;
                    break;
                case "delete":
                    Survey.Delete(new Guid(e.CommandArgument.ToString()));
                    break;
                case "export":

                    DataTable dataTable = Survey.GetResultsTable(surveyGuid);

                    string fileName = "csv" + DateTimeHelper.GetDateTimeStringForFileName() + ".csv";

                    ExportHelper.ExportDataTableToCsv(HttpContext.Current, dataTable, fileName);

                    break;
            }

            BindGrid();
        }
Пример #11
0
        ///// <summary>
        ///// Returns the count of pages on the given survey
        ///// </summary>
        ///// <param name="surveyGuid"> pageGuid </param>
        ///// <returns></returns>
        //public static int GetPageCount(Guid surveyGuid)
        //{
        //    return DB.SurveyPagesCount(surveyGuid);
        //}
        /// <summary>
        /// Gets an IList with all instances of Survey.
        /// </summary>
        public static List<Survey> GetAll(Guid siteGuid)
        {
            List<Survey> surveyList
                = new List<Survey>();

            using (IDataReader reader = DBSurvey.GetAll(siteGuid))
            {
                while (reader.Read())
                {
                    Survey survey = new Survey();
                    survey.surveyGuid = new Guid(reader["SurveyGuid"].ToString());
                    survey.siteGuid = new Guid(reader["SiteGuid"].ToString());
                    survey.surveyName = reader["SurveyName"].ToString();
                    survey.creationDate = Convert.ToDateTime(reader["CreationDate"]);
                    survey.startPageText = reader["StartPageText"].ToString();
                    survey.endPageText = reader["EndPageText"].ToString();
                    survey.pageCount = Convert.ToInt32(reader["PageCount"]);
                    survey.responseCount = Convert.ToInt32(reader["ResponseCount"]);
                    surveyList.Add(survey);
                }
            }

            return surveyList;
        }