protected void Page_Init(object sender, EventArgs e)
 {
     _element = PageElement as PrivacyDataSectionDto;
     if (_element == null)
     {
         throw new BugException("Privacy section received an incompatible page element \"" + PageElement.GetType().Name + "\"");
     }
 }
Beispiel #2
0
 public void Setup()
 {
     CreateNewQuestionnaire();
     CreateNewFormPage();
     long responseKey = FormRegistry.ResponseDao.CreateSubmitResponse(Constants.UnknownCustomer, null, _currentQuestionnaire.QuestionnaireId, ViewType.CleanSheetOverlay).First;            
     PersonalResponseDto dto = new PersonalResponseDto(responseKey, "address1", "address2", "address3", "bus", "businessSiebel63", "company name", "UK", "county", Constants.UnknownCustomer, "email", "firstname", "flex1", "flex10", "flex11", "flex12", "flex13", "flex14", "flex15", "flex2", "flex3", "flex4", "flex5", "flex6", "flex7", "flex8", "flex9", "job", "jobsiebel", "jobtitle", "lastname", "persontit", "postcode", "pwd", "telephone", "telephone2", "telephone3", "telephone4", "fax", "fax2", "fax3", "fax4", "mobile", "mobile2", "town", "wor", "world6", "United Kingdom", null, "prefLang", "companyWebsite", "companyRevenue");
     FormRegistry.ResponseDao.Add(dto);
     SpecificCrmResponseDto dto2 = new SpecificCrmResponseDto(responseKey, false, true, SpecificCrmResponseDto.ElementTypeRequestOptInOut, _currentPage.PageId, null, _currentPage.QuestionnaireId, "respdesc");
     FormRegistry.ResponseDao.Add(dto2);
     dto3 = new PrivacyResponseDto(responseKey, true, true, true, EmailPreferences.Html, true);
     FormRegistry.ResponseDao.Add(dto3);
     PrivacyDataSectionDto dto4 = new PrivacyDataSectionDto("privacy header", true, _currentPage.PageId, true,
         "privacy text", "email", "email pref", "email pref html", "email pref text", "post", "phone",
         "general opt out", "yeys", "no", "crm offer code", true);
     PrivacyDataSectionDto pers = FormRegistry.PrivacyDao.Create(dto4);
     PageElementType type = PageElementType.RequestedMoreInfo;
     PageElementReqDto dto5 = new PageElementReqDto("element text", true, type, _currentPage.PageId, 0, Migration.GetMaxLength(type), true);
     PageElementReqDto pers2 = FormRegistry.PageElementDao.Create(dto5);
 }
 public PrivacyDataSectionDto Create(PrivacyDataSectionDto dto)
 {
     PrivacyDataSectionDto retval = null;
     DbCommand sp = null;
     DbConnection connection = null;
     IDataReader reader = null;
     try
     {
         connection = _dbLayer.GetConnection();
         sp = connection.CreateCommand();
         sp.CommandText = "rfg_PrivacyDataSection_Create";
         sp.CommandType = CommandType.StoredProcedure;
         Write(sp, dto, false);
         _dbLayer.AddBigReturnParameter(sp);
         _dbLayer.AddReturnParameter(sp);
         sp.ExecuteNonQuery();
         int code = _dbLayer.GetReturnValue(sp);
         if (code < 0)
         {
             Trace.WriteLine("PrivacyDataSectionDao.Create(" + dto + "): returned " + code);
             throw new SupportRequiredException(Constants.SupportRequiredPrivacyDataSectionCreate);
         }
         long newId = _dbLayer.GetBigReturnValue(sp);
         retval = Fill(dto, newId);
     }
     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;
 }
 private PrivacyDataSectionDto Fill(PrivacyDataSectionDto dto, long newId)
 {
     PrivacyDataSectionDto retval = new PrivacyDataSectionDto((int)newId, dto.ElementText, dto.IsActive,
         dto.PageId, dto.IsRequired, dto.PrivacyText, dto.Email, dto.EmailPreferences,
         dto.EmailPreferenceHtml, dto.EmailPreferenceText, dto.Post, dto.Phone, dto.GeneralOptOut,
         dto.Yes, dto.No, dto.CrmOfferCode, dto.Prefilled);
     return retval;
 }
 private void Write(DbCommand sp, PrivacyDataSectionDto dto, bool includeId)
 {
     if (includeId)
     {
         _dbLayer.AddInParameter(sp, "@elementId", DbType.Int32, dto.ElementId);
     }
     _dbLayer.AddInParameter(sp, "@pageId", DbType.Int32, dto.PageId);
     _dbLayer.AddInParameter(sp, "@required", DbType.Boolean, dto.IsRequired);
     _dbLayer.AddInParameter(sp, "@sortSequence", DbType.Int32, dto.SortSequence);
     _dbLayer.AddInParameter(sp, "@privacyHeader", DbType.String, dto.ElementText);
     _dbLayer.AddInParameter(sp, "@isActive", DbType.Boolean, dto.IsActive);
     _dbLayer.AddInParameter(sp, "@isRequired", DbType.Boolean, dto.IsRequired);
     _dbLayer.AddInParameter(sp, "@privacyText", DbType.String, dto.PrivacyText);
     _dbLayer.AddInParameter(sp, "@email", DbType.String, dto.Email);
     _dbLayer.AddInParameter(sp, "@emailPreferences", DbType.String, dto.EmailPreferences);
     _dbLayer.AddInParameter(sp, "@emailPreferenceHtml", DbType.String, dto.EmailPreferenceHtml);
     _dbLayer.AddInParameter(sp, "@emailPreferenceText", DbType.String, dto.EmailPreferenceText);
     _dbLayer.AddInParameter(sp, "@post", DbType.String, dto.Post);
     _dbLayer.AddInParameter(sp, "@phone", DbType.String, dto.Phone);
     _dbLayer.AddInParameter(sp, "@generalOptOut", DbType.String, dto.GeneralOptOut);
     _dbLayer.AddInParameter(sp, "@yes", DbType.String, dto.Yes);
     _dbLayer.AddInParameter(sp, "@no", DbType.String, dto.No);
     _dbLayer.AddInParameter(sp, "@crmOfferCode", DbType.String, dto.CrmOfferCode);
     _dbLayer.AddInParameter(sp, "@prefilled", DbType.Boolean, dto.Prefilled);
 }
 private PrivacyDataSectionDto Read(IDataReader reader, ref bool alreadyRead)
 {
     int elementId = reader.GetInt32(0);
     int pageId = reader.GetInt32(1);
     bool isActive = reader.GetBoolean(2);
     int sortSequence = reader.GetInt32(3);
     bool isRequired = reader.GetBoolean(4);
     string privacyHeader = GetString(reader, 5);
     string privacyText = GetString(reader, 6);
     string email = GetString(reader, 7);
     string emailPreferences = GetString(reader, 8);
     string emailPreferenceHtml = GetString(reader, 9);
     string emailPreferenceText = GetString(reader, 10);
     string post = GetString(reader, 11);
     string phone = GetString(reader, 12);
     string generalOptOut = GetString(reader, 13);
     string yes = GetString(reader, 14);
     string no = GetString(reader, 15);
     string crmOfferCode = GetString(reader, 16);
     bool prefilled = reader.GetBoolean(17);
     PrivacyDataSectionDto retval = new PrivacyDataSectionDto(elementId, privacyHeader, isActive, pageId, 
         isRequired, privacyText, email, emailPreferences, emailPreferenceHtml, emailPreferenceText, post, phone,
         generalOptOut, yes, no, crmOfferCode, prefilled);
     return retval;
 }