예제 #1
0
 public List <MessageDispatchInfoContract> GetMessagesSentToUser(IRetrieveMessageRequest messageRequest)
 {
     try
     {
         RetrieveMessageServiceBl retrieveMessageBL = new RetrieveMessageServiceBl();
         return(retrieveMessageBL.GetMessagesSentToUser(messageRequest));
     }
     catch (TokenValidationException exception)
     {
         WriteErrorLog("Encontered a token validation error getting messages set to user.", exception);
         ErrorContract error = new ErrorContract(exception.Message, StatusList.VALIDATION_ERROR);
         throw new FaultException <ErrorContract>(error);
     }
     catch (Exception exception)
     {
         WriteErrorLog("Error encountered when getting messages-sent-to-user.", exception);
         ErrorContract error = new ErrorContract(exception.Message, StatusList.PROCESS_ERROR);
         throw new FaultException <ErrorContract>(error);
     }
 }
예제 #2
0
        public List <MessageDispatchInfoContract> GetMessagesSentToUser(IRetrieveMessageRequest messageRequest)
        {
            ValidateAccessToken(messageRequest.UserCredentials);

            string username = messageRequest.Username;

            if (string.IsNullOrEmpty(username))
            {
                throw new ApplicationException("Username value passed is empty.");
            }

            User user = GetUserMatchingUsername(username);

            if (user == null)
            {
                throw new ApplicationException("Could not find a matching Username.");
            }

            WriteInfoLog(string.Format("Getting messages sent to user: {0};", username));
            return(MessagesSentToUser(user.Id, messageRequest.ReceiverEmailAddress));
        }
예제 #3
0
        public List <MessageDispatchInfoContract> GetMsgDispatchesBetweenSenderReceiver(IRetrieveMessageRequest messageRequest)
        {
            ValidateAccessToken(messageRequest.UserCredentials);

            string username = messageRequest.Username;

            if (string.IsNullOrEmpty(username))
            {
                throw new ApplicationException("Username value passed is empty.");
            }

            User user = GetUserMatchingUsername(username);

            if (user == null)
            {
                throw new ApplicationException("Could not find a matching Username.");
            }

            string infotext = string.Format("Getting message messageDispatches between sender: {0} and receiver: {1}.",
                                            messageRequest.SenderEmailAddress,
                                            messageRequest.ReceiverEmailAddress);

            WriteInfoLog(infotext);

            IMessageDispatchRepository dispatchRepo      = GetMessageDispatchRepository();
            List <MessageDispatch>     messageDispatches = dispatchRepo.GetDispatchesBetweenSenderReceiver(messageRequest.SenderEmailAddress,
                                                                                                           messageRequest.ReceiverEmailAddress,
                                                                                                           messageRequest.MessageIdThreshold,
                                                                                                           messageRequest.NumberOfMessages);
            List <MessageDispatchInfoContract> messageDispatchInfos = CreateDispatchInfoList(messageDispatches, user.Id);

            return(messageDispatchInfos);
        }
예제 #4
0
 public List <MessageDispatchInfoContract> GetMessageDipatchesBetweenSenderReceiver(IRetrieveMessageRequest messageRequest)
 {
     try
     {
         RetrieveMessageServiceBl retrieveMessageBL = new RetrieveMessageServiceBl();
         return(retrieveMessageBL.GetMsgDispatchesBetweenSenderReceiver(messageRequest));
     }
     catch (TokenValidationException exception)
     {
         WriteErrorLog("Encontered a token validation error getting messages between sender and receiver.", exception);
         ErrorContract error = new ErrorContract(exception.Message, StatusList.VALIDATION_ERROR);
         throw new FaultException <ErrorContract>(error);
     }
     catch (Exception exception)
     {
         WriteErrorLog("Error encountered when Getting-Message-Dispatches-Between-Sender-Receiver.", exception);
         ErrorContract error = new ErrorContract(exception.Message, StatusList.PROCESS_ERROR);
         throw new FaultException <ErrorContract>(error);
     }
 }