Example #1
0
 public static ShippingAddressResponseDto TestAddShippingAddressResponseDto(QuestionnaireDto _currentQuestionnaire)
 {
     long responseKey = FormRegistry.ResponseDao.CreateSubmitResponse(Constants.UnknownCustomer, null, _currentQuestionnaire.QuestionnaireId, ViewType.CleanSheetOverlay).First;
     Assert.Greater(responseKey, 0);
     ShippingAddressResponseDto dto = new ShippingAddressResponseDto(responseKey, "address1", "address2", "address3", "UK", "county", Constants.UnknownCustomer, "emailaddress", "postcode", "town", false, "United Kingdom");
     Assert.IsTrue(FormRegistry.ResponseDao.Add(dto));
     return dto;
 }
Example #2
0
 private void Write(DbCommand sp, ShippingAddressResponseDto dto)
 {
     _dbLayer.AddInParameter(sp, "@response_id", DbType.Int64, dto.ResponseKey);
     _dbLayer.AddInParameter(sp, "@customer_id", DbType.String, dto.CustomerId);
     _dbLayer.AddInParameter(sp, "@use_profile_flag", DbType.String, dto.UseProfileFlag);
     _dbLayer.AddInParameter(sp, "@address1", DbType.String, dto.Address1);
     _dbLayer.AddInParameter(sp, "@address2", DbType.String, dto.Address2);
     _dbLayer.AddInParameter(sp, "@address3", DbType.String, dto.Address3);
     _dbLayer.AddInParameter(sp, "@town", DbType.String, dto.Town);
     _dbLayer.AddInParameter(sp, "@postcode", DbType.String, dto.Postcode);
     _dbLayer.AddInParameter(sp, "@county", DbType.String, dto.County);
     _dbLayer.AddInParameter(sp, "@country_FK", DbType.String, dto.CountryCode);
     _dbLayer.AddInParameter(sp, "@email_address", DbType.String, dto.EmailAddress);
 }
Example #3
0
        public bool Add(ShippingAddressResponseDto dto)
        {
            bool retval = false;
            DbCommand sp = null;
            DbConnection connection = null;
            IDataReader reader = null;
            try
            {
                connection = _dbLayer.GetConnection();
                sp = connection.CreateCommand();

                sp.CommandText = "insert_response_shipping_address";
                sp.CommandType = CommandType.StoredProcedure;
                _dbLayer.AddReturnParameter(sp);
                Write(sp, dto);
                sp.ExecuteNonQuery();
                int err = _dbLayer.GetReturnValue(sp);
                if (err == 0)
                {
                    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;
        }
Example #5
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);
        }
 private void ValidateShippingAddress(ShippingAddressResponseDto shAddress, IResponseElementProvider elementToValidate, List<int> validationHints, PersonalDataSectionDto personalDataSectionDto)
 {
     PageElementWithErrorDto element = elementToValidate.PageElement as PageElementWithErrorDto;
     PersonalDataSectionDto personalDataSection =  FormRegistry.PersonalDao.GetByPageId(element.PageId);
     foreach (KeyValuePair<PersonalDataSectionElements, Triple<int?, bool, bool>> elementToCheck in personalDataSection.PresentationPosition)
     {
         if (elementToCheck.Value != null)
         {
             if (elementToCheck.Value.Second)//mandatory
             {
                 int validationHint = DoTheSwitch(elementToCheck.Key, shAddress, personalDataSection);
                 if (validationHint > 0)
                 {
                     validationHints.Add(validationHint);
                 }
             }
             else
             {                        
                 switch (elementToCheck.Key)
                 {
                     case PersonalDataSectionElements.Email:
                         if (!DataValidation.ValidateEmail(shAddress.EmailAddress, false))
                         {
                             validationHints.Add(PersonalDataSectionDto.InvalidEmailAddress);
                         }
                         break;
                     default:
                         break;
                 }                        
             }
         }
     }                
 }
 private int DoTheSwitch(PersonalDataSectionElements elementToCheck, ShippingAddressResponseDto response, PersonalDataSectionDto personalDataSection)
 {
     int validationHint = -1;
     switch (elementToCheck)
     {
         case PersonalDataSectionElements.Address:
             if (String.IsNullOrEmpty(response.Address1))
                 validationHint = PersonalDataSectionDto.InvalidAddress1;
             break;
         case PersonalDataSectionElements.Address2:
             if (String.IsNullOrEmpty(response.Address2))
                 validationHint = PersonalDataSectionDto.InvalidAddress2;
             break;
         case PersonalDataSectionElements.Address3:
             if (String.IsNullOrEmpty(response.Address3))
                 validationHint = PersonalDataSectionDto.InvalidAddress3;
             break;
         case PersonalDataSectionElements.Town:
             if (String.IsNullOrEmpty(response.Town))
                 validationHint = PersonalDataSectionDto.InvalidTown;
             break;
         case PersonalDataSectionElements.County:
             if (String.IsNullOrEmpty(response.County))
                 validationHint = PersonalDataSectionDto.InvalidCounty;
             break;
         case PersonalDataSectionElements.PostalCode:
             if (String.IsNullOrEmpty(response.Postcode))
                 validationHint = PersonalDataSectionDto.InvalidPostcode;
             break;
         case PersonalDataSectionElements.CountryRegion:                    
             if (!IsValidSelection(personalDataSection.CountryRegionChoices, response.CountryCode))
                 validationHint = PersonalDataSectionDto.InvalidCountryCode;
             break;
         case PersonalDataSectionElements.Email:
             if (!DataValidation.ValidateEmail(response.EmailAddress, true))
                 validationHint = PersonalDataSectionDto.InvalidEmailAddress;
             break;
     }
     return validationHint;
 }