using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using WebLib; namespace Education.Forms.辦訓前置作業 { public partial class 講師行前通知 : FormBase { private DAC_訓練課程內容 Dao訓練課程內容; protected void Page_Load(object sender, EventArgs e) { FunctionName = "講師行前通知"; Dao訓練課程內容 = new DAC_訓練課程內容(conn); if (IsPostBack) { gv講師.DataBind(); } RegisterPostbackTrigger(btn發送); } protected void btn查詢_Click(object sender, EventArgs e) { if (訓練企劃搜尋.訓練企劃編號 == 0) { Panel1.Visible = false; lbMessage.Text = "請選擇課程企劃"; return; } gv講師.DataBind(); Get課程資料(); } protected void btn發送_Click(object sender, EventArgs e) { int 課程企劃id = 訓練企劃搜尋.訓練企劃編號; 發送郵件 發送郵件 = new 發送郵件(); 發送郵件.Context = this.Context; 訓練課程企劃List 訓練課程企劃 = Dao訓練課程企劃.SelectOne(課程企劃id); string 場地名稱 = GetData.取得選定場地(課程企劃id).場地名稱; // 檢查是否有勾選 bool hasChecked = false; foreach (GridViewRow row in gv講師.Rows) { if (row.RowType != DataControlRowType.DataRow) continue; CheckBox cb要發送 = FindControl(row.Cells[0], "cb要發送"); if (cb要發送 == null || !cb要發送.Checked) continue; hasChecked = true; break; } if (!hasChecked) { ClientShowMessage("請勾選要發送行前通知的講師"); return; } foreach (GridViewRow row in gv講師.Rows) { if (row.RowType != DataControlRowType.DataRow) continue; CheckBox cb要發送 = FindControl(row.Cells[0], "cb要發送"); HiddenField hf課程序號 = FindControl(row.Cells[0], "hf課程序號"); HiddenField hf訓練日期 = FindControl(row.Cells[0], "hf訓練日期"); HiddenField hf時間起 = FindControl(row.Cells[0], "hf時間起"); HiddenField hf時間迄 = FindControl(row.Cells[0], "hf時間迄"); Label lb講師姓名 = FindControl