Example #1
0
        private readonly IGetCoordinateDistaccamento _getCooDistaccamento; //TODO chiedere ad Igor di implementare le coordinate

        public GetRichiesta(DbContext dbContext, IMapper mapper, IGetTipologieByCodice getTipologiaByCodice, IGetListaDistaccamentiByCodiceSede getAnagraficaDistaccamento,
                            MapperRichiestaAssistenzaSuSintesi mapperSintesi, IGetAlberaturaUnitaOperative getAlberaturaUnitaOperative,
                            IGetCoordinateDistaccamento getCooDistaccamento, IGetDistaccamentoByCodiceSedeUC getDistaccamentoUC)
        {
            _dbContext                   = dbContext;
            _mapper                      = mapper;
            _getTipologiaByCodice        = getTipologiaByCodice;
            _getAnagraficaDistaccamento  = getAnagraficaDistaccamento;
            _mapperSintesi               = mapperSintesi;
            _getAlberaturaUnitaOperative = getAlberaturaUnitaOperative;
            _getCooDistaccamento         = getCooDistaccamento;
            _getDistaccamentoUC          = getDistaccamentoUC;
        }
Example #2
0
 public NotificationModificaPartenza(IHubContext <NotificationHub> notificationHubContext,
                                     IGetAlberaturaUnitaOperative getAlberaturaUnitaOperative,
                                     IQueryHandler <BoxRichiesteQuery, BoxRichiesteResult> boxRichiesteHandler,
                                     IQueryHandler <BoxMezziQuery, BoxMezziResult> boxMezziHandler,
                                     IQueryHandler <BoxPersonaleQuery, BoxPersonaleResult> boxPersonaleHandler,
                                     IMapper mapper,
                                     IGetTipologieByCodice getTipologieByCodice,
                                     IGetUtenteById getUtenteById)
 {
     _getGerarchiaToSend     = new GetGerarchiaToSend(getAlberaturaUnitaOperative);
     _mapperSintesi          = new MapperRichiestaAssistenzaSuSintesi(mapper, getTipologieByCodice, getUtenteById);
     _notificationHubContext = notificationHubContext;
     _boxMezziHandler        = boxMezziHandler;
     _boxPersonaleHandler    = boxPersonaleHandler;
     _boxRichiesteHandler    = boxRichiesteHandler;
 }
