/// <summary> /// Generate sample data button click handler /// </summary> protected void btnGenerate_Click(object sender, EventArgs e) { if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageData")) { RedirectToCMSDeskAccessDenied("CMS.WebAnalytics", "ManageData"); } // Check whether range is defined if ((ucSampleFrom.SelectedDateTime == DateTimeHelper.ZERO_TIME) || (ucSampleTo.SelectedDateTime == DateTimeHelper.ZERO_TIME)) { ShowError(GetString("analyt.settings.invalidrangegenerate")); return; } // Try start sample data generator if (StatisticsInfoProvider.GenerateSampleData(ucSampleFrom.SelectedDateTime, ucSampleTo.SelectedDateTime, CMSContext.CurrentSiteID, drpGenerateObejcts.SelectedValue)) { EnableControls(false); ViewState["GeneratorStarted"] = true; } // Start refresh timer timeRefresh.Enabled = true; // Display info label and loading image ReloadInfoPanel(); }
/// <summary> /// Fill statistics boundaries (from - to) /// </summary> private void FillStatisticsBoundaries() { // Fill statistics boundaries string statCodeName = drpDeleteObjects.SelectedValue; string boundariesWhere = String.Empty; String where = GenerateWhereCondition(statCodeName); // Add 'AND' if where condition applied if (!String.IsNullOrEmpty(where)) { where = " AND " + where; } // Select data from current site and filter by codename boundariesWhere = "HitsStatisticsID IN (SELECT StatisticsID FROM Analytics_Statistics WHERE StatisticsSiteID =" + CMSContext.CurrentSiteID + where + ") "; // Set interval text for no records lblIntervalInfo.Text = "-"; DataSet ds = StatisticsInfoProvider.GetStatisticsBoundaries(boundariesWhere); if (!DataHelper.DataSourceIsEmpty(ds)) { DateTime dtFrom = ValidationHelper.GetDateTime(ds.Tables[0].Rows[0]["DateFrom"], DateTimeHelper.ZERO_TIME); DateTime dtTo = ValidationHelper.GetDateTime(ds.Tables[0].Rows[0]["DateTo"], DateTimeHelper.ZERO_TIME); if ((dtFrom != DateTimeHelper.ZERO_TIME) && (dtTo != DateTimeHelper.ZERO_TIME)) { lblIntervalInfo.Text = dtFrom.ToString("d") + " - " + dtTo.ToString("d"); } } }
protected TreeNode Control_OnNodeCreated(UIElementInfo uiElement, TreeNode defaultNode) { string elementName = uiElement.ElementName.ToLowerCSafe(); // Add all custom reports if (elementName == "custom") { customWhereCondition = SqlHelper.AddWhereCondition(customWhereCondition, " StatisticsSiteID = " + SiteContext.CurrentSiteID); DataSet ds = StatisticsInfoProvider.GetCodeNames(customWhereCondition, "StatisticsCode ASC", 0); // If no custom reports found - hide Custom Reports node if (DataHelper.DataSourceIsEmpty(ds)) { return(null); } foreach (DataRow dr in ds.Tables[0].Rows) { TreeNode childNode = new TreeNode(); string codeName = ValidationHelper.GetString(dr["StatisticsCode"], String.Empty).ToLowerCSafe(); string name = ResHelper.GetString("analytics_codename." + codeName); string dataCodeName = GetDataCodeName(codeName); string reportCodeName = GetReportCodeNames(codeName); childNode.Text = "<span id=\"node_" + codeName + "\" class=\"ContentTreeItem\" name=\"treeNode\"><span class=\"Name\">" + name + "</span></span>"; childNode.NavigateUrl = "~/CMSModules/WebAnalytics/Tools/Analytics_Report.aspx?statCodeName=" + codeName + "&dataCodeName=" + dataCodeName + "&reportCodeName=" + reportCodeName + "&isCustom=1"; childNode.Target = Control.TargetFrame; defaultNode.ChildNodes.Add(childNode); } } return(defaultNode); }
/// <summary> /// Gets number of visitors for the last week based on statistics with given staticstics type. /// </summary> /// <param name="siteId">ID of the site</param> /// <param name="statisticsCode">Statistics code</param> /// <exception cref="ArgumentException"><paramref name="statisticsCode"/> is null or empty.</exception> /// <returns>Visitors count</returns> private int GetVisitCount(int siteId, string statisticsCode) { if (string.IsNullOrEmpty(statisticsCode)) { throw new ArgumentException("statisticsCode"); } var statistics = StatisticsInfoProvider.GetStatistics() .OnSite(siteId) .Column("StatisticsID") .WhereEquals("StatisticsCode", statisticsCode); var hits = HitsDayInfoProvider.GetHitsDays() .WhereIn("HitsStatisticsID", statistics) .WhereGreaterThan("HitsStartTime", DateTime.Now.AddDays(-7).Date) .Column(new AggregatedColumn(AggregationType.Sum, "HitsCount")); int count = 0; if (!DataHelper.DataSourceIsEmpty(hits)) { count = ValidationHelper.GetInteger(hits.Tables[0].Rows[0][0], 0); } return(count); }
/// <summary> /// Delete analytics data button click handler /// </summary> protected void btnDelete_Click(object sender, EventArgs e) { // Check whether current user is authorized to manage analytics data if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageData")) { RedirectToCMSDeskAccessDenied("CMS.WebAnalytics", "ManageData"); } string statCodeName = drpDeleteObjects.SelectedValue; DateTime fromDate = ucDeleteFrom.SelectedDateTime; DateTime toDate = ucDeleteTo.SelectedDateTime; // Remove all data if (String.IsNullOrEmpty(statCodeName)) { StatisticsInfoProvider.RemoveAnalyticsDataAsync(fromDate, toDate, CMSContext.CurrentSiteID, String.Empty); } // Remove data from specific report else { String where = String.Empty; // Stats for visitors needs special manipulation (it consist of two types // of statistics with different code names - new visitor and returning visitor) if (statCodeName.ToLowerCSafe() != HitLogProvider.VISITORS_FIRST) { // Ignore multilingual suffix (multilingual stats use the same data as "base" stats) if (statCodeName.ToLowerCSafe().EndsWithCSafe(MULTILINGUAL_SUFFIX)) { statCodeName = statCodeName.Remove(statCodeName.Length - MULTILINGUAL_SUFFIX.Length); } // Add where condition based on stat code name where = GenerateWhereCondition(statCodeName); // Recalculate/delete ordinary stats StatisticsInfoProvider.RemoveAnalyticsDataAsync(fromDate, toDate, CMSContext.CurrentSiteID, where); } else { where = "(StatisticsCode = '" + HitLogProvider.VISITORS_FIRST + "' OR StatisticsCode ='" + HitLogProvider.VISITORS_RETURNING + "')"; StatisticsInfoProvider.RemoveAnalyticsDataAsync(fromDate, toDate, CMSContext.CurrentSiteID, where); } } // Disable controls EnableControls(false); ViewState["DeleterStarted"] = true; // Start refresh timer timeRefresh.Enabled = true; // Display info label and loading image ReloadInfoPanel(); }
/// <summary> /// Removes all previously logged data related to the Dancing Goat default A/B test and Campaign. /// </summary> private void ClearStatisticsData() { var whereCondition = new WhereCondition().WhereContains("StatisticsCode", AbTest.ABTestName).Or() .WhereEquals("StatisticsObjectName", Campaign.CampaignUTMCode).Or() .WhereEquals("StatisticsObjectName", Conversion.ConversionName); StatisticsInfoProvider.RemoveAnalyticsData(DateTimeHelper.ZERO_TIME, DateTimeHelper.ZERO_TIME, _mSite.SiteID, whereCondition.ToString(true)); }
/// <summary> /// Fills drop drop down field for deleted objects /// </summary> private void FillObjectsToDelete() { drpDeleteObjects.Items.Clear(); SortedList list = new SortedList(); // Get available statistics for current site DataSet ds = StatisticsInfoProvider.GetStatistics("StatisticsSiteID = " + CMSContext.CurrentSiteID + " AND StatisticsCode NOT LIKE '%;%'", null, 0, "DISTINCT StatisticsCode"); // Check whether exists at least one statistic if (!DataHelper.DataSourceIsEmpty(ds)) { // Loop thru all statistics foreach (DataRow dr in ds.Tables[0].Rows) { // Statistic codename string codeName = ValidationHelper.GetString(dr["StatisticsCode"], String.Empty); // Statistic dispaly name string displayName = GetString("analytics_codename." + codeName); // If resource string is not available use codename if (displayName.EqualsCSafe("analytics_codename." + codeName, true)) { displayName = codeName; } if (!list.Contains(displayName)) { // Add to the list collection list.Add(displayName, new ListItem(displayName, codeName)); } else { // If display name already in collection - add special display name list.Add(displayName + codeName, new ListItem(displayName + " (" + codeName + ")", codeName)); } } // Add A/B and M/V testing list.Add(GetString("analytics_codename.abtest"), new ListItem(GetString("analytics_codename.abtest"), "abtest")); list.Add(GetString("analytics_codename.mvtest"), new ListItem(GetString("analytics_codename.mvtest"), "mvtest")); // Add values from sorted list foreach (ListItem li in list.Values) { drpDeleteObjects.Items.Add(li); } } // Add default (all) value drpDeleteObjects.Items.Insert(0, new ListItem(GetString("general.selectall"), "")); }
/// <summary> /// Fills drop drop down field for deleted objects /// </summary> private void FillObjectsToDelete() { drpDeleteObjects.Items.Clear(); SortedList list = new SortedList(); var statistics = StatisticsInfoProvider.GetStatistics() .Column("StatisticsCode") .Distinct() .WhereEquals("StatisticsSiteID", SiteContext.CurrentSiteID) .WhereNotContains("StatisticsCode", ";"); foreach (var statisticsInfo in statistics) { // Statistic codename string codeName = statisticsInfo.StatisticsCode; // Statistic dispaly name string displayName = GetString("analytics_codename." + codeName); // If resource string is not available use codename if (displayName.EqualsCSafe("analytics_codename." + codeName, true)) { displayName = codeName; } if (!list.Contains(displayName)) { // Add to the list collection list.Add(displayName, new ListItem(displayName, codeName)); } else { // If display name already in collection - add special display name list.Add(displayName + codeName, new ListItem(displayName + " (" + codeName + ")", codeName)); } } // Add A/B and M/V testing list.Add(GetString("analytics_codename.abtest"), new ListItem(GetString("analytics_codename.abtest"), "abtest")); list.Add(GetString("analytics_codename.mvtest"), new ListItem(GetString("analytics_codename.mvtest"), "mvtest")); // Add values from sorted list foreach (ListItem li in list.Values) { drpDeleteObjects.Items.Add(li); } // Add default (all) value drpDeleteObjects.Items.Insert(0, new ListItem(GetString("general.selectall"), "")); }
public void Generate() { var whereCondition = new WhereCondition().WhereEquals("StatisticsSiteID", _mSite.SiteID) .WhereIn("StatisticsCode", StatisticCodeNames); StatisticsInfoProvider.RemoveAnalyticsData(DateTimeHelper.ZERO_TIME, DateTimeHelper.ZERO_TIME, _mSite.SiteID, whereCondition.ToString(true)); var action = RegisterGenerators(); var dateTime1 = DateTime.Now.AddDays(1.0); var dateTime2 = dateTime1.AddDays(-35.0); var random = new Random(); RegisteredUsers(random); var days1 = (dateTime1 - dateTime2).Days; for (var date = dateTime2; date < dateTime1; date = date.AddDays(1.0)) { var days2 = (date - dateTime2).Days; var num1 = (int)(TotalMonthsVisits / days1 + Logit(random.NextDouble()) * VisitsVariance + (days2 - days1 / 2) * VisitsGradient); var num2 = (int)((0.2 + random.NextDouble() * 0.1) * num1); var dictionary = new Dictionary <string, int> { { "en-US", num1 - num2 }, { "es-ES", num2 } }; action(date, dictionary, random); WebAnalyticsEvents.GenerateStatistics.StartEvent(date, dictionary); } }
public void btnDelete_Click(object sender, EventArgs e) { // Check 'ManageData' permission if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageData")) { RedirectToCMSDeskAccessDenied("CMS.WebAnalytics", "ManageData"); } if (statCodeName == String.Empty) { return; } DateTime fromDate = pickerFrom.SelectedDateTime; DateTime toDate = pickerTo.SelectedDateTime; if (!pickerFrom.IsValidRange() || !pickerTo.IsValidRange()) { lblError.Text = GetString("general.errorinvaliddatetimerange"); lblError.Visible = true; return; } if ((fromDate > toDate) && (toDate != DateTimeHelper.ZERO_TIME)) { lblError.Visible = true; lblError.Text = GetString("analt.invalidinterval"); return; } String where = String.Empty; // Manage A/B test selector if ((statCodeName == "abtest") && (ucABTests != null)) { string abTest = ValidationHelper.GetString(ucABTests.Value, String.Empty); if ((abTest == String.Empty) || (abTest == "pleaseselect")) { lblError.Visible = true; lblError.Text = GetString("abtest.pleaseselect"); return; } String codeName = (abTest == ValidationHelper.GetString(ucABTests.GetValue("AllRecordValue"), String.Empty)) ? "'abconversion;%'" : "'abconversion;" + SqlHelperClass.GetSafeQueryString(abTest) + ";%'"; where = "StatisticsCode LIKE " + codeName; } // Manage MVT test selector if ((statCodeName == "mvtest") && (ucMVTests != null)) { string mvTest = ValidationHelper.GetString(ucMVTests.Value, String.Empty); if ((mvTest == String.Empty) || (mvTest == "pleaseselect")) { lblError.Visible = true; lblError.Text = GetString("mvtest.pleaseselect"); return; } String codeName = (mvTest == ValidationHelper.GetString(ucMVTests.GetValue("AllRecordValue"), String.Empty)) ? "'mvtconversion;%'" : "'mvtconversion;" + SqlHelperClass.GetSafeQueryString(mvTest) + ";%'"; where = "StatisticsCode LIKE " + codeName; } // Manage campaigns if (statCodeName == "campaigns") { string campaign = ValidationHelper.GetString(usCampaigns.Value, String.Empty); if ((campaign == String.Empty) || (campaign == "pleaseselect")) { lblError.Visible = true; lblError.Text = GetString("campaigns.pleaseselect"); return; } if (campaign == usCampaigns.AllRecordValue) { where = "(StatisticsCode='campaign' OR StatisticsCode LIKE 'campconversion;%')"; } else { where = " ((StatisticsCode='campaign' AND StatisticsObjectName ='" + SqlHelperClass.GetSafeQueryString(campaign) + "') OR StatisticsCode LIKE 'campconversion;" + SqlHelperClass.GetSafeQueryString(campaign) + "')"; } } // Delete one campaign (set from url) if (statCodeName.StartsWith("singlecampaign")) { string[] arr = statCodeName.Split(';'); if (arr.Length == 2) { String campaign = arr[1]; where = "(StatisticsCode='campaign' AND StatisticsObjectName ='" + SqlHelperClass.GetSafeQueryString(campaign) + "') OR StatisticsCode LIKE 'campconversion;" + SqlHelperClass.GetSafeQueryString(campaign) + "'"; } } // Ingore multilingual suffix (multilingual stats use the same data as "base" stats) if (statCodeName.ToLower().EndsWith(MULTILINGUAL_SUFFIX)) { statCodeName = statCodeName.Remove(statCodeName.Length - MULTILINGUAL_SUFFIX.Length); } // Add where condition based on stat code name if (where == String.Empty) { where = "StatisticsCode LIKE '" + SqlHelperClass.GetSafeQueryString(statCodeName, false) + "'"; } // In case of any error - (this page don't allow deleting all statistics) if (where == String.Empty) { return; } // Stats for visitors needs special manipulation (it consist of two types // of statistics with different code names - new visitor and returning visitor) if (statCodeName.ToLower() != HitLogProvider.VISITORS_FIRST) { StatisticsInfoProvider.RemoveAnalyticsDataAsync(fromDate, toDate, CMSContext.CurrentSiteID, where); } else { where = "(StatisticsCode = '" + HitLogProvider.VISITORS_FIRST + "' OR StatisticsCode ='" + HitLogProvider.VISITORS_RETURNING + "')"; StatisticsInfoProvider.RemoveAnalyticsDataAsync(fromDate, toDate, CMSContext.CurrentSiteID, where); } // Manage async delete info timeRefresh.Enabled = true; EnableControls(false); ReloadInfoPanel(); ViewState.Add("DeleterStarted", 1); }
/// <summary> /// Removes all previously logged data related to the Dancing Goat A/B test. /// </summary> private void ClearStatisticsData() { var where = new WhereCondition().WhereContains("StatisticsCode", ABTest.ABTestName); StatisticsInfoProvider.RemoveAnalyticsData(DateTimeHelper.ZERO_TIME, DateTimeHelper.ZERO_TIME, SiteContext.CurrentSiteID, where.ToString(true)); }
private TreeNode menuElem_OnNodeCreated(UIElementInfo uiElement, TreeNode defaultNode) { String elementName = uiElement.ElementName.ToLowerCSafe(); // Remove Optimalization node when module OnlineMarketing not present if (elementName == "optimalization") { if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING)) { return(null); } } String imagesUrl = "CMSModules/CMS_WebAnalytics/"; if (uiElement != null) { if (!IsToolsUIElementAvailable(uiElement)) { return(null); } } // Add all custom reports if (elementName == "custom") { customWhereCondition = SqlHelperClass.AddWhereCondition(customWhereCondition, " StatisticsSiteID = " + CMSContext.CurrentSiteID); DataSet ds = StatisticsInfoProvider.GetCodeNames(customWhereCondition, "StatisticsCode ASC", 0, "StatisticsCode"); // If no custom reports found - hide Custom Reports node if (DataHelper.DataSourceIsEmpty(ds)) { return(null); } foreach (DataRow dr in ds.Tables[0].Rows) { TreeNode childNode = new TreeNode(); string codeName = ValidationHelper.GetString(dr["StatisticsCode"], String.Empty).ToLowerCSafe(); string name = GetString("analytics_codename." + codeName); string dataCodeName = GetDataCodeName(codeName); string reportCodeName = GetReportCodeNames(codeName); childNode.Text = "<span id=\"node_" + codeName + "\" class=\"ContentTreeItem\" name=\"treeNode\"><span class=\"Name\">" + name + "</span></span>"; childNode.NavigateUrl = "~/CMSModules/WebAnalytics/Tools/Analytics_Report.aspx?statCodeName=" + codeName + "&dataCodeName=" + dataCodeName + "&reportCodeName=" + reportCodeName + "&isCustom=1"; childNode.Target = treeElem.TargetFrame; // Icon String iconPath = imagesUrl + codeName.Replace(".", "_") + ".png"; String corePath = URLHelper.ResolveUrl(UIHelper.GetImagePath(Page, iconPath, false, false)); if (FileHelper.FileExists(corePath)) { childNode.ImageUrl = GetImageUrl(iconPath); } else { childNode.ImageUrl = GetImageUrl(imagesUrl + "statistics.png"); } defaultNode.ChildNodes.Add(childNode); } } return(defaultNode); }
TreeNode menuElem_OnNodeCreated(UIElementInfo uiElement, TreeNode defaultNode) { String elementName = uiElement.ElementName.ToLower(); // Remove Optimalization node when module OnlineMarketing not present if (elementName == "optimalization") { if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING)) { return(null); } } // Select first intem under node if (!firstElementSelected) { // Resolve hash string url = URLHelper.EnsureHashToQueryParameters(uiElement.ElementTargetURL); // Is a page node (with page url) if (url != "@") { firstElementSelected = true; SelectItem(uiElement.ElementName, url); } // Is a category node (without page url) else { // Try to display a child element if (uiElement.ElementChildCount > 0) { defaultNode.Expanded = true; } } } // Preselect node if (uiElement.ElementName.ToLower() == this.selectedNode.ToLower()) { this.SelectItem(uiElement.ElementName, URLHelper.EnsureHashToQueryParameters(uiElement.ElementTargetURL)); } String imagesUrl = "CMSModules/CMS_WebAnalytics/"; if (uiElement != null) { if (!IsToolsUIElementAvailable(uiElement)) { return(null); } } // Add all custom reports if (elementName == "custom") { customWhereCondition = SqlHelperClass.AddWhereCondition(customWhereCondition, " StatisticsSiteID = " + CMSContext.CurrentSiteID); DataSet ds = StatisticsInfoProvider.GetCodeNames(customWhereCondition, "StatisticsCode ASC", 0, "StatisticsCode"); // If no custom reports found - hide Custom Reports node if (DataHelper.DataSourceIsEmpty(ds)) { return(null); } foreach (DataRow dr in ds.Tables[0].Rows) { TreeNode childNode = new TreeNode(); string codeName = ValidationHelper.GetString(dr["StatisticsCode"], String.Empty).ToLower(); string name = GetString("analytics_codename." + codeName); string dataCodeName = GetDataCodeName(codeName); string reportCodeName = GetReportCodeNames(codeName); string reportUrl = "Analytics_Report.aspx?statCodeName=" + codeName + "&dataCodeName=" + dataCodeName + "&reportCodeName=" + reportCodeName + "&isCustom=1"; childNode.Text = "<span id=\"node_" + codeName + "\" class=\"ContentTreeItem\" name=\"treeNode\" onclick=\"SelectNode('" + codeName + "');parent.frames['analyticsDefault'].location.href = '" + reportUrl + "' ; \"><span class=\"Name\">" + name + "</span></span>"; childNode.NavigateUrl = "~/CMSModules/WebAnalytics/Tools/Analytics_Statistics.aspx#"; // Icon String imgPath = GetImageUrl(imagesUrl + codeName.Replace(".", "_") + ".png"); if (FileHelper.FileExists(imgPath)) { childNode.ImageUrl = imgPath; } else { childNode.ImageUrl = GetImageUrl(imagesUrl + "statistics.png"); } defaultNode.ChildNodes.Add(childNode); } } return(defaultNode); }
public void btnDelete_Click(object sender, EventArgs e) { // Check 'ManageData' permission if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageData")) { RedirectToAccessDenied("CMS.WebAnalytics", "ManageData"); } if (statCodeName == String.Empty) { return; } DateTime fromDate = pickerFrom.SelectedDateTime; DateTime toDate = pickerTo.SelectedDateTime; if (!pickerFrom.IsValidRange() || !pickerTo.IsValidRange()) { ShowError(GetString("general.errorinvaliddatetimerange")); return; } if ((fromDate > toDate) && (toDate != DateTimeHelper.ZERO_TIME)) { ShowError(GetString("analt.invalidinterval")); return; } String where = String.Empty; // Manage campaigns if (statCodeName == "campaigns") { string campaign = ValidationHelper.GetString(usCampaigns.Value, String.Empty); if (campaign == String.Empty) { ShowError(GetString("campaigns.pleaseselect")); return; } if (campaign == usCampaigns.AllRecordValue) { where = "(StatisticsCode='campaign' OR StatisticsCode LIKE 'campconversion;%')"; } else { where = " ((StatisticsCode='campaign' AND StatisticsObjectName ='" + SqlHelper.EscapeQuotes(campaign) + "') OR StatisticsCode LIKE 'campconversion;" + SqlHelper.EscapeLikeText(SqlHelper.EscapeQuotes(campaign)) + "')"; } } if ((statCodeName == "conversion") || statCodeName.StartsWithCSafe("singleconversion", true)) { String defaultWhere = "(StatisticsCode='conversion' OR StatisticsCode LIKE 'campconversion;%' OR StatisticsCode LIKE 'abconversion;%' OR StatisticsCode LIKE 'mvtconversion;%')"; if (!statCodeName.StartsWithCSafe("singleconversion", true)) { string conversion = ValidationHelper.GetString(ucConversions.Value, String.Empty); if (conversion == String.Empty) { ShowError(GetString("conversions.pleaseselect")); return; } if (conversion == usCampaigns.AllRecordValue) { where = defaultWhere; } else { String saveConv = SqlHelper.EscapeQuotes(conversion); where = String.Format("((StatisticsObjectName = '{0}') AND {1})", saveConv, defaultWhere); } } else { string[] arr = statCodeName.Split(';'); if (arr.Length == 2) { String saveConv = SqlHelper.EscapeQuotes(arr[1]); where = String.Format("((StatisticsObjectName = '{0}') AND {1})", saveConv, defaultWhere); } } } // Delete one campaign (set from url) if (statCodeName.StartsWithCSafe("singlecampaign", true)) { string[] arr = statCodeName.Split(';'); if (arr.Length == 2) { String campaign = arr[1]; where = "(StatisticsCode='campaign' AND StatisticsObjectName ='" + SqlHelper.EscapeQuotes(campaign) + "') OR StatisticsCode LIKE 'campconversion;" + SqlHelper.EscapeLikeText(SqlHelper.EscapeQuotes(campaign)) + "'"; } } // Ingore multilingual suffix (multilingual stats use the same data as "base" stats) if (statCodeName.ToLowerCSafe().EndsWithCSafe(MULTILINGUAL_SUFFIX)) { statCodeName = statCodeName.Remove(statCodeName.Length - MULTILINGUAL_SUFFIX.Length); } // Add where condition based on stat code name if (where == String.Empty) { where = "StatisticsCode LIKE '" + SqlHelper.EscapeLikeText(SqlHelper.EscapeQuotes(statCodeName)) + "'"; } // In case of any error - (this page don't allow deleting all statistics) if (where == String.Empty) { return; } // Stats for visitors needs special manipulation (it consist of two types // of statistics with different code names - new visitor and returning visitor) if (statCodeName.ToLowerCSafe() != HitLogProvider.VISITORS_FIRST) { StatisticsInfoProvider.RemoveAnalyticsDataAsync(fromDate, toDate, SiteContext.CurrentSiteID, where); } else { where = "(StatisticsCode = '" + HitLogProvider.VISITORS_FIRST + "' OR StatisticsCode ='" + HitLogProvider.VISITORS_RETURNING + "')"; StatisticsInfoProvider.RemoveAnalyticsDataAsync(fromDate, toDate, SiteContext.CurrentSiteID, where); } // Manage async delete info timeRefresh.Enabled = true; EnableControls(false); ReloadInfoPanel(); ViewState.Add("DeleterStarted", 1); }