Esempio n. 1
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);
        }
Esempio n. 2
0
        public static Services.AddressBook.SearchUsers.SearchUsersResponse SearchUsers(Services.AddressBook.SearchUsers.SearchUsersRequest request)
        {
            Services.AddressBook.SearchUsers.SearchUsersResponse response = new Services.AddressBook.SearchUsers.SearchUsersResponse();
            try
            {
                DocsPaVO.utente.Utente     utente     = null;
                DocsPaVO.utente.InfoUtente infoUtente = null;

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

                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");
                }

                //Chiamata al metodo CheckFilterType(request.Filters)
                Utils.CheckFilterTypes(request.Filters);

                //Filtri ricerca rubrica
                DocsPaVO.rubrica.ParametriRicercaRubrica      qco = new DocsPaVO.rubrica.ParametriRicercaRubrica();
                BusinessLogic.Rubrica.DPA3_RubricaSearchAgent ccs = new BusinessLogic.Rubrica.DPA3_RubricaSearchAgent(infoUtente);
                DocsPaVO.rubrica.SmistamentoRubrica           smistamentoRubrica = new DocsPaVO.rubrica.SmistamentoRubrica();
                qco.caller          = new DocsPaVO.rubrica.ParametriRicercaRubrica.CallerIdentity();
                qco.caller.IdUtente = infoUtente.idPeople;
                qco.caller.IdRuolo  = infoUtente.idGruppo;
                qco.caller.filtroRegistroPerRicerca = null;
                qco.doUtenti = true;
                qco.calltype = DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_PROTO_IN;
                //

                bool filterFound = false;

                foreach (VtDocsWS.Domain.Filter fil in request.Filters)
                {
                    if (fil != null && !string.IsNullOrEmpty(fil.Value))
                    {
                        if (fil.Name.ToUpper().Equals("NATIONAL_IDENTIFICATION_NUMBER"))
                        {
                            filterFound = true;
                            qco.cf_piva = fil.Value;
                        }
                        if (fil.Name.ToUpper().Equals("USER_MAIL"))
                        {
                            filterFound = true;
                            qco.email   = fil.Value;
                        }
                        if (fil.Name.ToUpper().Equals("USER_NAME"))
                        {
                            filterFound     = true;
                            qco.descrizione = fil.Value;
                        }
                        if (fil.Name.ToUpper().Equals("USER_SURNAME"))
                        {
                            filterFound     = true;
                            qco.descrizione = fil.Value;
                        }

                        if (!filterFound)
                        {
                            throw new PisException("FILTER_NOT_FOUND");
                        }
                    }
                }
                Domain.User[] userResponse = null;

                ArrayList objElementiRubrica = ccs.Search(qco, smistamentoRubrica);

                if (objElementiRubrica != null && objElementiRubrica.Count > 0)
                {
                    userResponse = new Domain.User[objElementiRubrica.Count];
                    for (int i = 0; i < objElementiRubrica.Count; i++)
                    {
                        Domain.User userTemp = new Domain.User();
                        userTemp.Id          = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).idPeople;
                        userTemp.Description = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).descrizione;
                        userTemp.UserId      = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).codice;
                        userTemp.Name        = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).nome;
                        userTemp.Surname     = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).cognome;
                        userTemp.NationalIdentificationNumber = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).cf_piva;
                        userResponse[i] = userTemp;
                    }
                    response.Users = userResponse;
                }
                else
                {
                    //throw new PisException("USERS_NOT_FOUND");
                    userResponse   = new Domain.User[0];
                    response.Users = userResponse;
                }

                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);
        }
Esempio n. 3
0
        //public abstract ArrayList SearchForCorr(string codice, DocsPaVO.rubrica.SmistamentoRubrica smistaRubrica);

        /// <summary>
        /// Restituisce un singolo elemento dato il codice rubrica
        /// </summary>
        /// <param name="codice">Il codice rubrica associato all'elemento da cercare</param>
        /// <param name="smistamentoRubrica">Oggetto necessario a contenele le informazioni
        /// per filtrare o meno le informazioni relative allo smistamento</param>
        /// <returns>Un'istanza della classe <see cref="DocsPaVO.rubrica.ElementoRubrica">ElementoRubrica</see>
        /// contenente i dati dell'elemento trovato oppure null</returns>
        public abstract DocsPaVO.rubrica.ElementoRubrica SearchSingle(string codice, DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica, string condRegistri);
Esempio n. 4
0
 /// <summary>
 /// Il metodo principale per l'esecuzione delle ricerche
 /// </summary>
 /// <param name="ParametriRicerca">Un'istanza della classe <see cref="DocsPaVo.rubrica.ParametriRicercaRubrica"/>
 /// contenente i parametri di ricerca</param>
 /// <returns>Un <see cref="System.Collections.ArrayList">ArrayList</see> contenente il risultato</returns>
 /// <remarks>
 /// <para>
 /// Le classi che implementano questo metodo devono restituire un
 /// <see cref="System.Collections.ArrayList">ArrayList</see> contenente i
 /// risultati della ricerca. </para>
 /// Ogni elemento restituito è un'istanza della classe
 /// <see cref="DocsPaVO.rubrica.ElementoRubrica">ElementoRubrica</see>
 /// </remarks>
 public abstract ArrayList SearchPaging(DocsPaVO.rubrica.ParametriRicercaRubrica ParametriRicerca, DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica, int firstRowNum, int maxRowForPage, out int totale);
Esempio n. 5
0
 /// <summary>
 /// Il metodo principale per l'esecuzione delle ricerche
 /// </summary>
 /// <param name="ParametriRicerca">Un'istanza della classe <see cref="DocsPaVo.rubrica.ParametriRicercaRubrica"/>
 /// contenente i parametri di ricerca</param>
 /// <returns>Un <see cref="System.Collections.ArrayList">ArrayList</see> contenente il risultato</returns>
 /// <remarks>
 /// <para>
 /// Le classi che implementano questo metodo devono restituire un
 /// <see cref="System.Collections.ArrayList">ArrayList</see> contenente i
 /// risultati della ricerca. </para>
 /// Ogni elemento restituito è un'istanza della classe
 /// <see cref="DocsPaVO.rubrica.ElementoRubrica">ElementoRubrica</see>
 /// </remarks>
 public abstract ArrayList Search(DocsPaVO.rubrica.ParametriRicercaRubrica ParametriRicerca, DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica);
Esempio n. 6
0
 public abstract ArrayList GetRootItems(DocsPaVO.addressbook.TipoUtente tipoIE, DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica);
Esempio n. 7
0
 /// <summary>
 /// Restituisce la gerarchia dell'elemento selezionato
 /// </summary>
 /// <param name="codice">Il codice dell'elemento rubrica</param>
 /// <returns>Le classi che implementano questo metodo devono
 /// restituire un <see cref="System.Collections.ArrayList">ArrayList</see>
 /// contenente gli elementi della catena gerarchica che dall'elemento
 /// di più alto livello arriva all'elemento il cui codice
 /// è stato indicato come parametro. Gli elementi restituiti sono
 /// altrettante istanza della classe
 /// <see cref="DocsPaVO.rubrica.ElementoRubrica">ElementoRubrica</see>
 /// e sono ordinati all'interno dell'ArrayList dal più alto in grado
 /// al più in basso.</returns>
 public abstract ArrayList GetHierarchy(string codice, DocsPaVO.addressbook.TipoUtente tipoIE, DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica);