示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.m_Action   = BasePage.RequestStringToLower("Action");
     this.m_SurveyId = BasePage.RequestInt32("SurveyID");
     if (!this.Page.IsPostBack)
     {
         SurveyInfo surveyById = new SurveyInfo();
         surveyById           = SurveyManager.GetSurveyById(this.m_SurveyId);
         this.HdnIsOpen.Value = surveyById.IsOpen.ToString();
         string surveyName = surveyById.SurveyName;
         this.LnkSurveyName.Text        = surveyName;
         this.LnkSurveyName.NavigateUrl = "QuestionManage.aspx?SurveyID=" + this.m_SurveyId;
         if (this.m_SurveyId != 0)
         {
             if (this.m_Action == "modify")
             {
                 int num = BasePage.RequestInt32("QuestionId");
                 this.LblTitle.Text = "修改问卷";
                 if (num != 0)
                 {
                     this.HdnQuestionId.Value = num.ToString();
                     this.ModifyInitialize();
                 }
                 else
                 {
                     AdminPage.WriteErrMsg("<li>问题ID不能为空</li>");
                 }
             }
         }
         else
         {
             AdminPage.WriteErrMsg("<li>问卷ID不能为空</li>");
         }
     }
 }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (this.IsPostBack == false)
            {
                if (string.IsNullOrEmpty(Request.Params["surveyid"]))
                {
                    throw new ArgumentNullException("surveyid");
                }
                this.Surveyid = Int32.Parse(Request.Params["surveyid"]);


                if (Request.Params["textslanguage"] != null)
                {
                    this.TextsLanguage = Int16.Parse(Request.Params["textslanguage"]);
                }

                if (Request.Params["viewId"] != null)
                {
                    this.ViewId = Guid.Parse(Request.Params["viewId"]);
                }
                else
                {
                    this.m_selectedView = SurveyManager.GetDefaultView(this.Surveyid);
                    this.ViewId         = this.SelectedView.ViewId;
                }
            }
        }
示例#3
0
        //问卷
        public ActionResult SurveyExp()
        {
            int total;
            var list = new SurveyManager().GetExampapers(out total, CurrentUser.TenantId, "", -1, -1, -1, 0, 5);

            return(View(list));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.m_SurveyId = BasePage.RequestInt32("SurveyID");
     this.m_RecordId = BasePage.RequestInt32("RecordID");
     if (this.m_SurveyId == 0)
     {
         AdminPage.WriteErrMsg("<li>请指定问卷ID</li>", "SurveyManage.aspx");
     }
     else if (!SurveyManager.SurveyIdOfPassedExists(this.m_SurveyId))
     {
         AdminPage.WriteErrMsg("<li>该问卷未启用,不能查看调查结果!</li>");
     }
     else
     {
         this.Pager.PageSize = 1;
         this.BindData();
         if (this.m_RecordId > 0)
         {
             this.showPage.Visible   = false;
             this.showButton.Visible = true;
         }
         else
         {
             this.showPage.Visible   = true;
             this.showButton.Visible = false;
         }
     }
 }
