Ejemplo n.º 1
0
 public static bool ManageSubscription(Subscriber entity)
 {
     DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString, "dbo.mon_elrn_INSERT_SUBSCRIBERINFO");
     cmd.AddInputParam("@Email", DbType.AnsiString, entity.Email);
     cmd.AddInputParam("@FirstName", DbType.AnsiString, entity.FirstName);
     cmd.AddInputParam("@LastName", DbType.AnsiString, entity.LastName);
     cmd.AddInputParam("@CreatedDate", DbType.DateTime, System.DateTime.Now);
     cmd.AddInputParam("@OptOutDate", DbType.DateTime, GetOptOutDate(entity.SubscribedStatus));
     cmd.AddInputParam("@TotalEmailsSent", DbType.Int64, entity.TotalEmailsSent);
     cmd.AddInputParam("@ApplicationName", DbType.String, System.Web.Security.Membership.Provider.ApplicationName);
     if (Convert.ToInt32(SqlHelpers.ExecuteScalar(cmd)) <= 0)
         return false;
     return true;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Replaces the input text's personalization placeholders
 /// </summary>
 private static string ReplacePersonalizationPlaceholders(string text, Subscriber subscriber, bool isHtml)
 {
     if (isHtml)
     {
         text = Regex.Replace(text, @"&lt;%\s*email\s*%&gt;",
            subscriber.Email, RegexOptions.IgnoreCase | RegexOptions.Compiled);
         text = Regex.Replace(text, @"&lt;%\s*firstname\s*%&gt;",
            (subscriber.FirstName.Length > 0 ? subscriber.FirstName : "reader"),
            RegexOptions.IgnoreCase | RegexOptions.Compiled);
         text = Regex.Replace(text, @"&lt;%\s*lastname\s*%&gt;",
            subscriber.LastName, RegexOptions.IgnoreCase | RegexOptions.Compiled);
     }
     else
     {
         text = Regex.Replace(text, @"<%\s*email\s*%>",
            subscriber.Email, RegexOptions.IgnoreCase | RegexOptions.Compiled);
         text = Regex.Replace(text, @"<%\s*firstname\s*%>",
            (subscriber.FirstName.Length > 0 ? subscriber.FirstName : "reader"),
            RegexOptions.IgnoreCase | RegexOptions.Compiled);
         text = Regex.Replace(text, @"<%\s*lastname\s*%>",
            subscriber.LastName, RegexOptions.IgnoreCase | RegexOptions.Compiled);
     }
     return text;
 }
Ejemplo n.º 3
0
 public static bool ResetSubscription(Subscriber entity)
 {
     DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString, "dbo.mon_elrn_UPDATE_RESETSUBSCRIPTION");
     cmd.AddInputParam("@Email", DbType.AnsiString, entity.Email);
     cmd.AddInputParam("@OptOutDate", DbType.DateTime, GetOptOutDate(entity.SubscribedStatus));
     return Convert.ToBoolean(SqlHelpers.ExecuteNonQuery(cmd));
 }