Example #1
0
 private void btnRimuoviInfezione_Click(object sender, EventArgs e)
 {
     if (grdMalattie.SelectedRows.Count == 1)
     {
         DialogResult res = MessageBox.Show("Vuoi rimuovere questa malattia dal personaggio?", "Sei sicuro?", MessageBoxButtons.YesNo);
         if (res == DialogResult.Yes)
         {
             long numeroPG    = (long)grdPersonaggi.SelectedRows[0].Cells["NumeroPG"].Value;
             long progressivo = (long)grdMalattie.SelectedRows[0].Cells["Progressivo"].Value;
             using (databaseContext = CreateDatabaseContext())
             {
                 InfezioniManager manager = new InfezioniManager(databaseContext);
                 bool             result  = manager.RemoveInfectionFromCharacter(numeroPG, progressivo);
                 if (result)
                 {
                     databaseContext.SaveChanges();
                     MessageBox.Show("Infezione eliminata correttamente");
                     LoadMalattie();
                 }
                 else
                 {
                     MessageBox.Show("C'è stato un errore nel salvataggio");
                     LoadMalattie();
                 }
             }
         }
     }
 }
Example #2
0
 private void LoadData()
 {
     if (cmbTipo.SelectedValue != null)
     {
         long tipoSelezionato = (long)cmbTipo.SelectedValue;
         using (context = CreateDatabaseContext())
         {
             ElementiBaseManager manager = new ElementiBaseManager(context);
             var elementsToShow          = manager.GetItemsForCombo();
             if (radItem.Checked)
             {
                 IQueryable <NewOggetti> filteredList = elementsToShow.OfType <NewOggetti>();
                 if (tipoSelezionato != -1)
                 {
                     filteredList = filteredList.Where(p => p.Tipo == tipoSelezionato);
                 }
                 grdElementi.DataSource = (from oggetti in filteredList
                                           select new { oggetti.Progressivo, oggetti.Nome, oggetti.Effetto, oggetti.Descrizione }).ToList();
             }
             else
             {
                 IQueryable <NewSostanze> filteredList = elementsToShow.OfType <NewSostanze>();
                 filteredList           = filteredList.Where(p => p.Tipo == tipoSelezionato);
                 grdElementi.DataSource = (from sostanze in filteredList
                                           select new { sostanze.Progressivo, sostanze.Nome, sostanze.ValoreEfficacia, sostanze.Effetto }).ToList();
             }
         }
     }
 }
Example #3
0
 private void btnModificaDisco_Click(object sender, EventArgs e)
 {
     if (grdDischi.SelectedRows.Count == 1)
     {
         DialogResult confirm = MessageBox.Show("Eliminare dalla stampa l'Holodisco/Datapad selezionato?", "Conferma", MessageBoxButtons.YesNo);
         if (confirm == DialogResult.Yes)
         {
             long codEvento = long.Parse(grdEventi.SelectedRows[0].Cells["Numero"].Value.ToString());
             long progDisco = long.Parse(grdDischi.SelectedRows[0].Cells["Progressivo"].Value.ToString());
             using (databaseContext = CreateDatabaseContext())
             {
                 EventiManagerNew manager = new EventiManagerNew(databaseContext);
                 bool             result  = manager.UpdateHolodiskCopiesToPrint(codEvento, progDisco, 0);
                 if (!result)
                 {
                     MessageBox.Show("Si è verificato un errore");
                 }
                 else
                 {
                     databaseContext.SaveChanges();
                 }
                 loadSubGrids();
             }
         }
     }
 }
