当前位置: 首页>>代码示例>>C#>>正文


C# DataLayer.UpdateLastMotivatorDate方法代码示例

本文整理汇总了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));
 }
开发者ID:chevex-archived,项目名称:ReferralNetworX,代码行数:5,代码来源:test.aspx.cs

示例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)
//.........这里部分代码省略.........
开发者ID:chevex-archived,项目名称:ReferralNetworX,代码行数:101,代码来源:ManageDailyMotivator.aspx.cs


注:本文中的DataLayer.UpdateLastMotivatorDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。