Пример #1
0
        public void SubmitCrmData(string CountryCode, string LanguageCode,int Company_Code)
        {
            #region init variables and flex fields
            string address1 = string.Empty;
            string address2 = string.Empty;
            string address3 = string.Empty;
            string businessCode = string.Empty;
            string businessSiebel63 = string.Empty;
            string companyName = string.Empty;

            //RFG 2.11 | Added by Raju
            string companyWebsite = string.Empty;  
            string companyRevenue = string.Empty;
            string companyRevenueCode = string.Empty;
  
            string countryCode = string.Empty;
            string county = string.Empty;
            string customerId = CustomerID;
            string emailAddress = string.Empty;
            string firstName = string.Empty;
            string flexField1 = string.Empty;
            string flexField10 = string.Empty;
            string flexField11 = string.Empty;
            string flexField12 = string.Empty;
            string flexField13 = string.Empty;
            string flexField14 = string.Empty;
            string flexField15 = string.Empty;
            string flexfield2 = string.Empty;
            string flexField3 = string.Empty;
            string flexField4 = string.Empty;
            string flexField5 = string.Empty;
            string flexField6 = string.Empty;
            string flexField7 = string.Empty;
            string flexField8 = string.Empty;
            string flexField9 = string.Empty;
            string jobCode = string.Empty;
            string jobSiebel63 = string.Empty;
            string jobTitle = string.Empty;
            string lastName = string.Empty;
            string personalTitle = string.Empty;
            string postcode = string.Empty;
            string pwd = string.Empty;
            string telephoneCountry = string.Empty;
            string telephoneArea = string.Empty;
            string telephoneNumber = string.Empty;
            string telephoneExt = string.Empty;
            string faxCountry = string.Empty;
            string faxArea = string.Empty;
            string faxNumber = string.Empty;
            string faxExt = string.Empty;
            string mobileCountry = string.Empty;
            string mobileNumber = string.Empty;

            string town = string.Empty;
            string worldSize = string.Empty;
            string worldSize63 = string.Empty;
            string countryName = string.Empty;
            EmailPreferences? emailPreferences = null;
            string EmailPref = null; 
            #endregion

            string CamaignCode = string.Empty;
            string WaveCode = null;  //QC 6166
            string JumpId = null;
            string languageFK = string.Empty;
            string languageName = string.Empty;

            string numberOfEmployees = string.Empty;

            PersonalResponseDto ResponseDto = null;
            FormSubmissionPersonalSectionLabels ObjPersonalLabels = new FormSubmissionPersonalSectionLabels();
            FormSubmissionPrivacySectionLabels ObjPrivacyLabels = new FormSubmissionPrivacySectionLabels(); //QC:6159 & 6160

            // EmailPreferences? emailPreferences = null;

            if (HashPersonalFields != null)
            {
                if (HashPersonalFields.Count > 0)
                {
                    foreach (DictionaryEntry Item in HashPersonalFields)
                    {
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Address1)
                        {
                            address1 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Address2)
                        {
                            address2 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Address3)
                        {
                            address3 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.PreferredLanguage)
                        {
                            string[] ArrayPreferredLanguage = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayPreferredLanguage = Item.Value.ToString().Split(',');
                                    if (ArrayPreferredLanguage[0] != null)
                                        languageFK = ArrayPreferredLanguage[0];
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.CompanyName)
                        {
                            companyName = Item.Value.ToString();
                        }

                        //RFG 2.11 | Added by Raju
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.CompanyWebsite)
                        {
                            companyWebsite = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.CompanyRevenue)
                        {
                            string[] ArrayCompanyRevenue = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayCompanyRevenue = Item.Value.ToString().Split(',');
                                    if (ArrayCompanyRevenue.Length > 0)
                                    {
                                        if (ArrayCompanyRevenue[0] != null)
                                            companyRevenueCode = ArrayCompanyRevenue[0].ToString();
                                        if (ArrayCompanyRevenue[1] != null)
                                            companyRevenue = ArrayCompanyRevenue[1].ToString();
                                    }
                                }
                            }
                        }

                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Email_Address)
                        {
                            emailAddress = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Email_Pref)
                        {
                            string[] ArrayEmailPref = new string[1];
                            //string EmailPref = string.Empty;
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayEmailPref = Item.Value.ToString().Split(',');
                                    if (ArrayEmailPref[0] != null)
                                        EmailPref = ArrayEmailPref[0];
                                }
                            }

                            if (EmailPref.ToLower() == "html")
                                emailPreferences = EmailPreferences.Html;

                            if (EmailPref.ToLower() == "text")
                                emailPreferences = EmailPreferences.Text;
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.County)
                        {
                            county = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Country_code)
                        {
                            string[] ArrayCountry = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayCountry = Item.Value.ToString().Split(',');
                                    if (ArrayCountry[0] != null)
                                        countryCode = ArrayCountry[0];
                                }
                            }
                            if (countryCode == "")
                                countryCode = CountryCode;
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.JobCode)
                        {
                            string[] ArrayJob = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayJob = Item.Value.ToString().Split(',');
                                    if (ArrayJob[0] != null)
                                        jobCode = ArrayJob[0];
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Business_Code)
                        {
                            string[] ArrayBusinessCode = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayBusinessCode = Item.Value.ToString().Split(',');
                                    if (ArrayBusinessCode[0] != null)
                                        businessCode = ArrayBusinessCode[0];
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.FirstName)
                        {
                            firstName = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.JobTitle)
                        {
                            jobTitle = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.LastName)
                        {
                            lastName = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.WorlSize_Code)
                        {
                            string[] ArrayWorldSize_fk = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayWorldSize_fk = Item.Value.ToString().Split(',');
                                    if (ArrayWorldSize_fk.Length > 0)
                                    {
                                        if (ArrayWorldSize_fk[0] != null)
                                            worldSize = ArrayWorldSize_fk[0].ToString();
                                        if (ArrayWorldSize_fk[1] != null)
                                            numberOfEmployees = ArrayWorldSize_fk[1].ToString();
                                    }
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Title)
                        {
                            string[] ArrayTitle = new string[1];

                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty)
                                {
                                    ArrayTitle = Item.Value.ToString().Split(',');
                                    if (ArrayTitle.Length > 0)
                                    {
                                        if (ArrayTitle[1] != null)
                                            personalTitle = ArrayTitle[1].ToString();
                                    }
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.PostCode)
                        {
                            postcode = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Telephone_Country)
                        {
                            telephoneCountry = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Telephone_Area)
                        {
                            telephoneArea = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Telephone)
                        {
                            telephoneNumber = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Telephone_Extn)
                        {
                            telephoneExt = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Fax_Country)
                        {
                            faxCountry = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Fax_Area)
                        {
                            faxArea = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Fax)
                        {
                            faxNumber = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Fax_Extn)
                        {
                            faxExt = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Mobile_Country)
                        {
                            mobileCountry = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Mobile)
                        {
                            mobileNumber = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Town)
                        {
                            town = Item.Value.ToString();
                        }
                        #region flexfileds
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield1)
                        {
                            flexField1 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield2)
                        {
                            flexfield2 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield3)
                        {
                            flexField3 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield4)
                        {
                            flexField4 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield5)
                        {
                            flexField5 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield6)
                        {
                            flexField6 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield7)
                        {
                            flexField7 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield8)
                        {
                            flexField8 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield9)
                        {
                            flexField9 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield10)
                        {
                            //flexField10 = Item.Value.ToString();   //RFG 2.12 QC:6946
                            flexField10 = Item.Value.ToString().Equals("") ? null : Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield11)
                        {
                            flexField11 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield12)
                        {
                            flexField12 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield13)
                        {
                            flexField13 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield14)
                        {
                            flexField14 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield15)
                        {
                            flexField15 = Item.Value.ToString();
                        }

                        if (Item.Key.ToString() == ObjPersonalLabels.campaign_code)
                        {
                            CamaignCode = Item.Value.ToString();
                            if (string.IsNullOrEmpty(CamaignCode.Trim()))
                                CamaignCode = null;
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.wavecode)
                        {
                            WaveCode = Item.Value.ToString();
                            //QC6166 | Tirumala Raju
                            //if (string.IsNullOrEmpty(WaveCode.Trim()))
                            //    WaveCode = null;
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.JumpId)
                        {
                            JumpId = Item.Value.ToString();
                            //if (string.IsNullOrEmpty(JumpId.Trim()))
                            //    JumpId = null;
                        }
                        #endregion
                    }
                }
            }

            //20120803 | Tirumala Raju | RFG 2.8 | QC:6159 & QC:6160 |Start
            if (HashPrivacyFields != null)
            {
                foreach (DictionaryEntry Item in HashPrivacyFields)
                {
                    if (Item.Key.ToString() == "aid_o_" + ObjPrivacyLabels.Privacy_Email_Pref)
                    {
                        string[] ArrayEmailPref = new string[1];
                        if (Item.Value != null)
                        {
                            if (Item.Value.ToString().Trim() != string.Empty.ToString())
                            {
                                ArrayEmailPref = Item.Value.ToString().Split(',');
                                if (ArrayEmailPref[0] != null)
                                    EmailPref = ArrayEmailPref[0];
                            }
                        }

                        emailPreferences = EmailPref.Trim().ToLower() == "html" ? EmailPreferences.Html : EmailPreferences.Text;
                    }
                }
            }
            //20120308 | Tirumala Raju | RFG 2.8 | QC:6159 & QC:6160  |End

            if (countryCode == String.Empty)
                countryCode = CountryCode;

            if (CamaignCode != null)
            {
                if (string.IsNullOrEmpty(CamaignCode.Trim()))
                    CamaignCode = null;
            }

            //QC6166
            //if (string.IsNullOrEmpty(WaveCode))
            //    WaveCode = null;

            //if (string.IsNullOrEmpty(JumpId))
            //    JumpId = null;


            if (worldSize != null)
            {
                if (worldSize.Trim() != string.Empty.ToString())
                {
                    QuestionnaireDto QT = null;
                    QT = new QuestionnaireDto(
                        QuestionnaireType.Questionnaire, null, null, countryCode, LanguageCode,
                        null, false, DateTime.Now, null, false,
                        null, false, false, false, null, false,
                        false, null, null, null, null, 0, 0, DateTime.Now, null, null, false, null, null,
                        null, null, null, null, null, null, null, null, null, null, null, false, false, null, 0, null,false,0,0,false,0,0,null,0,0,0,2);

                    
                    if (worldSize.Trim() != string.Empty.ToString())
                        numberOfEmployees = ResponseFacade.GetSelctedText(QT, "WorldSize", worldSize);
                }
            }

            //RFG 2.11
            if ((companyRevenue != null) && (companyRevenue.Trim() != string.Empty))
            {
                QuestionnaireDto QT = null;
                QT = new QuestionnaireDto(
                    QuestionnaireType.Questionnaire, null, null, countryCode, LanguageCode,
                    null, false, DateTime.Now, null, false,
                    null, false, false, false, null, false,
                    false, null, null, null, null, 0, 0, DateTime.Now, null, null, false, null, null,
                    null, null, null, null, null, null, null, null, null, null, null, false, false, null, 0, null,false,0,0,false,0,0,null,0,0,0,2); //Balakumar Sprint2

                companyRevenue = ResponseFacade.GetSelctedText(QT, "CompanyRevenue", companyRevenueCode);
            }
            
            //try to translate into CRM english value... for the namevalue passed and from state_locals where in_country_fk and in_language_Fk = questionnaire settings?
            //if possible overwrite value from county otherwise leave it as it was
            if (!String.IsNullOrEmpty(county))
            {
                StandardCountyDto sCounty = FormRegistry.ResponseDao.GetStandardCountyByLocalName(county, CountryCode, LanguageCode, countryCode);
                if (sCounty != null)
                {
                    county = sCounty.CountyName;
                }
            }


            SiebelLanguageDto sLanguage = FormRegistry.ResponseDao.GetSiebelLanguage(languageFK);
            if (sLanguage != null)
            {
                languageFK = sLanguage.LanguageFK;
                languageName = sLanguage.LanguageName;
            }
            PersonalCrmRecordDto ResponsePersonalCrm = null;
            //Comapany Value------RFG:2.20
            ResponsePersonalCrm = new PersonalCrmRecordDto(Convert.ToInt64(ResponseID), address1, address2, address3,
                             string.Empty, companyName,companyWebsite,companyRevenue, county, countryCode, emailAddress, emailPreferences.ToString(),
                             firstName, JumpId, jobTitle, languageFK, lastName, numberOfEmployees,
                             personalTitle, postcode, string.Empty, string.Empty, telephoneCountry, telephoneArea, 
                             telephoneNumber, telephoneExt, faxCountry, faxArea, faxNumber, faxExt, mobileCountry,
                             mobileNumber, town, WaveCode, customquestionssummary.ToString(), flexField10, flexField11, flexField12, flexField14, null, languageName,Company_Code);//††† 20120410 Parthasarathy | RFG 2.6  Support Sub_bu capture †††  RFG 2.9


            FormRegistry.ResponseDao.Finalize(ResponsePersonalCrm);
            responses.Add(ResponsePersonalCrm);

        }