Example #4
0
        protected void TimerTick(object sender, EventArgs e)
        {
            string code = txtCodice.Text.Trim();

            using (HolonetEntities context = new HolonetEntities())
            {
                var sostanze = (from substances in context.Sostanzes
                                where substances.CodiceSostanza == code
                                where substances.Tipo == 2
                                select substances);
                if (sostanze.Count() > 0)
                {
                    var sostanzaAnalizzata = sostanze.First();
                    //if (!enzimaAnalizzato.Infezione1Reference.IsLoaded)
                    //{
                    //    enzimaAnalizzato.Infezione1Reference.Load();
                    //}
                    lblRisultato.Text = sostanzaAnalizzata.Nome + ": " + sostanzaAnalizzata.Effetto + "<br/> Disponibilità: " + sostanzaAnalizzata.Disponibilita + "; Valore stimato: " + sostanzaAnalizzata.Costo + " crediti;<br/><br/> Valore efficacia: " + sostanzaAnalizzata.ValoreEfficacia + "<br/><br/> Modalità d'uso: " + sostanzaAnalizzata.ModoUso;
                }
                else
                {
                    lblRisultato.Text = "La Tossina non è presente negli archivi";
                }
            }

            Timer1.Enabled = false;
        }
Example #5
0
 private void btnStampa_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     if (grdOggetti.SelectedRows.Count > 0)
     {
         FolderBrowserDialog selectFolder = new FolderBrowserDialog();
         var res = selectFolder.ShowDialog();
         if (res == DialogResult.OK)
         {
             string path = selectFolder.SelectedPath;
             using (databaseContext = CreateDatabaseContext())
             {
                 OggettiManager manager = new OggettiManager(databaseContext);
                 List <long>    indexes = new List <long>();
                 for (int i = 0; i < grdOggetti.SelectedRows.Count; i++)
                 {
                     indexes.Add((long)grdOggetti.SelectedRows[i].Cells["Progressivo"].Value);
                 }
                 List <NewOggetti> itemsToPrint = manager.GetItemsFromNumbers(indexes).ToList <NewOggetti>();
                 if (itemsToPrint.Count == 1 && chkMultiplePrint.Checked)
                 {
                     for (int i = 1; i < 10; i++)
                     {
                         itemsToPrint.Add(itemsToPrint[0]);
                     }
                 }
                 CartelliniOggetto cartellini = new CartelliniOggetto(path + @"\" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", itemsToPrint);
                 cartellini.Save();
             }
             MessageBox.Show("Stampa avvenuta");
             OpenFolder(path);
         }
     }
     Cursor.Current = Cursors.Default;
 }
Example #6
0
        protected void lblTitolo_Click(object sender, EventArgs e)
        {
            PostaInArrivo elemento = null;

            using (HolonetEntities context = new HolonetEntities())
            {
                //Personaggio personaggioAttuale = (Personaggio)Session["Personaggio"];
                Personaggio personaggioAttuale = refCharacter;
                elemento = (from messaggio in context.PostaInArrivoes
                            where messaggio.NumeroMissione == NumeroMissione
                            where messaggio.NumeroPG == personaggioAttuale.NumeroPG
                            select messaggio).First();
                if (elemento != null)
                {
                    elemento.Letta = true;

                    if (!elemento.MissioneReference.IsLoaded)
                    {
                        elemento.MissioneReference.Load();
                        if (!elemento.Missione.PersonaggioReference.IsLoaded)
                        {
                            elemento.Missione.PersonaggioReference.Load();
                        }
                    }
                    context.SaveChanges();
                }
            }
            lblStatoLettura.Text = "Sì";
            ((IMessaggi)this.Page).MessaggioVisualizzato = elemento.Missione;
            ((IMessaggi)this.Page).IsInUscita            = false;
            ((IMessaggi)this.Page).MostraMessaggio();
        }
Example #7
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         using (databaseContext = CreateDatabaseContext())
         {
             AbilitaManager manager = new AbilitaManager(databaseContext);
             bool           res     = false;
             if (string.IsNullOrWhiteSpace(cdAttitudine))
             {
                 res = manager.InsertNewSkillgroup(txtCodice.Text.Trim().ToUpper(), txtNome.Text.Trim(), txtDescr.Text, (TipoAttitudine)cmbTipoLista.SelectedItem);
             }
             else
             {
                 res = manager.EditSkillGroup(cdAttitudine, txtNome.Text.Trim(), txtDescr.Text, (TipoAttitudine)cmbTipoLista.SelectedItem);
             }
             if (res)
             {
                 databaseContext.SaveChanges();
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Errore nel salvataggio, assicurarsi che il nome della lista non sia già in uso");
             }
         }
     }
 }
