Exemplo n.º 1
0
 public static SpecificCrmResponseDto TestAddSpecificCrmResponseDto(PageDto _currentPage)
 {
     long responseKey = FormRegistry.ResponseDao.CreateSubmitResponse(Constants.UnknownCustomer, null, _currentPage.QuestionnaireId, ViewType.CleanSheetOverlay).First;
     Assert.Greater(responseKey, 0);
     SpecificCrmResponseDto dto = new SpecificCrmResponseDto(responseKey, false, true, SpecificCrmResponseDto.ElementTypeRequestOptInOut, _currentPage.PageId, null, _currentPage.QuestionnaireId, "respdesc");
     Assert.IsTrue(FormRegistry.ResponseDao.Add(dto));
     return dto;
 }
Exemplo n.º 2
0
 public void Setup()
 {
     CreateNewQuestionnaire();
     CreateNewFormPage();
     long responseKey = FormRegistry.ResponseDao.CreateSubmitResponse(Constants.UnknownCustomer, null, _currentQuestionnaire.QuestionnaireId, ViewType.CleanSheetOverlay).First;            
     PersonalResponseDto dto = new PersonalResponseDto(responseKey, "address1", "address2", "address3", "bus", "businessSiebel63", "company name", "UK", "county", Constants.UnknownCustomer, "email", "firstname", "flex1", "flex10", "flex11", "flex12", "flex13", "flex14", "flex15", "flex2", "flex3", "flex4", "flex5", "flex6", "flex7", "flex8", "flex9", "job", "jobsiebel", "jobtitle", "lastname", "persontit", "postcode", "pwd", "telephone", "telephone2", "telephone3", "telephone4", "fax", "fax2", "fax3", "fax4", "mobile", "mobile2", "town", "wor", "world6", "United Kingdom", null, "prefLang", "companyWebsite", "companyRevenue");
     FormRegistry.ResponseDao.Add(dto);
     SpecificCrmResponseDto dto2 = new SpecificCrmResponseDto(responseKey, false, true, SpecificCrmResponseDto.ElementTypeRequestOptInOut, _currentPage.PageId, null, _currentPage.QuestionnaireId, "respdesc");
     FormRegistry.ResponseDao.Add(dto2);
     dto3 = new PrivacyResponseDto(responseKey, true, true, true, EmailPreferences.Html, true);
     FormRegistry.ResponseDao.Add(dto3);
     PrivacyDataSectionDto dto4 = new PrivacyDataSectionDto("privacy header", true, _currentPage.PageId, true,
         "privacy text", "email", "email pref", "email pref html", "email pref text", "post", "phone",
         "general opt out", "yeys", "no", "crm offer code", true);
     PrivacyDataSectionDto pers = FormRegistry.PrivacyDao.Create(dto4);
     PageElementType type = PageElementType.RequestedMoreInfo;
     PageElementReqDto dto5 = new PageElementReqDto("element text", true, type, _currentPage.PageId, 0, Migration.GetMaxLength(type), true);
     PageElementReqDto pers2 = FormRegistry.PageElementDao.Create(dto5);
 }
        public override List<ResponseDto> GetResponseDto(long responseId)
        {
            RfgExternalPage page = Page as RfgExternalPage;
            if (page == null)
            {
                throw new BugException(GetType().Name + " is only supported within RFG pages");
            }
            List<ResponseDto> retval = new List<ResponseDto>();

            if (_phone != null)
            {
                if (!String.IsNullOrEmpty(Ux_Telephone.Text))
                {
                    QuestionResponseDto phone = new QuestionResponseDto(responseId, _phone.ChoiceId, Ux_Telephone.Text, null);
                    retval.Add(phone);
                }
            }

            if (_callBack != null)
            {
                if (Ux_CallBack.SelectedIndex > 0)
                {
                    int lovFk = 0;
                    if (Int32.TryParse(Ux_CallBack.SelectedItem.Value, out lovFk))
                    {
                        QuestionResponseDto callback = new QuestionResponseDto(responseId, _callBack.ChoiceId, null, lovFk);
                        retval.Add(callback);
                    }
                }
            }

            if (retval.Count > 0)
            {
                bool cidSubmit = false;
                bool crmSubmit = page.PageAssembly.Questionnaire.SendToCrm;
                string elementType = SpecificCrmResponseDto.ElementTypeRequestCallback;
                int pageId = page.PageAssembly.Page.PageId;
                int? questionId = PageElement.ElementId;
                int questionnaireId = page.PageAssembly.Questionnaire.QuestionnaireId;
                //string respDesc = "Response to RFG web form - " + Page.Request.Url;
                string respDesc = "Response to RFG web form - qid " + questionnaireId;
                SpecificCrmResponseDto response = new SpecificCrmResponseDto(responseId, cidSubmit, crmSubmit, elementType, pageId, questionId, questionnaireId, respDesc);
                retval.Add(response);
            }
            return retval;
        }
