public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, string emailContent, EmailDto email, string failureReason, string modifiedMailTo)
        {
                StringBuilder messageBody = new StringBuilder();
                string mailFrom = email.EmailFrom;
                string mailTo = email.EmailTo;                
                
                string cC = email.EmailCc;
                string bCc = email.EmailBcc;
                string subject = email.Subject;

                int emailId = email.EmailId;

                string emailText;
                string emailidtext = "misconfiguration for ";
                switch (email.EmailType)
                {
                    case EmailType.ASTRO2Notification:
                        emailidtext += "ASTRO2notification-email";
                        break;
                    case EmailType.Notification:
                        emailidtext += "notification-email";
                        break;
                    case EmailType.ThankYou:
                        emailidtext += "thankyou-email";
                        break;
                    default:
                        emailidtext += "unknown-email";
                        break;
                }
                emailText = "EMAIL_DB_ID:          "+emailidtext + Environment.NewLine;
                emailText += "EMAIL_TYPE:          " + email.EmailType.ToString() + Environment.NewLine;
                emailText += "FROM:                " + mailFrom + Environment.NewLine;
                emailText += "TO:                  " + modifiedMailTo + Environment.NewLine;

                if (cC != null && cC!="")
                {
                    emailText += "CC:                  " + cC + Environment.NewLine;
                }

                if (bCc != null && bCc != "")
                {
                    emailText += "BCC:                  " + bCc + Environment.NewLine;
                }

                emailText += "SUBJECT:             " + email.Subject + Environment.NewLine;
                emailText += "CONTENT:             " + emailContent + Environment.NewLine;
                //email_text += "REASON FOR FAILURE:  " + String.Format("{0} -- {1}", failure_reason, smtp_mail.LastErrorText);
                
                messageBody.Append(emailText+Environment.NewLine);
                //messageBody.Append(emailContent);
                
                return messageBody.ToString();
        }
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, string emailContent, EmailDto email, string failureReason, string modifiedMailTo)
        {
                StringBuilder messageBody = new StringBuilder();
                string mailFrom = email.EmailFrom;
                string mailTo = email.EmailTo;                
                
                string cC = email.EmailCc;
                string bCc = email.EmailBcc;
                string subject = email.Subject;

                int emailId = email.EmailId;

                StringBuilder emailText = new StringBuilder();
                emailText.Append( "EMAIL_DB_ID:         " + emailId.ToString() + Environment.NewLine);
                emailText.Append("EMAIL_TYPE:          " + email.EmailType.ToString() + Environment.NewLine);
                emailText.Append("FROM:                " + mailFrom + Environment.NewLine);
                emailText.Append("TO:                  " + modifiedMailTo + Environment.NewLine);

                emailText.Append("CC:                  ");

                if (cC != null && cC!="")
                {
                    emailText.Append(cC);
                }
                emailText.Append(Environment.NewLine);

                emailText.Append("BCC:                  ");
                if (bCc != null && bCc != "")
                {
                    emailText.Append(bCc);
                }
                emailText.Append(Environment.NewLine);

                emailText.Append("SUBJECT:             " + email.Subject + Environment.NewLine);
                emailText.Append("CONTENT:             " + emailContent + Environment.NewLine);
                //email_text += "REASON FOR FAILURE:  " + String.Format("{0} -- {1}", failure_reason, smtp_mail.LastErrorText);
                emailText.Append("REASON FOR FAILURE:  " + String.Format("{0}", failureReason));
                messageBody.Append(emailText+Environment.NewLine);
                //messageBody.Append(emailContent);
                
                return messageBody.ToString();
        }
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO email, EmailDto notificationEmail)
        {

            StringBuilder messageBody = new StringBuilder();
            string contentText = notificationEmail.ContentText;
            StringBuilder personalDataContent = new StringBuilder();
            #region add customer data
            IResponseElementProvider personalElement = null;
            if (email.ResponseHolder.GetElements() != null)
                personalElement = email.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PersonalDataSection; });
            List<ResponseDto> response = null; 
            PersonalResponseDto personalData = null;

            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            PersonalDataSectionDto configuration = null;
            PersonalCrmRecordDto Submissionconfiguration = null;

            if (email.ResponseHolder.GetElements() != null)
            {
                foreach (IResponseElementProvider provider in email.ResponseHolder.GetElements())
                {
                    if (provider.PageElementType == PageElementType.PersonalDataSection)
                    {
                        configuration = provider.PageElement as PersonalDataSectionDto;
                    }
                }
                //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            }


            foreach (ResponseDto responses in email.Responses)
            {
                Type respType = responses.GetType();

                if (respType == typeof(PersonalCrmRecordDto))
                {
                    if (respType == typeof(PersonalCrmRecordDto))
                    {
                        Submissionconfiguration = (PersonalCrmRecordDto)responses;
                    }
                }

            }

            if (personalElement != null)
            {
                response = personalElement.GetResponseDto(email.ResponseKey);
            }
            else
            {
                response = new List<ResponseDto>();
                if (email.Responses.Count != -1)
                {
                    if (email.Responses[0] != null)
                    {
                        response.Add(((PersonalResponseDto)email.Responses[0]));
                        //email.Responses.Remove(email.Responses[0]);
                    }
                }
            }

            if (response.Count > 0 && response != null)
            {
                personalData = ((PersonalResponseDto)response[0]);
                //mailTo = personalData.EmailAddress;

                messageBody.Append(contentText + Environment.NewLine);
                //replyTo = personalData.EmailAddress;
                ReplaceStaticPlaceholders(messageBody, personalData);

            }
            string year = DateTime.Now.Year.ToString();
            string month = GetWithZero(DateTime.Now.Month);
            string day = GetWithZero(DateTime.Now.Day);
            string hour = GetWithZero(DateTime.Now.Hour);
            string minute = GetWithZero(DateTime.Now.Minute);
            string sec = GetWithZero(DateTime.Now.Second);

            //Added \r\n" by Chandra on 10/26/2010 for 2.2.1 Release
            messageBody.Append(String.Format("\r\n" + "Sent: {0}-{1}-{2} {3}:{4}:{5}Z (GMT)", year, month, day, hour, minute, sec));
            #endregion
            ReplaceDynamicPlaceholders(messageBody, email);

            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            Hashtable h_params = new Hashtable();
            h_params.Clear();
            h_params.Add("response_id", Convert.ToInt64(email.ResponseKey));
            if (email.CustomerId != HP.Rfg.Common.Constants.UnknownCustomer)
                h_params.Add("customer_id", email.CustomerId);
            DataTable customer_data = DB.execProc("select_customerinfo", h_params);
            ReplacePlaceholders(messageBody, customer_data);
            PlaceholdersFacade.ReplaceText(messageBody, "[url_to_questionnaire]", email.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageBody, "[wavecode]", email.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageBody, "[flexfield_jumpid]", email.ResponseHolder.JumpId);
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", Submissionconfiguration.NumberOfEmployees);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", Submissionconfiguration.JobTitle);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", personalData.BusinessCode);                
            }
            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††

            //RFG 2.11
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]", GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else if (Submissionconfiguration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]", Submissionconfiguration.CompanyRevenue);
            }

            //††† 20101013 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            StringBuilder messageSubject = new StringBuilder();
            messageSubject.Append(notificationEmail.Subject.ToString());
            ReplaceStaticPlaceholders(messageSubject, personalData);
            ReplaceDynamicPlaceholders(messageSubject, email);
            ReplacePlaceholders(messageSubject, customer_data);
            PlaceholdersFacade.ReplaceText(messageSubject, "[url_to_questionnaire]", email.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageSubject, "[wavecode]", email.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageSubject, "[flexfield_jumpid]", email.ResponseHolder.JumpId);
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[number_of_employees]", GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", Submissionconfiguration.NumberOfEmployees);
            }
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[job_code]", GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", Submissionconfiguration.JobTitle);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[business_name]", GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", personalData.BusinessCode);
            }

            //RFG 2.11
            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]", GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else if (Submissionconfiguration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]", Submissionconfiguration.CompanyRevenue);
            }

            notificationEmail.Subject = messageSubject.ToString();
            //††† 20101013 Biju Pattathil | RFG 2.3 QC:4861 End†††
            return messageBody.ToString();
            

        }
 public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, EmailDto thankYouEmail, StringBuilder QuestionrespSummary)
 {
     return null;
 }   
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, EmailDto email)
        {

            StringBuilder messageBody = new StringBuilder();
            string contentText = email.ContentText;
            string contentHtml = email.ContentHtml;

            #region add customer data
            IResponseElementProvider personalElement = null;
            if (complete.ResponseHolder.GetElements() != null)
                personalElement = complete.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PersonalDataSection; });
            
            PersonalResponseDto personalData = (PersonalResponseDto)complete.Responses.Find(a => a is PersonalResponseDto);
            ResetPwdUrlResponseDto resetUrl = (ResetPwdUrlResponseDto)complete.Responses.Find(a => (a is ResetPwdUrlResponseDto));
            CustomerInfoDto customer_data = (personalData is CustomerInfoDto) ? (CustomerInfoDto)personalData : (CustomerInfoDto)complete.Responses.Find(a => a is CustomerInfoDto);

            if ((customer_data != null) &&
                customer_data.EmailPreferences.HasValue &&
                (customer_data.EmailPreferences.Value == EmailPreferences.Html) &&
                (!string.IsNullOrEmpty(contentHtml)))
            {
                messageBody.Append(contentHtml);
            }
            else
            {
                messageBody.Append(contentText);
            }

            PersonalDataSectionDto configuration = (personalElement == null)? null : personalElement.PageElement as PersonalDataSectionDto;

            PersonalCrmRecordDto Submissionconfiguration = null;

            ReplaceStaticPlaceholders(messageBody, personalData);

            #endregion
            ReplaceDynamicPlaceholders(messageBody, complete);

            ReplacePlaceholders(messageBody, customer_data);

            PlaceholdersFacade.ReplaceText(messageBody, "[url_to_questionnaire]", complete.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageBody, "[wavecode]", complete.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageBody, "[flexfield_jumpid]", complete.ResponseHolder.JumpId);
            PlaceholdersFacade.ReplaceText(messageBody, "[url]", resetUrl.Url);

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", Submissionconfiguration.NumberOfEmployees);
            }

            if (configuration != null)
            {       
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", Submissionconfiguration.JobTitle);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", personalData.BusinessCode);
            }            
            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††

            //††† 20101013 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            StringBuilder messageSubject = new StringBuilder();
            messageSubject.Append(email.Subject);

            ReplaceStaticPlaceholders(messageSubject, personalData);
            ReplaceDynamicPlaceholders(messageSubject, complete);
            ReplacePlaceholders(messageSubject, customer_data);

            PlaceholdersFacade.ReplaceText(messageSubject, "[url_to_questionnaire]", complete.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageSubject, "[wavecode]", complete.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageSubject, "[flexfield_jumpid]", complete.ResponseHolder.JumpId);

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[number_of_employees]", GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]", Submissionconfiguration.NumberOfEmployees);
            }


            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[job_code]", GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]", Submissionconfiguration.JobTitle);
            }

            if (configuration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[business_name]", GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[business_name]", personalData.BusinessCode);
            }            

            email.Subject = messageSubject.ToString();

            return messageBody.ToString();
        }