Example #8
0
        private void CaricaMessaggiInUscita()
        {
            listaMessaggiInviati.refCharacter = (Personaggio)Session["Personaggio"];
            listaMessaggiRicevuti.Visible     = false;
            listaMessaggiInviati.Visible      = true;

            Personaggio          character = (Personaggio)Session["Personaggio"];
            List <PostaInUscita> elenco;

            using (HolonetEntities context = new HolonetEntities())
            {
                var messaggiInUscita = (from messages in context.PostaInUscitas
                                        where messages.NumeroPG == character.NumeroPG
                                        where messages.Cancellata == false
                                        select messages).OrderByDescending(mexs => mexs.NumeroMissione);
                foreach (var messaggio in messaggiInUscita)
                {
                    if (!messaggio.MissioneReference.IsLoaded)
                    {
                        messaggio.MissioneReference.Load();
                    }
                }
                elenco = messaggiInUscita.ToList();
            }
            panMessage.Visible    = false;
            panCancellato.Visible = false;
            panSalvato.Visible    = false;

            //Passo l'elenco dei messaggi al controllo che creerà la lista visibile, e invoco il databind esplicito
            listaMessaggiInviati.Messaggi = elenco;
            listaMessaggiInviati.Carica();
        }
Example #9
0
        //protected void Page_PreInit(object sender, EventArgs e)
        //{
        //    if (Session["Tema"] != null)
        //    {
        //        Page.Theme = Session["Tema"].ToString();
        //    }
        //    else
        //    {
        //        Page.Theme = "TemaBlu";
        //    }
        //}

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LoggedCharacter != null)
                {
                    Personaggio currentCharacter     = (Personaggio)Session["Personaggio"];
                    Dictionary <long, string> elenco = new Dictionary <long, string>();
                    using (HolonetEntities context = new HolonetEntities())
                    {
                        var elencoRubrica = (from nominativi in context.Rubricas
                                             where nominativi.NumeroPG == currentCharacter.NumeroPG
                                             select nominativi);

                        foreach (var item in elencoRubrica)
                        {
                            elenco.Add(item.NumeroSalvato, item.NomeVisualizzato);
                        }
                    }
                    cmbNomiSalvati.DataValueField = "Key";
                    cmbNomiSalvati.DataTextField  = "Value";
                    cmbNomiSalvati.DataSource     = elenco;
                    cmbNomiSalvati.DataBind();
                }
            }
        }
Example #10
0
 private void btnInvia_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         long        mittente    = (long)cmbMittente.SelectedValue;
         List <long> destinatari = new List <long>();
         DateTime    dataInvio   = DateTime.Now;
         if (dtInvio.Value > DateTime.Now)
         {
             dataInvio = dtInvio.Value;
         }
         foreach (var item in lstDestinatari.SelectedItems)
         {
             destinatari.Add(((Personaggio)item).NumeroPG);
         }
         using (databaseContext = CreateDatabaseContext())
         {
             MessaggiManager manager = new MessaggiManager(databaseContext);
             bool            res     = manager.SendMessage(mittente, destinatari, txtOggetto.Text.Trim(), txtMessaggio.Text.Trim(), (long)numCrypt.Value, dataInvio);
             if (res)
             {
                 databaseContext.SaveChanges();
                 MessageBox.Show("Messaggio inviato");
                 this.Close();
             }
             else
             {
                 MessageBox.Show("C'è stato un errore durante l'invio");
             }
         }
     }
 }
