Exemplo n.º 1
0
 public void Save(Utente utente)
 {
     if (utente.Id != 0 && utente.Agenzia == null)
     {
         AgenziaRepository ar = new AgenziaRepository();
         utente.Agenzia = ar.GetAgenziaByIdUtente(utente.Id);
         UtenteRepository ur = new UtenteRepository();
         ur.Save(utente);
     }
 }
Exemplo n.º 2
0
 public void Delete(Utente utente)
 {
     using (var manager = new OperationManager())
     {
         try
         {
             manager.BeginOperation();
             base.delete<Utente>(utente);
             manager.CommitOperation();
             logger.Info("Utente {0} eliminato con successo", utente);
         }
         catch (Exception ex)
         {
             string message = "Errore nella cancellazione dell'utente";
             logger.ErrorException(message, ex);
             throw new Exception(message, ex);
         }
     }
 }
Exemplo n.º 3
0
 public DashBoardInfo(Utente utente)
 {
     Utente = utente;
     DettaglioAgenzia = new DettaglioAgenziaView(Utente.Agenzia);
 }
Exemplo n.º 4
0
 public ActionResult Registration(RegistrationView registration)
 {
     if (ModelState.IsValid)
     {
         if (!ReCaptcha.Validate(privateKey: ConfigurationManager.Configurator.Istance.recaptchaPublicKey))
         {
         }
         if (registration.Utente.Password.Equals(registration.UtenteRepeatPassword))
         {
             Agenzia agenzia = new Agenzia();
             agenzia.Nome = registration.Agenzia.Nome;
             agenzia.RagioneSociale = registration.Agenzia.RagioneSociale;
             agenzia.PIva = registration.Agenzia.PIva;
             agenzia.Email = registration.Agenzia.Email;
             ar.Save(agenzia);
             Utente utente = new Utente();
             utente.Nome = registration.Utente.Nome;
             utente.Cognome = registration.Utente.Cognome;
             utente.Username = registration.Utente.Username;
             utente.Email = registration.Utente.Email;
             utente.Agenzia = agenzia;
             var cryptedPassword = crypto.cryptPassword(registration.Utente.Password);
             utente.Password = cryptedPassword;
             ur.Save(utente);
             var message = ConfigurationManager.Configurator.Istance.mailBodyRegister;
             mh.SendMail(utente.Email, message);
             ViewBag.RedirectUrl = Url.Action("Index", "Home");
             return View("Redirect");
         }
     }
     return View(registration);
 }
Exemplo n.º 5
0
 public ActionResult ResetPassword(Utente u)
 {
     if (ModelState.IsValid)
     {
         var user = ur.GetByUsername(u.Username);
         if (user != null)
         {
             var newPassword = Membership.GeneratePassword(12, 0);
             user.Password = crypto.cryptPassword(newPassword);
             ur.Save(user);
             var message = ConfigurationManager.Configurator.Istance.mailBodyChangePassword.Replace("{password}", newPassword);
             mh.SendMail(u.Email, message);
         }
     }
     return View(u);
 }
Exemplo n.º 6
0
 public ActionResult ResetPassword()
 {
     Utente utente = new Utente();
     return View(utente);
 }
Exemplo n.º 7
0
 public MenuView(Utente utente)
 {
     Utente = utente;
     var mr = new MessaggioRepository();
     Messaggi = mr.GetMessaggiUnreadByDestinatario(utente.Id);
 }
Exemplo n.º 8
0
 public void RegistraPartecipazione(Viaggio viaggio, Utente utenteRichiedente)
 {
     try
     {
         Partecipazione richiestaPartecipazione = new Partecipazione()
             {
                 Viaggio = viaggio,
                 Utente = utenteRichiedente,
                 DataRichiesta = DateTime.Now
             };
         pr.Save(richiestaPartecipazione);
         logger.Info("L'azienda {0} ha registrato la sua partecipazione al viaggio {1}",
             utenteRichiedente.Agenzia, viaggio);
     }
     catch (Exception ex)
     {
         string msg = String.Format("Impossibile registrare la partecipazione al viaggio {0} da parte dell'agenzia {1}",
             viaggio, utenteRichiedente.Agenzia);
         logger.ErrorException(msg, ex);
         throw new Exception(msg, ex);
     }
 }
Exemplo n.º 9
0
 public ActionResult Create(Utente utente)
 {
     if (ModelState.IsValid)
     {
         var cryptyo = new CryptoHelper();
         utente.Password = cryptyo.cryptPassword(utente.Password);
         ur.Save(utente);
         return RedirectToAction("List");
     }
     return View(utente);
 }
Exemplo n.º 10
0
 public ActionResult Create()
 {
     Utente utente = new Utente();
     return View(utente);
 }
Exemplo n.º 11
0
 public ActionResult Edit(Utente utente)
 {
     if (ModelState.IsValid)
     {
         UtenteManager um = new UtenteManager();
         um.Save(utente);
         return RedirectToAction("List");
     }
     return View(utente);
 }
Exemplo n.º 12
0
 public void Save(Utente utente)
 {
     using (var manager = new OperationManager())
     {
         try
         {
             manager.BeginOperation();
             base.update<Utente>(utente);
             manager.CommitOperation();
             logger.Info("Dati dell'utente {0} salvati con successo", utente);
         }
         catch (Exception ex)
         {
             manager.RollbackOperation();
             string message = "Errore nel salvataggio dell'utente";
             logger.ErrorException(message, ex);
             throw new Exception(message, ex);
         }
     }
 }
Exemplo n.º 13
0
 public DettaglioUtenteView(Utente u, String s)
 {
     utente = u;
     search = s;
 }