Beispiel #6
0
        private EmailDto Read(IDataReader reader, ref bool alreadyRead)
        {
            EmailDto retval = null;

           
            int emailId = reader.GetInt32(0);
            int questionnaireFk = reader.GetInt32(1);
            string emailType = reader.GetString(2);


            string emailFrom = null;
            if (!reader.IsDBNull(3))
            {
                emailFrom = reader.GetString(3);
            }

            string emailTo = null;
            if (!reader.IsDBNull(4))
            {
                emailTo = reader.GetString(4);
            }
            string emailCc = null;
            if (!reader.IsDBNull(5))
            {
                emailCc = reader.GetString(5);
            }
            string emailBcc = null;
            if (!reader.IsDBNull(6))
            {
                emailBcc = reader.GetString(6);
            }
            string subject = null;
            if (!reader.IsDBNull(7))
            {
                subject = reader.GetString(7);
            }
            string contentText = null;
            if (!reader.IsDBNull(8))
            {
                contentText = reader.GetString(8);
            }
            string contentHtml = null;
            if (!reader.IsDBNull(9))
            {
                contentHtml = reader.GetString(9);
            }
            retval = new EmailDto(emailId, questionnaireFk, Convert(emailType), emailFrom, emailTo, emailCc, emailBcc, subject, contentText, contentHtml);
            return retval;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="email"></param>
        /// <param name="notificationEmail"></param>
        /// <returns></returns>
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO email, EmailDto notificationEmail, StringBuilder QuestionRespSummary)
        {

            StringBuilder questionnaireDataContent = new StringBuilder();
            //CampaignDto campaign = FormRegistry.CampaignDao.get
            string contentText = notificationEmail.ContentText + Environment.NewLine;

            #region fill questionnaireData
            //questionnaireDataContent = ResponseHolder.QuestionnaireDto.QuestionaireId.ToString();
            string campaignTitle = email.ResponseHolder.QuestionnaireDto.CampaignCode;

            questionnaireDataContent.Append(String.Format("QUESTIONNAIRE: <<CAMPAIGN: {0} CC: {1} LL: {2} TITLE: {3}>>", campaignTitle, email.ResponseHolder.QuestionnaireDto.CountryCode, email.ResponseHolder.QuestionnaireDto.LanguageCode, email.ResponseHolder.QuestionnaireDto.QidTitle) + Environment.NewLine);
            questionnaireDataContent.Append(String.Format("{0}: {1}", HP.Rfg.Common.Constants.QuestionnaireId.ToUpper(), email.ResponseHolder.QuestionnaireDto.QuestionnaireId) + Environment.NewLine);

            #endregion
            StringBuilder personalDataContent = new StringBuilder();
            #region add customer data
            IResponseElementProvider personalElement = null;
            if (email.ResponseHolder.GetElements() != null)
                personalElement = email.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PersonalDataSection; });
            PersonalDataSectionDto configuration = null;
            if (email.ResponseHolder.GetElements() != null)
            {
                foreach (IResponseElementProvider provider in email.ResponseHolder.GetElements())
                {
                    if (provider.PageElementType == PageElementType.PersonalDataSection)
                    {
                        configuration = provider.PageElement as PersonalDataSectionDto;
                    }
                }
            }
            else
            {
                configuration = FormRegistry.PersonalDao.GetByPageId(email.ResponseHolder.PageDto.PageId);
            }

            List<ResponseDto> response = null;
            if (personalElement != null)
            {
                response = personalElement.GetResponseDto(email.ResponseKey);
            }
            else
            {
                response = new List<ResponseDto>();
                if (email.Responses.Count != -1)
                {
                    if (email.Responses[0] != null)
                    {
                        response.Add(((PersonalResponseDto)email.Responses[0]));
                      //  email.Responses.Remove(email.Responses[0]);
                    }
                }
            }

            PersonalResponseDto personalData = null;
            if (response != null && response.Count > 0)
            {
                personalData = ((PersonalResponseDto)response[0]);
                personalDataContent.Append(HP.Rfg.Common.Constants.CustomerId.ToUpper() + ": " + email.CustomerId + Environment.NewLine);
                //configuration.CountryRegionChoices;
                personalDataContent.Append(HP.Rfg.Common.Constants.CountryFk.ToUpper() + ": " + GetValueOfList(configuration.CountryRegionChoices, personalData.CountryCode) + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.LanguageFk.ToUpper() + ": " + email.ResponseHolder.QuestionnaireDto.LanguageCode + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.EmailAddress.ToUpper() + ": " + personalData.EmailAddress + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.FirstName.ToUpper() + ": " + personalData.FirstName + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.LastName.ToUpper() + ": " + personalData.LastName + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.CompanyId.ToUpper() + ": " + Environment.NewLine);//TODO: cs personalized
                personalDataContent.Append(HP.Rfg.Common.Constants.CompanyName.ToUpper() + ": " + personalData.CompanyName + Environment.NewLine);

                //RFG 2.11
                personalDataContent.Append(HP.Rfg.Common.Constants.CompanyWebsite.ToUpper() + ": " + personalData.CompanyWebsite + Environment.NewLine);
                string temp = "";
                temp = configuration != null ? GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue) : "";
                personalDataContent.Append(HP.Rfg.Common.Constants.CompanyRevenue.ToUpper() + ": " + temp + Environment.NewLine);

                //configuration.CompanySizeChoices;
                if (configuration != null)
                {
                    temp = GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize);
                }
                personalDataContent.Append(HP.Rfg.Common.Constants.NumberOfEmployees.ToUpper() + ": " + temp + Environment.NewLine);
                //configuration.JobChoices;
                if (configuration != null)
                {
                    temp = GetValueOfList(configuration.JobChoices, personalData.JobCode);
                }
                else
                {
                    temp = "";
                }
                personalDataContent.Append(HP.Rfg.Common.Constants.JobCode.ToUpper() + ": " + temp + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.JobTitle.ToUpper() + ": " + personalData.JobTitle + Environment.NewLine);
                //configuration.BusinessChoices;
                if (configuration != null)
                {
                    temp = GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode);
                }
                else
                {
                    temp = "";
                }
                personalDataContent.Append(HP.Rfg.Common.Constants.BusinessName.ToUpper() + ": " + temp + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.GreetingString.ToUpper() + ": " + Environment.NewLine);//TODO: cs personalized
                //configuration.PersonalTitleChoices;
                if (configuration != null)
                {
                    temp = GetValueOfList(configuration.PersonalTitleChoices, personalData.PersonalTitle);
                }
                else
                {
                    temp = "";
                }
                personalDataContent.Append(HP.Rfg.Common.Constants.PersonalTitle.ToUpper() + ": " + temp + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Address1.ToUpper() + ": " + personalData.Address1 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Address2.ToUpper() + ": " + personalData.Address2 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Address3.ToUpper() + ": " + personalData.Address3 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Town.ToUpper() + ": " + personalData.Town + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.County.ToUpper() + ": " + personalData.County + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.PostCode.ToUpper() + ": " + personalData.Postcode + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.TelephoneCountry.ToUpper() + ": " + personalData.TelephoneCountry + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.TelephoneArea.ToUpper() + ": " + personalData.TelephoneArea + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Telephone.ToUpper() + ": " + personalData.TelephoneNumber + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.TelephoneExtn.ToUpper() + ": " + personalData.TelephoneExt + Environment.NewLine);

                personalDataContent.Append(HP.Rfg.Common.Constants.FaxCountry.ToUpper() + ": " + personalData.FaxCountry + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.FaxArea.ToUpper() + ": " + personalData.FaxArea + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.FaxNumber.ToUpper() + ": " + personalData.FaxNumber + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.FaxExtn.ToUpper() + ": " + personalData.FaxExt + Environment.NewLine);

                personalDataContent.Append(HP.Rfg.Common.Constants.MobileCountry.ToUpper() + ": " + personalData.MobileCountry + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.MobileNumber.ToUpper() + ": " + personalData.MobileNumber + Environment.NewLine);

                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield1.ToUpper() + ": " + personalData.FlexField1 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield2.ToUpper() + ": " + personalData.FlexField2 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield3.ToUpper() + ": " + personalData.FlexField3 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield4.ToUpper() + ": " + personalData.FlexField4 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield5.ToUpper() + ": " + personalData.FlexField5 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield6.ToUpper() + ": " + personalData.FlexField6 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield7.ToUpper() + ": " + personalData.FlexField7 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield8.ToUpper() + ": " + personalData.FlexField8 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield9.ToUpper() + ": " + personalData.FlexField9 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield10.ToUpper() + ": " + personalData.FlexField10 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield11.ToUpper() + ": " + personalData.FlexField11 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield12.ToUpper() + ": " + personalData.FlexField12 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield13.ToUpper() + ": " + personalData.FlexField13 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield14.ToUpper() + ": " + personalData.FlexField14 + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.Flexfield15.ToUpper() + ": " + personalData.FlexField15 + Environment.NewLine);

                personalDataContent.Append(HP.Rfg.Common.Constants.Pwd.ToUpper() + ": " + personalData.Pwd + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.SiebelConId.ToUpper() + ": " + Environment.NewLine);//TODO: cs personalized
                personalDataContent.Append(HP.Rfg.Common.Constants.SiebelProspId.ToUpper() + ": " + Environment.NewLine);//TODO: cs personalized




            }

            IResponseElementProvider privacyElement = null;
            if (email.ResponseHolder.GetElements() != null)
            {
                privacyElement = email.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PrivacyDataSection; });
            }

            List<ResponseDto> privacyResponse = null;
            if (privacyElement != null)
            {
                privacyResponse = privacyElement.GetResponseDto(email.ResponseKey);
            }
            else
            {
                privacyResponse = new List<ResponseDto>();
                if (email.Responses.Count > 0)
                {
                    if (email.Responses[1] != null)
                    {
                        privacyResponse.Add(((PrivacyResponseDto)email.Responses[1]));
                      //  email.Responses.Remove(email.Responses[1]);
                    }
                }
            }
            if (privacyResponse.Count > 0)
            {
                PrivacyResponseDto privacyData = ((PrivacyResponseDto)privacyResponse[0]);
                string contactByPost = "";
                string contactByPhone = "";
                string contactByEmail = "";
                string mailStop = "";
                string emailPreferences = "";
                if (privacyData.ContactByEmail.HasValue) contactByEmail = privacyData.ContactByEmail.Value.ToString();
                if (privacyData.ContactByPhone.HasValue) contactByPhone = privacyData.ContactByPhone.Value.ToString();
                if (privacyData.ContactByPost.HasValue) contactByPost = privacyData.ContactByPost.Value.ToString();
                if (privacyData.MailStop.HasValue) mailStop = privacyData.MailStop.Value.ToString();
                if (privacyData.EmailPreferences.HasValue) emailPreferences = privacyData.EmailPreferences.Value.ToString();

                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByEmail.ToUpper() + ": " + contactByEmail + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.EmailPref.ToUpper() + ": " + emailPreferences + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByPost.ToUpper() + ": " + contactByPost + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByPhone.ToUpper() + ": " + contactByPhone + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.MailstopFlag.ToUpper() + ": " + mailStop + Environment.NewLine);

            }
            else
            {
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByEmail.ToUpper() + ": " + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.EmailPref.ToUpper() + ": " + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByPost.ToUpper() + ": " + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.ContactByPhone.ToUpper() + ": " + Environment.NewLine);
                personalDataContent.Append(HP.Rfg.Common.Constants.MailstopFlag.ToUpper() + ": " + Environment.NewLine);
            }


            personalDataContent.Append(HP.Rfg.Common.Constants.ResponseFk.ToUpper() + ": " + email.ResponseKey + Environment.NewLine);
            personalDataContent.Append(HP.Rfg.Common.Constants.ResponserId.ToUpper() + ": " + email.ResponserId + Environment.NewLine);
            personalDataContent.Append(HP.Rfg.Common.Constants.UrlToQuestionnaire.ToUpper() + ": " + email.ResponseHolder.RequestUrl + Environment.NewLine);
            personalDataContent.Append(HP.Rfg.Common.Constants.WaveCode.ToUpper() + ": " + email.ResponseHolder.WaveCode + Environment.NewLine);
            personalDataContent.Append(HP.Rfg.Common.Constants.FlexfieldJumpid.ToUpper() + ": " + email.ResponseHolder.JumpId + Environment.NewLine);
            personalDataContent.Append(Environment.NewLine);
            #endregion
            StringBuilder responseContent = new StringBuilder();


            #region add responses
            //foreach (IResponseElementProvider element in email.ResponseHolder.GetElements())
            //{
            //    List<ResponseDto> responseElements = element.GetResponseDto(email.ResponseKey);

            //    if (/*element.PageElementType != PageElementType.MailToSubject && */element.PageElementType != PageElementType.PrivacyDataSection && element.PageElementType != PageElementType.PersonalDataSection && responseElements != null)
            //    {
            //        responseContent.Append(element.PageElement.ElementText + ": ");
            //        if (responseElements != null)
            //        {
            //            string answer = "";
            //            foreach (ResponseDto rd in responseElements)
            //            {
            //                QuestionResponseDto qrd = rd as QuestionResponseDto;
            //                if (qrd != null)
            //                {
            //                    int choiceId = qrd.ChoiceId;
            //                    PageElementChoiceDto choice = element.Choices.Find(delegate(PageElementChoiceDto pecd) { return pecd.ChoiceId == choiceId; });
            //                    if (choice != null)
            //                    {
            //                        answer = answer.TrimStart(' ');
            //                        if (answer != "")
            //                        {
            //                            answer += ", ";
            //                        }
            //                        answer += choice.ElementText;
            //                        if (qrd.ListOfValuesId != null)
            //                        {
            //                            answer += " - " + choice.Choices.Find(delegate(LovInfo lov) { return lov.LovKey == qrd.ListOfValuesId; }).ColValue;
            //                        }
            //                    }
            //                    if (!string.IsNullOrEmpty(qrd.ChoiceText))
            //                    {
            //                        answer = answer.TrimStart(' ');
            //                        if (answer != "")
            //                        {
            //                            answer += " - ";
            //                        }
            //                        answer += qrd.ChoiceText;
            //                    }
            //                }
            //            }
            //            responseContent.Append(answer);
            //            responseContent.Append(Environment.NewLine);
            //        }
            //    }
            //}


            string[] QustionAnswers = new string[100];

            QuestionRespSummary = QuestionRespSummary.Replace(HP.Rfg.lib.utility.getParameter("crm_summary_delimiter_before_customquestions").ToString(), string.Empty);

            QustionAnswers = QuestionRespSummary.ToString().Split('^');

            for (int i = 0; i <= QustionAnswers.Length - 1; i++)
            {

                responseContent.Append(QustionAnswers[i].ToString().Replace(Environment.NewLine, ""));
                responseContent.Append("\t");
                responseContent.Append(Environment.NewLine);
               
            }

          //  responseContent.Append(Environment.NewLine);

            #endregion

            #region send mail
            #endregion

            StringBuilder messageBody = new StringBuilder();


            messageBody.Append(contentText);
            messageBody.Append(Environment.NewLine);
            messageBody.Append(Environment.NewLine);
            messageBody.Append("ADDITIONAL CUSTOMER DATA AS FOLLOWS");
            messageBody.Append(Environment.NewLine);
            messageBody.Append("-----------------------------------");
            messageBody.Append(Environment.NewLine);
            messageBody.Append(questionnaireDataContent.ToString());
            messageBody.Append(personalDataContent.ToString());
            messageBody.Append("QUESTIONNAIRE ANSWERS AS FOLLOWS" + Environment.NewLine);
            messageBody.Append("-----------------------------------" + Environment.NewLine);
            messageBody.Append(responseContent.ToString());
            ReplaceStaticPlaceholders(messageBody, personalData);
            ReplaceDynamicPlaceholders(messageBody, email);

            //††† 20101014 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            Hashtable h_params = new Hashtable();
            h_params.Clear();
            h_params.Add("response_id", Convert.ToInt64(email.ResponseKey));
            if (email.CustomerId != HP.Rfg.Common.Constants.UnknownCustomer)
                h_params.Add("customer_id", email.CustomerId);
            DataTable customer_data = HP.Rfg.lib.DB.execProc("select_customerinfo", h_params);
            ReplacePlaceholders(messageBody, customer_data);
            PlaceholdersFacade.ReplaceText(messageBody, "[url_to_questionnaire]".ToLower(), email.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageBody, "[wavecode]".ToLower(), email.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageBody, "[flexfield_jumpid]".ToLower(), email.ResponseHolder.JumpId);
            if (personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, personalData.JobCode));
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, string.Empty));
            }
            //††† 20101014 Biju Pattathil | RFG 2.3 QC: 4861 Start†††

            //††† 20101004 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            StringBuilder messageSubject = new StringBuilder();
            messageSubject.Append(notificationEmail.Subject.ToString());
            ReplaceStaticPlaceholders(messageSubject, personalData);
            ReplaceDynamicPlaceholders(messageSubject, email);
            ReplacePlaceholders(messageSubject, customer_data);
            PlaceholdersFacade.ReplaceText(messageSubject, "[url_to_questionnaire]".ToLower(), email.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageSubject, "[wavecode]".ToLower(), email.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageSubject, "[flexfield_jumpid]".ToLower(), email.ResponseHolder.JumpId);
            if (personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
                PlaceholdersFacade.ReplaceText(messageSubject, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, personalData.JobCode));
                PlaceholdersFacade.ReplaceText(messageSubject, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, String.Empty));
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, string.Empty));
            }
            notificationEmail.Subject = messageSubject.ToString();
            //††† 20101004 Biju Pattathil | RFG 2.3 QC:4861 End†††

            //MailRegistry.Mailer.SendMail(mailTo, mailFrom, subject, messageBody.ToString());
            return messageBody.ToString();



        }