Example #11
0
        protected void TimerTick(object sender, EventArgs e)
        {
            string code = txtCodice.Text.Trim();

            using (HolonetEntities context = new HolonetEntities())
            {
                var enzimas = (from enzimi in context.EnzimaInfeziones
                               where enzimi.Enzima == code
                               select enzimi);
                if (enzimas.Count() > 0)
                {
                    var enzimaAnalizzato = enzimas.First();
                    if (!enzimaAnalizzato.Infezione1Reference.IsLoaded)
                    {
                        enzimaAnalizzato.Infezione1Reference.Load();
                    }
                    lblRisultato.Text = enzimaAnalizzato.Infezione1.Nome + ": " + enzimaAnalizzato.Infezione1.Descrizione;
                }
                else
                {
                    lblRisultato.Text = "Impossibile identificare l'enzima.";
                }
            }

            Timer1.Enabled = false;
        }
Example #12
0
 private void LoadData()
 {
     dtInvio.Value = DateTime.Now;
     using (databaseContext = CreateDatabaseContext())
     {
         PersonaggiManagerNew characterManager = new PersonaggiManagerNew(databaseContext);
         lstDestinatari.DataSource   = characterManager.GetAllCharacters();
         lstDestinatari.SelectedItem = null;
         if (!originalMessage.HasValue)
         {
             cmbMittente.DataSource      = characterManager.GetAllCharacters();
             lstDestinatari.SelectedItem = null;
         }
         else
         {
             MessaggiManager messageManager    = new MessaggiManager(databaseContext);
             Missione        messaggio         = messageManager.GetSingleMessage(originalMessage.Value);
             var             mittentiPossibili = (from destinatari in messaggio.PostaInArrivoes
                                                  orderby destinatari.Personaggio.Nome
                                                  select destinatari.Personaggio).ToList();
             cmbMittente.DataSource       = mittentiPossibili;
             lstDestinatari.SelectedValue = messaggio.Personaggio.NumeroPG;
             txtOggetto.Text   = "Re: " + messaggio.Titolo;
             txtMessaggio.Text = "\r\n ---------- \r\n" + "Da: " + messaggio.Personaggio.Nome + "\r\nData: " + messaggio.DataCreazione + "\r\n" + messaggio.Testo.Replace("<br />", "\r\n").Replace("<br>", "\r\n");
         }
     }
 }
Example #13
0
        public void OnCrypting(long crypterLevel)
        {
            if (LoggedCharacter != null)
            {
                using (HolonetEntities context = new HolonetEntities())
                {
#warning dovrei salvarmi il codice per ricaricare il personaggio dal context, invece di ricaricarlo dalla sessione. Aggiustare!
                    Personaggio loadedCharacter = (Personaggio)Session["Personaggio"];

                    Personaggio currentCharacter = (from characters in context.Personaggios
                                                    where characters.NumeroPG == loadedCharacter.NumeroPG
                                                    select characters).First();

                    if (crypterLevel >= currentCharacter.LivelloCrittazione)
                    {
                        currentCharacter.LivelloCrittazione = crypterLevel;
                        currentCharacter.UltimaCrittazione  = DateTime.Now;
                        context.SaveChanges();
                    }
                    //int protection = 0;
                    //if (currentCharacter.Hacker.HasValue)
                    //{
                    //    protection += (int)currentCharacter.Hacker;
                    //}
                    //protection += (int)currentCharacter.LivelloCrittazione;
                    //lblLevel.Text = protection.ToString();
                    lblLevel.Text = currentCharacter.Protezione.ToString();
                }
                Page_Load(this, new EventArgs());
            }
        }
Example #14
0
        private void LoadData()
        {
            List <NewElementiDisponibilita> datasource = new List <NewElementiDisponibilita>();

            using (databaseContext = CreateDatabaseContext())
            {
                var listDisponibilita = from disp in databaseContext.NewElementiDisponibilitas
                                        orderby disp.Progressivo
                                        select disp;
                cmbDisponibilita.ValueMember   = "Progressivo";
                cmbDisponibilita.DisplayMember = "Descrizione";
                cmbDisponibilita.DataSource    = listDisponibilita;
                //datasource = listDisponibilita.ToList();

                var listTipi = from tipi in databaseContext.TipoSostanzes
                               orderby tipi.Progressivo
                               select tipi;
                cmbTipo.ValueMember   = "Progressivo";
                cmbTipo.DisplayMember = "Descrizione";
                cmbTipo.DataSource    = listTipi;

                cmbModoUso.DataSource = ModiUso.Lista();
            }
            //cmbDisponibilita.DataSource = datasource;
        }
