예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int    id     = Convert.ToInt32(Context.User.Identity.Name);
                Utente utente = UtenteService.GetUtenteById(id);
                if (utente == null)
                {
                    utente                         = new Utente();
                    utente.Nome                    = "gigalollo";
                    utente.ImgProfilo              = "/Images/Users/User1.jpg";
                    utente.Password                = "******";
                    utente.Email                   = "*****@*****.**";
                    utente.DataRegistrazione       = System.DateTime.Now;
                    utente.DataUltimoAggiornamento = System.DateTime.Now;
                }

                UserProfile.ImageUrl = utente.ImgProfilo;
                UserName.Text        = utente.Nome;
                UserRegDate.Text     = utente.DataRegistrazione.ToString();

                //Ha creato Meme l'utente?
                //funzione per guardare restituisce true o false

                NoMemes.Visible = true;
                OkMemes.Visible = false;
            }
        }
예제 #2
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";
                }
            }
        }
예제 #3
0
 public int Save(Utente user)  //Restituisce 1 se l'operazione ha avuto successo, -1 se ha fallito
 {
     return(UtenteService.Save(user));
 }
예제 #4
0
 public int isExistingEmail(string mail) //Restituisce 1 se esiste, 0 se non esiste e -1 se c'è un errore
 {
     return(UtenteService.isExistingEmail(mail));
 }
예제 #5
0
 public Utente getUtenteById(int id)
 {
     return(UtenteService.GetUtenteById(id));
 }