根据条件发送电子邮件警报 [英] Sending email alert based on if condition

查看:109
本文介绍了根据条件发送电子邮件警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我有表格(gridview),其中4个col就已过期,在代码后面我做了

如果语句只显示我将在45日过期时出现的行天,((但现在我需要当特定行显示基于过期发送电子邮件,某些东西将过期并链接到具有我做过的表的页面



i search for关于它,小心我不能使用sql代理因为sql版本没有它。



谢谢你...



我尝试过:



hello, i have table(gridview) with 4 col on of them is expiredate, in code behind i did
if statement to show me only the row that will appear when the expire date in 45 days, (( but now i need when the specific row appear based on expire send email that something will expire and link to page that have table that i did

i search for bit about it, be careful that i cant use sql agent because of sql version don't have it.

thank u..

What I have tried:

<pre>   }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {


        GridView1.Columns[4].Visible = false;
        
        
          Label a = e.Row.FindControl("Label2") as Label;
          Label b = e.Row.FindControl("Label3") as Label;
         
        if ((a != null) & (b!= null))
        {
            DateTime lblDate;
            if ((!DateTime.TryParse(a.Text, out lblDate)) & (!DateTime.TryParse(b.Text, out lblDate)))
            {
                // date time conversion not success 
                // you may have empty or invalid datetime 
                // do something in this case 
                return;
            }
            
            if (lblDate <= DateTime.Today.AddDays(45))
            {

                e.Row.Visible = true;

            }

            else
            {
e.Row.Visible = false;
          
            }

推荐答案

ASP.Net代码仅在有人访问您的某个页面时运行。如果您需要安排事情,则不要使用ASP.Net,而是可以使用任务计划程序编写Windows服务或控制台应用程序。
ASP.Net code only runs when someone visits one of your pages. If you need to schedule things, you do not use ASP.Net but instead you can write a Windows Service or a console app that you schedule with Task Scheduler.


这篇关于根据条件发送电子邮件警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