Example #15
0
        protected void repeatMessage_ItemDataBound1(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PostaInUscita singleMessage = (PostaInUscita)e.Item.DataItem;

                //Recupero l'elenco dei destinatari
                StringBuilder destinatari = new StringBuilder();
                using (HolonetEntities context = new HolonetEntities())
                {
                    var receivers = (from ricevuti in context.PostaInArrivoes
                                     where ricevuti.NumeroMissione == singleMessage.NumeroMissione
                                     select ricevuti.Personaggio);
                    foreach (var item in receivers)
                    {
                        destinatari.Append(item.NumeroPG);
                        destinatari.Append(" - ");
                        destinatari.Append(item.Nome);
                        destinatari.Append(", ");
                    }
                }

                SingleSentMessageControl RepeatedElement = (SingleSentMessageControl)(e.Item.FindControl("singleMessageView"));

                RepeatedElement.refCharacter   = refCharacter;
                RepeatedElement.Destinatari    = destinatari.ToString();
                RepeatedElement.Titolo         = singleMessage.Missione.Titolo;
                RepeatedElement.NumeroMissione = singleMessage.NumeroMissione;

                RepeatedElement.Carica();
            }
        }
Example #16
0
        //Metodi per registrare i tentativi precedenti
        public static void RegistraHackingAccount(long account, long hacker, bool successo)
        {
            using (HolonetEntities context = new HolonetEntities())
            {
                long numeroTentativo = 0;

                var tentativiPrecedenti = (from trials in context.AccountHackings
                                           where trials.NumeroPGAccount == account
                                           where trials.NumeroPGHacker == hacker
                                           select trials.NumeroTentativo);
                if (tentativiPrecedenti.Count() > 0)
                {
                    long ultimoTentativo = tentativiPrecedenti.Max();
                    numeroTentativo = ultimoTentativo + 1;
                }

                AccountHacking tentativoDaRegistrare = new AccountHacking();
                tentativoDaRegistrare.NumeroPGAccount = account;
                tentativoDaRegistrare.NumeroPGHacker  = hacker;
                tentativoDaRegistrare.NumeroTentativo = numeroTentativo;
                tentativoDaRegistrare.Riuscito        = successo ? 1 : 0;
                tentativoDaRegistrare.DataTentativo   = DateTime.Now;

                context.AddToAccountHackings(tentativoDaRegistrare);
                context.SaveChanges();
            }
        }
Example #17
0
 private void grdGiorni_SelectionChanged(object sender, EventArgs e)
 {
     if (grdGiorni.SelectedRows.Count == 1)
     {
         DateTime data = (DateTime)grdGiorni.SelectedRows[0].Cells["DataGiorno"].Value;
         using (databaseContext = CreateDatabaseContext())
         {
             EventiManagerNew manager   = new EventiManagerNew(databaseContext);
             EventoGiorni     singleDay = manager.GetSingleDay(cdEvento, data);
             txtCosto.Text      = singleDay.CostoGiorno.ToString();
             mstxPunti.Text     = singleDay.PuntiAssegnati.ToString();
             dtOraInGioco.Value = singleDay.OraInGioco;
             dtOraFg.Value      = singleDay.OraFuoriGioco;
             EnableControls(true);
         }
     }
     else
     {
         txtCosto.Text      = string.Empty;
         mstxPunti.Text     = string.Empty;
         dtOraInGioco.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 0, 0);
         dtOraFg.Value      = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 0, 0);
         EnableControls(false);
     }
 }
