Esempio n. 1
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!");
            }
        }
Esempio n. 2
0
 public FinestraRegistrazione()
 {
     InitializeComponent();
     InitializeMyControl();
     temp = new Utente();
 }