Exemplo n.º 1
0
        /// <summary>
        /// Retrieves list of EmailHistory objects from SqlCommand, after database query
        /// number of rows retrieved and returned depends upon the rows field value
        /// </summary>
        /// <param name="cmd">The command object to use for query</param>
        /// <param name="rows">Number of rows to process</param>
        /// <returns>A list of EmailHistory objects</returns>
        private EmailHistoryList GetList(SqlCommand cmd, long rows)
        {
            // Select multiple records
            SqlDataReader reader;
            long          result = SelectRecords(cmd, out reader);

            //EmailHistory list
            EmailHistoryList list = new EmailHistoryList();

            using ( reader )
            {
                // Read rows until end of result or number of rows specified is reached
                while (reader.Read() && rows-- != 0)
                {
                    EmailHistory emailHistoryObject = new EmailHistory();
                    FillObject(emailHistoryObject, reader);

                    list.Add(emailHistoryObject);
                }

                // Close the reader in order to receive output parameters
                // Output parameters are not available until reader is closed.
                reader.Close();
            }

            return(list);
        }
Exemplo n.º 2
0
        internal static EmailHistoryList getEmailHistoryList(HttpResponseMessage responce)
        {
            var emailHistoryList = new EmailHistoryList();
            var jsonObj          = JsonConvert.DeserializeObject <Dictionary <string, object> >(responce.Content.ReadAsStringAsync().Result);

            if (jsonObj.ContainsKey("email_history"))
            {
                var emailHistoryArray = JsonConvert.DeserializeObject <List <object> >(jsonObj["email_history"].ToString());
                foreach (var emailHistoryObj in emailHistoryArray)
                {
                    var emailHistory = new EmailHistory();
                    emailHistory = JsonConvert.DeserializeObject <EmailHistory>(emailHistoryObj.ToString());
                    emailHistoryList.Add(emailHistory);
                }
            }
            return(emailHistoryList);
        }
 internal static EmailHistoryList getEmailHistoryList(HttpResponseMessage responce)
 {
     var emailHistoryList = new EmailHistoryList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("email_history"))
     {
         var emailHistoryArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["email_history"].ToString());
         foreach(var emailHistoryObj in emailHistoryArray)
         {
             var emailHistory = new EmailHistory();
             emailHistory = JsonConvert.DeserializeObject<EmailHistory>(emailHistoryObj.ToString());
             emailHistoryList.Add(emailHistory);
         }
     }
     return emailHistoryList;
 }