protected void BindLatestItem() { RadGrid grid = GridPlaceHolder.FindControl(DocumentSeriesRadGrid.DefaultControlId) as RadGrid; if (grid == null) { return; } SethlPriorityHigh(false); DocumentSeriesItemResultWSO latestItemResult = SerializationHelper.SerializeFromString <DocumentSeriesItemResultWSO>(SerializedLatestSeriesResult); grid.DataSource = latestItemResult.DocumentSeriesItems; grid.CurrentPageIndex = 0; grid.AllowPaging = ShowAllItems; grid.VirtualItemCount = NumerOfItems(latestItemResult.TotalRowCount); grid.DataBind(); }
protected void BindPriority() { RadGrid grid = GridPlaceHolder.FindControl(DocumentSeriesRadGrid.DefaultControlId) as RadGrid; if (grid == null) { return; } SethlPriorityHigh(true); DocumentSeriesItemResultWSO priorityItemResult = SerializationHelper.SerializeFromString <DocumentSeriesItemResultWSO>(SerializedPriorityResult); grid.DataSource = priorityItemResult.DocumentSeriesItems; grid.CurrentPageIndex = 0; grid.AllowPaging = false; grid.VirtualItemCount = priorityItemResult.TotalRowCount; grid.DataBind(); }
private void Initialize() { string resultFinder = SerializationHelper.SerializeToString(Finder); btnAllPublishedSeries.PostBackUrl = string.Concat("SeriesGrid.aspx?idSeries=", IdSeries, "&noFilter=true", (MyMaster.HistoryEnable ? "&history=" + MyMaster.StoricoEnabled : "")); string seriesName = SeriesWso.Name; if (IdSubSection.HasValue) { seriesName = string.Concat(seriesName, " - ", SeriesWso.DocumentSeriesSubsections.Single(ss => ss.Id == IdSubSection.Value).Description); } if (ShowSeriesCountDetails) { if (SeriesPreviewConfiguration.PriorityEnabled && PrioritySeriesResultCount > 0) { lblSeriesName.Text = string.Format("{0} ({1} {2} di cui {3} in Primo Piano)", seriesName, TotalSeriesResultCount, TotalSeriesResultCount == 1 ? "elemento" : "elementi", PrioritySeriesResultCount); } else { lblSeriesName.Text = string.Format("{0} ({1} {2})", seriesName, TotalSeriesResultCount, TotalSeriesResultCount == 1 ? "elemento" : "elementi"); } } else { lblSeriesName.Text = seriesName.ToString(); } if (!String.IsNullOrEmpty(MyMaster.GoogleAnalyticsCode)) { AnalyticsReportService reportService = new AnalyticsReportService(MyMaster.GoogleReportingService); var dimensions = new List <Dimension> { new Dimension { Name = "ga:pagePath" } }; var metrics = new List <Metric> { new Metric { Expression = "ga:pageviews" } }; lblAnalyticsCounter.Visible = true; lblAnalyticsCounter.Text = "Numero di visite: " + reportService.GetVisitorsCount(HttpContext.Current.Request.Url.PathAndQuery, MyMaster.AnalyticsStartDate, MyMaster.AnalyticsIDView, dimensions, metrics); } DocumentSeriesHeader headerItem = Singleton.Instance.DocumentSeriesHeaders.SingleOrDefault(t => t.IdSeries.HasValue && t.IdSeries.Value.Equals(IdSeries)); if (IdSubSection.HasValue) { headerItem = Singleton.Instance.DocumentSeriesHeaders.SingleOrDefault(t => t.IdSeries.HasValue && t.IdSeries.Value.Equals(IdSeries) && t.IdSubSection.HasValue && t.IdSubSection.Value.Equals(IdSubSection.Value)); } lblHeader.Text = headerItem != null ? headerItem.Header : string.Empty; inYear.NumberFormat.DecimalDigits = 0; inYear.NumberFormat.GroupSeparator = string.Empty; dynamicDataPlaceHolder.Visible = !SimpleSearchEnable; btnSearchType.Visible = SimpleSearchEnable; btnSearchType.Text = "Ricerca avanzata"; btnAllPublishedSeries.Visible = !ShowAllItems; btnSearch.PostBackUrl = string.Format("{0}?IdSeries={1}{2}{3}", btnSearch.PostBackUrl, IdSeries, IdSubSection.HasValue ? "&IdSubSection=" + IdSubSection : "", (MyMaster.HistoryEnable ? "&history=" + MyMaster.StoricoEnabled : "")); var grid = GridPlaceHolder.FindControl(DocumentSeriesRadGrid.DefaultControlId) as RadGrid; switch (TotalSeriesResultCount) { case 0: pnlPreviewSeries.Visible = false; btnSearch.Enabled = OneDocumentSeriesItemEnable ? false : true; break; case 1: pnlPreviewSeries.Visible = true; btnSearch.Enabled = OneDocumentSeriesItemEnable ? false : true; string serializedItems = MyMaster.StoricoEnabled ? MyMaster.Client.SearchRetired(resultFinder, true) : MyMaster.Client.Search(resultFinder, true); MyMaster.Client.Close(); DocumentSeriesItemResultWSO items = SerializationHelper.SerializeFromString <DocumentSeriesItemResultWSO>(serializedItems); if (grid == null) { return; } grid.VirtualItemCount = TotalSeriesResultCount; hlLastModifiedSeries.Visible = false; hlPriority.Visible = false; lblLastModifiedSeries.Visible = false; lblPriority.Visible = false; DocumentSeriesItemWSO currentItem = items.DocumentSeriesItems.First(); pnlPreviewSeries.Visible = SeriesPreviewConfiguration.LatestSeriesEnabled || SeriesPreviewConfiguration.PriorityEnabled; if (SeriesPreviewConfiguration.LatestSeriesEnabled) { DateTime?lastUpdateDate = (currentItem.PublishingDate > currentItem.LastChangedDate || !currentItem.LastChangedDate.HasValue) ? currentItem.PublishingDate : currentItem.LastChangedDate; lblLastModifiedSeries.Visible = true; lblLastModifiedSeries.Text = string.Format("Informazioni recenti ({0:dd/MM/yyyy})", lastUpdateDate); } if (SeriesPreviewConfiguration.PriorityEnabled && currentItem.Priority.HasValue && currentItem.Priority.Value) { lblPriority.Visible = true; lblPriority.Text = "In Primo Piano"; } break; default: pnlPreviewSeries.Visible = SeriesPreviewConfiguration.PriorityEnabled || SeriesPreviewConfiguration.LatestSeriesEnabled; lblPriority.Visible = false; lblLastModifiedSeries.Visible = false; hlLastModifiedSeries.Visible = false; hlPriority.Visible = false; if (SeriesPreviewConfiguration.LatestSeriesEnabled) { DocumentSeriesItemResultWSO latestItemResult = SerializationHelper.SerializeFromString <DocumentSeriesItemResultWSO>(SerializedLatestSeriesResult); DocumentSeriesItemWSO latestItem = latestItemResult.DocumentSeriesItems.First(); DateTime?lastUpdateDate = (latestItem.PublishingDate > latestItem.LastChangedDate || !latestItem.LastChangedDate.HasValue) ? latestItem.PublishingDate : latestItem.LastChangedDate; hlLastModifiedSeries.Visible = true; hlLastModifiedSeries.Text = string.Format("Informazioni recenti ({0:dd/MM/yyyy})", lastUpdateDate); if ((!SeriesPreviewConfiguration.PriorityEnabled || PrioritySeriesResultCount == 0 || DefaultViewSeries == ViewSerieLatestSeries) && grid != null) { BindLatestItem(); } } if (SeriesPreviewConfiguration.PriorityEnabled && PrioritySeriesResultCount > 0) { // DocumentSeriesItemResultWSO priorityItems = SerializationHelper.SerializeFromString<DocumentSeriesItemResultWSO>(SerializedPriorityResult); hlPriority.Visible = true; hlPriority.Text = "In Primo Piano"; if (grid == null) { return; } if (DefaultViewSeries == ViewSeriePriority || DefaultViewSeries == "") { BindPriority(); } } break; } }