chore: 首次簽入 Thinkyu ASP.NET 專案

- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
2026-09-10 09:42:37 +08:00
commit 577060bc78
2496 changed files with 501389 additions and 0 deletions
@@ -0,0 +1,212 @@
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
{
protected void Page_Load(object sender, EventArgs e)
{
FunctionName = "學員行前通知";
if (IsPostBack)
{
gv學員.DataBind();
}
RegisterPostbackTrigger(btn發送);
}
protected void btn查詢_Click(object sender, EventArgs e)
{
if (. == 0)
{
Panel1.Visible = false;
lbMessage.Text = "請選擇課程企劃";
return;
}
Get課程資料();
ddl計畫.DataBind();
}
protected void btn查詢學員_Click(object sender, EventArgs e)
{
gv學員.DataBind();
}
protected void gv學員_DataBound(object sender, EventArgs e)
{
btn全選.Visible = gv學員.Rows.Count > 0;
btn不選.Visible = btn全選.Visible;
btn發送.Visible = btn全選.Visible;
SetSelected(true, true);
}
private void Get課程資料()
{
int id = .;
List = Dao訓練課程企劃.SelectOne(id);
if (.Count > 0)
{
txt聯絡人.Text = Dao員工.Get員工姓名([0].);
txt聯絡人電話.Text = Dao員工.Get公司電話([0].);
txt聯絡人email.Text = Dao員工.Get電子郵件([0].);
Panel1.Visible = true;
}
}
private void SetSelected(bool selected, bool = false)
{
foreach (GridViewRow row in gv學員.Rows)
{
if (row.RowType != DataControlRowType.DataRow)
continue;
CheckBox cb = FindControl<CheckBox>(row.Cells[0], "cb寄送");
HiddenField hf = FindControl<HiddenField>(row.Cells[3], "hf通知發送狀態");
if (cb == null || hf == null)
continue;
cb.Checked = selected;
if (selected && && hf.Value == "Y")
cb.Checked = false;
}
}
protected void btn全選_Click(object sender, EventArgs e)
{
SetSelected(true);
}
protected void btn不選_Click(object sender, EventArgs e)
{
SetSelected(false);
}
protected void btn發送_Click(object sender, EventArgs e)
{
int id = .;
= new ();
.Context = this.Context;
List = Dao訓練課程企劃.SelectOne(id);
DAC_訓練課程內容 Dao訓練課程內容 = new DAC_訓練課程內容(conn);
List = Dao訓練課程內容.SelectBy課程企劃(id);
string = GetData.(id).;
string = new DAC_公司別().GetName(CompanyId);
DAC_講師遴選 Dao講師遴選 = new DAC_講師遴選(conn);
// 拿課程類別來存放講師姓名
foreach ( item in )
{
item. = GetData.(item., item.).;
}
// 檢查是否有勾選
bool hasChecked = false;
foreach (GridViewRow row in gv學員.Rows)
{
if (row.RowType != DataControlRowType.DataRow)
continue;
CheckBox cb寄送 = FindControl<CheckBox>(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<CheckBox>(row.Cells[0], "cb寄送");
Label = FindControl<Label>(row.Cells[1], "lb學員姓名");
HiddenField = FindControl<HiddenField>(row.Cells[1], "hf學員編號");
TextBox = FindControl<TextBox>(row.Cells[1], "txt電子郵件");
if (cb寄送 == null)
continue;
if (cb寄送.Checked)
{
// 發送行前通知郵件
if (fuAttach.HasFile)
{
MemoryStream ms = new MemoryStream();
ms.Write(fuAttach.FileBytes, 0, fuAttach.FileBytes.Length);
ms.Position = 0;
.(.Text, .Text,
txt聯絡人.Text, txt聯絡人電話.Text, txt聯絡人email.Text, ,
[0]., [0]., [0]., ,
[0]., , fuAttach.FileName, ms);
}
else
{
.(.Text, .Text,
txt聯絡人.Text, txt聯絡人電話.Text, txt聯絡人email.Text, ,
[0]., [0]., [0]., ,
[0]., , "", null);
}
// 標記已發送
Dao課程報名.(.Value, id, UserId);
}
}
// 發送一份給承辦人存查
if (fuAttach.HasFile)
{
MemoryStream ms = new MemoryStream();
ms.Write(fuAttach.FileBytes, 0, fuAttach.FileBytes.Length);
ms.Position = 0;
.(txt聯絡人.Text, txt聯絡人email.Text,
txt聯絡人.Text, txt聯絡人電話.Text, txt聯絡人email.Text, ,
[0]., [0]., [0]., ,
[0]., , fuAttach.FileName, ms);
}
else
{
.(txt聯絡人.Text, txt聯絡人email.Text,
txt聯絡人.Text, txt聯絡人電話.Text, txt聯絡人email.Text, ,
[0]., [0]., [0].,
, [0]., , "", null);
}
gv學員.DataBind();
ClientShowMessage("學員行前通知發送完畢");
}
protected void ds已截止未上課_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = Dao訓練課程企劃;
}
protected void ds報名學員_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = Dao課程報名;
}
}
}