Пример #1
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);
            }
        }
Пример #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));
        }
Пример #3
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();

                    letterSubscriber.FirstName = reader["FirstName"].ToString();
                    letterSubscriber.LastName  = reader["LastName"].ToString();

                    return(letterSubscriber);
                }
            }

            return(null);
        }
Пример #4
0
        public List <LetterSubscriber> GetSubscribersNotSentYet(
            Guid letterGuid,
            Guid letterInfoGuid)
        {
            IDataReader reader = DBLetterSubscription.GetSubscribersNotSentYet(letterGuid, letterInfoGuid);

            return(LoadFromReader(reader));
        }
Пример #5
0
 public bool Verify(
     Guid guid,
     bool isVerified,
     Guid verifyGuid)
 {
     return(DBLetterSubscription.Verify(
                guid,
                isVerified,
                verifyGuid));
 }
Пример #6
0
 public IDataReader GetPage(
     Guid letterInfoGuid,
     int pageNumber,
     int pageSize,
     out int totalPages)
 {
     return(DBLetterSubscription.GetPage(
                letterInfoGuid,
                pageNumber,
                pageSize,
                out totalPages));
 }
Пример #7
0
        public static DataTable GetTop1000UsersNotSubscribed(Guid siteGuid, Guid letterInfoGuid, bool excludeIfAnyUnsubscribeHx)
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("UserID", typeof(int));
            dataTable.Columns.Add("UserGuid", typeof(string));
            dataTable.Columns.Add("Email", typeof(string));

            using (IDataReader reader = DBLetterSubscription.GetTop1000UsersNotSubscribed(siteGuid, letterInfoGuid, excludeIfAnyUnsubscribeHx))
            {
                while (reader.Read())
                {
                    DataRow row = dataTable.NewRow();
                    row["UserID"]   = Convert.ToInt32(reader["UserID"]);
                    row["UserGuid"] = reader["UserGuid"].ToString();
                    row["Email"]    = reader["Email"].ToString();
                    dataTable.Rows.Add(row);
                }
            }

            return(dataTable);
        }
Пример #8
0
 public IDataReader GetByLetter(Guid letterInfoGuid)
 {
     return(DBLetterSubscription.GetByLetter(letterInfoGuid));
 }
Пример #9
0
        public List <LetterSubscriber> GetListByUser(Guid siteGuid, Guid userGuid)
        {
            IDataReader reader = DBLetterSubscription.GetByUser(siteGuid, userGuid);

            return(LoadFromReader(reader));
        }
Пример #10
0
        public List <LetterSubscriber> GetListByEmail(Guid siteGuid, string email)
        {
            IDataReader reader = DBLetterSubscription.GetByEmail(siteGuid, email.ToLower());

            return(LoadFromReader(reader));
        }
Пример #11
0
 public bool DeleteByLetter(Guid letterInfoGuid)
 {
     return(DBLetterSubscription.DeleteByLetter(letterInfoGuid));
 }
Пример #12
0
 public static int CountUsersNotSubscribedByLetter(Guid siteGuid, Guid letterInfoGuid, bool excludeIfAnyUnsubscribeHx)
 {
     return(DBLetterSubscription.CountUsersNotSubscribedByLetter(siteGuid, letterInfoGuid, excludeIfAnyUnsubscribeHx));
 }
Пример #13
0
 public IDataReader Search(
     Guid letterInfoGuid,
     string emailOrIpAddress)
 {
     return(DBLetterSubscription.Search(letterInfoGuid, emailOrIpAddress));
 }
Пример #14
0
 public IDataReader GetOne(Guid guid)
 {
     return(DBLetterSubscription.GetOne(guid));
 }
Пример #15
0
 public bool DeleteHistoryByLetterInfo(Guid letterInfoGuid)
 {
     return(DBLetterSubscription.DeleteHistoryByLetterInfo(letterInfoGuid));
 }
Пример #16
0
 public bool DeleteHistoryBySite(Guid siteGuid)
 {
     return(DBLetterSubscription.DeleteHistoryBySite(siteGuid));
 }
Пример #17
0
 public bool DeleteByUser(Guid userGuid)
 {
     return(DBLetterSubscription.DeleteByUser(userGuid));
 }
Пример #18
0
 public bool DeleteUnverified(Guid letterInfoGuid, DateTime olderThanUtc)
 {
     return(DBLetterSubscription.DeleteUnverified(letterInfoGuid, olderThanUtc));
 }
Пример #19
0
 public int GetCountByLetter(Guid letterInfoGuid)
 {
     return(DBLetterSubscription.GetCountByLetter(letterInfoGuid));
 }
Пример #20
0
 public IDataReader GetByUser(Guid siteGuid, Guid userGuid)
 {
     return(DBLetterSubscription.GetByUser(siteGuid, userGuid));
 }
Пример #21
0
 public IDataReader GetByEmail(Guid siteGuid, string email)
 {
     return(DBLetterSubscription.GetByEmail(siteGuid, email.ToLower()));
 }
Пример #22
0
 public bool Exists(Guid letterInfoGuid, string email)
 {
     return(DBLetterSubscription.Exists(letterInfoGuid, email.ToLower()));
 }