chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Net.Mail;
|
||||
using System.Text;
|
||||
|
||||
public partial class forms_訊息發送_MessageWriter : Wellan.Web.UI.WUserControlBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
DropDownList1.DataBind();
|
||||
CheckBoxList1.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
SqlDataSource1.ConnectionString = ConnectionString;
|
||||
SqlDataSource2.ConnectionString = ConnectionString;
|
||||
}
|
||||
|
||||
protected void Button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
CheckBoxList1.DataBind();
|
||||
}
|
||||
|
||||
protected void SelectAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (ListItem item in CheckBoxList1.Items)
|
||||
item.Selected = true;
|
||||
}
|
||||
|
||||
protected void SelectNone_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (ListItem item in CheckBoxList1.Items)
|
||||
item.Selected = false;
|
||||
}
|
||||
|
||||
protected void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (ListItem item in CheckBoxList1.Items)
|
||||
{
|
||||
if (item.Selected)
|
||||
{
|
||||
if (CheckBoxList2.Items.FindByValue(item.Value) == null)
|
||||
CheckBoxList2.Items.Add(new ListItem(item.Text, item.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = CheckBoxList2.Items.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (CheckBoxList2.Items[i].Selected)
|
||||
CheckBoxList2.Items.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
CheckBoxList2.Items.Clear();
|
||||
}
|
||||
|
||||
protected void Button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
MailMessage message = new MailMessage();
|
||||
//SmtpClient sc = new SmtpClient();
|
||||
message.Subject = txtSubject.Text;
|
||||
|
||||
foreach (ListItem item in CheckBoxList2.Items)
|
||||
message.To.Add(new MailAddress(item.Value, item.Text));
|
||||
|
||||
message.BodyEncoding = Encoding.UTF8;
|
||||
message.IsBodyHtml = false;
|
||||
message.Body = txtBody.Text;
|
||||
|
||||
Wellan.Service.WMailSender.GetInstance().Send(message, String.Format("訊息發送 主旨:{0}", txtSubject.Text));
|
||||
//sc.Send(message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user