Beispiel #8
0
        public void Delete(EmailDto email)
        {
            
            DbCommand sp = null;
            DbConnection connection = null;
            IDataReader reader = null;
            try
            {
                connection = _dbLayer.GetConnection();
                sp = connection.CreateCommand();

                sp.CommandText = "rfg_Email_Delete";
                sp.CommandType = CommandType.StoredProcedure;
                _dbLayer.AddParameter(sp, "@questionnaire_FK", ParameterDirection.Input, DbType.Int32,email.QuestionnaireFk);
                _dbLayer.AddParameter(sp, "@email_type", ParameterDirection.Input, DbType.String, HP.Rfg.Common.Migration.Convert(email.EmailType));
                _dbLayer.AddReturnParameter(sp);
                sp.ExecuteNonQuery();
                int code = _dbLayer.GetReturnValue(sp);
                if (code < 0)
                {
                    Trace.WriteLine("EmailDAO.Delete(" + email.QuestionnaireFk + ", " + email.EmailType + "): "+code);
                    throw new Exception(code.ToString());

                }
                else
                {
                    Trace.WriteLine("EmailDAO.Delete(" + email.QuestionnaireFk + ", " + email.EmailType + "): "+ code);
                }

            }
            catch (DbException e)
            {
                Trace.WriteLine("EmailDAO.Delete(" + email.QuestionnaireFk + ", " + email.EmailType + "): " + 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);
                }
            }
        }
