Exemplo n.º 1
0
        protected void Update_Click(object sender, EventArgs e)
        {
            bool   mod    = false;
            int    id     = Convert.ToInt32(Context.User.Identity.Name);
            Utente utente = UtenteService.GetUtenteById(id);

            if (TextName.Text != "")
            {
                utente.Nome = TextName.Text;
                mod         = true;
            }
            if (TextEMail.Text != "")
            {
                utente.Email = TextEMail.Text;
                mod          = true;
            }
            if (TextPassword.Text != "")
            {
                utente.Password = TextPassword.Text;
                mod             = true;
            }
            if (mod == true)
            {
                utente.DataUltimoAggiornamento = System.DateTime.Now;
                int res = UtenteService.Save(utente);
                if (res == 1)
                {
                    OkMessage.Visible = true;
                    OkText.Text       = "Complimenti! Aggiornamento completato";
                }
                else if (res == -1)
                {
                    ErrorMessage.Visible = true;
                    FailureText.Text     = "Errore! Impossibile contattare il database";
                }
            }
        }
Exemplo n.º 2
0
 public int Save(Utente user)  //Restituisce 1 se l'operazione ha avuto successo, -1 se ha fallito
 {
     return(UtenteService.Save(user));
 }