Ejemplo n.º 1
0
        public Sessione(string nomeSessione, GeneraChiavi gc)
        {
            this._nomeSessione = nomeSessione;
            this._dString      = gc.D.ToString();
            this._eString      = gc.E.ToString();
            this._nString      = gc.N.ToString();
            this._utente       = System.Environment.UserName;

            this._dBigI = gc.D;
            this._eBigI = gc.E;
            this._nBigI = gc.N;
        }
Ejemplo n.º 2
0
        private void _crea_Click(object sender, EventArgs e)
        {
            if (radioStandard.Checked)
            {
                if (!checkPubblicaDB.Checked)
                {
                    txtEmail.Text = "_null_";
                }

                gc   = new GeneraChiavi();
                addS = new Sessione(txtNomeSessione.Text, gc, txtEmail.Text);

                sCollection.Add(addS);

                if (checkPubblicaDB.Checked)
                {
                    sProvider.AddEntity(addS);
                }

                addS.AggiungiSessione(tabSessione, this, true);

                formSessione.Close();
                btnCancellaS.Enabled = true;

                writeConfig = new StreamWriter("config.cfg", true);
                writeConfig.WriteLine(addS.ToString());
                writeConfig.Dispose();
            }
            else if (radioCustom.Checked)
            {
                List <Sessione> listSessione = sProvider.GetEntityList();
                try
                {
                    string   pubb  = lstvBoxSessioni.SelectedItems[0].SubItems[2].Text;
                    string[] split = new string[2];
                    split = pubb.Split(',');

                    for (int i = 0; i < listSessione.Count; i++)
                    {
                        if (listSessione[i].NString == split[1])
                        {
                            listSessione[i].AggiungiSessione(tabSessione, this, false);
                            sCollection.Add(listSessione[i]);
                        }
                    }

                    formSessione.Close();
                    btnCancellaS.Enabled = true;

                    writeConfig = new StreamWriter("config.cfg", true);
                    writeConfig.WriteLine(sCollection[0].ToString());
                    writeConfig.Dispose();
                }
                catch (Exception ex)
                {
                    if (lstvBoxSessioni.SelectedItems.Count == 0)
                    {
                        DialogResult msgBox = MessageBox.Show("Errore", "Seleziona una Sessione Valida!");
                    }
                    else
                    {
                        DialogResult msgBox = MessageBox.Show("Connessione Assente", "Errore di connessione al database. Riconnettersi e riprovare.");
                        writeConfig.Dispose();
                        checkDBConnection.Text = String.Format("Connessione al Database: " + "Assente");
                        reConnect.Enabled      = true;
                    }
                }
            }
        }