Exemplo n.º 4
0
 private void Write(DbCommand sp, SpecificCrmResponseDto dto)
 {
     _dbLayer.AddInParameter(sp, "@response_id", DbType.Int64, dto.ResponseKey);
     _dbLayer.AddInParameter(sp, "@questionnaire_id", DbType.Int32, dto.QuestionnaireId);
     _dbLayer.AddInParameter(sp, "@page_id", DbType.Int32, dto.PageId);
     _dbLayer.AddInParameter(sp, "@question_id", DbType.Int32, dto.QuestionId);
     _dbLayer.AddInParameter(sp, "@element_type_FK", DbType.String, dto.ElementType);
     if (dto.CrmSubmit)
         _dbLayer.AddInParameter(sp, "@crm_submit", DbType.Int16, 1);
     else
         _dbLayer.AddInParameter(sp, "@crm_submit", DbType.Int16, 0);
     if (dto.CidSubmit)
         _dbLayer.AddInParameter(sp, "@cid_submit", DbType.Int16, 1);
     else
         _dbLayer.AddInParameter(sp, "@cid_submit", DbType.Int16, 0);
     _dbLayer.AddInParameter(sp, "@resp_desc", DbType.String, dto.RespDesc);
 }
Exemplo n.º 5
0
        public bool Add(SpecificCrmResponseDto dto)
        {
            bool retval = false;
            DbCommand sp = null;
            DbConnection connection = null;
            IDataReader reader = null;
            try
            {
                connection = _dbLayer.GetConnection();
                sp = connection.CreateCommand();

                sp.CommandText = "insert_response_crm_record";
                sp.CommandType = CommandType.StoredProcedure;
                Write(sp, dto);
                sp.ExecuteNonQuery();
                retval = true;
            }
            catch (DbException e)
            {
                Trace.WriteLine("ResponseDao.Add(" + dto + "): " + e.Message);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }

                if (sp != null)
                {
                    sp.Dispose();
                }

                if (connection != null)
                {
                    _dbLayer.ReturnConnection(connection);
                }
                else
                {
                    _dbLayer.ReturnConnection(connection, true);
                }
            }

            return retval;
        }
        public override List<ResponseDto> GetResponseDto(long responseId)
        {
            IResponseProvider provider = Page as IResponseProvider;
            string customerId = provider.CustomerId;
            RfgExternalPage page = Page as RfgExternalPage;
            if (page == null)
            {
                throw new BugException(GetType().Name + " is only supported within RFG pages");
            }
            List<ResponseDto> retval = new List<ResponseDto>();            

            #region Data about brochures user would like to receive

            foreach (Triple<int, string, string> brochure in _radioTextIds)
            {
                int choiceId = brochure.First;
                string choiceText = null;
                int? lovId = null;
                CheckBox b = FindControl(brochure.Second) as CheckBox;
                if (b != null && b.Checked)
                {
                    if (!String.IsNullOrEmpty(brochure.Third))
                    {
                        TextBox tb = FindControl(brochure.Third) as TextBox;
                        if (tb != null)
                        {
                            choiceText = tb.Text;
                        }
                    }
                    if (Choices != null)
                    {
                        retval.Add(new QuestionResponseDto(responseId, choiceId, choiceText, lovId));
                    }                    
                }
            }

            #endregion  

            #region Data to shipping address

            CheckBox useProfileDataAsShippingAddress = FindControl("Uxd_Lit_CheckBox_" + this.ID) as CheckBox;
            if (!useProfileDataAsShippingAddress.Checked)
            {
                _hasData = false;
                ShippingAddressResponseDto shippingAddressDto = null;                

                #region init variables and flex fields                
                string address1 = null;
                string address2 = null;
                string address3 = null;
                string countryCode = null;
                string county = null;
                string emailAddress = null;
                string postcode = null;
                string town = null;
                #endregion

                #region select
                PersonalDataSectionElements[] selects = SelectControls;
                foreach (PersonalDataSectionElements currentElement in selects)
                {
                    string selectedValue = FindValueForSelect(currentElement);
                    switch (currentElement)
                    {
                        case PersonalDataSectionElements.CountryRegion:
                            if(!String.IsNullOrEmpty(selectedValue))
                                countryCode = selectedValue.Replace("Lit_", String.Empty);

                            if (countryCode == null)
                                countryCode = _questionnaire.CountryCode;

                            break;
                        case PersonalDataSectionElements.County:
                            if (boolCountyDDLExists == true)
                                county = selectedValue;
                            break;
                        default:
                            throw new BugException("personal data section element \"" + currentElement + "\" is not a select");
                    }
                }
                #endregion

                #region texts
                selects = TextControls;
                foreach (PersonalDataSectionElements currentElement in selects)
                {
                    string selectedValue = FindValueForText(currentElement);
                    switch (currentElement)
                    {
                        case PersonalDataSectionElements.Town:
                            town = selectedValue;
                            break;
                        case PersonalDataSectionElements.County:
                            if (boolCountyExists == true)
                                county = selectedValue.Replace("Lit_", String.Empty);
                            break;
                        case PersonalDataSectionElements.PostalCode:
                            postcode = selectedValue;
                            break;
                        case PersonalDataSectionElements.Email:
                            emailAddress = selectedValue;
                            break;

                        case PersonalDataSectionElements.Address:
                            address1 = selectedValue;
                            break;
                        case PersonalDataSectionElements.Address2:
                            address2 = selectedValue;
                            break;
                        case PersonalDataSectionElements.Address3:
                            address3 = selectedValue;
                            break;
                        default:
                            throw new BugException("personal data text element \"" + currentElement + "\" is not a text");
                    }
                }

                #endregion

                if (_hasData)
                {
                    shippingAddressDto = new ShippingAddressResponseDto();                    
                    shippingAddressDto.ResponseKey = responseId;                    
                    shippingAddressDto.CustomerId = customerId;
                    shippingAddressDto.UseProfileFlag = false;
                    shippingAddressDto.Address1 = address1;
                    shippingAddressDto.Address2 = address2;
                    shippingAddressDto.Address3 = address3;
                    shippingAddressDto.CountryCode = countryCode;
                    shippingAddressDto.County = county;
                    shippingAddressDto.EmailAddress = emailAddress;
                    shippingAddressDto.Postcode = postcode;
                    shippingAddressDto.Town = town;
                    retval.Add(shippingAddressDto);
                }
                else // otherwise add empty personal response
                {
                    shippingAddressDto = new ShippingAddressResponseDto();
                    shippingAddressDto.UseProfileFlag = false;
                    shippingAddressDto.ResponseKey = responseId;
                    shippingAddressDto.CustomerId = customerId;
                    retval.Add(shippingAddressDto);
                }
            }
            else // otherwise use personal responses
            {
                ShippingAddressResponseDto shippingAddressDto = new ShippingAddressResponseDto();
                shippingAddressDto.ResponseKey = responseId;
                shippingAddressDto.CustomerId = customerId;
                if (personalDataSectionDto != null)
                {
                    shippingAddressDto.Address1 = personalDataSectionDto.Address;
                    shippingAddressDto.Address2 = personalDataSectionDto.Address2;
                    shippingAddressDto.Address3 = personalDataSectionDto.Address3;
                    shippingAddressDto.CountryCode = personalDataSectionDto.CountryCode;
                    shippingAddressDto.County = personalDataSectionDto.County;
                    shippingAddressDto.EmailAddress = personalDataSectionDto.Email;
                    shippingAddressDto.Postcode = personalDataSectionDto.PostalCode;
                    shippingAddressDto.Town = personalDataSectionDto.Town;
                }
                shippingAddressDto.UseProfileFlag = true;
                retval.Add(shippingAddressDto);
            }

            #endregion 


            if (retval.Count > 0)
            {
                bool cidSubmit = false;
                bool crmSubmit = page.PageAssembly.Questionnaire.SendToCrm;
                string elementType = SpecificCrmResponseDto.ElementTypeRequestLiterature;
                int pageId = page.PageAssembly.Page.PageId;
                int? questionId = PageElement.ElementId;
                int questionnaireId = page.PageAssembly.Questionnaire.QuestionnaireId;
                string respDesc = "Response to RFG web form - qid " + questionnaireId;
                SpecificCrmResponseDto response = new SpecificCrmResponseDto(responseId, cidSubmit, crmSubmit, elementType, pageId, questionId, questionnaireId, respDesc);
                retval.Add(response);
            }
            return retval;
        }
        public override List<ResponseDto> GetResponseDto(long responseId)
        {
            RfgExternalPage page = Page as RfgExternalPage;
            if (page == null)
            {
                throw new BugException(GetType().Name + " is only supported within RFG pages");
            }
            List<ResponseDto> retval = new List<ResponseDto>();

            if (Ux_Yes.Checked)
            {
                //ReadResponse(_yes, responseId, null, retval);
                retval.Add(new QuestionResponseDto(responseId, _yes.ChoiceId, null, null));
            }
            else
            {
                if (Ux_No.Checked)
                {
                    //ReadResponse(_no, responseId, null, retval);
                    retval.Add(new QuestionResponseDto(responseId, _no.ChoiceId, null, null));
                }
            }

            if (Ux_TimeFrame.SelectedIndex > 0)
            {
                int lovFk = 0;
                if (Int32.TryParse(Ux_TimeFrame.SelectedItem.Value, out lovFk))
                {
                    QuestionResponseDto callback = new QuestionResponseDto(responseId, _timeFrame.ChoiceId, null, lovFk);
                    retval.Add(callback);
                }
            }

            if (retval.Count > 0)
            {
                bool cidSubmit = false;
                bool crmSubmit = page.PageAssembly.Questionnaire.SendToCrm;
                string elementType = SpecificCrmResponseDto.ElementTypeRespondInterest;
                int pageId = page.PageAssembly.Page.PageId;
                int? questionId = PageElement.ElementId;
                int questionnaireId = page.PageAssembly.Questionnaire.QuestionnaireId;
                //string respDesc = "Response to RFG web form - " + Page.Request.Url;
                string respDesc = "Response to RFG web form - qid " + questionnaireId;
                SpecificCrmResponseDto response = new SpecificCrmResponseDto(responseId, cidSubmit, crmSubmit, elementType, pageId, questionId, questionnaireId, respDesc);
                retval.Add(response);
            }
            return retval;
        }
        public override List<ResponseDto> GetResponseDto(long responseId)
        {
            RfgExternalPage page = Page as RfgExternalPage;
            if (page == null)
            {
                throw new BugException(GetType().Name + " is only supported within RFG pages");
            }
            List<ResponseDto> retval = new List<ResponseDto>();

            if (_fax != null)
            {
                if (Ux_ByFaxRadio.Checked || Ux_ByFaxCheck.Checked)
                {
                    ReadResponse(_fax, responseId, Ux_Fax.Text, retval);
                }
            }

            if (_email != null)
            {
                if (Ux_ByEmailCheck.Checked || Ux_ByEmailRadio.Checked)
                {
                    ReadResponse(_email, responseId, Ux_Email.Text, retval);
                }
            }

            if (retval.Count > 0)
            {
                bool cidSubmit = false;
                bool crmSubmit = page.PageAssembly.Questionnaire.SendToCrm;
                string elementType = SpecificCrmResponseDto.ElementTypeRequestMoreInfo;
                int pageId = page.PageAssembly.Page.PageId;
                int? questionId = PageElement.ElementId;
                int questionnaireId = page.PageAssembly.Questionnaire.QuestionnaireId;
                //string respDesc = "Response to RFG web form - " + Page.Request.Url;
                string respDesc = "Response to RFG web form - qid " + questionnaireId;
                SpecificCrmResponseDto response = new SpecificCrmResponseDto(responseId, cidSubmit, crmSubmit, elementType, pageId, questionId, questionnaireId, respDesc);
                retval.Add(response);
            }
            return retval;
        }
