/// <summary> // Processes the form - saves the data. /// </summary> private void Process() { // Check manage permissions if (!CheckPermissions("CMS.ABTest", CMSAdminControl.PERMISSION_MANAGE)) { return; } // Validate the form if (Validate()) { bool isNew = false; // Ensure the info object if (this.AbTestObj == null) { this.AbTestObj = new ABTestInfo(); if (AliasPath != String.Empty) { this.AbTestObj.ABTestOriginalPage = AliasPath; } isNew = true; } // Initialize object String newName = this.txtABTestName.Text.Trim(); this.AbTestObj.ABTestDisplayName = this.txtABTestDisplayName.Text.Trim(); this.AbTestObj.ABTestDescription = this.txtABTestDescription.Text.Trim(); this.AbTestObj.ABTestMaxConversions = ValidationHelper.GetInteger(this.txtABTestMaxConversions.Text.Trim(), 0); this.AbTestObj.ABTestOpenFrom = this.dtpABTestOpenFrom.SelectedDateTime; this.AbTestObj.ABTestOpenTo = this.dtpABTestOpenTo.SelectedDateTime; this.AbTestObj.ABTestCulture = this.ucCultureSelector.Value.ToString(); this.AbTestObj.ABTestEnabled = this.chkABTestEnabled.Checked; this.AbTestObj.ABTestSiteID = CMSContext.CurrentSiteID; // Name has changed. Change analytics statistics data for existing object if ((this.AbTestObj.ABTestID != 0) && (this.AbTestObj.ABTestName != newName)) { ABTestInfoProvider.RenameABTestStatistics(this.AbTestObj.ABTestName, newName, CMSContext.CurrentSiteID); } this.AbTestObj.ABTestName = newName; // Store conversion type TargetConversionType conversionType = TargetConversionType.Total; if (radAnyVariant.Checked) { conversionType = TargetConversionType.AnyVariant; } this.AbTestObj.ABTestTargetConversionType = conversionType; if (ShowAliasPath) { this.AbTestObj.ABTestOriginalPage = this.ucPath.Value.ToString().Trim(); } // Save object data to database ABTestInfoProvider.SetABTestInfo(this.AbTestObj); this.ItemID = this.AbTestObj.ABTestID; // For new A/B test create default variant if (isNew) { // Create instance of ab variant ABVariantInfo variant = new ABVariantInfo(); // Set properties variant.ABVariantPath = this.AbTestObj.ABTestOriginalPage; variant.ABVariantTestID = this.AbTestObj.ABTestID; variant.ABVariantDisplayName = this.AbTestObj.ABTestDisplayName + " " + GetString("om.variant"); variant.ABVariantName = this.AbTestObj.ABTestName; variant.ABVariantSiteID = this.AbTestObj.ABTestSiteID; // Save to the storage ABVariantInfoProvider.SetABVariantInfo(variant); } this.RaiseOnSaved(); // Set the info message this.lblInfo.Text = GetString("general.changessaved"); } }