Beispiel #9
0
        private void Write(DbCommand sp, EmailDto email, bool includeId)
        {
            if (includeId)
                _dbLayer.AddInParameter(sp, "@email_id", DbType.Int32, email.EmailId);

            _dbLayer.AddParameter(sp, "@questionnaire_FK", ParameterDirection.Input, DbType.Int32, email.QuestionnaireFk);
            _dbLayer.AddParameter(sp, "@email_type", ParameterDirection.Input, DbType.String, HP.Rfg.Common.Migration.Convert(email.EmailType));
            _dbLayer.AddParameter(sp, "@email_from", ParameterDirection.Input, DbType.String, email.EmailFrom);
            _dbLayer.AddParameter(sp, "@email_to", ParameterDirection.Input, DbType.String, email.EmailTo);
            _dbLayer.AddParameter(sp, "@email_cc", ParameterDirection.Input, DbType.String, email.EmailCc);
            _dbLayer.AddParameter(sp, "@email_bcc", ParameterDirection.Input, DbType.String, email.EmailBcc);
            _dbLayer.AddParameter(sp, "@subject", ParameterDirection.Input, DbType.String, email.Subject);
            _dbLayer.AddParameter(sp, "@content_text", ParameterDirection.Input, DbType.String, email.ContentText);
            _dbLayer.AddParameter(sp, "@content_html", ParameterDirection.Input, DbType.String, email.ContentHtml);
        }
