Пример #1
0
        public override Dictionary <Guid, MailMessage> DequeueEmail()
        {
            System.Data.Common.DbCommand   sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_EmailQueue WHERE NextTryTime < getdate()");
            Dictionary <Guid, MailMessage> dictionary       = new Dictionary <Guid, MailMessage>();

            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (dataReader.Read())
                {
                    MailMessage mailMessage = EmailQueueProvider.PopulateEmailFromIDataReader(dataReader);
                    if (mailMessage != null)
                    {
                        dictionary.Add((Guid)dataReader["EmailId"], mailMessage);
                    }
                    else
                    {
                        this.DeleteQueuedEmail((Guid)dataReader["EmailId"]);
                    }
                }
                dataReader.Close();
            }
            return(dictionary);
        }
Пример #2
0
        public override Dictionary <Guid, SubsiteMailMessage> DequeueDistributorEmail()
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM distro_EmailQueue WHERE NextTryTime < getdate()");
            Dictionary <Guid, SubsiteMailMessage> dictionary = new Dictionary <Guid, SubsiteMailMessage>();

            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (reader.Read())
                {
                    MailMessage mail = EmailQueueProvider.PopulateEmailFromIDataReader(reader);
                    if (mail != null)
                    {
                        dictionary.Add((Guid)reader["EmailId"], new SubsiteMailMessage((int)reader["UserId"], mail));
                    }
                    else
                    {
                        this.DeleteDistributorQueuedEmail((Guid)reader["EmailId"]);
                    }
                }
                reader.Close();
            }
            return(dictionary);
        }