Example #1
0
 public LogTransazione(AzioneUtente azioneUtente, Utente utente, string identificativo)
 {
     AzioneUtente = azioneUtente;
     Identificativo = identificativo;
     Utente = utente;
     Data = DateTime.Now;
 }
Example #2
0
 /// <summary>
 /// Crea un Log valido
 /// </summary>
 public LogTransazione(AzioneUtente azioneUtente, Computer computer, IpAddress clientIp, Utente utente, ComputerVersion version)
 {
     AzioneUtente = azioneUtente;
     Computer = computer;
     ClientIp = clientIp;
     Version = version;
     Utente = utente;
     Data = DateTime.Now;
 }
        public void SetUp()
        {
            _documentService = MockRepository.GenerateStub<IDocumentService>();
            _fileSystem = MockRepository.GenerateStub<IFileSystem>();

            const string str = "Documento Bolletta di Prova";
            _documentoSpesa = new byte[str.Length * sizeof(char)];
            Buffer.BlockCopy(str.ToCharArray(), 0, _documentoSpesa, 0, _documentoSpesa.Length);

            _fileSystem = MockRepository.GenerateStub<IFileSystem>();
            _fileSystem.Stub(x => x.ReadAllBytes(Arg<string>.Is.Anything)).Return(_documentoSpesa);

            IList<Spesa> listaSpese = new List<Spesa>();
            _utente = new Utente("PP");
            _logTransazione = new LogTransazione(AzioneUtente.TransazioneContabile, _utente, Guid.NewGuid().ToString());

            _azienda = new Azienda("PROV", "Prova") { ID = 1 };
            _condominio1 = new Condominio("Condominio 1", 31, 12, 2014, _azienda) { CodiceFiscale = "91138030373" };
            _annoGestionaleCondominio1 = new AnnoGestionale(_condominio1, 2014, 2014);
            _esercizioCondominio1 = new Esercizio(_condominio1, new DateTime(2014, 1, 1), new DateTime(2014, 12, 31), _annoGestionaleCondominio1, GestioneEsercizioEnum.Ordinario);

            _condominio2 = new Condominio("Condominio 2", 31, 12, 2014, _azienda) { CodiceFiscale = "90036640374" };
            _annoGestionaleCondominio2 = new AnnoGestionale(_condominio2, 2014, 2014);
            _esercizioCondominio2 = new Esercizio(_condominio2, new DateTime(2014, 1, 1), new DateTime(2014, 12, 31), _annoGestionaleCondominio2, GestioneEsercizioEnum.Ordinario);

            _persona = new Persona(TipoPersonaEnum.Fisica, "Mario", "Rossi", _azienda.ID, true);
            _fornitore = new Fornitore(_persona, _azienda.ID);

            _documentiBolletteDTO = buildDocumentoBolletteDTO();
            foreach (var documentoBollettaDTO in _documentiBolletteDTO)
            {
                var esercizio = _esercizioCondominio1;
                if (documentoBollettaDTO.CodiceFiscaleCliente == _condominio2.CodiceFiscale)
                    esercizio = _esercizioCondominio2;

                listaSpese.Add(new Spesa(_fornitore, esercizio, _logTransazione) { ID = documentoBollettaDTO.IdSpesa, NumeroDocumento = documentoBollettaDTO.NumeroDocumento, DataDocumento = documentoBollettaDTO.DataDocumento });
            }

            _daoFactory = MockRepository.GenerateStub<IDaoFactory>();

            _daoFactory.Stub(x => x.GetCondominioDao().GetByCodiceFiscale(_condominio1.CodiceFiscale)).Return(_condominio1);
            _daoFactory.Stub(x => x.GetCondominioDao().GetByCodiceFiscale(_condominio2.CodiceFiscale)).Return(_condominio2);

            _spesaDao = MockRepository.GenerateStub<ISpesaDao>();
            _documentoDao = MockRepository.GenerateStub<IDocumentoDao>();

            _daoFactory.Stub(x => x.GetSpesaDao()).Return(_spesaDao);
            _daoFactory.Stub(x => x.GetDocumentoDao()).Return(_documentoDao);

            foreach (var spesa in listaSpese)
                _spesaDao.Stub(x => x.Find(spesa.ID, false)).Return(spesa);

            _utenzaDocumentoService = MockRepository.GenerateMock<UtenzaDocumentoService>(_daoFactory, _documentService, _fileSystem);
        }