示例#5
0
        public void GetSurveysHistories_Return_OK()
        {
            // Arrange
            var mockDb = new Mock <IDataBaseManager>();
            SurveysHistoryResponse expectedObj = new SurveysHistoryResponse {
                SurveyId = 213, SurveyName = "Rb", SurveyScore = 20, SurveyMaxScore = 100
            };

            mockDb.Setup(db => db.isExistUserId(It.IsAny <int>())).Returns(true);
            mockDb.Setup(db => db.GetSurveysHistory(It.IsAny <int>())).Returns(new SurveysHistoryResponse[] {
                new SurveysHistoryResponse {
                    SurveyId = 213, SurveyName = "Rb", SurveyScore = 20, SurveyMaxScore = 100
                }
            });

            var mockLogger = new Mock <ILogger>();

            mockLogger.Setup(db => db.Debug(It.IsAny <string>()));
            var manager = new SurveyManager(mockDb.Object, mockLogger.Object);

            // Act
            SurveysHistoryResponse[] result = manager.GetSurveysHistories(1, out Errors statusCode);

            // Assert
            Assert.AreEqual(Errors.OK, statusCode);
            Assert.AreEqual(expectedObj, result[0]);
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.surveyId = DataConverter.CLng(base.Request.QueryString["SurveyID"]);
            SurveyInfo surveyById = SurveyManager.GetSurveyById(this.surveyId);

            this.SmpNavigator.AdditionalNode = "<b>[</b><font color=red>" + DataSecurity.HtmlEncode(surveyById.SurveyName) + "</font><b>]</b>题目列表";
            this.isOpen = surveyById.IsOpen;
            if (this.isOpen == 1)
            {
                this.EgvQuestion.Columns[3].Visible = false;
                this.BtnAddQuestion.Visible         = false;
                this.BtnSetOrderId.Visible          = false;
                this.BtnDel.Visible = false;
                this.EgvQuestion.AutoGenerateCheckBoxColumn = false;
            }
            if (!base.IsPostBack)
            {
                int    questionId = DataConverter.CLng(base.Request.QueryString["QuestionId"]);
                string str        = base.Request.QueryString["Action"];
                if (str == "Delete")
                {
                    SurveyField.Delete(this.surveyId, questionId);
                }
            }
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SecurityHelper.DisableBrowserCache();

            LoadSettings();

            if (!UserHasPermissionToComplete())
            {
                SiteUtils.RedirectToAccessDeniedPage();
            }

            if (survey.SurveyGuid == Guid.Empty || survey.SiteGuid != siteSettings.SiteGuid)
            {
                WebUtils.SetupRedirect(this, $"{SiteRoot}/Default.aspx");

                return;
            }

            PopulateLabels();

            manager = new SurveyManager(surveyGuid);

            previousSurveyPageGuid = manager.GetPreviousSurveyPageGuid(surveyPageGuid);
            nextSurveyPageGuid     = manager.GetNextSurveyPageGuid(surveyPageGuid);

            SetNavigationButtons();
            RenderQuestions();
        }
        protected void DataBind(int surveyId)
        {
            SurveyInfo surveyById = SurveyManager.GetSurveyById(surveyId);

            this.ViewState["surveyInfo"] = surveyById;
            this.SurveyContent.Value     = SurveyCreate.GetSurveyTemplate(surveyById);
            string fileName = surveyById.FileName;

            if (string.IsNullOrEmpty(fileName))
            {
                fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".html";
            }
            string[] strArray = fileName.Split(new char[] { '.' });
            string   str2     = strArray[1];

            this.HdnShortFileName.Value = strArray[0];
            this.HdnFileName.Value      = fileName;
            if (str2 == "html")
            {
                this.RadlPageType.SelectedValue = "0";
            }
            else
            {
                this.RadlPageType.SelectedValue = "1";
            }
            this.TxtFileName.Text  = fileName;
            this.HdnSurveyId.Value = surveyId.ToString();
        }
示例#9
0
        public async Task <int> OnPostReview()
        {
            var gender      = Gender;
            var age         = Age;
            var rating      = Rating;
            var postalCode  = PostalCode;
            var description = Description;

            ReviewerManager reviewerManager = new ReviewerManager();
            Reviewer        reviewer        = new Reviewer(gender, age, postalCode);

            reviewerManager.PostReviewer(reviewer);

            SurveyManager surveyManager = new SurveyManager();
            Survey        survey        = new Survey()
            {
                Id = 1, Rating = rating, Description = description
            };

            surveyManager.PostSurvey(survey);

            LocationManager locationManager = new LocationManager();
            await locationManager.PostLocation(postalCode, 1);

            return(rating);
        }