Example #18
0
        //Metodi per controllare se l'hacking non è bloccato da tentativi precedenti
        public static bool AbilitatoHackingAccount(long numeroAccount, long hacker)
        {
            bool res = false;

            using (HolonetEntities context = new HolonetEntities())
            {
                var tentativi = (from t in context.AccountHackings
                                 where t.NumeroPGAccount == numeroAccount
                                 where t.NumeroPGHacker == hacker
                                 select t).OrderByDescending(tent => tent.DataTentativo);
                if (tentativi.Count() == 0)
                {
                    res = true;
                }
                else
                {
                    var tentativoRecente = tentativi.First();
                    if (DateTime.Now > ((DateTime)tentativoRecente.DataTentativo).AddMinutes(8))
                    {
                        res = true;
                    }
                    else
                    {
                        if (tentativoRecente.Riuscito == 1)
                        {
                            res = true;
                        }
                    }
                }
            }

            return(res);
        }
Example #19
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(txtCodice.Text))
     {
         MessageBox.Show("Il campo 'Nome del Datapad' è obbligatorio");
         return;
     }
     using (databaseContext = CreateDatabaseContext())
     {
         HoloDischiManager manager = new HoloDischiManager(databaseContext);
         bool res = false;
         if (originalDisk.HasValue)
         {
             res = manager.UpdateDisk(originalDisk.Value, txtCodice.Text, txtContenuto.Text, (long)numHacking.Value);
         }
         else
         {
             res = manager.InsertNewDisk(txtCodice.Text, txtContenuto.Text, (long)numHacking.Value);
         }
         if (res)
         {
             databaseContext.SaveChanges();
             MessageBox.Show("Salvataggio avvenuto correttamente");
             this.Close();
         }
         else
         {
             MessageBox.Show("Si è verificato un errore durante il salvataggio, verificare che non esista già un datapad con lo stesso nome");
         }
     }
 }
Example #20
0
        public static bool AbilitatoMissioneHacking(long missione, long hacker)
        {
            bool res = false;

            using (HolonetEntities context = new HolonetEntities())
            {
                var tentativi = (from t in context.MissioneHackings
                                 where t.NumeroMissione == missione
                                 where t.NumeroPG == hacker
                                 select t).OrderByDescending(tent => tent.DataTentativo);
                if (tentativi.Count() == 0)
                {
                    res = true;
                }
                else
                {
                    var tentativoRecente = tentativi.First();
                    if (tentativoRecente.DataTentativo < DateTime.Now.AddMinutes(8))
                    {
                        res = true;
                    }
                    else
                    {
                        if (tentativoRecente.Riuscito == 1)
                        {
                            res = true;
                        }
                    }
                }
            }

            return(res);
        }
Example #21
0
        //protected void Page_PreInit(object sender, EventArgs e)
        //{
        //    if (Session["Tema"] != null)
        //    {
        //        Page.Theme = Session["Tema"].ToString();
        //    }
        //    else
        //    {
        //        Page.Theme = "TemaBlu";
        //    }
        //}

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LoggedCharacter != null)
                {
                    Personaggio character = (Personaggio)Session["Personaggio"];
                    IQueryable <AbilitaPersonaggio> ricerca;
                    int CanUse = 0;
                    using (HolonetEntities context = new HolonetEntities())
                    {
                        ricerca = (from abilita in context.AbilitaPersonaggios
                                   where abilita.NumeroPG == character.NumeroPG
                                   where abilita.CdAbilita == 2
                                   select abilita);
                        CanUse = ricerca.Count();
                    }
                    if (CanUse <= 0)
                    {
                        Response.Redirect("~/Default.aspx");
                    }
                    else
                    {
                        Timer1.Interval = 30000;
                    }
                }
            }
        }
Example #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ((SiteMaster)this.Page.Master).FindControl("NavigationMenu").Visible = false;
            if (!IsPostBack)
            {
                long accountInfranto = (long)Session["AccountInfranto"];
                using (HolonetEntities context = new HolonetEntities())
                {
                    var account = (from personaggio in context.Personaggios
                                   where personaggio.NumeroPG == accountInfranto
                                   select personaggio).First();

                    lblNomeProprietario.Text = account.Nome;
                    livelloHacking           = account.Protezione;
                    //if (account.Hacker.HasValue && account.Hacker > 1)
                    //{
                    //    livelloHacking = (long)account.Hacker;
                    //}
                    //else
                    //{
                    //    livelloHacking = 1;
                    //}
                    //if (account.UltimaCrittazione.HasValue && account.UltimaCrittazione > DateTime.Now.AddHours(-3))
                    //{
                    //    livelloHacking += account.LivelloCrittazione;
                    //}
                }
            }
        }
