Exemple #1
0
 public static QuestionResponseDto TestAddQuestionResponseDto(QuestionnaireDto _currentQuestionnaire, PageElementChoiceDto pers)
 {
     long responseKey = FormRegistry.ResponseDao.CreateSubmitResponse(Constants.UnknownCustomer, null, _currentQuestionnaire.QuestionnaireId, ViewType.CleanSheetOverlay).First;
     Assert.Greater(responseKey, 0);
     QuestionResponseDto dto = new QuestionResponseDto(responseKey, pers.ChoiceId, "choiceText", null, "ckmfieldid_tirumala");
     Assert.IsTrue(FormRegistry.ResponseDao.Add(dto));
     return dto;
 }
 public void Test1()
 {
     _messageId = Constants.UserCausedDataFormatIncorrectElementNull;
     ChoicesValidator validator = new ChoicesValidator(PageElementType.BandedHeader);
     TestResponseElementProvider element = new TestResponseElementProvider();
     element.TestPageElementType = PageElementType.BandedHeader;
     PageElementChoiceDto choiceElement = new PageElementChoiceDto(1, "choice label", 2, 3, 4, false, null, "lov", PageElementChoiceDto.EmptyKeys);
     QuestionnaireDto questionnaire = new QuestionnaireDto();
     Assert.IsTrue(validator.Validate(element, questionnaire));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                //    return;
            }

            Ux_ElementTitel.Text = _element.ElementText;
            _callBack = null;
            _phone = null;
            foreach (PageElementChoiceDto dto in Choices)
            {
                if (dto.LovKey == "resp_phone")
                {
                    _phone = dto;
                }
                else if (dto.LovKey == "callback_time")
                {
                    _callBack = dto;
                }
            }
            if (_callBack != null)
            {
                Ux_Label_CallBack.Text = _callBack.ElementText;
                foreach (LovInfo info in _callBack.Choices)
                {
                    string key = "";
                    if (info.LovKey.HasValue)
                    {
                        key = info.LovKey.Value.ToString();
                    }
                    Ux_CallBack.Items.Add(new ListItem(info.ColValue, key));
                }
            }
            if (_phone != null)
            {
                Ux_Label_Telephone.Text = _phone.ElementText;
            }
            if (_phone != null && _callBack != null)
            {
                if (_phone != Choices[0])
                {
                    Ux_QuestionHolder.Controls.Remove(Ux_TelephoneHolder);
                    Ux_QuestionHolder.Controls.Add(Ux_TelephoneHolder);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
              //  return;
            }

            Ux_ElementTitel.Text = PageElement.ElementText;
            _email = Choices.Find(delegate(PageElementChoiceDto cur)
            {
                return cur.LovKey == "resp_email";
            });
            _fax = Choices.Find(delegate(PageElementChoiceDto cur)
            {
                return cur.LovKey == "resp_fax";
            });
            if (_email != null || _fax != null)
            {
                if (_email != null && _fax != null)
                {//fill both and sort
                    SetEmail(true);
                    SetFax(true);
                    if (_email.SortSequence > _fax.SortSequence)
                    {
                        Control parent = Ux_QuestionHolderEmail.Parent;
                        parent.Controls.Remove(Ux_QuestionHolderEmail);
                        parent.Controls.Add(Ux_QuestionHolderEmail);
                    }
                }
                else
                {
                    if (_email != null)
                    {//remove fax and fill email
                        SetEmail(false);
                        RemoveFax();
                    }
                    else
                    {//remove email and fill fax
                        SetFax(false);
                        RemoveEmail();
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
               // return;
            }

            Ux_ElementTitel.Text = PageElement.ElementText;
            _yes = Choices.Find(delegate(PageElementChoiceDto cur)
            {
                return cur.LovKey == "will_yes";
            });
            _no = Choices.Find(delegate(PageElementChoiceDto cur)
            {
                return cur.LovKey == "will_no";
            });
            _timeFrame = Choices.Find(delegate(PageElementChoiceDto cur)
            {
                return cur.LovKey == "timeframe_to_buy";
            });
            if (_no != null)
            {//fill both and sort
                Ux_Label_No.Text = _no.ElementText;
            }
            if (_yes != null)
            {
                Ux_Label_Yes.Text = _yes.ElementText;
            }
            if (_timeFrame != null)
            {
                Ux_Label_TimeFrame.Text = _timeFrame.ElementText;
                foreach (LovInfo info in _timeFrame.Choices)
                {
                    string key = "";
                    if (info.LovKey.HasValue)
                    {
                        key = info.LovKey.Value.ToString();
                    }
                    Ux_TimeFrame.Items.Add(new ListItem(info.ColValue, key));
                }
            }
        }
Exemple #6
0
        public static PageElementChoiceDto TestPageElementChoiceCreateList(PageDto _currentPage, out PageElementReqDto pers)
        {
            PageElementType type = PageElementType.RequestedMoreInfo;
            PageElementReqDto dto = new PageElementReqDto("element text", true, type, _currentPage.PageId, 0, Migration.GetMaxLength(type), true);
            pers = FormRegistry.PageElementDao.Create(dto);
            Assert.IsNotNull(pers);
            Assert.AreEqual(dto.GetType(), pers.GetType());
            Assert.Greater(pers.ElementId, 0);
            LovInfo[] lovKeys = new LovInfo[4];
            /*
                        h_params["comment"] = constants.COL_RESP_EMAIL;
						h_params["col_name_1"] = constants.COL_RESP_EMAIL;
						h_params["col_value_1"] = constants.VAL_CHOICE_TEXT;
						h_params["col_name_2"] = constants.COL_SHIP_METHOD;
						h_params["lov_FK_2"] = 0;
						h_params["col_name_3"] = constants.COL_SUBJECT;
						h_params["col_value_3"] = tb_subject;
						h_params["col_name_4"] = constants.COL_SUMMARY;
						h_params["col_value_4"] = tb_summary;
             * */
            lovKeys[0] = new LovInfo(constants.COL_RESP_EMAIL, constants.VAL_CHOICE_TEXT, null);
            lovKeys[1] = new LovInfo(constants.COL_SHIP_METHOD, null, null);
            lovKeys[2] = new LovInfo(constants.COL_SUBJECT, "subject 1", null);
            lovKeys[3] = new LovInfo(constants.COL_SUMMARY, "summary 1", null);
            PageElementChoiceDto choice1 = new PageElementChoiceDto(pers.ElementId, "choice label", pers.PageId, 0, Migration.GetMaxLength(pers.PageElementType), true, "*****@*****.**", constants.COL_RESP_EMAIL, lovKeys);

            PageElementChoiceDto pers1 = FormRegistry.PageElementDao.Create(choice1);
            return pers1;
        }
 private static void ReadResponse(PageElementChoiceDto choice, long responseId, string text, List<ResponseDto> retval)
 {
     LovInfo info = Array.Find<LovInfo>(choice.LovInfos, delegate(LovInfo cur) { return cur.ColName == "willingness_to_buy"; });
     int? lovFk = null;
     if (info != null)
     {
         lovFk = info.LovKey;
     }
     QuestionResponseDto response = new QuestionResponseDto(responseId, choice.ChoiceId, text, lovFk);
     retval.Add(response);
 }