public CustomerInfoDto GetCustomerInfoAndUnsubscribe(string email_address, string rid, int qid) { CustomerInfoDto retval = null; Call_SelectCustomerInfoLogin(email_address, null, qid, rid, null, null, "unsub", reader => { retval = new CustomerInfoDto(); ReadCustomerInfo(reader, retval); }); return retval; }
public CustomerInfoDto GetCustomerInfoForReset(string email_address, int qid) { CustomerInfoDto retval = null; Call_SelectCustomerInfoLogin(email_address, null, qid, null, null, null, null, reader => { retval = new CustomerInfoDto(); ReadCustomerInfo(reader, retval); }); return retval; }
/// <summary> /// Replacing Place holders which are not replaced by ReplaceStaticPlaceholders /// </summary> /// <param name="messageBody"></param> /// <param name="data"></param> public void ReplacePlaceholders(StringBuilder messageBody, CustomerInfoDto data) { PlaceholdersFacade.Replace(messageBody, data); }
private void ReadCustomerInfo(IDataReader reader, CustomerInfoDto customer) { customer.Questionnaire = GetString(reader, (int)fields_customerinfo_fromResponseId.questionnaire); customer.Questionnaire_id = (int)GetInt32(reader, (int)fields_customerinfo_fromResponseId.questionnaire_id); customer.Customer_id = GetString(reader, (int)fields_customerinfo_fromResponseId.customer_id); customer.Country_FK = GetString(reader, (int)fields_customerinfo_fromResponseId.country_FK); customer.Language_FK = GetString(reader, (int)fields_customerinfo_fromResponseId.language_FK); customer.EmailAddress = GetString(reader, (int)fields_customerinfo_fromResponseId.email_address); customer.FirstName = GetString(reader, (int)fields_customerinfo_fromResponseId.first_name); customer.LastName = GetString(reader, (int)fields_customerinfo_fromResponseId.last_name); customer.Company_id = GetString(reader, (int)fields_customerinfo_fromResponseId.company_id); customer.CompanyName = GetString(reader, (int)fields_customerinfo_fromResponseId.company_name); customer.CompanyWebsite = GetString(reader, (int)fields_customerinfo_fromResponseId.company_website); customer.CompanyRevenue = GetString(reader, (int)fields_customerinfo_fromResponseId.company_revenue); customer.WorldSize = GetString(reader, (int)fields_customerinfo_fromResponseId.number_of_employees); customer.JobCode = GetString(reader, (int)fields_customerinfo_fromResponseId.job_code); customer.JobTitle = GetString(reader, (int)fields_customerinfo_fromResponseId.jobtitle); customer.BusinessCode = GetString(reader, (int)fields_customerinfo_fromResponseId.business_name); customer.Greeting_string = GetString(reader, (int)fields_customerinfo_fromResponseId.greeting_string); customer.PersonalTitle = GetString(reader, (int)fields_customerinfo_fromResponseId.personal_title); customer.Address1 = GetString(reader, (int)fields_customerinfo_fromResponseId.address1); customer.Address2 = GetString(reader, (int)fields_customerinfo_fromResponseId.address2); customer.Address3 = GetString(reader, (int)fields_customerinfo_fromResponseId.address3); customer.Town = GetString(reader, (int)fields_customerinfo_fromResponseId.town); customer.County = GetString(reader, (int)fields_customerinfo_fromResponseId.county); customer.Postcode = GetString(reader, (int)fields_customerinfo_fromResponseId.postcode); customer.TelephoneCountry = GetString(reader, (int)fields_customerinfo_fromResponseId.telephone_country); customer.TelephoneArea = GetString(reader, (int)fields_customerinfo_fromResponseId.telephone_area); customer.TelephoneNumber = GetString(reader, (int)fields_customerinfo_fromResponseId.telephone); customer.TelephoneExt = GetString(reader, (int)fields_customerinfo_fromResponseId.telephone_extn); customer.FaxCountry = GetString(reader, (int)fields_customerinfo_fromResponseId.fax_country); customer.FaxArea = GetString(reader, (int)fields_customerinfo_fromResponseId.fax_area); customer.FaxNumber = GetString(reader, (int)fields_customerinfo_fromResponseId.fax); customer.FaxExt = GetString(reader, (int)fields_customerinfo_fromResponseId.fax_extn); customer.MobileCountry = GetString(reader, (int)fields_customerinfo_fromResponseId.mobile_country); customer.MobileNumber = GetString(reader, (int)fields_customerinfo_fromResponseId.mobile); customer.FlexField1 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield1); customer.FlexField2 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield2); customer.FlexField3 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield3); customer.FlexField4 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield4); customer.FlexField5 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield5); customer.FlexField6 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield6); customer.FlexField7 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield7); customer.FlexField8 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield8); customer.FlexField9 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield9); customer.FlexField10 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield10); customer.FlexField11 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield11); customer.FlexField12 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield12); customer.FlexField13 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield13); customer.FlexField14 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield14); customer.FlexField15 = GetString(reader, (int)fields_customerinfo_fromResponseId.flexfield15); customer.Pwd = GetString(reader, (int)fields_customerinfo_fromResponseId.pwd); customer.Siebel_con_id = GetInt32(reader, (int)fields_customerinfo_fromResponseId.siebel_con_id); customer.Siebel_prosp_id = GetInt32(reader, (int)fields_customerinfo_fromResponseId.siebel_prosp_id); customer.Contact_by_email = ConvertToBool(GetString(reader, (int)fields_customerinfo_fromResponseId.contact_by_email)); customer.Email_pref = ConvertToEmailPreferences(GetString(reader, (int)fields_customerinfo_fromResponseId.email_pref)); customer.Contact_by_post = ConvertToBool(GetString(reader, (int)fields_customerinfo_fromResponseId.contact_by_post)); customer.Contact_by_phone = ConvertToBool(GetString(reader, (int)fields_customerinfo_fromResponseId.contact_by_phone)); customer.Mailstop_flag = ConvertToBool(GetString(reader, (int)fields_customerinfo_fromResponseId.mailstop_flag)); customer.Response_FK = (long)GetInt64(reader, (int)fields_customerinfo_fromResponseId.response_FK); customer.Responser_id = GetString(reader, (int)fields_customerinfo_fromResponseId.responser_id); }
public void TestReplacePlaceholdersFromCustomerInfoDto() { EmailFormatterBase f = new EmailFormatterBase(); CustomerInfoDto data = new CustomerInfoDto(); data.Questionnaire = "questionnaire"; data.Questionnaire_id = 1234546; //"[questionnaire_id]"; data.Customer_id = "customer_id"; data.Country_FK = "country_fk"; data.Language_FK = "language_fk"; data.Company_id = "company_id"; //data.CompanyRevenue = ""; data.CompanyWebsite = "companywebsite"; data.Greeting_string = "greeting_string"; data.Pwd1 = "pwd"; data.Siebel_con_id = 234567; // "[siebel_con_id]" data.Siebel_prosp_id = 345678; // "[siebel_prosp_id]" #region TODO: these should also be tested with NULL data.Contact_by_email = true; // "[contact_by_email]" data.Email_pref = EmailPreferences.Text; // "[email_pref]" data.Contact_by_post = true; //"[contact_by_post]" data.Contact_by_phone = true; // "[contact_by_phone]" data.Mailstop_flag = true; //"[mailstop_flag]" #endregion data.Response_FK = 456789; //"[response_fk]" data.Responser_id = "responser_id"; //"[url_to_questionnaire], data.questionnaire); //"[wavecode]", data.questionnaire); //"[flexfield_jumpid]", data.questionnaire); //"[number_of_employees]", data.number_of_employees); //"[job_code]", data.job_code); //"[business_name]", data.business_name); string[] placeholders = new string[] { "[questionnaire]", "[questionnaire_id]", "[customer_id]", "[country_fk]", "[language_fk]", "[company_id]", "[greeting_string]", "[pwd]", "[siebel_con_id]", "[siebel_prosp_id]", "[contact_by_email]", "[email_pref]", "[contact_by_post]", "[contact_by_phone]", "[mailstop_flag]", "[response_fk]", "[responser_id]", //"[url_to_questionnaire], //"[wavecode]", //"[flexfield_jumpid]", //"[number_of_employees]", //"[job_code]", //"[business_name]", "[company_website]", //"[companyrevenue]", }; string result = "questionnaire|1234546|customer_id|country_fk|language_fk|company_id|greeting_string|pwd|234567|345678|True|Text|True|True|True|456789|responser_id|companywebsite"; StringBuilder sb = new StringBuilder(); foreach (string placeholder in placeholders) { if (sb.Length > 0) sb.Append('|'); sb.Append(placeholder); } f.ReplacePlaceholders(sb, data); Assert.AreEqual(result, sb.ToString()); }