コード例 #1
0
 protected override void OnLoad(EventArgs e)
 {
     MyMaster.SelectedFamily = MyMaster.GetFamilyBySeries(SeriesWso.Id);
     base.OnLoad(e);
 }
コード例 #2
0
        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;
        }