Example #23
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         using (databaseContext = CreateDatabaseContext())
         {
             HoloDischiManager manager = new HoloDischiManager(databaseContext);
             bool res = false;
             if (numeroFile.HasValue)
             {
                 res = manager.UpdateFile(progressivoDisco, numeroFile.Value, txtNomeFile.Text, txtContenuto.Text, (long)numCrypt.Value);
             }
             else
             {
                 res = manager.InsertNewFile(progressivoDisco, txtNomeFile.Text, txtContenuto.Text, (long)numCrypt.Value);
             }
             if (res)
             {
                 databaseContext.SaveChanges();
                 MessageBox.Show("Salvataggio avvenuto correttamente");
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Si è verificato un errore durante il salvataggio, verificare che non esista già nel datapad un file con lo stesso nome");
             }
         }
     }
 }
Example #24
0
        private void LoadData()
        {
            using (context = CreateDatabaseContext())
            {
                PersonaggiManagerNew     manager     = new PersonaggiManagerNew(context);
                Personaggio              character   = manager.GetCharacterByNumber(numeroPg);
                List <Attitudine>        cmbSource   = new List <Attitudine>();
                IEnumerable <Attitudine> skillgroups = character.Attitudines;
                foreach (var lista in skillgroups)
                {
                    cmbSource.Add(lista);
                }
                AbilitaManager           skillManager = new AbilitaManager(context);
                IEnumerable <Attitudine> expansionGroups;
                if (character.Tipo == 0)
                {
                    expansionGroups = skillManager.GetSkillGroupFromType(DataAccessLayer.Enum.TipoAttitudine.Innesti);
                }
                else
                {
                    expansionGroups = skillManager.GetSkillGroupFromType(DataAccessLayer.Enum.TipoAttitudine.InnestiDroide);
                }
                foreach (var lista in expansionGroups)
                {
                    cmbSource.Add(lista);
                }
                cmbAttitudine.ValueMember   = "CdAttitudine";
                cmbAttitudine.DisplayMember = "Nome";
                cmbAttitudine.DataSource    = cmbSource;

                freePoints         = manager.GetFreeSkillpoints(numeroPg);
                txtFreePoints.Text = freePoints.ToString();
            }
        }
Example #25
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     if (grdElementi.SelectedRows.Count == 1)
     {
         using (context = CreateDatabaseContext())
         {
             long             progressivo  = (long)grdElementi.SelectedRows[0].Cells["Progressivo"].Value;
             decimal          copie        = numCopie.Value;
             EventiManagerNew eventManager = new EventiManagerNew(context);
             if (eventManager.UpdateElementsCopiesToPrint(codEvento.Value, progressivo, (int)copie))
             {
                 context.SaveChanges();
                 MessageBox.Show("Salvato numero di copie da stampare: " + (int)copie);
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Si è verificato un errore");
             }
         }
     }
     else
     {
         MessageBox.Show("Occorre selezionare un oggetto/sostanza e stabilirne il numero di copie");
     }
 }
Example #26
0
        private void btnSalva_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("Vuoi acquistare questa abilità?", "Sei sicuro?", MessageBoxButtons.YesNo);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                string cdAttitudine = cmbAttitudine.SelectedValue.ToString();
                long   cdAbilita    = (long)grdAbilita.SelectedRows[0].Cells["CdAbilita"].Value;
                long?  numAcquisti  = null;
                if (numVolte.Enabled)
                {
                    numAcquisti = (long)numVolte.Value;
                }
                using (context = CreateDatabaseContext())
                {
                    PersonaggiManagerNew characterManager = new PersonaggiManagerNew(context);
                    bool res = characterManager.AddSkillToCharacter(numeroPg, cdAbilita, numAcquisti, cdAttitudine, txtSpecifiche.Text.Trim());
                    if (res)
                    {
                        context.SaveChanges();
                        MessageBox.Show("Abilità acquistata");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Errore durante il salvataggio");
                    }
                }
            }
        }
