public void OnTopUrlsItemDataBound(Object Sender, RepeaterItemEventArgs args) { HtmlTableRow row = (HtmlTableRow)args.Item.FindControl("Row"); if (args.Item.ItemType == ListItemType.Item || args.Item.ItemType == ListItemType.AlternatingItem) { RequestUrlEntry entry = (RequestUrlEntry)args.Item.DataItem; row.Controls.Add(GetTextCell(entry.Rank.ToString(CultureInfo.CurrentUICulture), "center")); row.Controls.Add(GetTextCell(entry.RequestCount.ToString(CultureInfo.CurrentUICulture), "right")); row.Controls.Add(GetTextCell(entry.Percentage.ToString("0.##%", CultureInfo.CurrentUICulture), "right")); row.Controls.Add(GetTextCell(entry.Url, "left")); } }
private void LoadRequestData() { // Use ConfigAgent to get the month to view. ConfigAgent configAgent = ((IStateProcessor)Parent).ConfigAgent; RequestStatisticService service = (RequestStatisticService)Portal.API.Statistics.Statistic.GetService(typeof(RequestStatisticService)); RequestUrlData data = service.GetRequestUrlData(Context, configAgent.Month); data.TRequestUrl.DefaultView.Sort = data.TRequestUrl.RequestCountColumn.ColumnName + " DESC"; // Calculate the total logged requests. int totalRequests = 0; foreach (RequestUrlData.TRequestUrlRow row in data.TRequestUrl.Rows) { totalRequests += row.RequestCount; } List <RequestUrlEntry> entries = new List <RequestUrlEntry>(); int rank = 1; foreach (DataRowView rv in data.TRequestUrl.DefaultView) { RequestUrlData.TRequestUrlRow row = (RequestUrlData.TRequestUrlRow)rv.Row; RequestUrlEntry entry = new RequestUrlEntry(); entry.Rank = rank++; entry.RequestCount = row.RequestCount; entry.Percentage = (double)row.RequestCount / (double)totalRequests; entry.Url = row.Url; entry.Url = entry.Url.Substring(entry.Url.IndexOf('/') + 1); entry.Url = entry.Url.Substring(entry.Url.IndexOf('/') + 1); entry.Url = entry.Url.Substring(entry.Url.IndexOf('/')); entries.Add(entry); if (rank > 30) { break; } } labelMonthlyRequests.Text = string.Format(Language.GetText(Portal.API.Module.GetModuleControl(this), "monthlyRequestsTitle"), rank - 1, data.TRequestUrl.Rows.Count); repeaterTopUrls.DataSource = entries; repeaterTopUrls.DataBind(); }
private void LoadRequestData() { // Use ConfigAgent to get the month to view. ConfigAgent configAgent = ((IStateProcessor)Parent).ConfigAgent; RequestStatisticService service = (RequestStatisticService)Portal.API.Statistics.Statistic.GetService(typeof(RequestStatisticService)); RequestUrlData data = service.GetRequestUrlData(Context, configAgent.Month); data.TRequestUrl.DefaultView.Sort = data.TRequestUrl.RequestCountColumn.ColumnName + " DESC"; // Calculate the total logged requests. int totalRequests = 0; foreach (RequestUrlData.TRequestUrlRow row in data.TRequestUrl.Rows) { totalRequests += row.RequestCount; } List<RequestUrlEntry> entries = new List<RequestUrlEntry>(); int rank = 1; foreach (DataRowView rv in data.TRequestUrl.DefaultView) { RequestUrlData.TRequestUrlRow row = (RequestUrlData.TRequestUrlRow)rv.Row; RequestUrlEntry entry = new RequestUrlEntry(); entry.Rank = rank++; entry.RequestCount = row.RequestCount; entry.Percentage = (double)row.RequestCount / (double)totalRequests; entry.Url = row.Url; entry.Url = entry.Url.Substring(entry.Url.IndexOf('/')+1); entry.Url = entry.Url.Substring(entry.Url.IndexOf('/')+1); entry.Url = entry.Url.Substring(entry.Url.IndexOf('/')); entries.Add(entry); if (rank > 30) break; } labelMonthlyRequests.Text = string.Format(Language.GetText(Portal.API.Module.GetModuleControl(this), "monthlyRequestsTitle"), rank-1, data.TRequestUrl.Rows.Count); repeaterTopUrls.DataSource = entries; repeaterTopUrls.DataBind(); }