Esempio n. 1
0
        private void ShowNotizia()
        {
            if (PosizioneLettura < 0)
            {
                PosizioneLettura = 0;
            }
            if (PosizioneLettura >= NewsCollection.Length)
            {
                PosizioneLettura = NewsCollection.Length - 1;
            }
            if (PosizioneLettura < NewsCollection.Length)
            {
                long                 numNotizia       = NewsCollection[PosizioneLettura];
                NotizieManager       newsManager      = new NotizieManager(DatabaseContext);
                PersonaggiManagerNew characterManager = new PersonaggiManagerNew(DatabaseContext);
                //var notizia = (from notizie in DatabaseContext.Notizias
                //                where notizie.NumeroNotizia == numNotizia
                //                select notizie).First();
                Notizia notizia = newsManager.GetSingleNewsItem(numNotizia);
                //var persAutore = (from personaggio in DatabaseContext.Personaggios
                //                    where personaggio.NumeroPG == notizia.Autore
                //                    select personaggio).First();
                Personaggio persAutore = characterManager.GetCharacterByNumber(notizia.Autore.Value);
                lblAutore.Text        = persAutore.Nome;
                lblDataNotizia.Text   = notizia.DataCreazione.ToString();
                lblTitoloNotizia.Text = notizia.Titolo;
                lblTestoNotizia.Text  = notizia.Testo;

                //Ora imposto un'immagine di cronista a caso
                Random randomizer       = new Random();
                int    immagineCronista = randomizer.Next(1, 33);
                facePicture.ImageUrl = "~/Images/Volti/" + immagineCronista.ToString() + ".jpg";
            }
        }
Esempio n. 2
0
        public void OnHackedSuccess(long hackerAccount)
        {
            pageViews.SetActiveView(viewEditor);
            NotizieManager manager       = new NotizieManager(DatabaseContext);
            Notizia        elementToEdit = manager.GetSingleNewsItem(NewsCollection[PosizioneLettura]);

            txtOggetto.Text = elementToEdit.Titolo;
            txtTesto.Text   = elementToEdit.Testo;
        }
Esempio n. 3
0
        protected void btnInvia_Click(object sender, EventArgs e)
        {
            NotizieManager manager       = new NotizieManager(DatabaseContext);
            Notizia        elementToEdit = manager.GetSingleNewsItem(NewsCollection[PosizioneLettura]);

            manager.UpdateNews(elementToEdit.NumeroNotizia, txtOggetto.Text.Trim(), txtTesto.Text.Trim(), elementToEdit.DataCreazione, elementToEdit.DataFine, elementToEdit.Rete, elementToEdit.Autore.Value, elementToEdit.LivelloHacking);
            DatabaseContext.SaveChanges();
            pageViews.SetActiveView(viewNotizia);
            ShowNotizia();
        }
Esempio n. 4
0
        protected void btnModifica_Click(object sender, EventArgs e)
        {
            NotizieManager manager       = new NotizieManager(DatabaseContext);
            Notizia        elementToEdit = manager.GetSingleNewsItem(NewsCollection[PosizioneLettura]);

            hackControl.LivelloHacking         = elementToEdit.LivelloHacking;
            hackControl.IdentificatoreElemento = NewsCollection[PosizioneLettura];
            hackControl.Carica();
            pageViews.SetActiveView(viewHacking);
        }
Esempio n. 5
0
 private void grdNotizie_SelectionChanged(object sender, EventArgs e)
 {
     if (grdNotizie.SelectedRows.Count == 1)
     {
         long numeroMissione = (long)grdNotizie.SelectedRows[0].Cells["NumeroNotizia"].Value;
         using (databaseContext = CreateDatabaseContext())
         {
             NotizieManager       manager     = new NotizieManager(databaseContext);
             PersonaggiManagerNew charManager = new PersonaggiManagerNew(databaseContext);
             Notizia     singleNew            = manager.GetSingleNewsItem(numeroMissione);
             Personaggio autore = charManager.GetCharacterByNumber(singleNew.Autore.Value);
             txtTesto.Text  = "AUTORE: " + autore.Nome + "\r\n \r\n";
             txtTesto.Text += singleNew.Testo.Replace("<br />", "\r\n");
         }
     }
 }
Esempio n. 6
0
 private void LoadSingleNews()
 {
     if (numeroNotizia != null)
     {
         using (databaseContext = CreateDatabaseContext())
         {
             NotizieManager newsManager = new NotizieManager(databaseContext);
             Notizia        newsToEdit  = newsManager.GetSingleNewsItem(numeroNotizia.Value);
             txtOggetto.Text          = newsToEdit.Titolo;
             cmbAutore.SelectedValue  = newsToEdit.Autore;
             cmbFazione.SelectedValue = newsToEdit.Rete;
             txtTesto.Text            = newsToEdit.Testo.Replace("<br />", "\r\n");
             dtCreazione.Value        = newsToEdit.DataCreazione;
             dtFine.Value             = newsToEdit.DataFine;
             numHacking.Value         = newsToEdit.LivelloHacking;
         }
     }
 }