Example #4
0
        public void Save(UserOption options, string codice, Utente utente)
        {
            Gipasoft.Business.GestioneCondomini.Domain.Opzioni opzioni = _opzioniDao.GetByCodice(codice, utente);
            if (opzioni == null)
                opzioni = new Gipasoft.Business.GestioneCondomini.Domain.Opzioni(codice, utente);
            opzioni.ToolBarIcon = options.ToolbarIconType;
            opzioni.MenuIcon = options.MenuIconType;
            opzioni.CurrentStyle = options.CurrentStyle;
            opzioni.MouseOverActionMenuScomparsa = options.MouseOverMenuScomparsa;
            _opzioniDao.SaveOrUpdate(opzioni);

        }
Example #5
0
 public UserOption GetUserOptions(string codice, Utente utente)
 {
     Gipasoft.Business.GestioneCondomini.Domain.Opzioni opzioni = _opzioniDao.GetByCodice(codice, utente);
     if(opzioni == null)
         opzioni = _opzioniDao.GetByCodice("default", utente);
     if(opzioni == null)
         opzioni = _opzioniDao.GetByCodice("default", null);
     if (opzioni != null)
         return new UserOption(opzioni.ToolBarIcon, opzioni.MenuIcon, opzioni.CurrentStyle, opzioni.MouseOverActionMenuScomparsa);
     else
         return new UserOption(IconType.Default, IconType.Default, string.Empty, MouseOverAction.Fly);
 }
Example #6
0
        public LogTransazione AddLog(Utente utente, ComputerDTO computerDto, IpAddress clientIp, AzioneUtente azioneUtente)
        {
            try
            {
                var azienda = _daoFactory.GetAziendaDao().GetById(utente.AziendaID.GetValueOrDefault(), false);
                var version = new ComputerVersion
                {
                    FrameworkVersion = computerDto.FrameworkVersion,
                    FrameworkServicePack = computerDto.FrameworkServicePack,
                    OsBits = computerDto.OsBits,
                    OsEdition = computerDto.OsEdition,
                    OsName = computerDto.OsName,
                    OsServicePack = computerDto.OsServicePack,
                    OsVersionString = computerDto.OsVersionString,
                    ProcessorBits = computerDto.ProcessorBits
                };

                var computer = _daoFactory.GetComputerDao().GetByNomeAzienda(computerDto.ComputerName, azienda.ID);
                if (computer != null)
                {
                    computer.Version = version;
                    computer.UltimoLogin = DateTime.Now;
                    _daoFactory.GetComputerDao().SaveOrUpdate(computer);
                }
                else
                {
                    computer = new Computer(computerDto.ComputerName, version, azienda);
                    _daoFactory.GetComputerDao().SaveOrUpdate(computer);
                }
                
                var logTransazione = new LogTransazione(azioneUtente, computer, clientIp, utente, version);
                _daoFactory.GetLogTransazioneDao().SaveOrUpdate(logTransazione);
                return logTransazione;
            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Errore inaspettato durante log della transazione - {0} - azione:{1}", ex, Library.Utility.GetMethodDescription() ,azioneUtente);
                return null;
            }
        }
Example #7
0
        private UtenteDTO setUtenteDto(Utente utente)
        {
            var dto = new UtenteDTO
            {
                ID = utente.ID,
                Password = utente.Password,
                Username = utente.Username,
                Version = utente.Version,
                Ruolo = utente.Ruolo
            };

            if (utente.Referente != null)
            {
                dto.IdReferente = utente.Referente.ID;
                dto.IdPersona = utente.Referente.PersonaRiferimento.ID;
                dto.Cognome = utente.Referente.PersonaRiferimento.Cognome;
                dto.Nome = utente.Referente.PersonaRiferimento.Nome;
                dto.Sigla = utente.Referente.Sigla;

                var contatti = new ContattoCollection(utente.Referente.PersonaRiferimento.Contatti);
                var email = contatti.GetFirstContatto<Email>();
                if(email != null)
                    dto.Email = email.Valore;
            }
            else
            {
                dto.Sigla = utente.Sigla;
                dto.Cognome = utente.Cognome;
                dto.Nome = utente.Nome;
            }
            
            return dto;
        }
Example #8
0
 public Opzioni(string codice, Utente utente)
 {
     _codice = codice;
     _utente = utente;
 }