Exemple #1
0
        /// <summary>
        /// Metodo per la cancellazione di un corrispondente
        /// </summary>
        /// <param name="request"></param>
        /// <returns>Response</returns>

        public Services.AddressBook.DeleteCorrespondent.DeleteCorrespondentResponse DeleteCorrespondent(Services.AddressBook.DeleteCorrespondent.DeleteCorrespondentRequest request)
        {
            logger.Info("BEGIN");
            Services.AddressBook.DeleteCorrespondent.DeleteCorrespondentResponse response = Manager.AddressBookManager.DeleteCorrespondent(request);

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

            return(response);
        }
Exemple #2
0
        public static Services.AddressBook.DeleteCorrespondent.DeleteCorrespondentResponse DeleteCorrespondent(Services.AddressBook.DeleteCorrespondent.DeleteCorrespondentRequest request)
        {
            Services.AddressBook.DeleteCorrespondent.DeleteCorrespondentResponse response = new Services.AddressBook.DeleteCorrespondent.DeleteCorrespondentResponse();

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

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

                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.CorrespondentId))
                {
                    //Corrispondente non trovato
                    throw new PisException("REQUIRED_IDCORRESPONDENT");
                }

                DocsPaVO.utente.Corrispondente corr = BusinessLogic.Utenti.UserManager.getCorrispondenteBySystemIDDisabled(request.CorrespondentId);

                if (corr == null)
                {
                    //Corrispondente non trovato
                    throw new PisException("CORRESPONDENT_NOT_FOUND");
                }

                string message = string.Empty;

                bool result = BusinessLogic.Utenti.UserManager.DeleteCorrispondenteEsterno(request.CorrespondentId, 0, infoUtente, out message);

                if (result)
                {
                    response.Success = true;
                }
                else
                {
                    //Corrispondente non trovato
                    throw new PisException("CORRESPONDENT_NOT_FOUND");
                }
            }
            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);
        }