Пример #2
0
        public XmlDocument ValidateAndSubmitFormData(XmlDocument FormDefinitionXml, XmlDocument FormSubmissionXml, int QuestionnaireID)
        {
            QuestionnaireId = QuestionnaireID;
            XmlDocument XmlFormSubmissionResultXml = new XmlDocument();
            this.FormDefinitionXml = FormDefinitionXml;
            this.FormSubmissionXml = FormSubmissionXml;

            int Page_ID = 0;
            string EmailRegx = utility.getParameter("regex_email");
            int privacycount = 0;
            int Company_Code = 0;
            Page_ID = GetPage(QuestionnaireID);

            HashMaxLengthFields.Clear();
            HashRequiredFields.Clear();
            HashEnabledFieldItems.Clear();
            HashChoiceItemsMapping.Clear();

            QuestionChoiceInvalidMappings.Clear();
            QuestionChoiceInvalidMappings.Columns.Clear();

            QuestionChoiceInvalidMappings.Columns.Add("FormFieldID");
            QuestionChoiceInvalidMappings.Columns.Add("ChoiceID");
            QuestionChoiceInvalidMappings.Columns.Add("ChoiceText");

            SpecialQuestion_Answers.Clear();
            SpecialQuestion_Answers.Columns.Clear();

            SpecialQuestion_Answers.Columns.Add("response_id");
            SpecialQuestion_Answers.Columns.Add("questionnaire_id");
            SpecialQuestion_Answers.Columns.Add("page_id");
            SpecialQuestion_Answers.Columns.Add("question_id");
            SpecialQuestion_Answers.Columns.Add("element_type_FK");
            SpecialQuestion_Answers.Columns.Add("element_id");
            SpecialQuestion_Answers.Columns.Add("resp_desc");

            Question_ChoiceIDs.Clear();
            Question_ChoiceIDs.Columns.Clear();

            Question_ChoiceIDs.Columns.Add("choice_id");
            Question_ChoiceIDs.Columns.Add("ResponseID");
            Question_ChoiceIDs.Columns.Add("Choice_Answer");
            Question_ChoiceIDs.Columns.Add("question_text");



            questionnaire_general.Clear();

            QuestionChoiceTexts.Clear();
            QuestionChoiceTexts.Columns.Clear();

            SpecialQuestionChoiceTexts.Clear();
            SpecialQuestionChoiceTexts.Columns.Clear();

            QuestionChoiceTexts.Columns.Add("choice_id");
            QuestionChoiceTexts.Columns.Add("Response_id");
            QuestionChoiceTexts.Columns.Add("Question_Choice_ExtraText");

            SpecialQuestionChoiceTexts.Columns.Add("choice_id");
            SpecialQuestionChoiceTexts.Columns.Add("Response_id");
            SpecialQuestionChoiceTexts.Columns.Add("Question_Choice_ExtraText");
            SpecialQuestionChoiceTexts.Columns.Add("lov_fk");

            responses.Clear();
            
            //20120522 |  Tirumala Raju | RFG 2.7 | CR: PR629430 | 
            //Validating all submitted form fields wheather exists in form definition or not.
            //HashInvalidFields.Clear();
            //XmlNodeList XmlFormDefinitionSectionItems = FormDefinitionXml.SelectNodes("/FormDefinition");
            //XmlNodeList XmlFormSubmissionSectionItems = FormSubmissionXml.SelectNodes("/FormSubmission");
            //ValidateFormFields(XmlFormDefinitionSectionItems, XmlFormSubmissionSectionItems);

            //RFG 2.8 | QC:5996 | Tirumala Raju
            isHPPEnabled = FormDefinitionXml.SelectSingleNode("/FormDefinition/@HPPEnabled").Value.ToString().ToLower() == "yes" ? true : false;

            //Personal Data Section
            XmlNodeList XmlFormDefinitionPersonalSectionItems = FormDefinitionXml.SelectNodes("/FormDefinition/PersonalDataSection/FormField");
            XmlNodeList XmlFormSubmissionPersonalSectionItems = FormSubmissionXml.SelectNodes("/FormSubmission");

            //Privacy Data Section
            XmlNodeList XmlFormDefinitionPrivacySectionItems = FormDefinitionXml.SelectNodes("/FormDefinition/PrivacySection/FormField");
            XmlNodeList XmlFormSubmissionPrivacySectionItems = FormSubmissionXml.SelectNodes("/FormSubmission");

            //CustomQuestion Data Section
            XmlNodeList XmlFormDefinitionCustomQuestionsSectionItems = FormDefinitionXml.SelectNodes("/FormDefinition/CustomQuestions/FormField");
            XmlNodeList XmlFormSubmissionCustomQuestionsSectionItems = FormSubmissionXml.SelectNodes("/FormSubmission");

            //PredefinedQuestion DataSection
            XmlNodeList XmlFormDefinitionPredefinedQuestionsSectionItems = FormDefinitionXml.SelectNodes("/FormDefinition/CustomQuestions/FormField[starts-with(@ID, 'aid_d_')]");
            XmlNodeList XmlFormSubmissionPredefinedQuestionsSectionItems = FormSubmissionXml.SelectNodes("/FormSubmission/FormField");

            //SpecialQuestions Data Section            
            DataTable[] results = page_utilities.LoadCustomQuestions(Convert.ToString(QuestionnaireID));
            DataTable customquestions = results[1];
            FormDefinitionFacade frmDeffacade = new FormDefinitionFacade();
            XmlDocument FormSpecialQuestions = new XmlDocument();
            string XmlizedString = null;
            MemoryStream memoryStream = new MemoryStream();
            XmlSerializer xs = new XmlSerializer(typeof(FormDefinition));
            XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, System.Text.Encoding.UTF8);
            xs.Serialize(xmlTextWriter, frmDeffacade.LoadFormCustomQuestions(customquestions.Select("element_type_fk in('c1','c2','c3','c4','c5','dm','pw','fu')"), results[0].Rows[0]));
            memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
            XmlizedString = UTF8ByteArrayToString(memoryStream.ToArray());

            byte[] byteArray = new byte[XmlizedString.Length];
            System.Text.UTF8Encoding encoding = new
            System.Text.UTF8Encoding();
            byteArray = encoding.GetBytes(XmlizedString);
            // Load the memory stream
            MemoryStream memoryStreams = new MemoryStream(byteArray);
            FormSpecialQuestions.Load(memoryStreams);

            XmlNodeList XmlFormDefinitionSpecialQuestionsSectionItems = FormSpecialQuestions.SelectNodes("/FormDefinition/SpecialQuestions/FormField");
            XmlNodeList XmlFormSubmissionSpecialQuestionsSectionItems = FormSubmissionXml.SelectNodes("/FormSubmission");

            //OtherData Data Section
            XmlNodeList XmlFormSubmissionOtherDataSectionItems = FormSubmissionXml.SelectNodes("/FormSubmission");

            //if(QuestionaireID != 0)
            //    ResponseID = GetResponseID(QuestionaireID); 

            if (XmlFormDefinitionPersonalSectionItems != null && XmlFormSubmissionPersonalSectionItems != null)
            {
                if (XmlFormDefinitionPersonalSectionItems.Count > 0 || XmlFormSubmissionPersonalSectionItems.Count > 0)
                    ValidateAndSubmitPersonalDataSection(XmlFormDefinitionPersonalSectionItems, XmlFormSubmissionPersonalSectionItems);
            }

            if (XmlFormDefinitionPrivacySectionItems != null && XmlFormSubmissionPrivacySectionItems != null)
            {
                if (XmlFormDefinitionPrivacySectionItems.Count > 0)
                {
                    ValidateAndSubmitPrivacyDataSection(XmlFormDefinitionPrivacySectionItems, XmlFormSubmissionPrivacySectionItems);
                    privacycount = XmlFormDefinitionPrivacySectionItems.Count;
                }
                else
                    privacycount = 0;
            }
            else
                privacycount = 0;

            if (XmlFormDefinitionCustomQuestionsSectionItems != null && XmlFormSubmissionCustomQuestionsSectionItems != null)
            {
                if (XmlFormDefinitionCustomQuestionsSectionItems.Count > 0 || XmlFormSubmissionCustomQuestionsSectionItems.Count > 0)
                    ValidateAndSubmitCustomQuestionsSection(XmlFormDefinitionCustomQuestionsSectionItems, XmlFormSubmissionCustomQuestionsSectionItems, QuestionnaireID, Page_ID);
            }

            if (XmlFormDefinitionSpecialQuestionsSectionItems != null && XmlFormSubmissionSpecialQuestionsSectionItems != null)
            {
                if (XmlFormDefinitionSpecialQuestionsSectionItems.Count > 0 || XmlFormSubmissionSpecialQuestionsSectionItems.Count > 0)
                    ValidateAndSubmitSpecialQuestionsSection(XmlFormDefinitionSpecialQuestionsSectionItems, XmlFormSubmissionSpecialQuestionsSectionItems, QuestionnaireID, Page_ID);
            }

            if (XmlFormSubmissionOtherDataSectionItems != null)
            {
                if (XmlFormSubmissionOtherDataSectionItems.Count > 0)
                    ValidateAndSubmitOtherDataSection(XmlFormSubmissionOtherDataSectionItems);
            }

            FormSubmissionPersonalSectionLabels PersonalFields = new FormSubmissionPersonalSectionLabels();

            IsValidSubmisson = true;

            isAnyAsset = IsAnyAssetQuestionnaire(QuestionnaireID);
            if (isAnyAsset)
            {
                if (HashPersonalFields != null)
                {
                    if (HashPersonalFields.Count > 0)
                    {
                        if (HashPersonalFields.ContainsKey(PersonalFields.flexfield10))
                        {
                            string AssetIDValue = HashPersonalFields[PersonalFields.flexfield10].ToString();

                            //QC: 6946	RFG 2.12 - Aprmo Code/Flexfield10 validation logic removal | Raju
                            //check if regular expression is still correct
                            //string AssetRegExpression = utility.getParameter("FlexField10Format");
                            //if (AssetIDValue != "")
                            //{
                            //    if (!Regex.IsMatch(AssetIDValue, AssetRegExpression))
                            //    {
                            //        IsValidSubmisson = false;
                            //        if (!HashRequiredFields.ContainsKey(PersonalFields.flexfield10))
                            //            HashRequiredFields.Add(PersonalFields.flexfield10, PersonalFields.flexfield10);
                            //    }
                            //}
                            //else
                            //{
                            //    if (!HashRequiredFields.ContainsKey(PersonalFields.flexfield10))
                            //        HashRequiredFields.Add(PersonalFields.flexfield10, PersonalFields.flexfield10);
                            //}
                        }
                        else
                        {
                            if (!HashRequiredFields.ContainsKey(PersonalFields.flexfield10))
                                HashRequiredFields.Add(PersonalFields.flexfield10, PersonalFields.flexfield10);
                        }

                        //††† 20120507 | Tirumala Raju | RFG 2.7 |QC 6025| Start†††
                        //if (HashPersonalFields.ContainsKey(PersonalFields.flexfield12))
                        //{
                        //    string flexfield12Value = HashPersonalFields[PersonalFields.flexfield12].ToString();
                        //    if (!string.IsNullOrEmpty(flexfield12Value))
                        //    {
                        //        if (flexfield12Value.Length > 255)
                        //        {
                        //            IsValidSubmisson = false;
                        //            HashMaxLengthFields.Add(PersonalFields.flexfield12, PersonalFields.flexfield12);
                        //        }
                        //    }
                        //}
                        //else if (!HashRequiredFields.ContainsKey(PersonalFields.flexfield12))
                        //{
                        //    HashMaxLengthFields.Add(PersonalFields.flexfield12, PersonalFields.flexfield12);
                        //}
                        //††† 20120507 | Tirumala Raju | RFG 2.7  End†††
                    }
                }
            }

            //E-Mail Validation

            HashEmailValidation.Clear();

            if (HashPersonalFields != null)
            {
                if (HashPersonalFields.Count > 0)
                {
                    foreach (DictionaryEntry Item in HashPersonalFields)
                    {
                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Email_Address)
                        {
                            if (!Regex.IsMatch(Item.Value.ToString(), EmailRegx))
                            {
                                IsValidSubmisson = false;
                                if (!HashEmailValidation.ContainsKey(Item.Key))
                                    HashEmailValidation.Add(Item.Key, Item.Value.ToString());
                            }
                        }
                    }
                }
            }

            // Campaign Code Max Lengh Check
            ////FormSubmissionPersonalSectionLabels ObjPersonalLabels = new FormSubmissionPersonalSectionLabels();
            ////if (HashPersonalfields != null)
            ////{
            ////    if (HashPersonalfields.Count > 0)
            ////    {
            ////        foreach (DictionaryEntry Item in HashPersonalfields)
            ////        {
            ////            if (Item.Key.ToString() ==  ObjPersonalLabels.campaign_code)
            ////            {
            ////                if (!String.IsNullOrEmpty(Item.Value.ToString()))
            ////                {
            ////                    if (Item.Value.ToString().Length > Convert.ToInt16(utility.getParameter("CampaignCodeMaxLength")))
            ////                    {
            ////                      IsvalidSubmisson = false;
            ////                    if (!HashMaxLengthfields.ContainsKey(Item.Key))
            ////                        HashMaxLengthfields.Add(Item.Key, Item.Value.ToString());
            ////                    }
            ////                }
            ////            }
            ////        }
            ////    }
            ////}

            //Tel/Fax/Mobile validations

            if (HashPersonalFields != null)
            {


                HashPhoneValidation = new Hashtable();

                HashPhoneValidation.Clear();

                if (HashPersonalFields.Count > 0)
                {

                    foreach (DictionaryEntry Item in HashPersonalFields)
                    {

                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Telephone)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_PhoneFaxValidation(Item.Value.ToString().Trim(), "Number"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }


                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Telephone_Area)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_PhoneFaxValidation(Item.Value.ToString().Trim(), "area"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }


                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Telephone_Extn)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_PhoneFaxValidation(Item.Value.ToString().Trim(), "Ext"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }

                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Telephone_Country)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_PhoneFaxValidation(Item.Value.ToString().Trim(), "CtryCode"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }


                        //Fax Validations


                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Fax)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_PhoneFaxValidation(Item.Value.ToString().Trim(), "Number"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }


                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Fax_Area)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_PhoneFaxValidation(Item.Value.ToString().Trim(), "area"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }


                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Fax_Extn)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_PhoneFaxValidation(Item.Value.ToString().Trim(), "Ext"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }

                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Fax_Country)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_PhoneFaxValidation(Item.Value.ToString().Trim(), "CtryCode"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }



                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Mobile)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_MobileValidation(Item.Value.ToString().Trim(), "Number"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }

                        if (Item.Key.ToString() == "aid_p_" + PersonalFields.Mobile_Country)
                        {
                            if (!String.IsNullOrEmpty(Item.Value.ToString().Trim()))
                            {
                                if (!Check_MobileValidation(Item.Value.ToString().Trim(), "CtryCode"))
                                {
                                    IsValidSubmisson = false;
                                    if (!HashPhoneValidation.ContainsKey(Item.Key))
                                        HashPhoneValidation.Add(Item.Key, Item.Value.ToString());
                                }
                            }
                        }
                    }
                }
            }



            questionnaire_general.Clear();

            Hashtable h_params = new Hashtable();
            string QuestionLanguageCode = string.Empty;
            string QuestionCountryCode = string.Empty;

            h_params.Add("questionnaire_id", QuestionnaireID);
            questionnaire_general = DB.execProc("select_questionnaire_general", h_params);

            if (questionnaire_general != null)
            {
                if (questionnaire_general.Rows.Count > 0)
                {
                    if (questionnaire_general.Rows[0]["language_FK"] != null)
                    {
                        QuestionLanguageCode = questionnaire_general.Rows[0]["language_FK"].ToString();
                        QuestionCountryCode = questionnaire_general.Rows[0]["country_FK"].ToString();
                    }
                }
            }

            //Check predefined questions            
            foreach (XmlElement elem in XmlFormDefinitionPredefinedQuestionsSectionItems)
            {
                String req = String.Empty;
                XmlNodeList childNodes = elem.ChildNodes;
                foreach (XmlElement reqElem in childNodes)
                {
                    if (reqElem.Name.Equals("Required"))
                        req = reqElem.InnerText;
                }
                if (req != String.Empty && req.Equals("1"))
                {
                    //check if any required field is missing
                    bool validated = false;
                    foreach (XmlElement submissionElement in XmlFormSubmissionPredefinedQuestionsSectionItems)
                    {
                        if (submissionElement.GetAttribute("ID").Equals(elem.GetAttribute("ID")))
                            validated = true;
                    }
                    if (!validated && !HashEnabledFieldItems.ContainsKey(elem.GetAttribute("ID")))
                    {
                        HashEnabledFieldItems.Add(elem.GetAttribute("ID"), elem.GetAttribute("ID"));
                    }
                    //check mandatory error or mapping error
                    if (validated)
                    {
                        validated = false;
                        for (int i = 0; i < QuestionChoiceInvalidMappings.Rows.Count && !validated; i++)
                        {
                            if (QuestionChoiceInvalidMappings.Rows[i]["FormFieldID"].ToString().Equals(elem.GetAttribute("ID")))
                            {
                                validated = true;
                            }
                        }
                        if (!validated)
                        {
                            if (predefinedQuestionsResponses != null && predefinedQuestionsResponses.Count > 0)
                            {
                                ResponsePredefinedQuestion pQuestion = predefinedQuestionsResponses.Find(p => p.QuestionInternalId.Equals(elem.GetAttribute("ID").Replace("aid_d_", "")));
                                if (pQuestion == null && !HashRequiredFields.ContainsKey(elem.GetAttribute("ID")))
                                    HashRequiredFields.Add(elem.GetAttribute("ID"), elem.GetAttribute("ID"));
                            }
                            else if (!HashRequiredFields.ContainsKey(elem.GetAttribute("ID")))
                                HashRequiredFields.Add(elem.GetAttribute("ID"), elem.GetAttribute("ID"));
                        }
                    }
                }
            }

            Company_Code = Convert.ToInt32(questionnaire_general.Rows[0]["Company"].ToString());  // RPG:2.20
            XmlFormSubmissionResultXml = SubmitResponses(QuestionnaireID, RequiredSentence, QuestionLanguageCode, QuestionCountryCode, Page_ID, privacycount, Company_Code);
            return XmlFormSubmissionResultXml;

        }
