protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (PreviousPage == null) { string subSection = IdSubSection.HasValue ? "&IdSubSection=" + IdSubSection : ""; Response.Redirect(ResolveUrl(string.Format("~/Series.aspx?idSeries={0}{1}{2}", IdSeries, subSection, (MyMaster.HistoryEnable ? "&history=" + MyMaster.StoricoEnabled : ""))), true); return; } 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); } var seriesName = new StringBuilder(SeriesWso.Name); if (IdSubSection.HasValue) { seriesName.AppendFormat(" - {0}", SeriesWso.DocumentSeriesSubsections.Single(ss => ss.Id == IdSubSection.Value).Description); } lblSeriesName.Text = seriesName.ToString(); uscSeriesGrid.Visible = !SeriesResultsByConstraintEnabled; uscSeriesGridConstraints.Visible = SeriesResultsByConstraintEnabled; // Salvo in ViewState il Finder dalla pagina precedente SerializedFinder = NoFilter ? SerializationHelper.SerializeToString(PreviousPage.BaseFinder) : SerializationHelper.SerializeToString(PreviousPage.Finder); RadScriptBlock.Visible = EnableHeaderComFixing; } }
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; } }
private void Initialize() { if (!MyMaster.StoricoEnabled && DateTime.Today >= ItemWso.RetireDate.GetValueOrDefault(DateTime.MaxValue)) { FileLogger.Error(LoggerName, String.Format("La registrazione [{0}] risulta ritirata il giorno {1}", ItemWso.Id, ItemWso.RetireDate.Value.ToString("dd/MM/yyyy"))); Response.Redirect("~/"); } MyMaster.SelectedFamily = MyMaster.GetFamilyBySeries(SeriesWso.Id); lblHeader.Text = SeriesWso.Name; lblYear.Text = ItemWso.Year.ToString(); tdSubject.InnerHtml = ItemWso.Subject.UrlToAnchor(); if (ItemWso.PublishingDate != null) { lblPublishingDate.Text = ItemWso.PublishingDate.Value.ToString("dd/MM/yyyy"); } if (ItemWso.LastChangedDate.HasValue) { lblLastChangedDate.Text = ItemWso.LastChangedDate.Value.ToString("dd/MM/yyyy"); } else { lblLastChangedDate.Text = ItemWso.PublishingDate.Value.ToString("dd/MM/yyyy"); } if (ItemWso.RetireDate.HasValue) { lblRetireDate.Text = ItemWso.RetireDate.Value.ToString("dd/MM/yyyy"); } 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); } DynamicRows.DataSource = ItemWso.DynamicData; DynamicRows.DataBind(); DocumentsRepeater.DataSource = ItemWso.MainDocs; DocumentsRepeater.DataBind(); AnnexedRepeater.DataSource = ItemWso.AnnexedDocs; AnnexedRepeater.DataBind(); pnlHeaderAnnexed.Visible = false; if (DocumentsHeaderLabel.Count > 0) { if (DocumentsHeaderLabel.ContainsKey("MainChain")) { lblMainDocuments.Text = DocumentsHeaderLabel["MainChain"]; } if (DocumentsHeaderLabel.ContainsKey("AnnexedChain") && !ItemWso.AnnexedDocs.IsNullOrEmpty()) { pnlHeaderAnnexed.Visible = true; lblAnnexed.Text = DocumentsHeaderLabel["AnnexedChain"]; } } if (ItemWso.MainDocs.Count == 0 && ItemWso.AnnexedDocs.Count == 0) { DocumentsPanel.Visible = false; } RadScriptBlock.Visible = EnableHeaderComFixing; }