示例#10
0
    private void OnMouseDown()
    {
        Debug.Log("Clicked");

        if (resetOnNextClick)
        {
            sm.SetQuestion(1);
            Destroy(this.gameObject);
        }
        else
        {
            SetCoffe(false);
            consumedCoffees++;

            if (consumedCoffees == 1)
            {
                GameObject obj = GameObject.Find("Laptop");
                sm = (SurveyManager)obj.GetComponent(typeof(SurveyManager));
                sm.SetQuestion(22);
            }
            if (consumedCoffees == 2)
            {
                sm.SetQuestion(25);
            }
        }
    }
        protected override void OnLoad(EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                //δίνουμε τις γλώσσες:
                this.surveyLanguageCreate.Items.Clear();
                this.surveyLanguageCreate.Items.Add(new ListItem(BuiltinLanguages.Invariant.EnglishName, BuiltinLanguages.Invariant.LanguageId.ToString()));
                this.surveyLanguageCreate.Items.Add(new ListItem(BuiltinLanguages.Greek.EnglishName, BuiltinLanguages.Greek.LanguageId.ToString()));
                this.surveyLanguageCreate.Items.Add(new ListItem(BuiltinLanguages.English.EnglishName, BuiltinLanguages.English.LanguageId.ToString()));
                this.surveyLanguageCreate.Items.Add(new ListItem(BuiltinLanguages.French.EnglishName, BuiltinLanguages.French.LanguageId.ToString()));
                this.surveyLanguageCreate.Items.Add(new ListItem(BuiltinLanguages.German.EnglishName, BuiltinLanguages.German.LanguageId.ToString()));


                //this.surveyLanguageCopy.Items.Clear();
                //this.surveyLanguageCopy.Items.Add(new ListItem(BuiltinLanguages.Invariant.EnglishName, BuiltinLanguages.Invariant.LanguageId.ToString()));
                //this.surveyLanguageCopy.Items.Add(new ListItem(BuiltinLanguages.Greek.EnglishName, BuiltinLanguages.Greek.LanguageId.ToString()));
                //this.surveyLanguageCopy.Items.Add(new ListItem(BuiltinLanguages.English.EnglishName, BuiltinLanguages.English.LanguageId.ToString()));
                //this.surveyLanguageCopy.Items.Add(new ListItem(BuiltinLanguages.French.EnglishName, BuiltinLanguages.French.LanguageId.ToString()));
                //this.surveyLanguageCopy.Items.Add(new ListItem(BuiltinLanguages.German.EnglishName, BuiltinLanguages.German.LanguageId.ToString()));

                //Γεμίζουμε και το surveyList
                var surveys = SurveyManager.GetSurveys();
                this.surveyList.Items.Clear();
                this.surveyList.Items.Add(new ListItem("Choose a survey to copy from...", "0"));
                foreach (var item in surveys)
                {
                    this.surveyList.Items.Add(new ListItem(item.Title, item.SurveyId.ToString()));
                }
            }
        }
示例#12
0
 public RespondentController(SurveyManager surveyManager, CoordinatorManager coordinatorManager, RespondentManager respondentManager, ResponseManager responseManager)
 {
     this._surveyManager      = surveyManager;
     this._coordinatorManager = coordinatorManager;
     this._respondentManager  = respondentManager;
     this._responseManager    = responseManager;
 }
示例#13
0
        void FillPageSelector()
        {
            var pages = SurveyManager.GetSurveyPages(this.SelectedSurvey);

            //Διαβάζουμε τις σελίδες
            this.pagesSelector.Items.Clear();
            foreach (var page in pages)
            {
                if (m_selectedSurveyPage == null)
                {
                    m_selectedSurveyPage = page;
                    this.SurveyPageId    = page.PageId;
                }

                var newItem = new ListItem();
                newItem.Text  = "Page " + page.DisplayOrder.ToString() + ". " + this.Server.HtmlEncode(page.ShowTitle);
                newItem.Value = page.PageId.ToString();
                if (page.HasSkipLogic)
                {
                    newItem.Attributes.Add("data-image", "/content/images/branch-page-icon.png");
                }

                if (this.SurveyPageId == page.PageId)
                {
                    newItem.Selected = true;
                }

                this.pagesSelector.Items.Add(newItem);
            }
        }