Пример #3
0
        public void SubmitPersonalSectionData(string CountryCode)
        {

            #region init variables and flex fields
            string address1 = string.Empty;
            string address2 = string.Empty;
            string address3 = string.Empty;
            string businessCode = string.Empty;
            string businessSiebel63 = string.Empty;
            string companyName = string.Empty;
            string countryCode = string.Empty;
            string county = string.Empty;
            string customerId = CustomerID;
            string emailAddress = string.Empty;
            string firstName = string.Empty;
            string flexField1 = string.Empty;
            string flexField10 = string.Empty;
            string flexField11 = string.Empty;
            string flexField12 = string.Empty;
            string flexField13 = string.Empty;
            string flexField14 = string.Empty;
            string flexField15 = string.Empty;
            string flexfield2 = string.Empty;
            string flexField3 = string.Empty;
            string flexField4 = string.Empty;
            string flexField5 = string.Empty;
            string flexField6 = string.Empty;
            string flexField7 = string.Empty;
            string flexField8 = string.Empty;
            string flexField9 = string.Empty;
            string jobCode = string.Empty;
            string jobSiebel63 = string.Empty;
            string jobTitle = string.Empty;
            string lastName = string.Empty;
            string personalTitle = string.Empty;
            string postcode = string.Empty;
            string pwd = string.Empty;
            string telephoneCountry = string.Empty;
            string telephoneArea = string.Empty;
            string telephoneNumber = string.Empty;
            string telephoneExt = string.Empty;
            string faxCountry = string.Empty;
            string faxArea = string.Empty;
            string faxNumber = string.Empty;
            string faxExt = string.Empty;
            string mobileCountry = string.Empty;
            string mobileNumber = string.Empty;
            string preferredLanguage = String.Empty;

            //RFG 2.11 | Added by Raju
            string companyWebsite = String.Empty;  
            string companyRevenue = String.Empty;  

            string town = string.Empty;
            string worldSize = string.Empty;
            string worldSize63 = string.Empty;
            string countryName = string.Empty;
            EmailPreferences? emailPreferences = null;
            #endregion

            string CamaignCode = string.Empty;
            string WaveCode = null;  //QC6166
            string JumpId = null;

            string numberOfEmployees = string.Empty;

            PersonalResponseDto ResponseDto = null;
            FormSubmissionPersonalSectionLabels ObjPersonalLabels = new FormSubmissionPersonalSectionLabels();

            // EmailPreferences? emailPreferences = null;

            if (HashPersonalFields != null)
            {
                if (HashPersonalFields.Count > 0)
                {
                    foreach (DictionaryEntry Item in HashPersonalFields)
                    {
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Address1)
                        {
                            address1 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Address2)
                        {
                            address2 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Address3)
                        {
                            address3 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.CompanyName)
                        {
                            companyName = Item.Value.ToString();
                        }
                        //RFG 2.11 | Added by Raju
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.CompanyWebsite)
                        {
                            companyWebsite = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.CompanyRevenue)
                        {
                            string[] ArrayCompanyRevenue = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayCompanyRevenue = Item.Value.ToString().Split(',');
                                    if (ArrayCompanyRevenue[0] != null)
                                        companyRevenue = ArrayCompanyRevenue[0];
                                }
                            }
                        }

                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Email_Address)
                        {
                            emailAddress = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Email_Pref)
                        {
                            string[] ArrayEmailPref = new string[1];
                            string EmailPref = string.Empty;
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayEmailPref = Item.Value.ToString().Split(',');
                                    if (ArrayEmailPref[0] != null)
                                        EmailPref = ArrayEmailPref[0];
                                }
                            }

                            if (EmailPref == "html")
                                emailPreferences = EmailPreferences.Html;

                            if (EmailPref == "text")
                                emailPreferences = EmailPreferences.Text;

                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.County)
                        {
                            county = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Country_code)
                        {
                            string[] ArrayCountry = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayCountry = Item.Value.ToString().Split(',');
                                    if (ArrayCountry[0] != null)
                                        countryCode = ArrayCountry[0];
                                }
                            }
                            if (countryCode == "")
                                countryCode = CountryCode;
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.JobCode)
                        {
                            string[] ArrayJob = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayJob = Item.Value.ToString().Split(',');
                                    if (ArrayJob[0] != null)
                                        jobCode = ArrayJob[0];
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.PreferredLanguage)
                        {
                            string[] ArrayPreferredLanguage = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayPreferredLanguage = Item.Value.ToString().Split(',');
                                    if (ArrayPreferredLanguage[0] != null)
                                        preferredLanguage = ArrayPreferredLanguage[0];
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Business_Code)
                        {
                            string[] ArrayBusinessCode = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayBusinessCode = Item.Value.ToString().Split(',');
                                    if (ArrayBusinessCode[0] != null)
                                        businessCode = ArrayBusinessCode[0];
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.FirstName)
                        {
                            firstName = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.JobTitle)
                        {
                            jobTitle = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.LastName)
                        {
                            lastName = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.WorlSize_Code)
                        {
                            string[] ArrayWorldSize_fk = new string[1];
                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayWorldSize_fk = Item.Value.ToString().Split(',');
                                    if (ArrayWorldSize_fk.Length > 0)
                                    {
                                        if (ArrayWorldSize_fk[0] != null)
                                            worldSize = ArrayWorldSize_fk[0].ToString();
                                        if (ArrayWorldSize_fk[1] != null)
                                            numberOfEmployees = ArrayWorldSize_fk[1].ToString();
                                    }
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Title)
                        {
                            string[] ArrayTitle = new string[1];

                            if (Item.Value != null)
                            {
                                if (Item.Value.ToString().Trim() != string.Empty.ToString())
                                {
                                    ArrayTitle = Item.Value.ToString().Split(',');
                                    if (ArrayTitle.Length > 0)
                                    {
                                        if (ArrayTitle[1] != null)
                                            personalTitle = ArrayTitle[1].ToString();
                                    }
                                }
                            }
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.PostCode)
                        {
                            postcode = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Telephone_Country)
                        {
                            telephoneCountry = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Telephone_Area)
                        {
                            telephoneArea = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Telephone)
                        {
                            telephoneNumber = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Telephone_Extn)
                        {
                            telephoneExt = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Fax_Country)
                        {
                            faxCountry = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Fax_Area)
                        {
                            faxArea = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Fax)
                        {
                            faxNumber = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Fax_Extn)
                        {
                            faxExt = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Mobile_Country)
                        {
                            mobileCountry = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Mobile)
                        {
                            mobileNumber = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == "aid_p_" + ObjPersonalLabels.Town)
                        {
                            town = Item.Value.ToString();
                        }

                        #region flexfileds
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield1)
                        {
                            flexField1 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield2)
                        {
                            flexfield2 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield3)
                        {
                            flexField3 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield4)
                        {
                            flexField4 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield5)
                        {
                            flexField5 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield6)
                        {
                            flexField6 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield7)
                        {
                            flexField7 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield8)
                        {
                            flexField8 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield9)
                        {
                            flexField9 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield10 )
                        {
                            //flexField10 = Item.Value.ToString();  //RFG 2.12 QC:6946
                            flexField10 = Item.Value.ToString().Equals("") ? null : Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield11)
                        {
                            flexField11 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield12)
                        {
                            flexField12 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield13)
                        {
                            flexField13 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield14)
                        {
                            flexField14 = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.flexfield15)
                        {
                            flexField15 = Item.Value.ToString();
                        }

                        if (Item.Key.ToString() == ObjPersonalLabels.campaign_code)
                        {
                            CamaignCode = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.wavecode)
                        {
                            WaveCode = Item.Value.ToString();
                        }
                        if (Item.Key.ToString() == ObjPersonalLabels.JumpId)
                        {
                            JumpId = Item.Value.ToString();
                        }

                        #endregion
                    }
                }
            }

            if (countryCode == "")
                countryCode = CountryCode;

            ResponseDto = new PersonalResponseDto(Convert.ToInt64(ResponseID), address1, address2, address3, businessCode, businessSiebel63,
                    companyName, countryCode, county, customerId, emailAddress, firstName, flexField1, flexField10,
                    flexField11, flexField12, flexField13, flexField14, flexField15, flexfield2, flexField3, flexField4,
                    flexField5, flexField6, flexField7, flexField8, flexField9, jobCode, jobSiebel63, jobTitle, lastName,
                    personalTitle, postcode, pwd, telephoneCountry, telephoneArea, telephoneNumber, telephoneExt, faxCountry, faxArea, faxNumber, faxExt, mobileCountry, mobileNumber, town, worldSize, worldSize63, countryName, emailPreferences, preferredLanguage, companyWebsite,companyRevenue);   //RFG 2.11

            FormRegistry.ResponseDao.Add(ResponseDto);

            responses.Add(ResponseDto);

            ShippingAddressResponseDto ResponseShippingDetails = null;
            ResponseShippingDetails = new ShippingAddressResponseDto(Convert.ToInt64(ResponseID), address1, address2, address3, countryCode, county, customerId, emailAddress, postcode, town, true, countryName);
            FormRegistry.ResponseDao.Add(ResponseShippingDetails);
        }