コード例 #1
0
        public MainWindow()
        {
            registrati = new gestioneFile();
            InitializeComponent();
            Biglietto temp    = new Biglietto("m", 12);
            Utente    utente1 = new Utente("Riccardo", "Camagni", " 18 / 29 / 0000", "miamael @gmail.com", "password", "123456", 10000, temp);

            registrati.registra(utente1);


            registrati.Salva();
            registrati.Carica();
        }
コード例 #2
0
        private void BtnCreaAcc_Click(object sender, RoutedEventArgs e)
        {
            string nometxt = txtNome.Text;

            string cognometxt = txtCognome.Text;
            string nome       = "";
            string cognome    = "";
            string nascita    = txtNascita.Text;
            string email      = txtEmail.Text;
            string password   = txtPassword.Password.ToString();
            string check      = txtConferma.Password.ToString();
            string codice     = txtFiscale.Text;
            float  saldo      = float.Parse(txtSaldo.Text);

            for (int i = 0; i < nometxt.Length; i++)
            {
                if (i == 0)
                {
                    nome = nome + nometxt.Substring(0, 1).ToUpper();
                }
                else
                {
                    nome = nome + nometxt.Substring(i, 1).ToLower();
                }
            }
            for (int i = 0; i < cognometxt.Length; i++)
            {
                if (i == 0)
                {
                    cognome = cognome + cognometxt.Substring(0, 1).ToUpper();
                }
                else
                {
                    cognome = cognome + cognometxt.Substring(i, 1).ToLower();
                }
            }


            bool viaLibera = true;

            if (password != check)
            {
                viaLibera = false;
            }

            if (viaLibera == true)
            {
                temp = new Utente(nome, cognome, nascita, email, password, codice, saldo, null);
                registrati1.registra(temp);
                MessageBox.Show("Registrato correttamente!");
                txtCognome.Text = "";
                txtConferma.Clear();
                txtEmail.Text   = "";
                txtFiscale.Text = "";
                txtNascita.Text = "";
                txtNome.Text    = "";
                txtSaldo.Text   = "";
                txtPassword.Clear();

                registrati1.Salva();
            }
            else
            {
                MessageBox.Show("Le password non coincidono!");
            }
        }