本文整理汇总了C#中DataLayer.UpdateLastMotivatorDate方法的典型用法代码示例。如果您正苦于以下问题:C# DataLayer.UpdateLastMotivatorDate方法的具体用法?C# DataLayer.UpdateLastMotivatorDate怎么用?C# DataLayer.UpdateLastMotivatorDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataLayer
的用法示例。
在下文中一共展示了DataLayer.UpdateLastMotivatorDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
dl.UpdateLastMotivatorDate(new DateTime(2010, 1, 1));
}
示例2: SendEmails
protected void SendEmails()
{
try
{
SmtpClient smtp = new SmtpClient("localhost");
MailMessage mm;
DataLayer dl = new DataLayer();
DataTable dt = dl.GetAllMotivatorSubscribedMembers();
DataTable dt2 = dl.GetAllMotivatorSubscribedNonMembers();
DataTable dtMotivator = dl.GetLastUnSentDailyMotivator();
int iDailyMotivatorID = Convert.ToInt32(dtMotivator.Rows[0].ItemArray[0]);
dl.MarkDailyMotivatorSent(iDailyMotivatorID);
dl.UpdateLastMotivatorDate(DateTime.Now);
ArrayList alFail = new ArrayList();
foreach (DataRow dr in dt.Rows)
{
try
{
mm = new MailMessage();
mm.IsBodyHtml = true;
mm.To.Add(dr.ItemArray[1].ToString());
mm.From = new MailAddress("[email protected]");
mm.Subject = dtMotivator.Rows[0].ItemArray[3].ToString();
mm.Body = "<div style=\"width: 790px; background-color: #333333; padding: 5px; border: solid 1px #333333;\"><a href=\"http://www.ReferralNetworX.com\"><img style=\"height: 125px; border-width:0px;\" src=\"http://www.referralnetworx.com/MakeThumbnail.aspx?size=237&image=images/networking.jpg\" /><img style=\"border-width:0px;\" src=\"http://www.referralnetworx.com/images/banner.jpg\" /></a></div>";
mm.Body += "<div style=\"width: 770px; background-color: #ddeedd; padding: 15px; border: solid 1px #333333;\"><div style=\"font-size:35px;text-align:center;margin-bottom:10px;\">Daily Motivator</div>";
string sName = dl.GetMemberNameBy_Email(dr.ItemArray[1].ToString());
mm.Body += "Hello " + sName + ",<br /><br />";
string sYouTubeLink = dtMotivator.Rows[0].ItemArray[5].ToString();
if (sYouTubeLink != "No Video.")
{
mm.Body += "<h1 style=\"text-align:center;\"><a href=\"" + sYouTubeLink + "\">Click Here to Watch The Video Motivator</a></h1>";
}
mm.Body += dtMotivator.Rows[0].ItemArray[4].ToString();
mm.Body += "<h2 style=\"text-align:center;\"><a href=\"http://www.ReferralNetworX.com\">Visit ReferralNetworX.com!</a></h2>";
mm.Body += "</div>";
int iCount = 0;
bool bLoop = true;
while (bLoop)
{
try
{
smtp.Send(mm);
bLoop = false;
}
catch (Exception ex)
{
System.Threading.Thread.Sleep(1000);
iCount++;
if (iCount >= 3)
{
alFail.Add(dr.ItemArray[0].ToString() + " - FAILED ON SEND");
alFail.Add(ex.ToString());
bLoop = false;
}
}
}
}
catch (Exception ex2)
{
alFail.Add(dr.ItemArray[0].ToString() + " - FAILED BEFORE SEND");
alFail.Add(ex2.ToString());
}
}
foreach (DataRow dr in dt2.Rows)
{
try
{
mm = new MailMessage();
mm.IsBodyHtml = true;
mm.To.Add(dr.ItemArray[1].ToString());
mm.From = new MailAddress("[email protected]");
mm.Subject = dtMotivator.Rows[0].ItemArray[3].ToString();
mm.Body = "<div style=\"width: 790px; background-color: #333333; padding: 5px; border: solid 1px #333333;\"><a href=\"http://www.ReferralNetworX.com\"><img style=\"height: 125px;border-width:0px;\" src=\"http://www.referralnetworx.com/MakeThumbnail.aspx?size=237&image=images/networking.png\" /><img style=\"border-width:0px;\" src=\"http://www.referralnetworx.com/images/banner.png\" /></a></div>";
mm.Body += "<div style=\"width: 770px; background-color: #ddeedd; padding: 15px; border: solid 1px #333333;\"><div style=\"font-size:35px;text-align:center;margin-bottom:10px;\">Daily Motivator</div>";
string sName = dl.GetNonMemberNameBy_Email(dr.ItemArray[1].ToString());
mm.Body += "Hello " + sName + ",<br /><br />";
string sYouTubeLink = dtMotivator.Rows[0].ItemArray[5].ToString();
if (sYouTubeLink != "No Video.")
{
mm.Body += "<h1 style=\"text-align:center;\"><a href=\"" + sYouTubeLink + "\">Click Here to Watch The Video Motivator</a></h1>";
}
mm.Body += dtMotivator.Rows[0].ItemArray[4].ToString();
mm.Body += "<h2 style=\"text-align:center;\"><a href=\"http://www.ReferralNetworX.com\">Visit ReferralNetworX.com!</a></h2>";
mm.Body += "</div>";
mm.Body += "<div style=\"font-size: 12px; border: solid 1px #333333; background-color: #ddeedd; padding: 5px; width: 790px;\">Click <a href=\"http://www.referralnetworx.com/Subscribe.aspx?e=" + dr.ItemArray[1].ToString() + "&type=dailymotivator\">here</a> to unsubscribe.</div>";
int iCount = 0;
bool bLoop = true;
while (bLoop)
{
try
{
smtp.Send(mm);
bLoop = false;
}
catch (Exception ex)
{
System.Threading.Thread.Sleep(1000);
iCount++;
if (iCount >= 3)
//.........这里部分代码省略.........