示例#14
0
 protected void EgvSurvey_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         SurveyInfo dataItem = e.Row.DataItem as SurveyInfo;
         e.Row.Cells[2].Text = dataItem.CreateDate.ToString("yyyy-MM-dd");
         DateTime endTime = dataItem.EndTime;
         DateTime now     = DateTime.Now;
         if (endTime >= now)
         {
             TableCell cell1 = e.Row.Cells[2];
             cell1.Text = cell1.Text + "/" + dataItem.EndTime.ToString("yyyy-MM-dd");
         }
         else
         {
             TableCell cell2 = e.Row.Cells[2];
             cell2.Text = cell2.Text + "/<span style='Color:#F00'>" + string.Format("{0:yyyy-MM-dd}", dataItem.EndTime) + "</span>";
         }
         e.Row.Cells[3].Text = SurveyManager.GetStateName(dataItem.IsOpen);
         if (dataItem.IsOpen == 1)
         {
             e.Row.Cells[0].Enabled = false;
         }
     }
 }
示例#15
0
        protected void saveAndContinue_Click(object sender, EventArgs e)
        {
            try
            {
                this.SelectedMessage.Sender  = this.txtReplyEmail.Text;
                this.SelectedMessage.Subject = this.txtSubject.Text;
                this.SelectedMessage.Body    = this.txtBody.Text;

                this.SelectedMessage.IsContentOK = true;
                var updatedMessage = SurveyManager.UpdateMessage(this.SelectedMessage);

                if (updatedMessage.IsSenderOK == false)
                {
                    this.ErrorMessage = "The message was saved, but there is an error below.";
                }
                else
                {
                    Response.Redirect(string.Format("~/clay/mysurveys/collectors/message_preview.aspx?surveyId={0}&collectorId={1}&messageId={2}&textslanguage={3}", this.Surveyid, this.CollectorId, updatedMessage.MessageId, this.TextsLanguage), false);
                    this.Context.ApplicationInstance.CompleteRequest();
                }
            }
            catch (ThreadAbortException)
            {
                //
            }
            catch (Exception ex)
            {
                this.ErrorMessage = ex.Message;
            }
        }
示例#16
0
 private void ShowSurveyInfo(int surveyId)
 {
     if (surveyId != 0)
     {
         SurveyInfo surveyById = SurveyManager.GetSurveyById(surveyId);
         this.ViewState["Info"] = surveyById;
         if (surveyById != null)
         {
             this.TxtSurveyName.Text  = surveyById.SurveyName;
             this.TxtDescription.Text = surveyById.Description;
             this.TxtIPRepeat.Text    = surveyById.IPRepeat.ToString();
             if (surveyById.NeedLogin == 1)
             {
                 this.RadNeedLogin1.Checked = true;
                 this.RadNeedLogin0.Checked = false;
                 this.TxtPresentPoint.Text  = surveyById.PresentPoint.ToString();
             }
             this.TxtSetPassword.Attributes.Add("value", surveyById.SetPassword);
             this.RadlLockIPType.SelectedValue = surveyById.LockIPType.ToString();
             string[] field = surveyById.SetIPLock.Split(new string[] { "|||" }, StringSplitOptions.None);
             this.IPLockWrite.Value = DataSecurity.GetArrayValue(0, field);
             this.IPLockBlack.Value = DataSecurity.GetArrayValue(1, field);
             this.DateEnd.Text      = surveyById.EndTime.ToString("yyyy-MM-dd");
             this.FscTemplate.Text  = surveyById.Template;
             this.TxtLockUrl.Text   = surveyById.LockUrl;
         }
         else
         {
             AdminPage.WriteErrMsg("找不到该问卷!", "SurveyManage.aspx");
         }
     }
 }
