Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Rete"] != null)
            {
                if (!IsPostBack)
                {
                    this.Page.Header.Title = "NOTIZIE";
                    int numeroRete = int.Parse(Session["Rete"].ToString());

                    NotizieManager manager = new NotizieManager(DatabaseContext);

                    //var elencoNotizie = (from notizie in DatabaseContext.Notizias
                    //                        where notizie.Rete == numeroRete
                    //                        where notizie.DataFine >= DateTime.Today
                    //                        where notizie.DataCreazione <= DateTime.Today
                    //                        orderby notizie.DataCreazione
                    //                        select notizie.NumeroNotizia).Distinct();
                    DateTime dataOdierna   = DateTime.Now;
                    var      elencoNotizie = manager.GetActiveNewsIndexes(numeroRete, dataOdierna);

                    PosizioneLettura = 0;
                    if (elencoNotizie.Count() > 0)
                    {
                        NewsCollection       = elencoNotizie.ToArray();
                        panelNotizie.Visible = true;
                        ShowNotizia();
                    }
                    else
                    {
                        panelNotizie.Visible = false;
                    }
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ((SiteMaster)this.Page.Master).FindControl("NavigationMenu").Visible = false;
            if (!IsPostBack)
            {
                pageViews.SetActiveView(viewNotizia);
                long accountInfranto = (long)Session["AccountInfranto"];

                var account = (from personaggio in DatabaseContext.Personaggios
                               where personaggio.NumeroPG == accountInfranto
                               select personaggio).First();

                lblNomeProprietario.Text = account.Nome;
                if (account.Hacker.HasValue && account.Hacker > 1)
                {
                    livelloHacking = (long)account.Hacker;
                }
                else
                {
                    livelloHacking = 1;
                }

                //caricamento notizie
                int            numeroRete    = reteHack;
                NotizieManager manager       = new NotizieManager(DatabaseContext);
                var            elencoNotizie = manager.GetActiveNewsIndexes(numeroRete, DateTime.Now);

                if (elencoNotizie.Count() > 0)
                {
                    NewsCollection     = elencoNotizie.ToArray();
                    tblContent.Visible = true;
                }
                else
                {
                    tblContent.Visible = false;
                }
                PosizioneLettura = 0;
                ShowNotizia();
            }
        }