Example #3
0
 public NotificationConfermaPartenze(IHubContext <NotificationHub> notificationHubContext,
                                     IQueryHandler <BoxRichiesteQuery, BoxRichiesteResult> boxRichiestehandler,
                                     IQueryHandler <BoxMezziQuery, BoxMezziResult> boxMezzihandler,
                                     IQueryHandler <BoxPersonaleQuery, BoxPersonaleResult> boxPersonalehandler,
                                     IQueryHandler <SintesiRichiesteAssistenzaMarkerQuery, SintesiRichiesteAssistenzaMarkerResult> sintesiRichiesteAssistenzaMarkerhandler,
                                     MapperRichiestaAssistenzaSuSintesi mapperSintesi,
                                     GetGerarchiaToSend getGerarchiaToSend, IGetDistaccamentoByCodiceSedeUC getDistaccamentoUC, IGetMezziInServizio getListaMezzi)
 {
     _getGerarchiaToSend     = getGerarchiaToSend;
     _getListaMezzi          = getListaMezzi;
     _notificationHubContext = notificationHubContext;
     _boxRichiestehandler    = boxRichiestehandler;
     _boxMezzihandler        = boxMezzihandler;
     _boxPersonalehandler    = boxPersonalehandler;
     _sintesiRichiesteAssistenzaMarkerhandler = sintesiRichiesteAssistenzaMarkerhandler;
     _mapperSintesi      = mapperSintesi;
     _getDistaccamentoUC = getDistaccamentoUC;
 }
 public NotificationConfermaPartenze(IHubContext <NotificationHub> notificationHubContext,
                                     IQueryHandler <BoxRichiesteQuery, BoxRichiesteResult> boxRichiestehandler,
                                     IQueryHandler <BoxMezziQuery, BoxMezziResult> boxMezzihandler,
                                     IQueryHandler <BoxPersonaleQuery, BoxPersonaleResult> boxPersonalehandler,
                                     IQueryHandler <SintesiRichiesteAssistenzaMarkerQuery, SintesiRichiesteAssistenzaMarkerResult> sintesiRichiesteAssistenzaMarkerhandler,
                                     IMapper mapper,
                                     IQueryHandler <SintesiRichiesteAssistenzaQuery, SintesiRichiesteAssistenzaResult> sintesiRichiesteHandler, IGetTipologieByCodice getTipologieByCodice, MapperRichiestaAssistenzaSuSintesi mapperSintesi)
 {
     _notificationHubContext = notificationHubContext;
     _boxRichiestehandler    = boxRichiestehandler;
     _boxMezzihandler        = boxMezzihandler;
     _boxPersonalehandler    = boxPersonalehandler;
     _sintesiRichiesteAssistenzaMarkerhandler = sintesiRichiesteAssistenzaMarkerhandler;
     _mapper = mapper;
     _sintesiRichiesteHandler = sintesiRichiesteHandler;
     _getTipologieByCodice    = getTipologieByCodice;
     _mapperSintesi           = mapperSintesi;
 }
        public async Task SendNotification(ConfermaPartenzeCommand conferma)
        {
            var        mapper = new MapperRichiestaAssistenzaSuSintesi(_mapper);
            const bool notificaChangeState = true;

            var richiesta = conferma.ConfermaPartenze.richiesta;
            var sintesi   = mapper.Map(richiesta);

            sintesi.Motivazione = sintesi.Descrizione;

            var boxRichiesteQuery     = new BoxRichiesteQuery();
            var boxMezziQuery         = new BoxMezziQuery();
            var boxPersonaleQuery     = new BoxPersonaleQuery();
            var sintesiRichiesteQuery = new SintesiRichiesteAssistenzaQuery();
            var sintesiRichiesteAssistenzaMarkerQuery = new SintesiRichiesteAssistenzaMarkerQuery();
            var boxInterventi      = _boxRichiestehandler.Handle(boxRichiesteQuery).BoxRichieste;
            var boxMezzi           = _boxMezzihandler.Handle(boxMezziQuery).BoxMezzi;
            var boxPersonale       = _boxPersonalehandler.Handle(boxPersonaleQuery).BoxPersonale;
            var sintesiRichieste   = _sintesiRichiesteHandler.Handle(sintesiRichiesteQuery).SintesiRichiesta;
            var listaSintesiMarker = _sintesiRichiesteAssistenzaMarkerhandler.Handle(sintesiRichiesteAssistenzaMarkerQuery).SintesiRichiestaMarker;

            conferma.ConfermaPartenze.Chiamata = sintesi;

            await _notificationHubContext.Clients.Group(conferma.ConfermaPartenze.CodiceSede).SendAsync("ModifyAndNotifySuccess", conferma.ConfermaPartenze);

            if (conferma.ConfermaPartenze.IdRichiestaDaSganciare != null)
            {
                conferma.ConfermaPartenze.Chiamata = sintesiRichieste.LastOrDefault(x => x.Codice == conferma.ConfermaPartenze.IdRichiesta);
                await _notificationHubContext.Clients.Group(conferma.ConfermaPartenze.CodiceSede).SendAsync("ModifyAndNotifySuccess", conferma.ConfermaPartenze);

                conferma.ConfermaPartenze.Chiamata = sintesiRichieste.LastOrDefault(x => x.Codice == conferma.ConfermaPartenze.IdRichiestaDaSganciare);
                await _notificationHubContext.Clients.Group(conferma.ConfermaPartenze.CodiceSede).SendAsync("ModifyAndNotifySuccess", conferma.ConfermaPartenze);
            }

            await _notificationHubContext.Clients.Group(conferma.ConfermaPartenze.CodiceSede).SendAsync("ChangeStateSuccess", notificaChangeState);

            await _notificationHubContext.Clients.Group(conferma.ConfermaPartenze.CodiceSede).SendAsync("NotifyGetBoxInterventi", boxInterventi);

            await _notificationHubContext.Clients.Group(conferma.ConfermaPartenze.CodiceSede).SendAsync("NotifyGetBoxMezzi", boxMezzi);

            await _notificationHubContext.Clients.Group(conferma.ConfermaPartenze.CodiceSede).SendAsync("NotifyGetBoxPersonale", boxPersonale);

            await _notificationHubContext.Clients.Group(conferma.ConfermaPartenze.CodiceSede).SendAsync("NotifyGetRichiestaMarker", listaSintesiMarker.LastOrDefault(marker => marker.CodiceRichiesta == sintesi.CodiceRichiesta));
        }
Example #6
0
        public List <SintesiRichiesta> GetListaSintesiRichieste(FiltroRicercaRichiesteAssistenza filtro)
        {
            var    mapper = new MapperRichiestaAssistenzaSuSintesi(_mapper);
            var    listaSintesiRichieste      = new List <SintesiRichiesta>();
            var    listaSintesiRichiesteVuota = new List <SintesiRichiesta>();
            var    listaRichiesteAssistenza   = new List <RichiestaAssistenza>();
            string filepath = CostantiJson.ListaRichiesteAssistenza;
            string json;

            using (StreamReader r = new StreamReader(filepath))
            {
                json = r.ReadToEnd();
            }

            var listaRichieste = JsonConvert.DeserializeObject <List <RichiestaAssistenzaDTO> >(json);

            if (listaRichieste != null)
            {
                foreach (RichiestaAssistenzaDTO richiesta in listaRichieste)
                {
                    richiesta.Id = richiesta.Codice;
                    listaRichiesteAssistenza.Add(MapperDTO.MapRichiestaDTOtoRichiesta(richiesta));
                }

                foreach (RichiestaAssistenza richiesta in listaRichiesteAssistenza)
                {
                    listaSintesiRichieste.Add(mapper.Map(richiesta));
                }

                listaSintesiRichieste = listaSintesiRichieste.OrderByDescending(x => x.Stato == Costanti.Chiamata)
                                        .ThenByDescending(x => x.PrioritaRichiesta)
                                        .ThenBy(x => x.IstanteRicezioneRichiesta)
                                        .ToList();

                return(listaSintesiRichieste);
            }

            return(listaSintesiRichiesteVuota);
        }
Example #7
0
 public GetListaSintesi(IMapper mapper, IGetTipologieByCodice getTipologieByCodice, MapperRichiestaAssistenzaSuSintesi mapperSintesi)
 {
     _mapper = mapper;
     _getTipologieByCodice = getTipologieByCodice;
     _mapperSintesi        = mapperSintesi;
 }