Example #1
0
        private static string[] GetElementiRubricaVeloce(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.rubrica.ParametriRicercaRubrica qco)
        {
            string[] listaTemp = null;
            DocsPaDB.Query_DocsPAWS.Rubrica query = new DocsPaDB.Query_DocsPAWS.Rubrica(infoUtente);
            ArrayList ers = query.GetElementiRubrica(qco);

            Mobile_RubricaSearchAgent SearchFilter = new Mobile_RubricaSearchAgent(infoUtente);

            if (SearchFilter != null)
            {
                SearchFilter.filtra_trasmissioni(qco, ref ers);
            }

            string tempStringElemento = null;

            if (ers.Count > 0 && ers != null)
            {
                listaTemp = new string[ers.Count];
            }

            for (int i = 0; i < ers.Count; i++)
            {
                DocsPaVO.rubrica.ElementoRubrica tempElement = (DocsPaVO.rubrica.ElementoRubrica)ers[i];

                //tempStringElemento = tempElement.descrizione + " (" + tempElement.codice + ")" + codRegTemp;
                tempStringElemento = tempElement.descrizione + "§" + tempElement.systemId + "§" + tempElement.tipo + "§" + tempElement.idPeople;
                listaTemp[i]       = tempStringElemento;
            }

            return(listaTemp);
        }
Example #2
0
        public static Services.AddressBook.SearchCorrespondents.SearchCorrespondentsResponse SearchCorrespondents(Services.AddressBook.SearchCorrespondents.SearchCorrespondentsRequest request)
        {
            Services.AddressBook.SearchCorrespondents.SearchCorrespondentsResponse response = new Services.AddressBook.SearchCorrespondents.SearchCorrespondentsResponse();

            try
            {
                DocsPaVO.utente.Utente     utente     = null;
                DocsPaVO.utente.InfoUtente infoUtente = null;

                //Inizio controllo autenticazione utente
                infoUtente = Utils.CheckAuthentication(request, "SearchCorrespondents");

                utente = BusinessLogic.Utenti.UserManager.getUtenteById(infoUtente.idPeople);
                if (utente == null)
                {
                    //Utente non trovato
                    throw new PisException("USER_NO_EXIST");
                }
                //Fine controllo autenticazione utente

                if (request.Filters == null || request.Filters.Length == 0)
                {
                    throw new PisException("REQUIRED_FILTER");
                }
                bool          idFromRC   = false;
                Domain.Filter filtroIDRC = (from filtro in request.Filters where (filtro != null && !string.IsNullOrEmpty(filtro.Name) && filtro.Name.ToUpper() == "EXTRACT_ID_COMMONADDRESSBOOK") select filtro).FirstOrDefault();
                if (filtroIDRC != null && filtroIDRC.Value.ToUpper() == "TRUE")
                {
                    idFromRC = true;
                }
                //Chiamata al metodo CheckFilterType(request.Filters)
                Utils.CheckFilterTypes(request.Filters);

                DocsPaVO.rubrica.ParametriRicercaRubrica qco = Utils.GetParametriRicercaRubricaFromPis(request.Filters, infoUtente);

                BusinessLogic.Rubrica.DPA3_RubricaSearchAgent corrSearcher = new BusinessLogic.Rubrica.DPA3_RubricaSearchAgent(infoUtente);

                // DocsPaDB.Query_DocsPAWS.Rubrica query = new DocsPaDB.Query_DocsPAWS.Rubrica(infoUtente);
                DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica = new DocsPaVO.rubrica.SmistamentoRubrica();
                ArrayList objElementiRubrica = corrSearcher.Search(qco, smistamentoRubrica);
                //ArrayList objElementiRubrica = query.GetElementiRubrica(qco);


                Domain.Correspondent[] correspondentsRespone = null;

                if (objElementiRubrica != null && objElementiRubrica.Count > 0)
                {
                    correspondentsRespone = new Domain.Correspondent[objElementiRubrica.Count];
                    for (int i = 0; i < objElementiRubrica.Count; i++)
                    {
                        Domain.Correspondent             userTemp        = new Domain.Correspondent();
                        DocsPaVO.rubrica.ElementoRubrica elementoRubrica = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]);

                        userTemp.Id          = elementoRubrica.systemId;
                        userTemp.Description = elementoRubrica.descrizione;
                        userTemp.Code        = elementoRubrica.codice;
                        userTemp.Name        = elementoRubrica.nome;
                        userTemp.Surname     = elementoRubrica.cognome;
                        userTemp.NationalIdentificationNumber = elementoRubrica.cf_piva;
                        userTemp.IsCommonAddress = elementoRubrica.isRubricaComune;
                        userTemp.Type            = (elementoRubrica.interno ? "I" : "E");
                        if (!String.IsNullOrEmpty(elementoRubrica.tipo))
                        {
                            userTemp.CorrespondentType = elementoRubrica.tipo;
                        }

                        if (idFromRC && string.IsNullOrEmpty(elementoRubrica.systemId))
                        {
                            DocsPaVO.utente.Corrispondente userTemp2 = BusinessLogic.Utenti.UserManager.getCorrispondenteByCodRubricaRubricaComune(elementoRubrica.codice, infoUtente);
                            userTemp.Id = userTemp2.systemId;
                        }


                        correspondentsRespone[i] = userTemp;
                    }
                    response.Correspondents = correspondentsRespone;
                }
                else
                {
                    //throw new PisException("CORRESPONDENTS_NOT_FOUND");
                    correspondentsRespone   = new Domain.Correspondent[0];
                    response.Correspondents = correspondentsRespone;
                }

                response.Success = true;
            }
            catch (PisException pisEx)
            {
                logger.ErrorFormat("PISException: {0}, {1}", pisEx.ErrorCode, pisEx.Description);
                response.Error = new Services.ResponseError
                {
                    Code        = pisEx.ErrorCode,
                    Description = pisEx.Description
                };

                response.Success = false;
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Eccezione Generica: APPLICATION_ERROR, {0}", ex.Message);
                response.Error = new Services.ResponseError
                {
                    Code        = "APPLICATION_ERROR",
                    Description = ex.Message
                };

                response.Success = false;
            }

            return(response);
        }