コード例 #1
0
        public SentMessageResponse GetSentSMS(
            DateTime dateTimeFrom,
            DateTime dateTimeTo,
            int skip,
            int take)
        {
            MessageSearchCriteria criteria = new MessageSearchCriteria()
            {
                DateTimeFrom = dateTimeFrom,
                DateTimeTo   = dateTimeTo,
                Skip         = skip,
                Take         = take
            };
            var messages = _dal.GetMessagesInRange(criteria).ToList();
            var response = new SentMessageResponse()
            {
                Messages      = messages,
                TotalMessages = messages.Count
            };

            return(response);
        }
コード例 #2
0
 private BatchSendFailException UnmarshallBatchSendError(XmlTextReader reader)
 {
     BatchSendFailException batchSendFailException = new BatchSendFailException();
     BatchSendErrorItem errorItem = null;
     SentMessageResponse responseItem = null;
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
             case XmlNodeType.Element:
                 switch (reader.LocalName)
                 {
                     case MNSConstants.XML_ELEMENT_ERROR_CODE:
                         if (errorItem == null)
                         {
                             errorItem = new BatchSendErrorItem();
                         }
                         errorItem.ErrorCode = reader.ReadElementContentAsString();
                         break;
                     case MNSConstants.XML_ELEMENT_ERROR_MESSAGE:
                         if (errorItem == null)
                         {
                             errorItem = new BatchSendErrorItem();
                         }
                         errorItem.ErrorMessage = reader.ReadElementContentAsString();
                         break;
                     case MNSConstants.XML_ELEMENT_MESSAGE_ID:
                         if (responseItem == null)
                         {
                             responseItem = new SentMessageResponse();
                         }
                         responseItem.MessageId = reader.ReadElementContentAsString();
                         break;
                     case MNSConstants.XML_ELEMENT_MESSAGE_BODY_MD5:
                         if (responseItem == null)
                         {
                             responseItem = new SentMessageResponse();
                         }
                         responseItem.MessageBodyMd5 = reader.ReadElementContentAsString();
                         break;
                 }
                 break;
             case XmlNodeType.EndElement:
                 if (reader.LocalName == MNSConstants.XML_ROOT_MESSAGE)
                 {
                     if (errorItem != null)
                     {
                         batchSendFailException.ErrorItems.Add(errorItem);
                         errorItem = null;
                     }
                     else if (responseItem != null)
                     {
                         batchSendFailException.SentMessageResponses.Add(responseItem);
                         responseItem = null;
                     }
                 }
                 break;
         }
     }
     reader.Close();
     return batchSendFailException;
 }
コード例 #3
0
        private BatchSendFailException UnmarshallBatchSendError(XmlTextReader reader)
        {
            BatchSendFailException batchSendFailException = new BatchSendFailException();
            BatchSendErrorItem     errorItem    = null;
            SentMessageResponse    responseItem = null;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    switch (reader.LocalName)
                    {
                    case MNSConstants.XML_ELEMENT_ERROR_CODE:
                        if (errorItem == null)
                        {
                            errorItem = new BatchSendErrorItem();
                        }
                        reader.Read();
                        errorItem.ErrorCode = reader.Value;
                        break;

                    case MNSConstants.XML_ELEMENT_ERROR_MESSAGE:
                        if (errorItem == null)
                        {
                            errorItem = new BatchSendErrorItem();
                        }
                        reader.Read();
                        errorItem.ErrorMessage = reader.Value;
                        break;

                    case MNSConstants.XML_ELEMENT_MESSAGE_ID:
                        if (responseItem == null)
                        {
                            responseItem = new SentMessageResponse();
                        }
                        reader.Read();
                        responseItem.MessageId = reader.Value;
                        break;

                    case MNSConstants.XML_ELEMENT_MESSAGE_BODY_MD5:
                        if (responseItem == null)
                        {
                            responseItem = new SentMessageResponse();
                        }
                        reader.Read();
                        responseItem.MessageBodyMd5 = reader.Value;
                        break;
                    }
                    break;

                case XmlNodeType.EndElement:
                    if (reader.LocalName == MNSConstants.XML_ROOT_MESSAGE)
                    {
                        if (errorItem != null)
                        {
                            batchSendFailException.ErrorItems.Add(errorItem);
                            errorItem = null;
                        }
                        else if (responseItem != null)
                        {
                            batchSendFailException.SentMessageResponses.Add(responseItem);
                            responseItem = null;
                        }
                    }
                    break;
                }
            }
            reader.Close();
            return(batchSendFailException);
        }