コード例 #1
0
ファイル: SferaService.cs プロジェクト: gipasoft/Sfera
		public UtenteDTO VerificaUtente(string codiceAzienda, string username, string password, ComputerDTO computerInfo)
		{
            var windsorRep = new WindsorConfigRepository();
			try
			{
                var repo = new AziendaRepository();
				IWindsorContainer container;
                var utenteVerifica = repo.VerifyUser(codiceAzienda, username, password, computerInfo, out container);
				UtenteDTO utente = null;

				if (utenteVerifica != null)
				{
					utente = repo.GetUtenteById(utenteVerifica.Id, container);
					utente.IdAzienda = utenteVerifica.IdAzienda.GetValueOrDefault();
                    _log.InfoFormat("L'utente: {0} si è collegato.", utente.Username);
                    windsorRep.Commit();
                }
				else
				{
                    _log.InfoFormat("L'utente: {0} ha tentato il collegamento con la password: {1}", username, password);
				}

				return utente;
			}
			catch (Exception ex)
			{
				_log.ErrorFormat("Errore nel riconoscimento dell'utente - {0}", ex, Utility.GetMethodDescription());
				throw;
			}
		}