Files
thinkyu/教育訓練系統/Web/Forms/辦訓狀況/訓練效益個人.aspx.cs
T
sryang 577060bc78 chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
2026-09-10 09:42:37 +08:00

90 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using WebLib;
namespace Education.Forms.辦訓狀況
{
public partial class 訓練效益個人 : FormBase
{
private DAC_訓練效益個人 Dao訓練效益個人;
private int 課程企劃ID;
private int 填表序號;
private string 填表人站別;
protected void Page_Load(object sender, EventArgs e)
{
FunctionName = "教育訓練效益追蹤調查表 >> 個人效益追蹤";
Dao訓練效益個人 = new DAC_訓練效益個人(conn);
課程企劃ID = DAC.GetInt32(Request["id"]);
填表序號 = DAC.GetInt32(Request["serial"]);
填表人站別 = DAC.GetString(Request["place"]);
if (!IsPostBack)
{
//DataList1.ItemDataBound += new DataListItemEventHandler(DataList1_ItemDataBound);
}
{
//DataList1.ItemDataBound -= new DataListItemEventHandler(DataList1_ItemDataBound);
DataList1.DataBind();
}
}
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
RadioButtonList rbl是否有成效 = FindControl<RadioButtonList>(e.Item, "rbl是否有成效");
TextBox txt成效說明 = FindControl<TextBox>(e.Item, "txt成效說明");
if (!(e.Item.DataItem is DataRowView r))
return;
訓練效益個人List d = Dao訓練效益個人.SelectOne(課程企劃ID, DAC.GetString(r["學員編號"]));
if (d.Count > 0)
{
rbl是否有成效.SelectedValue = d[0].是否有成效;
txt成效說明.Text = d[0].成效說明;
}
}
}
protected void ds效益追蹤個人_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = Dao課程報名;
}
protected void btnSave_Click(object sender, EventArgs e)
{
/*
if (!IsValid)
{
lbMessage.Text = "尚有項目未填寫完整!請填寫完整再儲存!";
return;
}
*/
foreach (DataListItem item in DataList1.Items)
{
HiddenField hf學員編號 = FindControl<HiddenField>(item, "hf學員編號");
RadioButtonList rbl是否有成效 = FindControl<RadioButtonList>(item, "rbl是否有成效");
TextBox txt成效說明 = FindControl<TextBox>(item, "txt成效說明");
Label lbSave = FindControl<Label>(item, "lbSave");
if (rbl是否有成效.SelectedValue.Length > 0 && txt成效說明.Text.Trim().Length > 0)
{
Dao訓練效益個人.Update(課程企劃ID, 填表序號, hf學員編號.Value,
rbl是否有成效.SelectedValue, txt成效說明.Text);
lbSave.Text = "*";
}
}
lbMessage.Text = "儲存完畢!";
}
}
}