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,173 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Transactions;
using WebLib;
namespace Education.Forms.
{
public partial class : FormBase
{
private DAC_學員出席 Dao學員出席;
protected void Page_Init(object sender, EventArgs e)
{
Dao學員出席 = new DAC_學員出席(conn);
}
protected void Page_Load(object sender, EventArgs e)
{
FunctionName = "學員出席登錄";
if (IsPostBack)
{
gv學員.DataBind();
}
}
protected void btn查詢_Click(object sender, EventArgs e)
{
if (. == 0)
{
Panel1.Visible = false;
lbMessage.Text = "請選擇課程企劃";
return;
}
Panel1.Visible = true;
ddl計畫.DataBind();
gv學員.DataBind();
}
protected void btn查詢學員_Click(object sender, EventArgs e)
{
gv學員.DataBind();
}
protected void btnSave_Click(object sender, EventArgs e)
{
GridView gv出席狀況;
RadioButtonList rb出席狀況;
TextBox txt請假原因;
List values = new List();
// 檢查是否有請假原因沒有填寫的
bool valid = true;
foreach (GridViewRow r in gv學員.Rows)
{
if (r.RowType != DataControlRowType.DataRow)
continue;
gv出席狀況 = FindControl<GridView>(r.Cells[4], "gv出席狀況");
if (gv出席狀況 != null)
{
foreach (GridViewRow r1 in gv出席狀況.Rows)
{
if (r1.RowType != DataControlRowType.DataRow)
continue;
rb出席狀況 = FindControl<RadioButtonList>(r1.Cells[1], "rb出席狀況");
txt請假原因 = FindControl<TextBox>(r1.Cells[1], "txt請假原因");
if (rb出席狀況.SelectedValue == "")
{
valid = false;
FindControl<ITextControl>(r1.Cells[1], "lbMessage").Text = "請選擇出席狀況";
}
else if (rb出席狀況.SelectedValue == "L" && txt請假原因.Text.Trim().Length == 0)
{
valid = false;
FindControl<ITextControl>(r1.Cells[1], "lbMessage").Text = "請填寫請假原因";
}
else
{
values.Add(new ()
{
= .,
= DAC.GetDateTime(r1.Cells[0].Text),
= r.Cells[0].Text,
= rb出席狀況.SelectedValue,
= txt請假原因.Text
});
}
}
}
}
if (!valid)
{
lbMessage2.Text = "有部份填寫不完全,請填寫完全之後再確定儲存!";
lbMessage3.Text = "有部份填寫不完全,請填寫完全之後再確定儲存!";
return;
}
using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
{
foreach ( item in values)
{
Dao學員出席.Update(item);
}
ts.Complete();
}
lbMessage2.Text = "儲存完畢!";
lbMessage3.Text = "儲存完畢!";
/*
foreach (GridViewRow r in gv學員.Rows)
{
if (r.RowType != DataControlRowType.DataRow)
continue;
學員編號 = r.Cells[0].Text;
rb出席狀況 = FindControl<RadioButtonList>(r.Cells[4], "rb出席狀況");
txt請假原因 = FindControl<TextBox>(r.Cells[4], "txt請假原因");
Dao課程報名.Update出席狀況(學員編號, DAC.GetInt32(ddl課程企劃.SelectedValue), rb出席狀況.SelectedValue, txt請假原因.Text, UserId);
}
*/
}
protected void ds已上課_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = Dao訓練課程企劃;
}
protected void ds報名學員_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = Dao課程報名;
}
protected void gv出席狀況_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType != DataControlRowType.DataRow)
return;
RadioButtonList rb出席狀況 = FindControl<RadioButtonList>(e.Row.Cells[1], "rb出席狀況");
rb出席狀況.Items[0].Attributes["style"] = "display:none";
TextBox txt請假原因 = FindControl<TextBox>(e.Row.Cells[1], "txt請假原因");
string = DAC.GetString((((sender as Control).Parent.Parent as GridViewRow).DataItem as System.Data.DataRowView)[0]);
int = .;
DateTime = DAC.GetDateTime(e.Row.DataItem).Date;
List d = Dao學員出席.SelectOne(, , );
if (d.Count > 0)
{
rb出席狀況.SelectedValue = d[0].;
txt請假原因.Text = d[0].;
}
else
{
rb出席狀況.SelectedValue = "";
txt請假原因.Text = "";
}
}
}
}