Example #27
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         using (databaseContext = CreateDatabaseContext())
         {
             AbilitaManager manager = new AbilitaManager(databaseContext);
             long           costo   = long.Parse(mstxCosto.Text);
             bool           res     = false;
             if (!cdAbilita.HasValue)
             {
                 res = manager.InsertSkillToGroup(cdAttitudine, txtNome.Text.Trim(), txtDescr.Text, chkMultiAcquisto.Checked, costo, chkAvanzato.Checked);
             }
             else
             {
                 res = manager.EditSkill(cdAbilita.Value, txtNome.Text.Trim(), txtDescr.Text, chkMultiAcquisto.Checked, costo, chkAvanzato.Checked);;
             }
             if (res)
             {
                 databaseContext.SaveChanges();
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Errore nel salvataggio, assicurarsi che la lista non contenga un'abilità con lo stesso nome se la si sta inserendo nuova");
             }
         }
     }
 }
Example #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ((SiteMaster)this.Page.Master).FindControl("NavigationMenu").Visible = false;
            if (!IsPostBack)
            {
                txtAccountDaAprire.Attributes.Add("onkeypress", "return isNumberKey(event)");
                this.Page.Header.Title = "LOGIN";
                object obj  = Session["Rete"];
                int    rete = (int)obj;
                Dictionary <long, string> values = new Dictionary <long, string>();
                using (HolonetEntities context = new HolonetEntities())
                {
                    var accounts = (from people in context.Personaggios
                                    where people.Fazione == rete
                                    where people.Vivo == 1
                                    orderby people.NumeroPG
                                    select people);
                    foreach (var item in accounts)
                    {
                        values.Add(item.NumeroPG, item.Nome);
                    }
                }

                rptAccountRete.DataSource = values;
                rptAccountRete.DataBind();
            }
        }
Example #29
0
 private void btnAggiungi_Click(object sender, EventArgs e)
 {
     if (lstComponenti.SelectedItems.Count > 0)
     {
         DialogResult res = MessageBox.Show("Vuoi aggiungere questo elemento alla lista degli ingredienti?", "Sei sicuro?", MessageBoxButtons.YesNo);
         if (res == System.Windows.Forms.DialogResult.Yes)
         {
             using (context = CreateDatabaseContext())
             {
                 long           progressivoOggetto = (long)lstComponenti.SelectedValue;
                 OggettiManager manager            = new OggettiManager(context);
                 bool           res2 = manager.AddComponentToItem(progressivoOggettoPadre, progressivoOggetto);
                 if (res2)
                 {
                     context.SaveChanges();
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("C'è stato un errore, chiedi allo Zeno");
                 }
             }
         }
     }
 }
Example #30
0
 private void btnAggiungi_Click(object sender, EventArgs e)
 {
     if (lstInfezioni.SelectedItems.Count == 1 && numeroPG.HasValue)
     {
         DialogResult res         = MessageBox.Show("Vuoi aggiungere questa malattia al personaggio " + numeroPG.Value.ToString() + "?", "Sei sicuro?", MessageBoxButtons.YesNo);
         long         progressivo = (long)lstInfezioni.SelectedValue;
         if (res == System.Windows.Forms.DialogResult.Yes)
         {
             using (databaseContext = CreateDatabaseContext())
             {
                 InfezioniManager manager = new InfezioniManager(databaseContext);
                 bool             result  = manager.AddInfectionToCharacter(numeroPG.Value, progressivo);
                 if (result)
                 {
                     databaseContext.SaveChanges();
                     MessageBox.Show("Infezione aggiunta al personaggio");
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("C'è stato un problema durante il salvataggio");
                 }
             }
         }
     }
 }