Beispiel #1
0
        private List <LetterSubscriber> LoadFromReader(IDataReader reader)
        {
            List <LetterSubscriber> letterSubscriberList
                = new List <LetterSubscriber>();

            try
            {
                while (reader.Read())
                {
                    LetterSubscriber letterSubscriber = new LetterSubscriber();
                    letterSubscriber.SubscribeGuid  = new Guid(reader["Guid"].ToString());
                    letterSubscriber.SiteGuid       = new Guid(reader["SiteGuid"].ToString());
                    letterSubscriber.LetterInfoGuid = new Guid(reader["LetterInfoGuid"].ToString());
                    letterSubscriber.VerifyGuid     = new Guid(reader["VerifyGuid"].ToString());
                    letterSubscriber.UserGuid       = new Guid(reader["UserGuid"].ToString());
                    letterSubscriber.UseHtml        = Convert.ToBoolean(reader["UseHtml"]);
                    letterSubscriber.BeginUtc       = Convert.ToDateTime(reader["BeginUtc"]);
                    letterSubscriber.EmailAddress   = reader["Email"].ToString();
                    letterSubscriber.Name           = reader["Name"].ToString();
                    letterSubscriber.IsVerified     = Convert.ToBoolean(reader["IsVerified"]);
                    letterSubscriber.IpAddress      = reader["IpAddress"].ToString();
                    letterSubscriberList.Add(letterSubscriber);
                }
            }
            finally
            {
                reader.Close();
            }

            return(letterSubscriberList);
        }
Beispiel #2
0
        public bool Delete(LetterSubscriber subscription, bool createHistory)
        {
            if (subscription == null)
            {
                return(false);
            }

            if (createHistory)
            {
                DBLetterSubscription.CreateHistory(
                    Guid.NewGuid(),
                    subscription.SiteGuid,
                    subscription.SubscribeGuid,
                    subscription.LetterInfoGuid,
                    subscription.UserGuid,
                    subscription.EmailAddress,
                    subscription.IsVerified,
                    subscription.UseHtml,
                    subscription.BeginUtc,
                    DateTime.UtcNow,
                    subscription.IpAddress);
            }



            return(DBLetterSubscription.Delete(subscription.SubscribeGuid));
        }
Beispiel #3
0
        public void Save(LetterSubscriber subsciption)
        {
            if (subsciption == null)
            {
                return;
            }
            if (subsciption.SubscribeGuid == Guid.Empty)
            {
                subsciption.SubscribeGuid = Guid.NewGuid();

                DBLetterSubscription.Create(
                    subsciption.SubscribeGuid,
                    subsciption.SiteGuid,
                    subsciption.LetterInfoGuid,
                    subsciption.UserGuid,
                    subsciption.EmailAddress.ToLower(),
                    subsciption.IsVerified,
                    subsciption.VerifyGuid,
                    DateTime.UtcNow,
                    subsciption.UseHtml,
                    subsciption.IpAddress);
            }
            else
            {
                DBLetterSubscription.Update(
                    subsciption.SubscribeGuid,
                    subsciption.UserGuid,
                    subsciption.UseHtml);
            }
        }
Beispiel #4
0
        public LetterSubscriber Fetch(Guid siteGuid, Guid letterInfoGuid, string email)
        {
            using (IDataReader reader = DBLetterSubscription.GetByEmail(siteGuid, letterInfoGuid, email.ToLower()))
            {
                if (reader.Read())
                {
                    LetterSubscriber letterSubscriber = new LetterSubscriber();
                    letterSubscriber.SubscribeGuid  = new Guid(reader["Guid"].ToString());
                    letterSubscriber.SiteGuid       = new Guid(reader["SiteGuid"].ToString());
                    letterSubscriber.LetterInfoGuid = new Guid(reader["LetterInfoGuid"].ToString());
                    letterSubscriber.VerifyGuid     = new Guid(reader["VerifyGuid"].ToString());
                    letterSubscriber.UserGuid       = new Guid(reader["UserGuid"].ToString());
                    letterSubscriber.UseHtml        = Convert.ToBoolean(reader["UseHtml"]);
                    letterSubscriber.BeginUtc       = Convert.ToDateTime(reader["BeginUtc"]);
                    letterSubscriber.EmailAddress   = reader["Email"].ToString();
                    letterSubscriber.Name           = reader["Name"].ToString();
                    letterSubscriber.IsVerified     = Convert.ToBoolean(reader["IsVerified"]);
                    letterSubscriber.IpAddress      = reader["IpAddress"].ToString();
                    return(letterSubscriber);
                }
            }

            return(null);
        }
Beispiel #5
0
 public bool Delete(LetterSubscriber subscription)
 {
     return(Delete(subscription, true));
 }