Beispiel #10
0
 private EmailDto Fill(EmailDto email, int id)
 {
     EmailDto retval = new EmailDto(id, email.QuestionnaireFk, email.EmailType, email.EmailFrom, email.EmailTo, email.EmailCc, email.EmailBcc, email.Subject, email.ContentText, email.ContentHtml);
     return retval;
 }
Beispiel #11
0
        public void Merge(EmailDto email)
        {
           
            DbCommand sp = null;
            DbConnection connection = null;
            IDataReader reader = null;
            try
            {
                connection = _dbLayer.GetConnection();
                sp = connection.CreateCommand();

                sp.CommandText = "rfg_Email_Merge";
                sp.CommandType = CommandType.StoredProcedure;
                Write(sp, email, false);
                
                _dbLayer.AddReturnParameter(sp);
                sp.ExecuteNonQuery();
                int code = _dbLayer.GetReturnValue(sp);
                if (code < 0)
                {
                    Trace.WriteLine("EmailDao.Create(" + email + "): returned " + code);
                    throw new Exception(code.ToString());
                    
                }
                else
                {
                    Trace.WriteLine("EmailDao.Create(" + email + "): returned " + code);
                }
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }

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

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

           
        }
        public string Format(HP.Rfg.Common.Questionnaire.CompleteResponseDTO complete, EmailDto thankYouEmail)
        {

            StringBuilder messageBody = new StringBuilder();
            string contentText = thankYouEmail.ContentText;
            string contentHtml = thankYouEmail.ContentHtml;

            StringBuilder personalDataContent = new StringBuilder();
            #region add customer data
            IResponseElementProvider personalElement = null;
            if (complete.ResponseHolder.GetElements() != null)
                personalElement = complete.ResponseHolder.GetElements().Find(delegate(IResponseElementProvider irep) { return irep.PageElementType == PageElementType.PersonalDataSection; });
            List<ResponseDto> response = null; 
            PersonalResponseDto personalData = null;
            bool isBodyHtml = false;

            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            PersonalDataSectionDto configuration = null;

            PersonalCrmRecordDto Submissionconfiguration = null;

            if (complete.ResponseHolder.GetElements() != null)
            {
                foreach (IResponseElementProvider provider in complete.ResponseHolder.GetElements())
                {
                    if (provider.PageElementType == PageElementType.PersonalDataSection)
                    {
                        configuration = provider.PageElement as PersonalDataSectionDto;
                    }
                }
                //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            }
            

            foreach (ResponseDto responses in complete.Responses)
            {
                Type respType = responses.GetType();

                if (respType == typeof(PersonalCrmRecordDto))
                {
                    if (respType == typeof(PersonalCrmRecordDto))
                    {
                        Submissionconfiguration = (PersonalCrmRecordDto)responses;
                    }
                }

            }

            if (personalElement != null)
            {
                response = personalElement.GetResponseDto(complete.ResponseKey);
            }
            else
            {
                response = new List<ResponseDto>();
                if (complete.Responses.Count != -1)
                {
                    if (complete.Responses[0] != null)
                    {
                        response.Add(((PersonalResponseDto)complete.Responses[0]));
                        //complete.Responses.Remove(complete.Responses[0]);
                    }
                }
            }

            if (response != null && response.Count > 0)
            {
                personalData = ((PersonalResponseDto)response[0]);

                if (personalData.EmailPreferences.HasValue && personalData.EmailPreferences == EmailPreferences.Html) isBodyHtml = true;

                //Added one more condition by Chandra for IM6724896 (QC4861) on 10/25/2010 for 2.2.1 Release
                if (isBodyHtml && contentHtml != null)
                    messageBody.Append(contentHtml);
                else
                    messageBody.Append(contentText);
                //End
                ReplaceStaticPlaceholders(messageBody, personalData);
            }
            else
            {
                if (isBodyHtml && contentHtml != null)
                    messageBody.Append(contentHtml);
                else
                    messageBody.Append(contentText);
            }
            #endregion
            ReplaceDynamicPlaceholders(messageBody, complete);
            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            Hashtable h_params = new Hashtable();
            h_params.Clear();
            h_params.Add("response_id", Convert.ToInt64(complete.ResponseKey));
            if (complete.CustomerId != HP.Rfg.Common.Constants.UnknownCustomer)
                h_params.Add("customer_id", complete.CustomerId);
            DataTable customer_data = DB.execProc("select_customerinfo", h_params);
            ReplacePlaceholders(messageBody, customer_data);
            PlaceholdersFacade.ReplaceText(messageBody, "[url_to_questionnaire]".ToLower(), complete.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageBody, "[wavecode]".ToLower(), complete.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageBody, "[flexfield_jumpid]".ToLower(), complete.ResponseHolder.JumpId);

            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {

                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), Submissionconfiguration.NumberOfEmployees);
            }

            if (configuration != null && personalData != null)
            {       
                PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), Submissionconfiguration.JobTitle);
            }

            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {

                if (Submissionconfiguration != null && personalData != null)
                PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), personalData.BusinessCode);
            }            
            //††† 20101015 Biju Pattathil | RFG 2.3 QC: 4861 Start†††

            //RFG 2.11
            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else if (Submissionconfiguration != null)
            {
                PlaceholdersFacade.ReplaceText(messageBody, "[company_revenue]".ToLower(), Submissionconfiguration.CompanyRevenue);
            }        

            //††† 20101013 Biju Pattathil | RFG 2.3 QC: 4861 Start†††
            StringBuilder messageSubject = new StringBuilder();
            messageSubject.Append(thankYouEmail.Subject.ToString());
            ReplaceStaticPlaceholders(messageSubject, personalData);
            ReplaceDynamicPlaceholders(messageSubject, complete);
            ReplacePlaceholders(messageSubject, customer_data);
            PlaceholdersFacade.ReplaceText(messageSubject, "[url_to_questionnaire]".ToLower(), complete.ResponseHolder.RequestUrl);
            PlaceholdersFacade.ReplaceText(messageSubject, "[wavecode]".ToLower(), complete.ResponseHolder.WaveCode);
            PlaceholdersFacade.ReplaceText(messageSubject, "[flexfield_jumpid]".ToLower(), complete.ResponseHolder.JumpId);

            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[number_of_employees]".ToLower(), GetValueOfList(configuration.CompanySizeChoices, personalData.WorldSize));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[number_of_employees]".ToLower(), Submissionconfiguration.NumberOfEmployees);
            }


            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[job_code]".ToLower(), GetValueOfList(configuration.JobChoices, personalData.JobCode));
            }
            else
            {
                if (Submissionconfiguration != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[job_code]".ToLower(), Submissionconfiguration.JobTitle);
            }

            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[business_name]".ToLower(), GetValueOfList(configuration.BusinessChoices, personalData.BusinessCode));
            }
            else
            {

                if (Submissionconfiguration != null && personalData != null)
                    PlaceholdersFacade.ReplaceText(messageBody, "[business_name]".ToLower(), personalData.BusinessCode);
            }

            //RFG 2.11
            if (configuration != null && personalData != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]".ToLower(), GetValueOfList(configuration.CompanyRevenueChoices, personalData.CompanyRevenue));
            }
            else if (Submissionconfiguration != null)
            {
                PlaceholdersFacade.ReplaceText(messageSubject, "[company_revenue]".ToLower(), Submissionconfiguration.CompanyRevenue);
            }

            thankYouEmail.Subject = messageSubject.ToString();
            //††† 20101013 Biju Pattathil | RFG 2.3 QC:4861 End†††
            return messageBody.ToString();
            

        }