protected void Page_Load(object sender, EventArgs e) { PageTitle.TitleText = GetString("newsletter_issue_subscribersclicks.title"); linkId = QueryHelper.GetInteger("linkid", 0); if (linkId == 0) { RequestHelper.EndResponse(); } LinkInfo link = LinkInfoProvider.GetLinkInfo(linkId); EditedObject = link; IssueInfo issue = IssueInfoProvider.GetIssueInfo(link.LinkIssueID); EditedObject = issue; // Prevent accessing issues from sites other than current site if (issue.IssueSiteID != SiteContext.CurrentSiteID) { RedirectToResourceNotAvailableOnSite("Issue with ID " + link.LinkIssueID); } var where = new WhereCondition().Where("LinkID", QueryOperator.Equals, linkId); // Link's issue is the main A/B test issue if (issue.IssueIsABTest && !issue.IssueIsVariant) { // Get A/B test and its winner issue ID ABTestInfo test = ABTestInfoProvider.GetABTestInfoForIssue(issue.IssueID); if (test != null) { // Get ID of the same link from winner issue var winnerLink = LinkInfoProvider.GetLinks() .WhereEquals("LinkIssueID", test.TestWinnerIssueID) .WhereEquals("LinkTarget", link.LinkTarget) .WhereEquals("LinkDescription", link.LinkDescription) .TopN(1) .Column("LinkID") .FirstOrDefault(); if (winnerLink != null) { if (winnerLink.LinkID > 0) { // Add link ID of winner issue link where.Or(new WhereCondition().Where("LinkID", QueryOperator.Equals, winnerLink.LinkID)); } } } } where.And(new WhereCondition(fltOpenedBy.WhereCondition)); UniGrid.WhereCondition = where.WhereCondition; UniGrid.QueryParameters = where.Parameters; UniGrid.Pager.DefaultPageSize = PAGESIZE; UniGrid.Pager.ShowPageSize = false; UniGrid.FilterLimit = 1; UniGrid.OnExternalDataBound += UniGrid_OnExternalDataBound; }
protected void Page_Load(object sender, EventArgs e) { PageTitle.TitleText = GetString("newsletter_issue_subscribersclicks.title"); linkId = QueryHelper.GetInteger("linkid", 0); if (linkId == 0) { RequestHelper.EndResponse(); } LinkInfo link = LinkInfoProvider.GetLinkInfo(linkId); EditedObject = link; IssueInfo issue = IssueInfoProvider.GetIssueInfo(link.LinkIssueID); EditedObject = issue; // Prevent accessing issues from sites other than current site if (issue.IssueSiteID != SiteContext.CurrentSiteID) { RedirectToResourceNotAvailableOnSite("Issue with ID " + link.LinkIssueID); } var listingWhereCondition = new WhereCondition().WhereEquals("ClickedLinkNewsletterLinkID", linkId); // Link's issue is the main A/B test issue if (issue.IssueIsABTest && !issue.IssueIsVariant) { // Get A/B test and its winner issue ID ABTestInfo test = ABTestInfoProvider.GetABTestInfoForIssue(issue.IssueID); if (test != null) { // Get ID of the same link from winner issue var winnerLink = LinkInfoProvider.GetLinks() .WhereEquals("LinkIssueID", test.TestWinnerIssueID) .WhereEquals("LinkTarget", link.LinkTarget) .WhereEquals("LinkDescription", link.LinkDescription) .TopN(1) .Column("LinkID") .FirstOrDefault(); if (winnerLink != null) { if (winnerLink.LinkID > 0) { // Add link ID of winner issue link listingWhereCondition.Or(new WhereCondition().WhereEquals("ClickedLinkNewsletterLinkID", winnerLink.LinkID)); } } } } UniGrid.Pager.DefaultPageSize = PAGESIZE; UniGrid.Pager.ShowPageSize = false; UniGrid.FilterLimit = 1; fltOpenedBy.EmailColumn = "ClickedLinkEmail"; // Get click count by email UniGrid.DataSource = ClickedLinkInfoProvider.GetClickedLinks() .Columns( new QueryColumn("ClickedLinkEmail"), new AggregatedColumn(AggregationType.Count, null).As("ClickCount") ) .GroupBy("ClickedLinkEmail") .Where(listingWhereCondition) .And() .Where(fltOpenedBy.WhereCondition) .OrderByDescending("ClickCount") .Result; }
protected void Page_Load(object sender, EventArgs e) { CurrentMaster.Title.TitleText = GetString("newsletter_issue_subscribersclicks.title"); CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Newsletter/ViewParticipants.png"); linkId = QueryHelper.GetInteger("linkid", 0); if (linkId == 0) { RequestHelper.EndResponse(); } LinkInfo link = LinkInfoProvider.GetLinkInfo(linkId); EditedObject = link; IssueInfo issue = IssueInfoProvider.GetIssueInfo(link.LinkIssueID); EditedObject = issue; // Prevent accessing issues from sites other than current site if (issue.IssueSiteID != CMSContext.CurrentSiteID) { RedirectToResourceNotAvailableOnSite("Issue with ID " + link.LinkIssueID); } QueryDataParameters parameters = null; string where = string.Empty; // Link's issue is the main A/B test issue if (issue.IssueIsABTest && !issue.IssueIsVariant) { // Prepare base where condition where = "LinkID IN (" + link.LinkID.ToString(); // Get A/B test and its winner issue ID ABTestInfo test = ABTestInfoProvider.GetABTestInfoForIssue(issue.IssueID); if (test != null) { // Get ID of the same link from winner issue InfoDataSet <LinkInfo> winnerLink = LinkInfoProvider.GetLinks(string.Format("LinkIssueID={0} AND LinkTarget=N'{1}' AND LinkDescription=N'{2}'", test.TestWinnerIssueID, link.LinkTarget, link.LinkDescription), null, 1, "LinkID"); if (!DataHelper.DataSourceIsEmpty(winnerLink)) { string winnerLinkID = ValidationHelper.GetString(DataHelper.GetDataRowValue(winnerLink.Tables[0].Rows[0], "LinkID"), string.Empty); if (!string.IsNullOrEmpty(winnerLinkID)) { // Add link ID of winner issue link where += "," + winnerLinkID; } } } // Close where condition where += ")"; } else { // Filter by Link ID (from querystring) parameters = new QueryDataParameters(); parameters.Add("@LinkID", linkId); } UniGrid.QueryParameters = parameters; UniGrid.WhereCondition = SqlHelperClass.AddWhereCondition(fltOpenedBy.WhereCondition, where); UniGrid.Pager.DefaultPageSize = PAGESIZE; UniGrid.Pager.ShowPageSize = false; UniGrid.FilterLimit = 1; UniGrid.OnExternalDataBound += UniGrid_OnExternalDataBound; }