Exemplo n.º 9
0
        private void SubmitSpecialQuestions(int QuestionnaireID, int Page_ID, int privacycount)
        {
            bool isTransferToSiebel = IsSiebelToTransferFlag(QuestionnaireID);
            SpecificCrmResponseDto SpecificResponseQuestions = null;
            QuestionResponseDto ResponseQuestions = null;
            Int32 questionID = 0;
            int SubmittedSiebelQuestionCount = 0;

            string strExtraChoiceText = string.Empty;

            if (SpecialQuestion_Answers != null)
            {
                if (SpecialQuestion_Answers.Rows.Count > 0)
                {
                    foreach (DataRow drs in SpecialQuestionChoiceTexts.Rows)
                    {
                        if (Convert.ToInt16(drs["lov_fk"].ToString()) != 0)
                        {
                            ResponseQuestions = new QuestionResponseDto(Convert.ToInt64(ResponseID), Convert.ToInt32(drs["choice_id"].ToString()), drs["Question_Choice_ExtraText"].ToString(), Convert.ToInt16(drs["lov_fk"].ToString()));
                            FormRegistry.ResponseDao.Add(ResponseQuestions);
                            responses.Add(ResponseQuestions);
                            if (ResponseQuestions.ChoiceId.ToString() != "")
                            {
                                SubmittedSiebelQuestionCount++;
                            }
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(drs["choice_id"].ToString()))
                            {
                                ResponseQuestions = new QuestionResponseDto(Convert.ToInt64(ResponseID), Convert.ToInt32(drs["choice_id"].ToString()), drs["Question_Choice_ExtraText"].ToString(), null);
                                FormRegistry.ResponseDao.Add(ResponseQuestions);
                                responses.Add(ResponseQuestions);
                                if (ResponseQuestions.ChoiceId.ToString() != "")
                                {
                                    SubmittedSiebelQuestionCount++;
                                }
                            }
                        }
                    }
                    foreach (DataRow QuestionRow in SpecialQuestion_Answers.Rows)
                    {
                        if ((QuestionRow["element_type_fk"].ToString().Equals("dm")))
                        {
                            questionID = int.Parse(QuestionRow["element_id"].ToString());
                            int choiceID = int.Parse(QuestionRow["question_id"].ToString());
                            if (questionID != 0 && choiceID != 0)
                            {
                                DataRow[] mailtosubject = null;
                                Hashtable h_params = new Hashtable();
                                h_params.Add("question_id", questionID);
                                DataTable MailtoSubject = DB.execProc("rfg_PageElement_ListChoices", h_params);

                                if (MailtoSubject != null)
                                {
                                    if (MailtoSubject.Rows.Count > 0)
                                    {
                                        mailtosubject = MailtoSubject.Select("choice_id = " + choiceID);
                                        if (mailtosubject != null)
                                        {
                                            if (mailtosubject.Length > 0)
                                                MailtoRecipent = mailtosubject[0]["mailto_recipient"].ToString().Trim();
                                        }
                                    }
                                }
                            }
                        }

                        if (!(QuestionRow["element_type_fk"].ToString().Equals("dm")))
                        {
                            if (isTransferToSiebel)
                            {
                                SpecificResponseQuestions = new SpecificCrmResponseDto(Convert.ToInt64(ResponseID), false, true, QuestionRow["element_type_FK"].ToString()
                                    , Convert.ToInt32(QuestionRow["page_id"].ToString()), Convert.ToInt32(QuestionRow["element_id"].ToString()),
                                   Convert.ToInt32(QuestionRow["questionnaire_id"].ToString()), QuestionResponseDescription);
                                FormRegistry.ResponseDao.Add(SpecificResponseQuestions);
                                responses.Add(SpecificResponseQuestions);
                            }
                        }
                    }

                   
                }


                if (isTransferToSiebel)
                {
                    if (privacycount > 0)
                    {
                        SpecificResponseQuestions = new SpecificCrmResponseDto(Convert.ToInt64(ResponseID), true, true, "--"
                        , Convert.ToInt32(Page_ID), null,
                        Convert.ToInt32(QuestionnaireID), QuestionResponseDescription);
                        //FormRegistry.ResponseDao.Add(SpecificResponseQuestions);
                        responses.Add(SpecificResponseQuestions);
                    }
                    else
                    {
                        //TODO: Check if that can be removed or element type can change to '--' 
                        //SpecificResponseQuestions = new SpecificCrmResponseDto(Convert.ToInt64(ResponseID), true, true, null
                        //, Convert.ToInt32(Page_ID), null,
                        //Convert.ToInt32(QuestinoareID), QuestionResponseDescription);
                        //FormRegistry.ResponseDao.Add(SpecificResponseQuestions);
                        //responses.Add(SpecificResponseQuestions);
                    }

                    // RFG 2.19 | DMS-update response type to "Complted Survey" if no sibel question submitted in the response and  privacy section exists
                    if (isTransferToSiebel)
                    {
                        foreach (ResponseDto response in responses)
                        {
                            if (response.GetType() == typeof(SpecificCrmResponseDto) && (((SpecificCrmResponseDto)response).ElementType == "--"))
                            {
                                if (SubmittedSiebelQuestionCount == 0 && !isAnyAsset)
                                {
                                    ((SpecificCrmResponseDto)response).ElementType = "##";
                                    FormRegistry.ResponseDao.Add((SpecificCrmResponseDto)response);
                                }
                                else
                                    FormRegistry.ResponseDao.Add((SpecificCrmResponseDto)response);
                            }
                        }
                    } //End RFG 2.19
                }
                else
                {
                    if (privacycount > 0)
                    {
                        SpecificResponseQuestions = new SpecificCrmResponseDto(Convert.ToInt64(ResponseID), true, false, "--"
                           , Convert.ToInt32(Page_ID), null,
                           Convert.ToInt32(QuestionnaireID), QuestionResponseDescription);
                        FormRegistry.ResponseDao.Add(SpecificResponseQuestions);
                        responses.Add(SpecificResponseQuestions);
                    }
                    else
                    {
                        //TODO: Check if that can be removed or element type can change to '--'
                        //SpecificResponseQuestions = new SpecificCrmResponseDto(Convert.ToInt64(ResponseID), true, false, null
                        //   , Convert.ToInt32(Page_ID), null,
                        //   Convert.ToInt32(QuestinoareID), QuestionResponseDescription);
                        //FormRegistry.ResponseDao.Add(SpecificResponseQuestions);
                        //responses.Add(SpecificResponseQuestions);
                    }
                }

                //trigger one time insertion for any asset crm response record "completed websurvey"
                if (isTransferToSiebel && isAnyAsset)
                {
                    SpecificResponseQuestions = new SpecificCrmResponseDto(Convert.ToInt64(ResponseID), false, true, ""
                       , Convert.ToInt32(Page_ID), null,
                       Convert.ToInt32(QuestionnaireID), QuestionResponseDescription);
                    FormRegistry.ResponseDao.Add(SpecificResponseQuestions);
                    //responses.Add(SpecificResponseQuestions);
                }
            }

        }
 public override System.Collections.Generic.List<HP.Rfg.Common.Questionnaire.ResponseDto> GetResponseDto(long responseId)
 {
     RfgExternalPage page = Page as RfgExternalPage;
     if (page == null)
     {
         throw new BugException(GetType().Name + " is only supported within RFG pages");
     }
     List<ResponseDto> retval = new List<ResponseDto>();
     string elementType = String.Empty;
     foreach (PageElementChoiceDto choice in Choices)
     {
         if (Choices.Count < 2)
         {
             CheckBox cb = (CheckBox)FindControl("Uxd_CheckRadio_" + choice.ChoiceId);
             if (cb.Checked)
             {                        
                 retval.Add(new QuestionResponseDto(responseId, choice.ChoiceId, null, null));
                 if (choice.LovKey == constants.COMM_SUBSCRIBE)
                     elementType = SpecificCrmResponseDto.ElementTypeRequestSubscribe;
                 else
                     elementType = SpecificCrmResponseDto.ElementTypeRequestUnSubscribe;
             }
         }
         else
         {
             RadioButton cb = (RadioButton)FindControl("Uxd_CheckRadio_" + choice.ChoiceId);
             if (cb.Checked)
             {
                 retval.Add(new QuestionResponseDto(responseId, choice.ChoiceId, null, null));
                 if (choice.LovKey == constants.COMM_SUBSCRIBE)
                     elementType = SpecificCrmResponseDto.ElementTypeRequestSubscribe;
                 else
                     elementType = SpecificCrmResponseDto.ElementTypeRequestUnSubscribe;
             }
         }
     }
     if (retval.Count > 0)
     {
         bool cidSubmit = false;
         bool crmSubmit = page.PageAssembly.Questionnaire.SendToCrm;               
         int pageId = page.PageAssembly.Page.PageId;
         int? questionId = PageElement.ElementId;
         int questionnaireId = page.PageAssembly.Questionnaire.QuestionnaireId;                
         string respDesc = "Response to RFG web form - qid " + questionnaireId;
         SpecificCrmResponseDto response = new SpecificCrmResponseDto(responseId, cidSubmit, crmSubmit, elementType, pageId, questionId, questionnaireId, respDesc);
         retval.Add(response);
     }
     return retval;
 }
        public override List<ResponseDto> GetResponseDto(long responseId)
        {
            HP.Rfg.Web.Pages.RfgExternalPage page = Page as HP.Rfg.Web.Pages.RfgExternalPage;
            if (page == null)
            {
                throw new BugException(GetType().Name + " is only supported within RFG pages");
            }

            bool? contactByEmail = null;
            bool? contactByPhone = null;
            bool? contactByPost = null;
            EmailPreferences? emailPrefs = null;
            bool? mailStop = null;

            if (!String.IsNullOrEmpty(_element.Email))
            {
                if (Ux_EmailOptIn.Checked)
                {
                    contactByEmail = true;
                }
                else
                {
                    if (Ux_EmailOptOut.Checked)
                    {
                        contactByEmail = false;
                    }
                }
            }

            if (!String.IsNullOrEmpty(_element.Phone))
            {
                if (Ux_PhoneOptIn.Checked)
                {
                    contactByPhone = true;
                }
                else
                {
                    if (Ux_PhoneOptOut.Checked)
                    {
                        contactByPhone = false;
                    }
                }
            }

            if (!String.IsNullOrEmpty(_element.Post))
            {
                if (Ux_PostOptIn.Checked)
                {
                    contactByPost = true;
                }
                else
                {
                    if (Ux_PostOptOut.Checked)
                    {
                        contactByPost = false;
                    }
                }
            }

            if (!String.IsNullOrEmpty(_element.EmailPreferences))
            {
                if (Ux_EmailPrefHtml.Checked)
                {
                    emailPrefs = EmailPreferences.Html;
                }
                else
                {
                    if (Ux_EmailPrefText.Checked)
                    {
                        emailPrefs = EmailPreferences.Text;
                    }
                }
            }

            if (!String.IsNullOrEmpty(_element.GeneralOptOut))
            {
                if (Ux_GeneralOptOut.Checked)
                {
                    mailStop = true;
                }
                else
                {
                    mailStop = false;
                }
            }

            PrivacyResponseDto response = new PrivacyResponseDto(responseId, contactByEmail, contactByPhone, contactByPost, emailPrefs, mailStop);
            List<ResponseDto> retval = new List<ResponseDto>();
            retval.Add(response);

            if (retval.Count > 0)
            {
                bool cidSubmit = true;
                bool crmSubmit = page.PageAssembly.Questionnaire.SendToCrm;
                string elementType = SpecificCrmResponseDto.ElementTypeRequestOptInOut;
                int pageId = page.PageAssembly.Page.PageId;
                //no questionId/ElementId is allowed for privacysection as insert_crm_record would fail then
                int? questionId = null;
                int questionnaireId = page.PageAssembly.Questionnaire.QuestionnaireId;
                //string respDesc = "Response to RFG web form - " + Page.Request.Url;
                string respDesc = "Response to RFG web form - qid " + questionnaireId;
                SpecificCrmResponseDto privacy = new SpecificCrmResponseDto(responseId, cidSubmit, crmSubmit, elementType, pageId, questionId, questionnaireId, respDesc);
                retval.Add(privacy);
            }

            return retval;
        }