示例#17
0
 private void UpdateSurvey()
 {
     if (this.ViewState["Info"] != null)
     {
         SurveyInfo surveyInfo = this.ViewState["Info"] as SurveyInfo;
         surveyInfo.SurveyName   = this.TxtSurveyName.Text;
         surveyInfo.Description  = this.TxtDescription.Text;
         surveyInfo.NeedLogin    = this.RadNeedLogin0.Checked ? 0 : 1;
         surveyInfo.SetPassword  = this.TxtSetPassword.Text;
         surveyInfo.IPRepeat     = DataConverter.CLng(this.TxtIPRepeat.Text, 1);
         surveyInfo.PresentPoint = DataConverter.CLng(this.TxtPresentPoint.Text);
         surveyInfo.LockIPType   = DataConverter.CLng(this.RadlLockIPType.SelectedValue);
         surveyInfo.EndTime      = DateTime.Parse(this.DateEnd.Date.ToString());
         surveyInfo.Template     = this.FscTemplate.Text;
         surveyInfo.LockUrl      = this.TxtLockUrl.Text.Trim();
         if (this.DateEnd.Date < DateTime.Now)
         {
             AdminPage.WriteErrMsg("<li>问卷结束时间早于创建时间!</li>");
         }
         else
         {
             surveyInfo.EndTime = DateTime.Parse(this.DateEnd.Date.ToString());
         }
         surveyInfo.SetIPLock = this.IPLockWrite.Value + "|||" + this.IPLockBlack.Value;
         surveyInfo.LockUrl   = this.TxtLockUrl.Text;
         if (SurveyManager.Update(surveyInfo))
         {
             AdminPage.WriteSuccessMsg("修改问卷成功!", "SurveyManage.aspx");
         }
         else
         {
             AdminPage.WriteErrMsg("<li>修改问卷失败!");
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.surveyId = BasePage.RequestInt32("SurveyID");
     if (!base.IsPostBack)
     {
         if (this.surveyId == 0)
         {
             AdminPage.WriteErrMsg("<li>请指定问卷ID</li>", "SurveyManage.aspx");
         }
         else if (!SurveyManager.SurveyIdOfPassedExists(this.surveyId))
         {
             AdminPage.WriteErrMsg("<li>该问卷未启用,不能查看报表!</li>");
         }
         else
         {
             SurveyInfo surveyById = SurveyManager.GetSurveyById(this.surveyId);
             if (!surveyById.IsNull)
             {
                 this.LblSurveyName.Text   = surveyById.SurveyName;
                 this.LblDescription.Text  = surveyById.Description;
                 this.LblTitle.Text        = "[" + surveyById.SurveyName + "]问卷报表";
                 this.LblSurveyNumber.Text = SurveyRecord.GetTotalOfSurveyRecord(this.surveyId).ToString();
                 this.LblDate.Text         = surveyById.CreateDate.ToString() + "/" + surveyById.EndTime.ToString();
             }
             else
             {
                 AdminPage.WriteErrMsg("<li>未找到对应的问卷信息</li>");
             }
         }
         this.BtnReport.Attributes.Add("onclick", "javascript:window.print();return false;");
     }
 }
示例#19
0
        public override void RenderQuestion(VLSurvey survey, VLSurveyPage page, VLSurveyQuestion question)
        {
            Collection <VLQuestionOption> options = SurveyManager.GetQuestionOptions(question);
            Collection <VLQuestionColumn> columns = SurveyManager.GetQuestionColumns(question);

            Writer.AddAttribute(HtmlTextWriterAttribute.Class, "matrixmanyperrow");
            Writer.RenderBeginTag(HtmlTextWriterTag.Table);

            //<thead>
            Writer.RenderBeginTag(HtmlTextWriterTag.Thead);
            Writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            Writer.RenderBeginTag(HtmlTextWriterTag.Td);
            Writer.RenderEndTag();
            foreach (VLQuestionColumn column in columns)
            {
                Writer.AddAttribute(HtmlTextWriterAttribute.Class, "ColumnText");
                Writer.RenderBeginTag(HtmlTextWriterTag.Td);
                HttpUtility.HtmlEncode(column.ColumnText, Writer);
                Writer.RenderEndTag();
            }
            Writer.RenderEndTag();
            Writer.RenderEndTag();


            //<tbody>
            foreach (VLQuestionOption option in options)
            {
                Writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                Writer.AddAttribute(HtmlTextWriterAttribute.Class, "OptionText");
                Writer.RenderBeginTag(HtmlTextWriterTag.Td);
                HttpUtility.HtmlEncode(option.OptionText, Writer);
                Writer.RenderEndTag();

                {
                    foreach (var column in columns)
                    {
                        Writer.RenderBeginTag(HtmlTextWriterTag.Td);

                        Writer.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox");
                        Writer.AddAttribute(HtmlTextWriterAttribute.Value, "1");
                        Writer.AddAttribute(HtmlTextWriterAttribute.Name, option.HtmlOptionId + column.HtmlPartialColumnId);//ID
                        if (this.RuntimeSession != null && this.RuntimeSession[option.HtmlOptionId + column.HtmlPartialColumnId] != null)
                        {
                            Writer.AddAttribute(HtmlTextWriterAttribute.Checked, "Checked");
                        }
                        Writer.RenderBeginTag(HtmlTextWriterTag.Input);
                        Writer.RenderEndTag();


                        Writer.RenderEndTag();
                    }
                }

                Writer.RenderEndTag();
            }

            Writer.RenderEndTag();
        }
示例#20
0
 public QuestionViewModel(Guid courseId, Guid questionId)
 {
     CourseId           = courseId;
     Question           = SurveyManager.GetQuestionById(questionId);
     CountOfResponses   = SurveyManager.GetResponseCountByCourseAndQuestion(courseId, questionId);
     SumOfResponses     = SurveyManager.GetResponseSumByCourseAndQuestion(courseId, questionId);
     AverageOfResponses = SurveyManager.GetAverageRatingByCourseAndQuestion(courseId, questionId);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     LoadParameters();
     manager        = new SurveyManager(surveyGuid);
     surveyPageGuid = manager.GetSurveyFirstSurveyPageGuid(surveyGuid);
     survey         = new Survey(surveyGuid);
     PopulateLabels();
 }
        public void Constructor_with_valid_arguments_instantiates_service()
        {
            _context.PrepareServiceConfiguration();
            var service = new SurveyManager(_context.DbContext.FakedObject, _context.Rng.FakedObject, _context.Mapper);

            service.Should().NotBeNull();
            service.Should().BeOfType <SurveyManager>();
        }
        protected override void OnPreLoad(EventArgs e)
        {
            base.OnPreLoad(e);


            m_TotalDraftMessages    = SurveyManager.GetDraftMessagesCount(this.CollectorId);
            m_TotalNonDraftMessages = SurveyManager.GetNonDraftMessagesCount(this.CollectorId);
        }
示例#24
0
        //调查结果
        public ActionResult SurveyResult()
        {
            int total;
            var list = new SurveyManager().GetSurveyResultList(out total, "", CurrentUser.TenantId, -1, null, null, 5);

            ViewBag.total = total;
            return(View(list));
        }
示例#25
0
        public SurveyViewModel(Course course)
        {
            CourseId = course.Id;

            User user;
            var  getUserRetVal = UserManager.GetUserByEmailAddress(HttpContext.Current.User.Identity.Name,
                                                                   out user);

            Survey = new Dictionary <Question, ResponseOptionViewModel[]>();
            var questions = SurveyManager.GetSurveyQuestions();

            if (getUserRetVal.Success)
            {
                // if user exists, attempt to get enrollment instance for that user
                var enrollment = CourseManager.GetEnrollmentByCourseIdAndStudentEmail(CourseId, user.Email);
                EnrollmentId = enrollment.Id;

                foreach (var question in questions)
                {
                    var response = SurveyManager.GetResponseByCourseQuestionAndUser(CourseId,
                                                                                    question.Id, user.Id);

                    var responseOptions          = SurveyManager.GetResponseOptionsByQuestionId(question.Id);
                    var responseOptionViewModels = new List <ResponseOptionViewModel>();
                    foreach (var responseOption in responseOptions)
                    {
                        if (response != null && response.ResponseOptionId == responseOption.Id)
                        {
                            responseOptionViewModels.Add(new ResponseOptionViewModel(responseOption, true));
                        }
                        else
                        {
                            responseOptionViewModels.Add(new ResponseOptionViewModel(responseOption, false));
                        }
                    }
                    Survey.Add(question, responseOptionViewModels.ToArray());
                }
            }
            else
            {
                // is user doesn't exist, don't bother attempting to get enrollment instance
                EnrollmentId = Guid.Empty;

                foreach (var question in questions)
                {
                    var responseOptions          = SurveyManager.GetResponseOptionsByQuestionId(question.Id);
                    var responseOptionViewModels = new List <ResponseOptionViewModel>();
                    foreach (var responseOption in responseOptions)
                    {
                        responseOptionViewModels.Add(new ResponseOptionViewModel(responseOption));
                    }
                    Survey.Add(question, responseOptionViewModels.ToArray());
                }
            }

            CountOfQuestions        = questions.Count;
            SelectedResponseOptions = new Models.SelectedOption[CountOfQuestions];
        }
示例#26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                this.Request  = context.Request;
                this.Response = context.Response;
                this.Context  = context;

                this.SurveyManager = ((ValisHttpApplication)context.ApplicationInstance).SurveyManager;
                this.SystemManager = ((ValisHttpApplication)context.ApplicationInstance).SystemManager;


                this.RequestType    = (RuntimeRequestType)Context.Items["RequestType"];
                this.Language       = (VLLanguage)context.Items["language"];
                this.Survey         = (VLSurvey)context.Items["survey"];
                this.Collector      = (VLCollector)context.Items["collector"];
                this.Recipient      = (VLRecipient)context.Items["recipient"];
                this.RuntimeSession = (VLRuntimeSession)context.Items["runtimeSession"];
                this.SurveyTheme    = SurveyManager.GetSurveyThemeById(this.Survey.Theme);


                #region Debug Info
                {
                    if (this.RuntimeSession != null)
                    {
                        foreach (var key in this.RuntimeSession.Keys)
                        {
                            var message = string.Format("BEFORE: RuntimeSession[{0}] = {1}", key, this.RuntimeSession[key]);
                            System.Diagnostics.Debug.WriteLine(message);
                        }
                    }
                }
                #endregion


                ProcessRequestImplementation();


                #region Debug Info
                {
                    if (this.RuntimeSession != null)
                    {
                        foreach (var key in this.RuntimeSession.Keys)
                        {
                            var message = string.Format("AFTER: RuntimeSession[{0}] = {1}", key, this.RuntimeSession[key]);
                            System.Diagnostics.Debug.WriteLine(message);
                        }
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                Logger.Error(context.Request.RawUrl, ex);
                ShowCannotExecutePage(9999, ex.Message);
            }
        }
        protected void btnAddSrvy_Click(object sender, EventArgs e)
        {
            try
            {
                string surveyCreate = this.Request.Params["SrvyCreate"];
                if (string.Equals(surveyCreate, "rdbtnScratch"))
                {
                    /*
                     * Το survey που θα δημιουργηθεί ανήκει στον τρέχοντα χρήστη που είναι logged-in
                     */
                    if (Globals.UserToken.PrincipalType == PrincipalType.SystemUser)
                    {
                        throw new NotSupportedException("Α systemUser cannot create surveys!");
                    }
                    var clientUser = SystemManager.GetClientUserById(Globals.UserToken.Principal);
                    if (clientUser == null)
                    {
                        throw new VLException(string.Format("Cannot find a clientUser with UserId={0}!", Globals.UserToken.Principal));
                    }

                    var newSurvey = new VLSurvey();
                    newSurvey.Client = clientUser.Client;
                    newSurvey.Title  = this.surveyTitleCreate.Text;
                    newSurvey        = SurveyManager.CreateSurvey(newSurvey, Int16.Parse(this.surveyLanguageCreate.SelectedValue));

                    Response.Redirect(string.Format("~/clay/mysurveys/Design_Survey.aspx?surveyid={0}&language={1}", newSurvey.SurveyId, newSurvey.TextsLanguage), false);
                    this.Context.ApplicationInstance.CompleteRequest();
                }
                else
                {
                    /*
                     * Το survey που θα δημιουργηθεί ανήκει στον τρέχοντα χρήστη που είναι logged-in
                     */
                    if (Globals.UserToken.PrincipalType == PrincipalType.SystemUser)
                    {
                        throw new NotSupportedException("Α systemUser cannot create surveys!");
                    }

                    Int32  sourceSurveyId = Int32.Parse(this.surveyList.SelectedValue);
                    string newTitle       = this.surveyTitleCopy.Text;
                    Int16  languageId     = Int16.Parse(this.Request.Params[this.surveyLanguageCopy.UniqueID]);

                    var newSurvey = SurveyManager.CopySurvey(sourceSurveyId, newTitle, languageId);
                    Response.Redirect(string.Format("~/clay/mysurveys/Design_Survey.aspx?surveyid={0}&language={1}", newSurvey.SurveyId, newSurvey.TextsLanguage), false);
                    this.Context.ApplicationInstance.CompleteRequest();
                }
            }
            catch (ThreadAbortException)
            {
                //
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                this.ErrorMessage = ex.Message;
            }
        }
示例#28
0
        void updateExistingMessage()
        {
            try
            {
                if (this.rdbtnNewAndUnsent.Checked)
                {
                    this.SelectedMessage.DeliveryMethod = Valis.Core.DeliveryMethod.NewAndUnsent;
                }
                else if (this.rdbtnNotResponded.Checked)
                {
                    this.SelectedMessage.DeliveryMethod = Valis.Core.DeliveryMethod.NotResponded;
                }
                else if (this.rdbtnAllResponded.Checked)
                {
                    this.SelectedMessage.DeliveryMethod = Valis.Core.DeliveryMethod.AllResponded;
                }
                else if (this.rdbtnAll.Checked)
                {
                    this.SelectedMessage.DeliveryMethod = Valis.Core.DeliveryMethod.All;;
                }
                else if (this.rdbtnCustom.Checked)
                {
                    if (string.IsNullOrWhiteSpace(this.txtKeyword.Text))
                    {
                        throw new VLException("Custom Criteria are invalid!");
                    }
                    if (string.IsNullOrWhiteSpace(ddlSearchField.SelectedValue))
                    {
                        throw new VLException("Custom Criteria are invalid!");
                    }
                    if (string.IsNullOrWhiteSpace(ddlCriteria.SelectedValue))
                    {
                        throw new VLException("Custom Criteria are invalid!");
                    }

                    this.SelectedMessage.DeliveryMethod    = Valis.Core.DeliveryMethod.Custom;
                    this.SelectedMessage.CustomSearchField = (RecipientSearchField)Enum.Parse(typeof(RecipientSearchField), this.ddlSearchField.SelectedValue);
                    this.SelectedMessage.CustomOperator    = (ComparisonOperator)Enum.Parse(typeof(ComparisonOperator), this.ddlCriteria.SelectedValue);
                    this.SelectedMessage.CustomKeyword     = txtKeyword.Text;
                }

                this.SelectedMessage.IsDeliveryMethodOK = true;
                var updatedMessage = SurveyManager.UpdateMessage(this.SelectedMessage);

                Response.Redirect(string.Format("~/clay/mysurveys/collectors/message_preview.aspx?surveyId={0}&collectorId={1}&messageId={2}&textslanguage={3}", this.Surveyid, this.CollectorId, updatedMessage.MessageId, this.TextsLanguage), false);
                this.Context.ApplicationInstance.CompleteRequest();
            }
            catch (ThreadAbortException)
            {
                //
            }
            catch (Exception ex)
            {
                this.ErrorMessage = ex.Message;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.surveyId   = BasePage.RequestInt32("SurveyID");
     this.questionId = BasePage.RequestInt32("QuestionID");
     if ((this.surveyId != 0) && (this.questionId != 0))
     {
         this.fieldInfo     = SurveyField.GetFieldInfoById(this.surveyId, this.questionId);
         this.LblTitle.Text = "当前问卷:" + SurveyManager.GetSurveyById(this.surveyId).SurveyName + " / 当前问题:" + this.fieldInfo.QuestionContent;
         this.BindData();
     }
 }
示例#30
0
        public ResultsViewModel(Guid courseId)
        {
            Course             = CourseManager.GetCourseById(courseId);
            QuestionViewModels = new List <QuestionViewModel>();
            var questions = SurveyManager.GetSurveyQuestions();

            foreach (var question in questions)
            {
                QuestionViewModels.Add(new QuestionViewModel(courseId, question.Id));
            }
        }
示例#31
0
 void Awake()
 {
     _surveyManager = this;
     surveyPlaneObjects = new List<Transform>();
     CameraNavigator.RegisterFocusChangeEvent(ProcessPlaneObjects);
     ActionManager.RegisterOnWorkTypeChangeEvent(OnWorkTypeChanged);
 }