Beispiel #1
0
        /// <summary>
        /// Metodo per il dettaglio di un corrispondente
        /// </summary>
        /// <param name="request"></param>
        /// <returns>Response</returns>

        public Services.AddressBook.GetCorrespondent.GetCorrespondentResponse GetCorrespondent(Services.AddressBook.GetCorrespondent.GetCorrespondentRequest request)
        {
            logger.Info("BEGIN");
            Services.AddressBook.GetCorrespondent.GetCorrespondentResponse response = Manager.AddressBookManager.GetCorrespondent(request);

            Utils.CheckFaultException(response);
            logger.Info("END");

            return(response);
        }
Beispiel #2
0
        public static Services.AddressBook.GetCorrespondent.GetCorrespondentResponse GetCorrespondent(Services.AddressBook.GetCorrespondent.GetCorrespondentRequest request)
        {
            Services.AddressBook.GetCorrespondent.GetCorrespondentResponse response = new Services.AddressBook.GetCorrespondent.GetCorrespondentResponse();

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

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

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

                if (string.IsNullOrEmpty(request.IdCorrespondent))
                {
                    //Id del corrispondente non presente
                    throw new PisException("REQUIRED_IDCORRESPONDENT");
                }

                DocsPaVO.utente.Corrispondente corr = BusinessLogic.Utenti.UserManager.getCorrispondenteBySystemID(request.IdCorrespondent);

                if ((corr == null) || (corr != null && string.IsNullOrEmpty(corr.systemId) && string.IsNullOrEmpty(corr.codiceRubrica)))
                {
                    bool rubricaComuneAbilitata = BusinessLogic.RubricaComune.Configurazioni.GetConfigurazioni(infoUtente).GestioneAbilitata;
                    if (rubricaComuneAbilitata)
                    {
                        corr = BusinessLogic.Utenti.UserManager.getCorrispondenteByCodRubricaRubricaComune(request.IdCorrespondent, infoUtente);
                    }

                    if (corr == null)
                    {
                        //Corrispondente non trovato
                        throw new PisException("CORRESPONDENT_NOT_FOUND");
                    }
                    else
                    {
                        corr.inRubricaComune = true;
                    }
                }
                else
                {
                    corr.inRubricaComune = false;
                }

                Domain.Correspondent corrResponse = Utils.GetCorrespondent(corr, infoUtente);
                response.Correspondent = corrResponse;

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