using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;

namespace JuSNS.Web.system.sys
{
    public partial class EmailSend : JuSNS.UI.Page.ManagePage
    {
        JuSNS.Home.MyInfo ac = new JuSNS.Home.MyInfo();
        protected string sort = "sys";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int day = int.Parse(Request.Form["txtDay"]);
            DataTable dt = ac.getEmail(day, 2);//ItemID,Announce,PostTime
            bool bg = false;
            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        bg = ac.sendEmailStr(int.Parse(dt.Rows[i]["UserID"].ToString()), dt.Rows[i]["Email"].ToString(), dt.Rows[i]["UserName"].ToString(), day);

                    }
                }
            }

            if (bg)
            {
                Response.Redirect("EmailSend.aspx");
            }
            else
            {
                PageError("·¢ËÍÓÊ¼þÍ¨ÖªÊ§°Ü!", "EmailSend.aspx");
            }
        }
    }
}
